123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815 |
- #pragma execution_character_set("utf-8")
- #include "wsserver.h"
- WSServer::WSServer(QObject *parent, quint16 port) : QObject(parent)
- {
- EsmworkPara.uRrPowerOn = 1;
- EsmworkPara.uRrWorkMode = 0;
- EsmworkPara.dScanAzCentDeg = 0;
- EsmworkPara.dScanAzWidthDeg = 5;
- EsmworkPara.dScanElCentDeg = 0;
- EsmworkPara.uLineNumPerFrame = 20;
- EsmworkPara.fAntScanVel = 1;
- EsmworkPara.fFreqScanVel = 100;
- EsmworkPara.fTecBeginFreqMhz = 500;
- EsmworkPara.fTecEndFreqMhz = 10000;
- m_pWebSocketServer = new QWebSocketServer(QStringLiteral("ZC Server"),
- QWebSocketServer::NonSecureMode,
- this);
- if (m_pWebSocketServer->listen(QHostAddress::Any, port))
- {
- qDebug() << "ZC Server listening on port" << port;
- connect(m_pWebSocketServer, &QWebSocketServer::newConnection,
- this, &WSServer::onNewConnection);
- }
- }
- WSServer::~WSServer()
- {
- m_pWebSocketServer->close();
- qDeleteAll(m_clients.begin(), m_clients.end());
- }
- void WSServer::onNewConnection()
- {
- QWebSocket *pSocket = m_pWebSocketServer->nextPendingConnection();
- connect(pSocket, &QWebSocket::textMessageReceived, this, &WSServer::processMessage);
- connect(pSocket, &QWebSocket::disconnected, this, &WSServer::socketDisconnected);
- m_clients << pSocket;
- }
- QJsonObject WSServer::processJsonObj(QJsonObject objin)
- {
- QJsonObject objout;
- QStringList Keys = objin.keys();
- for (auto k : Keys)
- {
- QJsonValue v = objin.value(k);
- if (k == "url")
- {
- objout.insert(k, v);
- }
- else if (k == "InstanceID")
- {
- objout.insert(k, v);
- }
- else if (k == "data")
- {
- if (v.isObject())
- {
- QJsonObject Props = v.toObject();
- QStringList Propkeys = Props.keys();
- QJsonObject Dataout;
- for (auto propkey : Propkeys)
- {
- if (propkey.compare("InstanceID") == 0)
- {
- objout.insert("InstanceID", Props.value("InstanceID"));
- }
- else if (propkey.compare("PlatformID") == 0)
- {
- objout.insert("PlatformID", Props.value("PlatformID"));
- }
- else
- {
- Dataout.insert(propkey, Props.value(propkey));
- }
- }
- if (!Dataout.isEmpty())
- objout.insert("data", Dataout);
- }
- }
- // 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.isDouble())
- {
- qDebug() << k << ": " << v.toDouble();
- }
- else if (v.isString())
- {
- qDebug() << k << ": " << v.toString();
- }
- else if (v.isObject())
- {
- qDebug() << k << "{";
- QJsonObject objout = processJsonObj(v.toObject());
- qDebug() << "}";
- }
- else if (v.isArray())
- {
- QJsonArray qarray = v.toArray();
- qDebug() << k << "[";
- for (auto i : qarray)
- {
- if (i.isString())
- {
- qDebug() << i.toString();
- }
- }
- qDebug() << "]";
- }
- }
- return objout;
- // qDebug() << QString(QJsonDocument(*objout).toJson());
- }
- void WSServer::processMessage(QString message)
- {
- // 以Json格式解码message
- QByteArray *ByteMessage = new QByteArray();
- ByteMessage->append(message);
- QJsonParseError *error = new QJsonParseError();
- QJsonDocument IncomingJson = QJsonDocument::fromJson(*ByteMessage, error);
- if (error->error == QJsonParseError::NoError)
- {
- if (IncomingJson.isObject())
- {
- QWebSocket *pSender = qobject_cast<QWebSocket *>(sender());
- // 解析message
- QJsonObject IncomingObj = IncomingJson.object();
- QJsonObject msgobj = this->processJsonObj(IncomingObj);
- QStringList props = msgobj.keys();
- QString url = msgobj.value("url").toString();
- qDebug() << "url:" << url;
- // 判断请求
- if (url == "getInit")
- {
- getInit(pSender, msgobj);
- }
- else if (url == "getPlatformTable")
- {
- getPlatformTable(pSender, msgobj);
- }
- else if (url == "getGlobalMap")
- {
- getGlobalMap(pSender, msgobj);
- }
- else
- {
- // 其他接口都需要带平台ID
- if (msgobj.contains("PlatformID") == false || msgobj.value("PlatformID") == QJsonValue())
- {
- // 要是没有平台ID,返回空数据
- QJsonObject *ret = new QJsonObject(
- {{"url", url},
- {"data", ""}});
- returnMessage(pSender, ret);
- }
- // 态势接口
- else if (url == "getLocalMap" || url == "getRemoteMap" || url == "getCombineMap")
- {
- }
- // ESM接口
- else if (url == "getESMInstances")
- {
- getESMInstances(pSender, msgobj);
- }
- else if (url == "setESMParams")
- {
- setESMParams(pSender, msgobj);
- }
- else if (url == "getESMParams")
- {
- getESMParams(pSender, msgobj);
- }
- else if (url == "getESMStatus")
- {
- getESMStatus(pSender, msgobj);
- }
- else if (url == "getESMData")
- {
- getESMData(pSender, msgobj);
- }
- else if (url == "getNavParams")
- {
- getNavParams(pSender, msgobj);
- }
- else if (url == "setFreePost")
- {
- setFreePost(pSender, msgobj);
- }
- else if (url == "getLeadPost")
- {
- getLeadPost(pSender, msgobj);
- }
- else if (url == "getTaskPlan")
- {
- getTaskPlan(pSender, msgobj);
- }
- }
- }
- }
- }
- void WSServer::socketDisconnected()
- {
- QWebSocket *pClient = qobject_cast<QWebSocket *>(sender());
- if (pClient)
- {
- m_clients.removeAll(pClient);
- pClient->deleteLater();
- }
- }
- void WSServer::returnMessage(QWebSocket *pSender, QJsonObject *jsonObj)
- {
- // qDebug() << "return message:";
- // qDebug() << QString(QJsonDocument(*jsonObj).toJson());
- pSender->sendTextMessage(QString(QJsonDocument(*jsonObj).toJson()));
- delete jsonObj;
- }
- // --------------------初始化状态接口---------------------------------
- void WSServer::getInit(QWebSocket *pSender, QJsonObject obj)
- {
- qDebug() << "网页请求初始化状态";
- // 假接口
- QJsonObject InitState{
- {"InitState", 100}};
- // 真实接口
- // QJsonObject InitState
- // {
- // {"InitState",100*(int)this->zcman->common_inter->InitState}
- // };
- QJsonObject *ret = new QJsonObject(
- {{"url", obj.value("url")},
- {"data", InitState}});
- returnMessage(pSender, ret);
- }
- // --------------------平台表接口----------------------------------------------
- void WSServer::getPlatformTable(QWebSocket *pSender, QJsonObject obj)
- {
- qDebug() << "网页请求平台信息";
- QJsonArray Platforms;
- // 假接口
- QJsonObject SinglePlatform[]{
- {{"platformID", 8015},
- {"platformName", "侦察机_1"}},
- {{"platformID", 8016},
- {"platformName", "侦察机_2"}},
- };
- 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);
- // }
- // 构造返回对象
- QJsonObject *ret = new QJsonObject(
- {{"url", obj.value("url")},
- {"data", Platforms}});
- returnMessage(pSender, ret);
- }
- // --------------------------任务管理显控接口------------------------------
- void WSServer::getLeadPost(QWebSocket *pSender, QJsonObject obj)
- {
- qDebug() << "网页请求指挥电文";
- // 假接口
- QJsonObject CurrentLeadPost1{
- {"time", "20:20:01"},
- {"GroupID", "0001"},
- {"LeaderID", "8015"},
- {"Abstract", "开始侦察"}};
- QJsonObject CurrentLeadPost2{
- {"time", "20:20:30"},
- {"GroupID", "0001"},
- {"LeaderID", "8015"},
- {"Abstract", "发现辐射源"}};
- QJsonObject CurrentLeadPost3{
- {"time", "20:20:40"},
- {"GroupID", "0001"},
- {"LeaderID", "8015"},
- {"Abstract", "请求干扰"}};
- QJsonObject CurrentLeadPost4{
- {"time", "20:20:01"},
- {"GroupID", "0003"},
- {"LeaderID", "8014"},
- {"Abstract", "开始干扰"}};
- QJsonArray LeadPost = {
- CurrentLeadPost1,
- CurrentLeadPost2,
- CurrentLeadPost3,
- CurrentLeadPost4};
- // 真实接口
- // 待定
- // 构造返回对象
- QJsonObject *ret = new QJsonObject(
- {{"url", obj.value("url")},
- {"PlatformID", obj.value("PlatformID")},
- {"data", LeadPost}});
- returnMessage(pSender, ret);
- }
- void WSServer::getTaskPlan(QWebSocket *pSender, QJsonObject obj)
- {
- qDebug() << "网页请求任务计划";
- // 假接口
- QJsonObject CurrentAirLine{
- {"TargetArea", 3},
- {"Longitude", 123},
- {"Longitude", 27},
- {"Radius", 300000}};
- QJsonObject CurrentTaskPlan{
- {"TargetArea", 2},
- {"ThrowGas", 2},
- {"ThrowBT", 2}};
- QJsonObject TaskPlan{
- {"Airline", CurrentAirLine},
- {"TaskPlan", CurrentTaskPlan}};
- // 真实接口 待定
- // 构造返回对象
- QJsonObject *ret = new QJsonObject(
- {{"url", obj.value("url")},
- {"PlatformID", obj.value("PlatformID")},
- {"data", TaskPlan}});
- returnMessage(pSender, ret);
- }
- // --------------------------态势显控接口---------------------------------
- void WSServer::getLocalMap(QWebSocket *pSender, QJsonObject obj)
- {
- qDebug() << "网页请求本地态势";
- // 来源1:导航位置信息
- // 来源2:ESM数据
- }
- void WSServer::getRemoteMap(QWebSocket *pSender, QJsonObject obj)
- {
- qDebug() << "网页请求远端态势";
- // 来源:保存下来的平台参数情报和航迹情报
- }
- void WSServer::getCombineMap(QWebSocket *pSender, QJsonObject obj)
- {
- qDebug() << "网页请求融合态势";
- // 来源1:导航位置信息
- // 来源2:ESM数据
- // 来源3:保存下来的平台参数情报和航迹情报
- }
- void WSServer::getGlobalMap(QWebSocket *pSender, QJsonObject obj)
- {
- qDebug() << "网页请求全局态势";
- // 来源:支撑平台的平台位置信息
- // 假接口
- 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++)
- {
- QJsonObject temp {
- {"name",allyNames.at(i)},
- {"value",allyPos[i]}
- };
- ally.append(temp);
- }
- for (int i= 0;i<enemyNames.count();i++)
- {
- QJsonObject temp {
- {"name",enemyNames.at(i)},
- {"value",enemyPos[i]}
- };
- enemy.append(temp);
- }
- // 真实接口
- // 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)}
- };
- QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
- {"data", GlobalMap}});
- returnMessage(pSender, ret);
- }
- // --------------------------雷侦、通侦显控接口-------------------------------
- void WSServer::getESMInstances(QWebSocket *pSender, QJsonObject obj)
- {
- qDebug() << "网页请求ESM传感器实例";
- // 假接口
- QJsonArray Instances;
- QJsonObject SingleInstance[] = {
- {{"instanceID", 62},
- {"instanceName", "信号侦察_1"}},
- {{"instanceID", 63},
- {"instanceName", "信号侦察_2"}}};
- // 真实接口 待开发
- // 构造返回对象
- for (auto i : SingleInstance)
- {
- Instances.append(i);
- }
- QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
- {"PlatformID", obj.value("PlatformID")},
- {"data", Instances}});
- returnMessage(pSender, ret);
- }
- void WSServer::setESMParams(QWebSocket *pSender, QJsonObject obj)
- {
- qDebug() << "网页修改ESM参数";
- // 假接口
- int PlatformID = obj.value("PlatformID").toInt();
- int InstanceID = obj.value("InstanceID").toInt();
- QJsonObject data = obj.value("data").toObject();
- if (data.contains("uRrPoweron"))
- {
- EsmworkPara.uRrPowerOn = data.value("uRrPoweron").toBool() ? 1 : 0;
- }
- if (data.contains("uRrWorkMode"))
- {
- EsmworkPara.uRrWorkMode = data.value("uRrWorkMode").toInt();
- }
- if (data.contains("uLineNumPerFrame"))
- {
- EsmworkPara.uLineNumPerFrame = data.value("uLineNumPerFrame").toInt();
- }
- if (data.contains("dScanAzCentDeg"))
- {
- EsmworkPara.dScanAzCentDeg = data.value("dScanAzCentDeg").toDouble();
- }
- if (data.contains("dScanAzWidthDeg"))
- {
- EsmworkPara.dScanAzWidthDeg = data.value("dScanAzWidthDeg").toDouble();
- }
- if (data.contains("dScanElCentDeg"))
- {
- EsmworkPara.dScanElCentDeg = data.value("dScanElCentDeg").toDouble();
- }
- if (data.contains("fAntScanVel"))
- {
- EsmworkPara.fAntScanVel = data.value("fAntScanVel").toDouble();
- }
- if (data.contains("fFreqScanVel"))
- {
- EsmworkPara.fFreqScanVel = data.value("fFreqScanVel").toDouble();
- }
- if (data.contains("fFreqMode"))
- {
- int mode = data.value("fFreqMode").toInt();
- if (mode == 1)
- {
- EsmworkPara.fTecBeginFreqMhz = 500;
- EsmworkPara.fTecEndFreqMhz = 2000;
- }
- else if (mode == 2)
- {
- EsmworkPara.fTecBeginFreqMhz = 2000;
- EsmworkPara.fTecEndFreqMhz = 5000;
- }
- else if (mode == 3)
- {
- EsmworkPara.fTecBeginFreqMhz = 5000;
- EsmworkPara.fTecEndFreqMhz = 18000;
- }
- }
- QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
- {"PlatformID", obj.value("PlatformID")},
- {"data", 1}});
- returnMessage(pSender, ret);
- }
- void WSServer::getESMParams(QWebSocket *pSender, QJsonObject obj)
- {
- qDebug() << "网页请求ESM参数";
- // 假接口
- int InstanceID = obj.value("InstanceID").toInt();
- if (true)
- {
- QJsonObject ESMProps[]{
- // fBeamAzWidth
- {
- {"key", "方位波束宽度"},
- {"value", 2}},
- // fBeamElWidth
- {
- {"key", "俯仰波束宽度"},
- {"value", 2}},
- // fTecMinFreqMhz
- {
- {"key", "侦收最小频率"},
- {"value", 2e3}},
- // fTecMaxFreqMhz
- {
- {"key", "侦收最大频率"},
- {"value", 18e3}},
- // fInstantPageWidMhz
- {
- {"key", "瞬时侦察工作频带带宽"},
- {"value", 500}},
- // ulChanNum
- {
- {"key", "信道个数"},
- {"value", 64}},
- // fTecMinPW
- {
- {"key", "侦收最小脉冲宽度"},
- {"value", 0.5}},
- // fTecMaxPW
- {
- {"key", "侦收最大脉冲宽度"},
- {"value", 10}},
- // fTecPriMean
- {
- {"key", "侦收平均重复周期"},
- {"value", 40}},
- // ulTecTrNumMean
- {
- {"key", "侦收平均脉冲个数"},
- {"value", 5}},
- // fMinSnrdB
- {
- {"key", "最小信噪比"},
- {"value", 0.5}},
- // fSysRcvLoss
- {
- {"key", "接收内部系统损耗"},
- {"value", 5}},
- // fFreqAccuracyReq
- {
- {"key", "频率测量精度要求"},
- {"value", 100}},
- // uRrPowerOn
- {
- {"key", "工作状态"},
- {"value", (int)EsmworkPara.uRrPowerOn}},
- // uRrWorkMode
- {
- {"key", "工作模式"},
- {"value", (int)EsmworkPara.uRrWorkMode}},
- // dScanAzCentDeg
- {
- {"key", "侦察方位中心"},
- {"value", EsmworkPara.dScanAzCentDeg}},
- // dScanAzWidthDeg
- {
- {"key", "侦察方位范围"},
- {"value", EsmworkPara.dScanAzWidthDeg}},
- // dScanElCentDeg
- {
- {"key", "侦察俯仰中心"},
- {"value", EsmworkPara.dScanElCentDeg}},
- // uLineNumPerFrame
- {
- {"key", "景幅行数"},
- {"value", (int)EsmworkPara.uLineNumPerFrame}},
- // fAntScanVel
- {
- {"key", "天线扫描速度"},
- {"value", EsmworkPara.fAntScanVel}},
- // fFreqScanVel
- {
- {"key", "频率扫描速度"},
- {"value", EsmworkPara.fFreqScanVel}},
- // fTecBeginFreqMhz
- {
- {"key", "侦收起始频率"},
- {"value", EsmworkPara.fTecBeginFreqMhz}},
- // fTecEndFreqMhz
- {
- {"key", "侦收终止频率"},
- {"value", EsmworkPara.fTecEndFreqMhz}}};
- QJsonArray ESMInitParams, ESMCtrlParams;
- for (int i = 0; i < 13; i++)
- {
- ESMInitParams.append(ESMProps[i]);
- }
- for (int i = 13; i < 23; i++)
- {
- ESMCtrlParams.append(ESMProps[i]);
- }
- QJsonObject ESMParams{
- {"InitParams", ESMInitParams},
- {"CtrlParams", ESMCtrlParams}};
- QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
- {"PlatformID", obj.value("PlatformID")},
- {"InstanceID", InstanceID},
- {"data", ESMParams}});
- returnMessage(pSender, ret);
- }
- }
- void WSServer::getESMStatus(QWebSocket *pSender, QJsonObject obj)
- {
- qDebug() << "网页请求初始化状态";
- // 假接口
- QJsonArray ESMStatus;
- QJsonObject ESMState[]{
- {{"key", "扫描行号"},
- {"value", 0}},
- {{"key", "扫描行状态"},
- {"value", 0}},
- {{"key", "侦察频率中心"},
- {"value", 0}},
- {{"key", "侦察频率带宽"},
- {"value", 0}},
- {{"key", "天线系波束方位"},
- {"value", 0}},
- {{"key", "天线系波束俯仰"},
- {"value", 0}},
- {{"key", "天线系波束方位"},
- {"value", 0}},
- {{"key", "天线系波束方位"},
- {"value", 0}}};
- for (int i = 0; i < 8; i++)
- {
- ESMStatus.append(ESMState[i]);
- }
- // 真实接口
- int PlatformID = obj.value("PlatformID").toInt();
- int InstanceID = obj.value("InstanceID").toInt();
- // 构造返回对象
- QJsonObject *ret = new QJsonObject(
- {{"url", obj.value("url")},
- {"PlatformID", obj.value("PlatformID")},
- {"data", ESMStatus}});
- returnMessage(pSender, ret);
- }
- void WSServer::getESMData(QWebSocket *pSender, QJsonObject obj)
- {
- }
- void WSServer::getNavParams(QWebSocket *pSender, QJsonObject obj)
- {
- // int InstanceID = obj.value("InstanceID").toInt();
- // QJsonArray *NavInitParams;
- // QJsonArray *NavCtrlParams;
- // QJsonObject *NavPropTemp;
- // NavInitParams = new QJsonArray();
- // NavCtrlParams = new QJsonArray();
- // NavPropTemp = new QJsonObject();
- // NavPropTemp->insert("key", "precision");
- // NavPropTemp->insert("value", QJsonValue(5));
- // NavInitParams->append(*NavPropTemp);
- // delete NavPropTemp;
- // qDebug() << "aaa" << QString(QJsonDocument(*NavCtrlParams).toJson());
- // NavPropTemp = new QJsonObject();
- // NavPropTemp->insert("key", "longitude");
- // NavPropTemp->insert("value", QJsonValue(120));
- // NavCtrlParams->append(*NavPropTemp);
- // delete NavPropTemp;
- // NavPropTemp = new QJsonObject();
- // NavPropTemp->insert("key", "latitude");
- // NavPropTemp->insert("value", QJsonValue(30));
- // NavCtrlParams->append(*NavPropTemp);
- // delete NavPropTemp;
- // NavPropTemp = new QJsonObject();
- // NavPropTemp->insert("key", "altitude");
- // NavPropTemp->insert("value", QJsonValue(8014.8));
- // NavCtrlParams->append(*NavPropTemp);
- // delete NavPropTemp;
- // NavPropTemp = new QJsonObject();
- // NavPropTemp->insert("key", "azimush");
- // NavPropTemp->insert("value", QJsonValue(10));
- // NavCtrlParams->append(*NavPropTemp);
- // delete NavPropTemp;
- // NavPropTemp = new QJsonObject();
- // NavPropTemp->insert("key", "elevation");
- // NavPropTemp->insert("value", QJsonValue(-3));
- // NavCtrlParams->append(*NavPropTemp);
- // delete NavPropTemp;
- // QJsonObject *NAVParams = new QJsonObject();
- // NAVParams->insert("InitParams", *NavInitParams);
- // NAVParams->insert("CtrlParams", *NavCtrlParams);
- // QJsonObject *ret = new QJsonObject({{"url", obj.value("url")},
- // {"PlatformID", obj.value("PlatformID")},
- // {"data", *NAVParams}});
- // returnMessage(pSender, ret);
- // delete NavInitParams;
- // delete NavCtrlParams;
- // delete NAVParams;
- }
- void WSServer::setFreePost(QWebSocket *pSender, QJsonObject obj)
- {
- }
|