Haobin Luo 1 yıl önce
ebeveyn
işleme
63cc253852
1 değiştirilmiş dosya ile 226 ekleme ve 303 silme
  1. 226 303
      wsserver.cpp

+ 226 - 303
wsserver.cpp

@@ -1,16 +1,16 @@
-//#pragma execution_character_set("utf-8")
+#pragma execution_character_set("utf-8")
 #include "wsserver.h"
 
 WSServer::WSServer(QObject *parent, quint16 port) : QObject(parent)
 {
     m_pWebSocketServer = new QWebSocketServer(QStringLiteral("Mock Server"),
-                                                    QWebSocketServer::NonSecureMode,
-                                                    this);
+                                              QWebSocketServer::NonSecureMode,
+                                              this);
     if (m_pWebSocketServer->listen(QHostAddress::Any, port))
     {
-      qDebug() << "Mock Server listening on port" << port;
-      connect(m_pWebSocketServer, &QWebSocketServer::newConnection,
-              this, &WSServer::onNewConnection);
+        qDebug() << "GR Server listening on port" << port;
+        connect(m_pWebSocketServer, &QWebSocketServer::newConnection,
+                this, &WSServer::onNewConnection);
     }
 }
 
@@ -62,34 +62,34 @@ QJsonObject WSServer::processJsonObj(QJsonObject objin)
                 {
                     ret.insert("PlatformID", Props.take("PlatformID"));
                 }
-                ret.insert("data",Props);
+                ret.insert("data", Props);
             }
         }
-//            if (v.isArray())
-//            {
-//                for (auto i : v.toArray())
-//                {
-//                    if (i.isString())
-//                    {
-//                        objout->insert(i.toString(),QJsonValue());
-//                    }
-//                }
-//            }
-//            else if (v.isObject())
-//            {
-//                QJsonObject Props = v.toObject();
-//                QStringList Propkeys = Props.keys();
-//                for (auto propkey: Propkeys)
-//                {
-//                    objout->insert(propkey,Props.value(k));
-//                }
-//            }
+        //            if (v.isArray())
+        //            {
+        //                for (auto i : v.toArray())
+        //                {
+        //                    if (i.isString())
+        //                    {
+        //                        objout->insert(i.toString(),QJsonValue());
+        //                    }
+        //                }
+        //            }
+        //            else if (v.isObject())
+        //            {
+        //                QJsonObject Props = v.toObject();
+        //                QStringList Propkeys = Props.keys();
+        //                for (auto propkey: Propkeys)
+        //                {
+        //                    objout->insert(propkey,Props.value(k));
+        //                }
+        //            }
 
         // 不想打印
-//        if (v.isObject())
-//        {
-//            processJsonObj(v.toObject(),objout);
-//        }
+        //        if (v.isObject())
+        //        {
+        //            processJsonObj(v.toObject(),objout);
+        //        }
 
         // 打印调试信息
         if (v.isDouble())
@@ -103,7 +103,7 @@ QJsonObject WSServer::processJsonObj(QJsonObject objin)
         else if (v.isObject())
         {
             qDebug() << k << "{";
-//            processJsonObj(v.toObject(),objout);
+            //            processJsonObj(v.toObject(),objout);
             QJsonObject objout = processJsonObj(v.toObject());
             qDebug() << "}";
         }
@@ -122,7 +122,7 @@ QJsonObject WSServer::processJsonObj(QJsonObject objin)
             qDebug() << "]";
         }
     }
-    //qDebug() << QString(QJsonDocument(*objout).toJson());
+    // qDebug() << QString(QJsonDocument(*objout).toJson());
     return ret;
 }
 
@@ -137,7 +137,6 @@ void WSServer::processMessage(QString message)
     QJsonParseError *error = new QJsonParseError();
     QJsonDocument IncomingJson = QJsonDocument::fromJson(*ByteMessage, error);
 
