wsserver.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. #pragma execution_character_set("utf-8")
  2. #include "wsserver.h"
  3. WSServer::WSServer(QObject *parent, quint16 port) : QObject(parent)
  4. {
  5. m_pWebSocketServer = new QWebSocketServer(QStringLiteral("Mock Server"),
  6. QWebSocketServer::NonSecureMode,
  7. this);
  8. if (m_pWebSocketServer->listen(QHostAddress::Any, port))
  9. {
  10. qDebug() << "GR Server listening on port" << port;
  11. connect(m_pWebSocketServer, &QWebSocketServer::newConnection,
  12. this, &WSServer::onNewConnection);
  13. }
  14. }
  15. WSServer::~WSServer()
  16. {
  17. m_pWebSocketServer->close();
  18. qDeleteAll(m_clients.begin(), m_clients.end());
  19. }
  20. void WSServer::onNewConnection()
  21. {
  22. QWebSocket *pSocket = m_pWebSocketServer->nextPendingConnection();
  23. connect(pSocket, &QWebSocket::textMessageReceived, this, &WSServer::processMessage);
  24. connect(pSocket, &QWebSocket::disconnected, this, &WSServer::socketDisconnected);
  25. m_clients << pSocket;
  26. }
  27. QJsonObject WSServer::processJsonObj(QJsonObject objin)
  28. {
  29. QJsonObject ret;
  30. QStringList Keys = objin.keys();
  31. for (auto k : Keys)
  32. {
  33. QJsonValue v = objin.value(k);
  34. if (k == "url")
  35. {
  36. ret.insert(k, v);
  37. }
  38. else if (k == "InstanceID")
  39. {
  40. ret.insert(k, v);
  41. }
  42. else if (k == "data")
  43. {
  44. if (v.isObject())
  45. {
  46. QJsonObject Props = v.toObject();
  47. QStringList Propkeys = Props.keys();
  48. if (Propkeys.contains("InstanceID"))
  49. {
  50. ret.insert("InstanceID", Props.take("InstanceID"));
  51. }
  52. if (Propkeys.contains("PlatformID"))
  53. {
  54. ret.insert("PlatformID", Props.take("PlatformID"));
  55. }
  56. ret.insert("data", Props);
  57. }
  58. }
  59. // if (v.isArray())
  60. // {
  61. // for (auto i : v.toArray())
  62. // {
  63. // if (i.isString())
  64. // {
  65. // objout->insert(i.toString(),QJsonValue());
  66. // }
  67. // }
  68. // }
  69. // else if (v.isObject())
  70. // {
  71. // QJsonObject Props = v.toObject();
  72. // QStringList Propkeys = Props.keys();
  73. // for (auto propkey: Propkeys)
  74. // {
  75. // objout->insert(propkey,Props.value(k));
  76. // }
  77. // }
  78. // 不想打印
  79. // if (v.isObject())
  80. // {
  81. // processJsonObj(v.toObject(),objout);
  82. // }
  83. // 打印调试信息
  84. if (v.isDouble())
  85. {
  86. qDebug() << k << ": " << v.toDouble();
  87. }
  88. else if (v.isString())
  89. {
  90. qDebug() << k << ": " << v.toString();
  91. }
  92. else if (v.isObject())
  93. {
  94. qDebug() << k << "{";
  95. // processJsonObj(v.toObject(),objout);
  96. QJsonObject objout = processJsonObj(v.toObject());
  97. qDebug() << "}";
  98. }
  99. else if (v.isArray())
  100. {
  101. QJsonArray qarray = v.toArray();
  102. qDebug() << k << "[";
  103. for (auto i : qarray)
  104. {
  105. if (i.isString())
  106. {
  107. qDebug() << i.toString();
  108. }
  109. }
  110. qDebug() << "]";
  111. }
  112. }
  113. // qDebug() << QString(QJsonDocument(*objout).toJson());
  114. return ret;
  115. }
  116. void WSServer::processMessage(QString message)
  117. {
  118. // 获取客户端
  119. QWebSocket *pSender = qobject_cast<QWebSocket *>(sender());
  120. // 以Json格式解码message
  121. QByteArray *ByteMessage = new QByteArray();
  122. ByteMessage->append(message);
  123. QJsonParseError *error = new QJsonParseError();
  124. QJsonDocument IncomingJson = QJsonDocument::fromJson(*ByteMessage, error);
  125. if (error->error == QJsonParseError::NoError)
  126. {
  127. if (IncomingJson.isObject())
  128. {
  129. // 解析message
  130. QJsonObject IncomingObj = IncomingJson.object();
  131. QJsonObject msgobj = this->processJsonObj(IncomingObj);
  132. QStringList props = msgobj.keys();
  133. QString url = msgobj.value("url").toString();
  134. // qDebug() << QString(QJsonDocument(msgobj).toJson());
  135. qDebug() << "url:" << url;
  136. // 判断请求
  137. if (url == "getInit")
  138. {
  139. getInit(pSender, msgobj);
  140. }
  141. else if (url == "getPlatformTable")
  142. {
  143. getPlatformTable(pSender, msgobj);
  144. }
  145. else if (url == "getGlobalMap" || url == "getLocalMap" || url == "getRemoteMap" || url == "getCombineMap")
  146. {
  147. getGlobalMap(pSender, msgobj);
  148. }
  149. else if (url == "getJammingSig")
  150. {
  151. getJammingSig(pSender, msgobj);
  152. }
  153. else
  154. {
  155. // 其他接口都需要带平台ID
  156. if (msgobj.contains("PlatformID") == false)
  157. {
  158. QJsonObject *ret = new QJsonObject();
  159. ret->insert("data", QJsonValue());
  160. // 要是没有平台ID,返回空数据
  161. msgobj.insert("data", QJsonValue());
  162. if (msgobj.contains("url") == true)
  163. {
  164. ret->insert("url", msgobj.value("url"));
  165. }
  166. returnMessage(pSender, ret);
  167. }
  168. else if (url == "getRadarInstances")
  169. {
  170. getRadarInstances(pSender, msgobj);
  171. }
  172. else if (url == "getRadarParams" && msgobj.contains("InstanceID"))
  173. {
  174. getRadarParams(pSender, msgobj);
  175. }
  176. else if (url == "getThaadParams" && msgobj.contains("InstanceID"))
  177. {
  178. getRadarParams(pSender, msgobj);
  179. }
  180. else if (url == "getJammingInstances")
  181. {
  182. getJammingInstances(pSender, msgobj);
  183. }
  184. else if (url == "getJammingParams" && msgobj.contains("InstanceID"))
  185. {
  186. getJammingParams(pSender, msgobj);
  187. }
  188. else if (url == "setJammingStyle" && msgobj.contains("InstanceID"))
  189. {
  190. setJammingStyle(pSender, msgobj);
  191. }
  192. else if (url == "getNavParams")
  193. {
  194. // getNavParams(msgobj);
  195. }
  196. else if (url == "setFreePost")
  197. {
  198. // setFreePost(msgobj);
  199. }
  200. else if (url == "getLeadPost")
  201. {
  202. getLeadPost(pSender, msgobj);
  203. }
  204. else if (url == "getTaskPlan")
  205. {
  206. getTaskPlan(pSender, msgobj);
  207. }
  208. }
  209. // qDebug() << "return message:";
  210. // qDebug() << QString(QJsonDocument(*msgobj).toJson());
  211. // QWebSocket *pSender = qobject_cast<QWebSocket *>(sender());
  212. // pSender->sendTextMessage(QString(QJsonDocument(*msgobj).toJson()));
  213. // for (QWebSocket *pClient : qAsConst(m_clients)) {
  214. // QJsonDocument *msgdoc = new QJsonDocument(*msgobj);
  215. // if (pClient == pSender) //don't echo message back to sender
  216. // {
  217. // QJsonValue msg = new QJsonValue(message);
  218. // pClient->sendTextMessage(QString(msgdoc->toJson()));
  219. // }
  220. // qDebug() << QString(msgdoc->toJson());
  221. }
  222. }
  223. }
  224. void WSServer::socketDisconnected()
  225. {
  226. QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
  227. if (pClient)
  228. {
  229. m_clients.removeAll(pClient);
  230. pClient->deleteLater();
  231. }
  232. }
  233. void WSServer::returnMessage(QWebSocket *pSender, QJsonObject *obj)
  234. {
  235. // qDebug() << "return message:";
  236. // qDebug() << QString(QJsonDocument(*obj).toJson());
  237. pSender->sendTextMessage(QString(QJsonDocument(*obj).toJson()));
  238. delete obj;
  239. }
  240. // --------------------初始化状态接口---------------------------------
  241. void WSServer::getInit(QWebSocket *pSender, QJsonObject obj)
  242. {
  243. qDebug() << "网页请求初始化状态";
  244. // 假接口
  245. QJsonObject InitState{
  246. {"InitState", 100}};
  247. // 真实接口
  248. // QJsonObject InitState
  249. // {
  250. // {"InitState",100*(int)this->zcman->common_inter->InitState}
  251. // };
  252. QJsonObject *ret = new QJsonObject(
  253. {{"url", obj.value("url")},
  254. {"data", InitState}});
  255. returnMessage(pSender, ret);
  256. }
  257. // --------------------平台表接口----------------------------------------------
  258. void WSServer::getPlatformTable(QWebSocket *pSender, QJsonObject obj)
  259. {
  260. qDebug() << "网页请求平台信息";
  261. QJsonArray Platforms;
  262. // 假接口
  263. QJsonObject SinglePlatform[]{
  264. {{"platformID", 8013},
  265. {"platformName", "干扰机_1"}},
  266. {{"platformID", 8014},
  267. {"platformName", "干扰机_2"}},
  268. };
  269. for (auto i : SinglePlatform)
  270. {
  271. Platforms.append(i);
  272. }
  273. // 真实接口
  274. // for (auto i : this->grman->grtaskplats)
  275. // {
  276. // QJsonObject SinglePlatform
  277. // {
  278. // {"platformID", (int)i->PlatID},
  279. // {"platformName", QString::fromLocal8Bit(i->PlatName.c_str())}
  280. // };
  281. // Platforms.append(SinglePlatform);
  282. // }
  283. // 构造返回对象
  284. QJsonObject *ret = new QJsonObject(
  285. {{"url", obj.value("url")},
  286. {"data", Platforms}});
  287. returnMessage(pSender, ret);
  288. }
  289. // --------------------------任务管理显控接口------------------------------
  290. void WSServer::getLeadPost(QWebSocket *pSender, QJsonObject obj)
  291. {
  292. qDebug() << "网页请求指挥电文";
  293. // 假接口
  294. QJsonObject CurrentLeadPost1{
  295. {"time", "20:20:01"},
  296. {"GroupID", "0001"},
  297. {"LeaderID", "8015"},
  298. {"Abstract", "开始侦察"}};
  299. QJsonObject CurrentLeadPost2{
  300. {"time", "20:20:30"},
  301. {"GroupID", "0001"},
  302. {"LeaderID", "8015"},
  303. {"Abstract", "发现辐射源"}};
  304. QJsonObject CurrentLeadPost3{
  305. {"time", "20:20:40"},
  306. {"GroupID", "0001"},
  307. {"LeaderID", "8015"},
  308. {"Abstract", "请求干扰"}};
  309. QJsonObject CurrentLeadPost4{
  310. {"time", "20:20:01"},
  311. {"GroupID", "0003"},
  312. {"LeaderID", "8014"},
  313. {"Abstract", "开始干扰"}};
  314. QJsonArray LeadPost = {
  315. CurrentLeadPost1,
  316. CurrentLeadPost2,
  317. CurrentLeadPost3,
  318. CurrentLeadPost4};
  319. // 真实接口
  320. // 待定
  321. // 构造返回对象
  322. QJsonObject *ret = new QJsonObject(
  323. {{"url", obj.value("url")},
  324. {"PlatformID", obj.value("PlatformID")},
  325. {"data", LeadPost}});
  326. returnMessage(pSender, ret);
  327. }
  328. void WSServer::getTaskPlan(QWebSocket *pSender, QJsonObject obj)
  329. {
  330. qDebug() << "网页请求任务计划";
  331. // 假接口
  332. QJsonObject CurrentAirLine{
  333. {"TargetArea", 3},
  334. {"Longitude", 123},
  335. {"Longitude", 27},
  336. {"Radius", 300000}};
  337. QJsonObject CurrentTaskPlan{
  338. {"TargetArea", 2},
  339. {"ThrowGas", 2},
  340. {"ThrowBT", 2}};
  341. QJsonObject TaskPlan{
  342. {"Airline", CurrentAirLine},
  343. {"TaskPlan", CurrentTaskPlan}};
  344. // 真实接口 待定
  345. // 构造返回对象
  346. QJsonObject *ret = new QJsonObject(
  347. {{"url", obj.value("url")},
  348. {"PlatformID", obj.value("PlatformID")},
  349. {"data", TaskPlan}});
  350. returnMessage(pSender, ret);
  351. }
  352. // --------------------------态势显控接口---------------------------------
  353. void WSServer::getLocalMap(QWebSocket *pSender, QJsonObject obj)
  354. {
  355. qDebug() << "网页请求本地态势";
  356. // 来源1:导航位置信息
  357. // 来源2:ESM数据
  358. }
  359. void WSServer::getRemoteMap(QWebSocket *pSender, QJsonObject obj)
  360. {
  361. qDebug() << "网页请求远端态势";
  362. // 来源:保存下来的平台参数情报和航迹情报
  363. }
  364. void WSServer::getCombineMap(QWebSocket *pSender, QJsonObject obj)
  365. {
  366. qDebug() << "网页请求融合态势";
  367. // 来源1:导航位置信息
  368. // 来源2:ESM数据
  369. // 来源3:保存下来的平台参数情报和航迹情报
  370. }
  371. void WSServer::getGlobalMap(QWebSocket *pSender, QJsonObject obj)
  372. {
  373. qDebug() << "网页请求全局态势";
  374. // 来源:支撑平台的平台位置信息
  375. // 假接口
  376. QJsonArray allyNames = {
  377. "导弹发射架_1",
  378. "机场_1",
  379. "预警机_1",
  380. "运侦8_1"};
  381. QJsonArray allyPos[] = {
  382. {117.525, 25.826, 100},
  383. {119.271, 26.26, 100},
  384. {120.288, 25.5734, 100},
  385. {117.525, 25.826, 100}};
  386. QJsonArray enemyNames = {
  387. "80xxA电子侦察船_1",
  388. "宙斯盾舰"};
  389. QJsonArray enemyPos[] = {
  390. {120.446, 24.8902, 100},
  391. {123.528, 25.2951, 100}};
  392. QJsonArray ally;
  393. QJsonArray enemy;
  394. for (int i = 0; i < allyNames.count(); i++)
  395. {
  396. QJsonObject temp{
  397. {"name", allyNames.at(i)},
  398. {"value", allyPos[i]}};
  399. ally.append(temp);
  400. }
  401. for (int i = 0; i < enemyNames.count(); i++)
  402. {
  403. QJsonObject temp{
  404. {"name", enemyNames.at(i)},
  405. {"value", enemyPos[i]}};
  406. enemy.append(temp);
  407. }
  408. // 真实接口
  409. // QJsonArray ally;
  410. // QJsonArray enemy;
  411. // for (auto i : this->zcman->common_inter->PlatformMovement)
  412. // {
  413. // QJsonArray currentPos = {
  414. // i.second.PlatLon,
  415. // i.second.PlatLat,
  416. // 100
  417. // };
  418. // QJsonObject currentPlat
  419. // {
  420. // {"name", QString::fromLocal8Bit(i.second.PlatName.c_str())},
  421. // {"value", currentPos}
  422. // };
  423. // // 判断敌我
  424. // if (i.second.PlatIdentification == 2)
  425. // {
  426. // ally.append(currentPlat);
  427. // }
  428. // else if (i.second.PlatIdentification == 1)
  429. // {
  430. // enemy.append(currentPlat);
  431. // }
  432. // }
  433. // 构造返回对象
  434. QJsonObject GlobalMap{
  435. {"friend", QJsonValue(ally)},
  436. {"enemy", QJsonValue(enemy)}};
  437. QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
  438. {"data", GlobalMap}});
  439. returnMessage(pSender, ret);
  440. }
  441. void WSServer::getRadarInstances(QWebSocket *pSender, QJsonObject obj)
  442. {
  443. int nowPlatform = obj.value("PlatformID").toInt();
  444. QJsonArray RadarInstances;
  445. // 假接口
  446. if (1)
  447. {
  448. QJsonObject tempRadar{
  449. {"instanceID", 20},
  450. {"instanceName", "雷达_1"}};
  451. RadarInstances.append(tempRadar);
  452. }
  453. // 真实接口:待开发
  454. // 构造返回对象
  455. QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
  456. {"PlatformID", obj.value("PlatformID")},
  457. {"data", RadarInstances}});
  458. returnMessage(pSender, ret);
  459. }
  460. void WSServer::getRadarParams(QWebSocket *pSender, QJsonObject obj)
  461. {
  462. int nowInstance = obj.value("InstanceID").toString().toInt();
  463. QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
  464. {"PlatformID", obj.value("PlatformID")},
  465. {"InstanceID", obj.value("InstanceID")},
  466. {"data", QJsonValue()}});
  467. returnMessage(pSender, ret);
  468. }
  469. void WSServer::getJammingInstances(QWebSocket *pSender, QJsonObject obj)
  470. {
  471. QJsonArray ECMInstances;
  472. // 假接口
  473. if (1)
  474. {
  475. QJsonObject tempECM{
  476. {"instanceID", 20},
  477. {"instanceName", "ECM_1"}};
  478. ECMInstances.append(tempECM);
  479. }
  480. // 真实接口:待开发
  481. // 构造返回对象
  482. QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
  483. {"PlatformID", obj.value("PlatformID")},
  484. {"data", ECMInstances}});
  485. returnMessage(pSender, ret);
  486. }
  487. void WSServer::getJammingParams(QWebSocket *pSender, QJsonObject obj)
  488. {
  489. QJsonArray nowParams = {};
  490. QJsonObject *ret = new QJsonObject();
  491. ret->insert("url", obj.value("url"));
  492. ret->insert("PlatformID", obj.value("PlatformID"));
  493. ret->insert("InstanceID", obj.value("InstanceID"));
  494. ret->insert("data", QJsonValue(nowParams));
  495. returnMessage(pSender, ret);
  496. }
  497. void WSServer::setJammingStyle(QWebSocket *pSender, QJsonObject obj)
  498. {
  499. // PlatformID和InstanceID是字符串
  500. int nowPlatform = obj.value("PlatformID").toString().toInt();
  501. int nowInstance = obj.value("InstanceID").toString().toInt();
  502. QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
  503. {"PlatformID", obj.value("PlatformID")},
  504. {"InstanceID", obj.value("InstanceID")},
  505. {"data", QJsonValue()}});
  506. returnMessage(pSender, ret);
  507. }
  508. void WSServer::getJammingSig(QWebSocket *pSender, QJsonObject obj)
  509. {
  510. QJsonObject dat = obj.value("data").toObject();
  511. if (dat.contains("order") == false)
  512. {
  513. QJsonObject *ret = new QJsonObject({{"order", 0}});
  514. returnMessage(pSender, ret);
  515. }
  516. else
  517. {
  518. int order = dat.value("order").toInt();
  519. QJsonObject *ret = new QJsonObject({{"order", order}});
  520. if (order == 1)
  521. {
  522. int lines = 0;
  523. double N = 10000;
  524. double B_n = 2e6;
  525. double T_s = 100e-6;
  526. double m_fe = 1;
  527. double f_0 = 10e6;
  528. double A = 1;
  529. double f_s = 100e6;
  530. coder::array<double, 2U> S;
  531. coder::array<double, 2U> S0;
  532. FMjamming_H(N, B_n, f_s, T_s, m_fe, A, f_0, S, S0);
  533. ret->insert("size", S.size(1));
  534. QJsonArray data;
  535. for (int i = 0; i < S.size(1); i++)
  536. {
  537. data.append(S[i]);
  538. }
  539. ret->insert("data", data);
  540. }
  541. else if (order == 2)
  542. {
  543. int lines = 0;
  544. double N = 10000;
  545. double B_n = 2e6;
  546. double m_A = 1;
  547. double f_0 = 10e6;
  548. double f_s = 100e6;
  549. coder::array<double, 2U> S;
  550. AMJamming_H(N, f_s, B_n, f_0, m_A, S);
  551. ret->insert("size", S.size(1));
  552. QJsonArray data;
  553. for (int i = 0; i < S.size(1); i++)
  554. {
  555. data.append(S[i]);
  556. }
  557. ret->insert("data", data);
  558. }
  559. else if (order == 3)
  560. {
  561. int lines = 0;
  562. double N = 1024;
  563. double B_n = 2e6;
  564. double A = 1;
  565. double f_0 = 10e6;
  566. double f_s = 100e6;
  567. coder::array<creal_T, 2U> S;
  568. jamming_H(N, f_s, A, B_n, f_0, S);
  569. double sig[1024];
  570. QJsonArray data;
  571. for (int i = 0; i < S.size(1); i++)
  572. {
  573. sig[i] = S[i].re;
  574. data.append(sig[i]);
  575. }
  576. ret->insert("size", 1024);
  577. ret->insert("data", data);
  578. }
  579. else if (order == 4)
  580. {
  581. int lines = 0;
  582. double fd = 200 / 3e2;
  583. double N = 1;
  584. double ts = 1 / 1e7;
  585. double Tr = 5e-4;
  586. double t_r = 2 / 1e4;
  587. double tau = 30e-6;
  588. double fo = 1e6;
  589. double k = 1e12 / 6;
  590. double A = 1;
  591. double dlt_t = 25e-6;
  592. double R = 30e3;
  593. double fs = 1e7;
  594. coder::array<double, 2U> S;
  595. coder::array<double, 2U> S1;
  596. coder::array<double, 2U> SS;
  597. coder::array<double, 2U> S_disturb;
  598. coder::array<double, 2U> S3;
  599. false_target_distance(fd, N, ts, Tr, t_r, tau, fo, k, A, dlt_t, R, fs, S, S1, SS, S_disturb, S3);
  600. ret->insert("size", S3.size(1));
  601. QJsonArray data;
  602. for (int i = 0; i < S3.size(1); i++)
  603. {
  604. data.append(S3[i]);
  605. }
  606. ret->insert("data", data);
  607. }
  608. else if (order == 5)
  609. {
  610. int lines = 0;
  611. double fd = 4;
  612. double N = 1;
  613. double ts = 1e-7;
  614. double Tr = 5e-4;
  615. double t_r = 20e-5;
  616. double tau = 30e-6;
  617. double fo = 1e6;
  618. double k = 5e6 / 30e-6;
  619. double V = 600;
  620. coder::array<double, 2U> S;
  621. false_speed(fd, fo, ts, tau, Tr, k, t_r, V, N, S);
  622. ret->insert("size", S.size(1));
  623. QJsonArray data;
  624. for (int i = 0; i < S.size(1); i++)
  625. {
  626. data.append(S[i]);
  627. }
  628. ret->insert("data", data);
  629. }
  630. else if (order == 6)
  631. {
  632. int lines = 0;
  633. double fd = 0.2;
  634. double N = 1;
  635. double dlt = 25e-6;
  636. double S[10500];
  637. S_jam(fd, dlt, N, S);
  638. ret->insert("size", 10500);
  639. QJsonArray data;
  640. for (int i = 0; i < 10500; i++)
  641. {
  642. data.append(S[i]);
  643. }
  644. ret->insert("data", data);
  645. }
  646. returnMessage(pSender, ret);
  647. }
  648. }