-
     if (error->error == QJsonParseError::NoError)
     {
         if (IncomingJson.isObject())
@@ -148,7 +147,7 @@ void WSServer::processMessage(QString message)
 
             QStringList props = msgobj.keys();
             QString url = msgobj.value("url").toString();
-//            qDebug() << QString(QJsonDocument(msgobj).toJson());
+            //            qDebug() << QString(QJsonDocument(msgobj).toJson());
             qDebug() << "url:" << url;
             // 判断请求
             if (url == "getInit")
@@ -170,7 +169,7 @@ void WSServer::processMessage(QString message)
             else
             {
                 // 其他接口都需要带平台ID
-                if (msgobj.contains("PlatformID")==false)
+                if (msgobj.contains("PlatformID") == false)
                 {
                     QJsonObject *ret = new QJsonObject();
                     ret->insert("data", QJsonValue());
@@ -209,11 +208,11 @@ void WSServer::processMessage(QString message)
                 }
                 else if (url == "getNavParams")
                 {
-//                    getNavParams(msgobj);
+                    //                    getNavParams(msgobj);
                 }
                 else if (url == "setFreePost")
                 {
-//                    setFreePost(msgobj);
+                    //                    setFreePost(msgobj);
                 }
                 else if (url == "getLeadPost")
                 {
@@ -225,22 +224,22 @@ void WSServer::processMessage(QString message)
                 }
             }
 
-//        qDebug() << "return message:";
-//        qDebug() << QString(QJsonDocument(*msgobj).toJson());
+            //        qDebug() << "return message:";
+            //        qDebug() << QString(QJsonDocument(*msgobj).toJson());
 
-//        QWebSocket *pSender = qobject_cast<QWebSocket *>(sender());
-//        pSender->sendTextMessage(QString(QJsonDocument(*msgobj).toJson()));
+            //        QWebSocket *pSender = qobject_cast<QWebSocket *>(sender());
+            //        pSender->sendTextMessage(QString(QJsonDocument(*msgobj).toJson()));
 
-//        for (QWebSocket *pClient : qAsConst(m_clients)) {
+            //        for (QWebSocket *pClient : qAsConst(m_clients)) {
 
-//            QJsonDocument *msgdoc = new QJsonDocument(*msgobj);
+            //            QJsonDocument *msgdoc = new QJsonDocument(*msgobj);
 
-//            if (pClient == pSender) //don't echo message back to sender
-//            {
-//                QJsonValue msg = new QJsonValue(message);
-//                pClient->sendTextMessage(QString(msgdoc->toJson()));
-//            }
-//            qDebug() << QString(msgdoc->toJson());
+            //            if (pClient == pSender) //don't echo message back to sender
+            //            {
+            //                QJsonValue msg = new QJsonValue(message);
+            //                pClient->sendTextMessage(QString(msgdoc->toJson()));
+            //            }
+            //            qDebug() << QString(msgdoc->toJson());
         }
     }
 }
@@ -268,22 +267,18 @@ void WSServer::getInit(QWebSocket *pSender, QJsonObject obj)
 {
     qDebug() << "网页请求初始化状态";
     // 假接口
-    QJsonObject InitState
-    {
-        {"InitState",100}
-    };
+    QJsonObject InitState{
+        {"InitState", 100}};
 
     // 真实接口
-//    QJsonObject InitState
-//    {
-//        {"InitState",100*(int)this->zcman->common_inter->InitState}
-//    };
+    //    QJsonObject InitState
+    //    {
+    //        {"InitState",100*(int)this->zcman->common_inter->InitState}
+    //    };
 
-   QJsonObject *ret = new QJsonObject(
-   {
-      {"url", obj.value("url")},
-      {"data", InitState}
-   });
+    QJsonObject *ret = new QJsonObject(
+        {{"url", obj.value("url")},
+         {"data", InitState}});
 
     returnMessage(pSender, ret);
 }
@@ -294,38 +289,32 @@ void WSServer::getPlatformTable(QWebSocket *pSender, QJsonObject obj)
     qDebug() << "网页请求平台信息";
     QJsonArray Platforms;
     // 假接口
-    QJsonObject SinglePlatform[] {
-        {
-            {"platformID", 8013},
-            {"platformName", "干扰机_1"}
-        },
-        {
-            {"platformID", 8014},
-            {"platformName", "干扰机_2"}
-        },
+    QJsonObject SinglePlatform[]{
+        {{"platformID", 8013},
+         {"platformName", "干扰机_1"}},
+        {{"platformID", 8014},
+         {"platformName", "干扰机_2"}},
     };
-    for (auto i: SinglePlatform)
+    for (auto i : SinglePlatform)
     {
         Platforms.append(i);
     }
 
     // 真实接口
-//    for (auto i : this->grman->grtaskplats)
-//    {
-//        QJsonObject SinglePlatform
-//        {
-//            {"platformID", (int)i->PlatID},
-//            {"platformName", QString::fromLocal8Bit(i->PlatName.c_str())}
-//        };
-//        Platforms.append(SinglePlatform);
-//    }
+    //    for (auto i : this->grman->grtaskplats)
+    //    {
+    //        QJsonObject SinglePlatform
+    //        {
+    //            {"platformID", (int)i->PlatID},
+    //            {"platformName", QString::fromLocal8Bit(i->PlatName.c_str())}
+    //        };
+    //        Platforms.append(SinglePlatform);
+    //    }
 
     // 构造返回对象
     QJsonObject *ret = new QJsonObject(
-    {
-        {"url", obj.value("url")},
-        {"data", Platforms}
-    });
+        {{"url", obj.value("url")},
+         {"data", Platforms}});
     returnMessage(pSender, ret);
 }
 
@@ -334,51 +323,40 @@ void WSServer::getLeadPost(QWebSocket *pSender, QJsonObject obj)
 {
     qDebug() << "网页请求指挥电文";
     // 假接口
-    QJsonObject CurrentLeadPost1
-    {
+    QJsonObject CurrentLeadPost1{
         {"time", "20:20:01"},
         {"GroupID", "0001"},
         {"LeaderID", "8015"},
-        {"Abstract", "开始侦察"}
-    };
-    QJsonObject CurrentLeadPost2
-    {
+        {"Abstract", "开始侦察"}};
+    QJsonObject CurrentLeadPost2{
         {"time", "20:20:30"},
         {"GroupID", "0001"},
         {"LeaderID", "8015"},
-        {"Abstract", "发现辐射源"}
-    };
-    QJsonObject CurrentLeadPost3
-    {
+        {"Abstract", "发现辐射源"}};
+    QJsonObject CurrentLeadPost3{
         {"time", "20:20:40"},
         {"GroupID", "0001"},
         {"LeaderID", "8015"},
-        {"Abstract", "请求干扰"}
-    };
-    QJsonObject CurrentLeadPost4
-    {
+        {"Abstract", "请求干扰"}};
+    QJsonObject CurrentLeadPost4{
         {"time", "20:20:01"},
         {"GroupID", "0003"},
         {"LeaderID", "8014"},
-        {"Abstract", "开始干扰"}
-    };
+        {"Abstract", "开始干扰"}};
 
     QJsonArray LeadPost = {
         CurrentLeadPost1,
         CurrentLeadPost2,
         CurrentLeadPost3,
-        CurrentLeadPost4
-    };
+        CurrentLeadPost4};
     // 真实接口
     // 待定
 
     // 构造返回对象
     QJsonObject *ret = new QJsonObject(
-    {
-        {"url", obj.value("url")},
-        {"PlatformID", obj.value("PlatformID")},
-        {"data", LeadPost}
-    });
+        {{"url", obj.value("url")},
+         {"PlatformID", obj.value("PlatformID")},
+         {"data", LeadPost}});
     returnMessage(pSender, ret);
 }
 
@@ -386,34 +364,26 @@ void WSServer::getTaskPlan(QWebSocket *pSender, QJsonObject obj)
 {
     qDebug() << "网页请求任务计划";
     // 假接口
-    QJsonObject CurrentAirLine
-    {
+    QJsonObject CurrentAirLine{
         {"TargetArea", 3},
         {"Longitude", 123},
         {"Longitude", 27},
-        {"Radius", 300000}
-    };
-    QJsonObject CurrentTaskPlan
-    {
+        {"Radius", 300000}};
+    QJsonObject CurrentTaskPlan{
         {"TargetArea", 2},
         {"ThrowGas", 2},
-        {"ThrowBT", 2}
-    };
+        {"ThrowBT", 2}};
 
-    QJsonObject TaskPlan
-    {
+    QJsonObject TaskPlan{
         {"Airline", CurrentAirLine},
-        {"TaskPlan", CurrentTaskPlan}
-    };
+        {"TaskPlan", CurrentTaskPlan}};
     // 真实接口 待定
 
     // 构造返回对象
     QJsonObject *ret = new QJsonObject(
-    {
-        {"url", obj.value("url")},
-        {"PlatformID", obj.value("PlatformID")},
-        {"data", TaskPlan}
-    });
+        {{"url", obj.value("url")},
+         {"PlatformID", obj.value("PlatformID")},
+         {"data", TaskPlan}});
     returnMessage(pSender, ret);
 }
 
@@ -444,113 +414,73 @@ void WSServer::getGlobalMap(QWebSocket *pSender, QJsonObject obj)
     qDebug() << "网页请求全局态势";
     // 来源:支撑平台的平台位置信息
     // 假接口
-    QJsonArray *alies = new QJsonArray();
-    QJsonArray *enemys = new QJsonArray();
-    QJsonArray *temparray;
-    QJsonObject *tempobj;
-
+    QJsonArray allyNames = {
+        "导弹发射架_1",
+        "机场_1",
+        "预警机_1",
+        "运侦8_1"};
+    QJsonArray allyPos[] = {
+        {117.525, 25.826, 100},
+        {119.271, 26.26, 100},
+        {120.288, 25.5734, 100},
+        {117.525, 25.826, 100}};
+    QJsonArray enemyNames = {
+        "80xxA电子侦察船_1",
+        "宙斯盾舰"};
+    QJsonArray enemyPos[] = {
+        {120.446, 24.8902, 100},
+        {123.528, 25.2951, 100}};
+
+    QJsonArray ally;
+    QJsonArray enemy;
+
+    for (int i = 0; i < allyNames.count(); i++)
     {
-        temparray = new QJsonArray();
-        tempobj = new QJsonObject();
-        tempobj->insert("name", "80xxA电子侦察船_1");
-        temparray->append(120.446), temparray->append(24.8902), temparray->append(100);
-        tempobj->insert("value", *temparray);
-//        alies->insert(("80xxA电子侦察船_1"), QJsonValue(*temparray));
-        alies->append(*tempobj);
-        delete temparray;
-        delete tempobj;
-
-        temparray = new QJsonArray();
-        tempobj = new QJsonObject();
-        tempobj->insert("name", "导弹发射架_1");
-        temparray->append(117.525), temparray->append(25.826), temparray->append(100);
-        tempobj->insert("value", *temparray);
-        alies->append(*tempobj);
-        delete temparray;
-        delete tempobj;
-
-        temparray = new QJsonArray();
-        tempobj = new QJsonObject();
-        tempobj->insert("name", "机场_1");
-        temparray->append(119.271), temparray->append(26.26), temparray->append(100);
-        tempobj->insert("value", *temparray);
-        alies->append(*tempobj);
-        delete temparray;
-        delete tempobj;
-
-        temparray = new QJsonArray();
-        tempobj = new QJsonObject();
-        tempobj->insert("name", "预警机_1");
-        temparray->append(120.288), temparray->append(25.5734), temparray->append(100);
-        tempobj->insert("value", *temparray);
-        alies->append(*tempobj);
-        delete temparray;
-        delete tempobj;
-
-        temparray = new QJsonArray();
-        tempobj = new QJsonObject();
-        tempobj->insert("name", "运侦8_1");
-        temparray->append(117.525), temparray->append(25.826), temparray->append(100);
-        tempobj->insert("value", *temparray);
-        alies->append(*tempobj);
-        delete temparray;
-        delete tempobj;
+        QJsonObject temp{
+            {"name", allyNames.at(i)},
+            {"value", allyPos[i]}};
+        ally.append(temp);
     }
-
+    for (int i = 0; i < enemyNames.count(); i++)
     {
-        temparray = new QJsonArray();
-        tempobj = new QJsonObject();
-        tempobj->insert("name", "宙斯盾舰");
-        temparray->append(123.528), temparray->append(25.2951), temparray->append(100);
-        tempobj->insert("value",*temparray);
-        enemys->append(*tempobj);
-        delete temparray;
-        delete tempobj;
+        QJsonObject temp{
+            {"name", enemyNames.at(i)},
+            {"value", enemyPos[i]}};
+        enemy.append(temp);
     }
 
-    QJsonObject GlobalMap
-    {
-        {"friend", QJsonValue(*alies)},
-        {"enemy", QJsonValue(*enemys)}
-    };
-    delete alies;
-    delete enemys;
     // 真实接口
-//    QJsonArray ally;
-//    QJsonArray enemy;
-//    for (auto i : this->zcman->common_inter->PlatformMovement)
-//    {
-//        QJsonArray currentPos = {
-//            i.second.PlatLon,
-//            i.second.PlatLat,
-//            100
-//        };
-//        QJsonObject currentPlat
-//        {
-//            {"name", QString::fromLocal8Bit(i.second.PlatName.c_str())},
-//            {"value", currentPos}
-//        };
-//        // 判断敌我
-//        if (i.second.PlatIdentification == 2)
-//        {
-//            ally.append(currentPlat);
-//        }
-//        else if (i.second.PlatIdentification == 1)
-//        {
-//            enemy.append(currentPlat);
-//        }
-//    }
-//    QJsonObject GlobalMap
-//    {
-//        {"friend", QJsonValue(ally)},
-//        {"enemy", QJsonValue(enemy)}
-//    };
+    //    QJsonArray ally;
+    //    QJsonArray enemy;
+    //    for (auto i : this->zcman->common_inter->PlatformMovement)
+    //    {
+    //        QJsonArray currentPos = {
+    //            i.second.PlatLon,
+    //            i.second.PlatLat,
+    //            100
+    //        };
+    //        QJsonObject currentPlat
+    //        {
+    //            {"name", QString::fromLocal8Bit(i.second.PlatName.c_str())},
+    //            {"value", currentPos}
+    //        };
+    //        // 判断敌我
+    //        if (i.second.PlatIdentification == 2)
+    //        {
+    //            ally.append(currentPlat);
+    //        }
+    //        else if (i.second.PlatIdentification == 1)
+    //        {
+    //            enemy.append(currentPlat);
+    //        }
+    //    }
 
     // 构造返回对象
-    QJsonObject *ret = new QJsonObject({
-                                           {"url", obj.value("url")},
-                                           {"data", GlobalMap}
-                                       });
+    QJsonObject GlobalMap{
+        {"friend", QJsonValue(ally)},
+        {"enemy", QJsonValue(enemy)}};
+    QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
+                                        {"data", GlobalMap}});
 
     returnMessage(pSender, ret);
 }
@@ -561,20 +491,20 @@ void WSServer::getRadarInstances(QWebSocket *pSender, QJsonObject obj)
 
     QJsonArray RadarInstances;
 
+    // 假接口
     if (1)
     {
-        QJsonObject tempRadar
-        {
-            {"instanceID",20},
-            {"instanceName","雷达_1"},
-            {"instanceState","开机"}
-        };
+        QJsonObject tempRadar{
+            {"instanceID", 20},
+            {"instanceName", "雷达_1"}};
         RadarInstances.append(tempRadar);
     }
-    QJsonObject *ret = new QJsonObject();
-    ret->insert("url", obj.value("url"));
-    ret->insert("PlatformID", obj.value("PlatformID"));
-    ret->insert("data",QJsonValue(RadarInstances));
+    // 真实接口:待开发
+
+    // 构造返回对象
+    QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
+                                        {"PlatformID", obj.value("PlatformID")},
+                                        {"data", RadarInstances}});
 
     returnMessage(pSender, ret);
 }
@@ -584,13 +514,10 @@ void WSServer::getRadarParams(QWebSocket *pSender, QJsonObject obj)
 
     int nowInstance = obj.value("InstanceID").toString().toInt();
 
-
-    QJsonObject *ret = new QJsonObject({
-                                           {"url", obj.value("url")},
-                                           {"PlatformID", obj.value("PlatformID")},
-                                           {"InstanceID", obj.value("InstanceID")},
-                                           {"data",QJsonValue()}
-                                       });
+    QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
+                                        {"PlatformID", obj.value("PlatformID")},
+                                        {"InstanceID", obj.value("InstanceID")},
+                                        {"data", QJsonValue()}});
 
     returnMessage(pSender, ret);
 }
@@ -599,21 +526,20 @@ void WSServer::getJammingInstances(QWebSocket *pSender, QJsonObject obj)
 {
     QJsonArray ECMInstances;
 
+    // 假接口
     if (1)
     {
-        QJsonObject tempECM
-        {
-            {"instanceID",20},
-            {"instanceName","ECM_1"},
-            {"instanceState","开机"}
-        };
+        QJsonObject tempECM{
+            {"instanceID", 20},
+            {"instanceName", "ECM_1"}};
         ECMInstances.append(tempECM);
     }
+    // 真实接口:待开发
 
-    QJsonObject *ret = new QJsonObject();
-    ret->insert("url", obj.value("url"));
-    ret->insert("PlatformID", obj.value("PlatformID"));
-    ret->insert("data",QJsonValue(ECMInstances));
+    // 构造返回对象
+    QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
+                                        {"PlatformID", obj.value("PlatformID")},
+                                        {"data", ECMInstances}});
 
     returnMessage(pSender, ret);
 }
@@ -627,10 +553,9 @@ void WSServer::getJammingParams(QWebSocket *pSender, QJsonObject obj)
     ret->insert("url", obj.value("url"));
     ret->insert("PlatformID", obj.value("PlatformID"));
     ret->insert("InstanceID", obj.value("InstanceID"));
-    ret->insert("data",QJsonValue(nowParams));
+    ret->insert("data", QJsonValue(nowParams));
 
     returnMessage(pSender, ret);
-
 }
 
 void WSServer::setJammingStyle(QWebSocket *pSender, QJsonObject obj)
@@ -639,12 +564,10 @@ void WSServer::setJammingStyle(QWebSocket *pSender, QJsonObject obj)
     int nowPlatform = obj.value("PlatformID").toString().toInt();
     int nowInstance = obj.value("InstanceID").toString().toInt();
 
-    QJsonObject *ret = new QJsonObject({
-                                           {"url", obj.value("url")},
-                                           {"PlatformID", obj.value("PlatformID")},
-                                           {"InstanceID", obj.value("InstanceID")},
-                                           {"data",QJsonValue()}
-                                       });
+    QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
+                                        {"PlatformID", obj.value("PlatformID")},
+                                        {"InstanceID", obj.value("InstanceID")},
+                                        {"data", QJsonValue()}});
 
     returnMessage(pSender, ret);
 }
@@ -652,20 +575,18 @@ void WSServer::setJammingStyle(QWebSocket *pSender, QJsonObject obj)
 void WSServer::getJammingSig(QWebSocket *pSender, QJsonObject obj)
 {
     QJsonObject dat = obj.value("data").toObject();
-    if (dat.contains("order")==false)
+    if (dat.contains("order") == false)
     {
-        QJsonObject *ret = new QJsonObject({
-            {"order", 0}
-        });
+        QJsonObject *ret = new QJsonObject({{"order", 0}});
         returnMessage(pSender, ret);
     }
-    else {
+    else
+    {
         int order = dat.value("order").toInt();
-        QJsonObject *ret = new QJsonObject({
-            {"order", order}
-        });
+        QJsonObject *ret = new QJsonObject({{"order", order}});
 
-        if(order==1){
+        if (order == 1)
+        {
             int lines = 0;
 
             double N = 10000;
@@ -674,19 +595,20 @@ void WSServer::getJammingSig(QWebSocket *pSender, QJsonObject obj)
             double m_fe = 1;
             double f_0 = 10e6;
             double A = 1;
-            double f_s =100e6;
+            double f_s = 100e6;
             coder::array<double, 2U> S;
             coder::array<double, 2U> S0;
-            FMjamming_H(N,B_n,f_s,T_s,m_fe,A,f_0,S,S0);
-            ret->insert("size",S.size(1));
+            FMjamming_H(N, B_n, f_s, T_s, m_fe, A, f_0, S, S0);
+            ret->insert("size", S.size(1));
             QJsonArray data;
-            for (int i=0; i<S.size(1); i++)
+            for (int i = 0; i < S.size(1); i++)
             {
                 data.append(S[i]);
             }
-            ret->insert("data",data);
+            ret->insert("data", data);
         }
-        else if(order==2){
+        else if (order == 2)
+        {
             int lines = 0;
             double N = 10000;
             double B_n = 2e6;
@@ -694,16 +616,17 @@ void WSServer::getJammingSig(QWebSocket *pSender, QJsonObject obj)
             double f_0 = 10e6;
             double f_s = 100e6;
             coder::array<double, 2U> S;
-            AMJamming_H(N,f_s,B_n,f_0,m_A,S);
-            ret->insert("size",S.size(1));
+            AMJamming_H(N, f_s, B_n, f_0, m_A, S);
+            ret->insert("size", S.size(1));
             QJsonArray data;
-            for (int i=0; i<S.size(1); i++)
+            for (int i = 0; i < S.size(1); i++)
             {
                 data.append(S[i]);
             }
-            ret->insert("data",data);
+            ret->insert("data", data);
         }
-        else if(order==3){
+        else if (order == 3)
+        {
             int lines = 0;
             double N = 1024;
             double B_n = 2e6;
@@ -712,27 +635,28 @@ void WSServer::getJammingSig(QWebSocket *pSender, QJsonObject obj)
             double f_s = 100e6;
             coder::array<creal_T, 2U> S;
 
-            jamming_H(N,f_s,A,B_n,f_0,S);
+            jamming_H(N, f_s, A, B_n, f_0, S);
             double sig[1024];
             QJsonArray data;
-            for(int i=0;i<S.size(1);i++)
+            for (int i = 0; i < S.size(1); i++)
             {
                 sig[i] = S[i].re;
                 data.append(sig[i]);
             }
-            ret->insert("size",1024);
-            ret->insert("data",data);
+            ret->insert("size", 1024);
+            ret->insert("data", data);
         }
-        else if(order==4){
+        else if (order == 4)
+        {
             int lines = 0;
-            double fd = 200/3e2;
+            double fd = 200 / 3e2;
             double N = 1;
-            double ts = 1/1e7;
+            double ts = 1 / 1e7;
             double Tr = 5e-4;
-            double t_r = 2/1e4;
+            double t_r = 2 / 1e4;
             double tau = 30e-6;
             double fo = 1e6;
-            double k = 1e12/6;
+            double k = 1e12 / 6;
             double A = 1;
             double dlt_t = 25e-6;
             double R = 30e3;
@@ -742,16 +666,17 @@ void WSServer::getJammingSig(QWebSocket *pSender, QJsonObject obj)
             coder::array<double, 2U> SS;
             coder::array<double, 2U> S_disturb;
             coder::array<double, 2U> S3;
-            false_target_distance(fd,N,ts,Tr,t_r,tau,fo,k,A,dlt_t,R,fs,S,S1,SS,S_disturb,S3);
-            ret->insert("size",S3.size(1));
+            false_target_distance(fd, N, ts, Tr, t_r, tau, fo, k, A, dlt_t, R, fs, S, S1, SS, S_disturb, S3);
+            ret->insert("size", S3.size(1));
             QJsonArray data;
-            for(int i=0;i<S3.size(1);i++)
+            for (int i = 0; i < S3.size(1); i++)
             {
                 data.append(S3[i]);
             }
             ret->insert("data", data);
         }
-        else if(order==5){
+        else if (order == 5)
+        {
             int lines = 0;
             double fd = 4;
             double N = 1;
@@ -760,28 +685,29 @@ void WSServer::getJammingSig(QWebSocket *pSender, QJsonObject obj)
             double t_r = 20e-5;
             double tau = 30e-6;
             double fo = 1e6;
-            double k = 5e6/30e-6;
+            double k = 5e6 / 30e-6;
             double V = 600;
             coder::array<double, 2U> S;
-            false_speed(fd,fo,ts,tau,Tr,k,t_r,V,N,S);
-            ret->insert("size",S.size(1));
+            false_speed(fd, fo, ts, tau, Tr, k, t_r, V, N, S);
+            ret->insert("size", S.size(1));
             QJsonArray data;
-            for(int i=0;i<S.size(1);i++)
+            for (int i = 0; i < S.size(1); i++)
             {
                 data.append(S[i]);
             }
             ret->insert("data", data);
         }
-        else if(order==6){
+        else if (order == 6)
+        {
             int lines = 0;
             double fd = 0.2;
             double N = 1;
             double dlt = 25e-6;
             double S[10500];
-            S_jam(fd,dlt,N,S);
-            ret->insert("size",10500);
+            S_jam(fd, dlt, N, S);
+            ret->insert("size", 10500);
             QJsonArray data;
-            for(int i=0;i<10500;i++)
+            for (int i = 0; i < 10500; i++)
             {
                 data.append(S[i]);
             }
@@ -790,6 +716,3 @@ void WSServer::getJammingSig(QWebSocket *pSender, QJsonObject obj)
         returnMessage(pSender, ret);
     }
 }
-
-
-