1326 lines
53 KiB
C++
1326 lines
53 KiB
C++
|
#include "controlnetconfigwidget.h"
|
|||
|
#include "ui_controlnetconfigwidget.h"
|
|||
|
#include "LoUIClass/x_uimsgboxok.h"
|
|||
|
#include <QJsonValue>
|
|||
|
#include <QJsonArray>
|
|||
|
#include <QJsonObject>
|
|||
|
#include <QJsonDocument>
|
|||
|
#include <globaldefine.h>
|
|||
|
ControlNetConfigWidget::ControlNetConfigWidget(QWidget *parent,QList<LedCard *> *list) :
|
|||
|
QWidget(parent),
|
|||
|
ui(new Ui::ControlNetConfigWidget)
|
|||
|
{
|
|||
|
ui->setupUi(this);
|
|||
|
ui->pushButtonReadbackWireNetwork->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonReadbackWireNetwork->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonReadbackWiFiModel->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonReadbackWiFiModel->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonSetWireNetwork->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonSetWireNetwork->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonApSet->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonApSet->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonWiFiModel->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonWiFiModel->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonScan->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonScan->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonReadback4G->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonReadback4G->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonSet4GInfo->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonSet4GInfo->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonGetMcc->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonGetMcc->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonSetYuanHengApn->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonSetYuanHengApn->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonReadbackFlightModel->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonReadbackFlightModel->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonRead4GStatus->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonRead4GStatus->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
// ui->widgetFightModel->setSliderColor(QColor(0, 160, 230),QColor(0, 160, 230));
|
|||
|
// ui->widgetFightModel->setBgColor(QColor(200,200,200),QColor(200,200,200));
|
|||
|
ui->widgetFightModel->setSliderColor(QColor(0, 0, 0),QColor(0, 160, 230));
|
|||
|
ui->widgetFightModel->setBgColor(QColor(200,200,200),QColor(0,200,0));
|
|||
|
ui->widgetFightModel->setTextColor(QColor(100,100,100),QColor(0, 160, 230));
|
|||
|
ui->widgetFightModel->setText(tr("OFF"),tr("ON"));
|
|||
|
|
|||
|
// ui->lineEditDns->setStyleSheet("QLineEdit{background:rgba(255,255,255,1);}");
|
|||
|
// ui->lineEditDns->setStyleSheet("QLineEdit:disable{background:rgba(0,0,245,1);}");
|
|||
|
// ui->lineEditWireIP->setStyleSheet("QLineEdit{background:rgba(255,255,255,1);}" "QLineEdit:disable{background:rgba(245,245,245,1);}");
|
|||
|
// ui->lineEditWireMask->setStyleSheet("QLineEdit{background:rgba(255,255,255,1);}" "QLineEdit:disable{background:rgba(245,245,245,1);}");
|
|||
|
// ui->lineEditApPassword->setStyleSheet("QLineEdit{background:rgba(255,255,255,1);}" "QLineEdit:disable{background:rgba(245,245,245,1);}");
|
|||
|
// ui->lineEditHotspotName->setStyleSheet("QLineEdit{background:rgba(255,255,255,1);}" "QLineEdit:disable{background:rgba(245,245,245,1);}");
|
|||
|
// ui->lineEditWireGateway->setStyleSheet("QLineEdit{background:rgba(255,255,255,1);}" "QLineEdit:disable{background:rgba(245,245,245,1);}");
|
|||
|
// ui->lineEditWifiPassword->setStyleSheet("QLineEdit{background:rgba(255,255,255,1);}" "QLineEdit:disable{background:rgba(245,245,245,1);}");
|
|||
|
m_buttonGroup = new QButtonGroup;
|
|||
|
m_buttonGroup->addButton(ui->radioButtonDhcp,0);
|
|||
|
m_buttonGroup->addButton(ui->radioButtonSpecifyIp,1);
|
|||
|
|
|||
|
ui->checkBox4g->setStyleSheet("QCheckBox::indicator {width: 16px; height: 16px;}");
|
|||
|
ui->checkBoxCustom->setStyleSheet("QCheckBox::indicator {width: 16px; height: 16px;}");
|
|||
|
ui->comboBoxCountryID->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
ui->comboBoxCarrierName->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
ui->lineEditAPN->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
ui->lineEditUser->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
ui->lineEditPassword->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
ui->checkBox4g->setChecked(true);
|
|||
|
ui->radioButtonDhcp->setChecked(true);
|
|||
|
|
|||
|
connect(this,SIGNAL(sigGetDhcpOrSpecifyIp(int)),this,SLOT(OnDhcpOrSpecifyIp(int)));
|
|||
|
connect(m_buttonGroup,SIGNAL(buttonClicked(int)),this,SLOT(OnDhcpOrSpecifyIp(int)));
|
|||
|
//按钮事件绑定
|
|||
|
connect(ui->pushButtonSetWireNetwork, SIGNAL(clicked()), this, SLOT(onSetWireNetwork()));
|
|||
|
connect(ui->pushButtonReadbackWireNetwork, SIGNAL(clicked()), this, SLOT(onReadbackWireNetwork()));
|
|||
|
connect(ui->pushButtonWiFiModel, SIGNAL(clicked()), this, SLOT(onSetWiFiModel()));
|
|||
|
connect(ui->pushButtonReadbackWiFiModel, SIGNAL(clicked()), this, SLOT(onReadbackWiFiModel()));
|
|||
|
connect(ui->pushButtonApSet, SIGNAL(clicked()), this, SLOT(onSetAp()));
|
|||
|
connect(ui->pushButtonScan,SIGNAL(clicked()),this,SLOT(OnScanWifi()));
|
|||
|
|
|||
|
connect(ui->pushButtonSet4GInfo, SIGNAL(clicked()), this, SLOT(onSet4GInfo()));
|
|||
|
connect(ui->pushButtonReadback4G, SIGNAL(clicked()), this, SLOT(onReadback4G()));
|
|||
|
connect(ui->pushButtonGetMcc, SIGNAL(clicked()), this, SLOT(onGetMcc()));
|
|||
|
connect(ui->pushButtonRead4GStatus, SIGNAL(clicked()), this, SLOT(onGet4GStatus()));
|
|||
|
|
|||
|
connect(ui->comboBoxCountryID, SIGNAL(currentIndexChanged(int)), this, SLOT(OnComboMccChanged(int)));
|
|||
|
connect(ui->comboBoxCarrierName, SIGNAL(currentIndexChanged(int)), this, SLOT(OnComboCarrierChanged(int)));
|
|||
|
connect(ui->checkBoxCustom, SIGNAL(clicked(bool)), this, SLOT(OnCustom4G(bool)));
|
|||
|
connect(ui->checkBox4g, SIGNAL(clicked(bool)), this, SLOT(OnOpne4G(bool)));
|
|||
|
connect(ui->widgetFightModel, SIGNAL(checkedChanged(bool)), this, SLOT(onFightModelChecked(bool)));
|
|||
|
connect(ui->pushButtonReadbackFlightModel, SIGNAL(clicked()), this, SLOT(onReadbackFlightModel()));
|
|||
|
|
|||
|
MARCO_DEFINE_CONTROL_FUNC2(parent->parent(),parent)
|
|||
|
emit sigGetDhcpOrSpecifyIp(0);
|
|||
|
//initTimezone();
|
|||
|
#ifdef MACRO_YUANHENG_VERSION
|
|||
|
//元亨
|
|||
|
ui->comboBoxCountryID->setCurrentText("310");
|
|||
|
ui->comboBoxCarrierName->setCurrentText("T-Mobile US 310");
|
|||
|
ui->lineEditAPN->setText("iot.cargo");
|
|||
|
|
|||
|
ui->lineEditWifiPassword->setEchoMode(QLineEdit::Password);
|
|||
|
ui->lineEditApPassword->setEchoMode(QLineEdit::Password);
|
|||
|
ui->groupBox_3->setChecked(true);
|
|||
|
ui->checkBoxCustom->setVisible(false);
|
|||
|
ui->label_2->setVisible(false);
|
|||
|
ui->label_3->setVisible(false);
|
|||
|
ui->comboBoxCountryID->setVisible(false);
|
|||
|
ui->comboBoxCarrierName->setVisible(false);
|
|||
|
ui->label_4->setVisible(false);
|
|||
|
ui->label_6->setVisible(false);
|
|||
|
ui->label_7->setVisible(false);
|
|||
|
ui->lineEditUser->setVisible(false);
|
|||
|
ui->lineEditPassword->setVisible(false);
|
|||
|
ui->label_8->setVisible(false);
|
|||
|
|
|||
|
|
|||
|
ui->pushButtonSetYuanHengApn->setVisible(true);
|
|||
|
|
|||
|
ui->lineEditAPN->setReadOnly(false);
|
|||
|
ui->lineEditAPN->setStyleSheet("background:rgba(255,255,255,1);");
|
|||
|
|
|||
|
connect(ui->pushButtonSetYuanHengApn, SIGNAL(clicked()), this, SLOT(OnSetYuanHengApn()));
|
|||
|
|
|||
|
#else
|
|||
|
|
|||
|
ui->pushButtonSetYuanHengApn->setVisible(false);
|
|||
|
#endif
|
|||
|
ui->checkBoxCustom->setVisible(false);
|
|||
|
OnCustom4G(true);
|
|||
|
// ui->checkBoxCustom->setVisible(false);
|
|||
|
// ui->checkBoxCustom->setVisible(false);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
ControlNetConfigWidget::~ControlNetConfigWidget()
|
|||
|
{
|
|||
|
delete ui;
|
|||
|
if(pHpptClient != nullptr)
|
|||
|
{
|
|||
|
qDebug() <<"delete pHpptClient in ~NetComm";
|
|||
|
delete pHpptClient;
|
|||
|
pHpptClient=nullptr;
|
|||
|
}
|
|||
|
if(pHpptClientAll != nullptr)
|
|||
|
{
|
|||
|
qDebug() <<"delete pHpptClientAll in ~NetComm";
|
|||
|
delete pHpptClientAll;
|
|||
|
pHpptClientAll=nullptr;
|
|||
|
}
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::refreshLable()
|
|||
|
{
|
|||
|
ui->labelWifiConfiguration->setText(tr(""));
|
|||
|
ui->radioButtonDhcp->setText(tr("DHCP"));
|
|||
|
ui->radioButtonSpecifyIp->setText(tr("Specify IP"));
|
|||
|
ui->labelApName->setText(tr("AP name"));
|
|||
|
ui->labelGateway->setText(tr("Gateway"));
|
|||
|
ui->labelWifiName->setText(tr("WiFi name"));
|
|||
|
ui->labelIpAddress->setText(tr("IP Address"));
|
|||
|
ui->labelApPassword->setText(tr("Password"));
|
|||
|
ui->labelDnsAddress->setText(tr("DNS Address"));
|
|||
|
ui->labelMaskAddress->setText(tr("Subnet mask"));
|
|||
|
ui->labelWifiPassword->setText(tr("Password"));
|
|||
|
ui->pushButtonScan->setText(tr("Scan"));
|
|||
|
ui->pushButtonApSet->setText(tr("Set"));
|
|||
|
ui->pushButtonWiFiModel->setText(tr("Set"));
|
|||
|
ui->pushButtonSetWireNetwork->setText(tr("Set"));
|
|||
|
ui->pushButtonReadbackWiFiModel->setText(tr("Readback"));
|
|||
|
ui->pushButtonReadbackWireNetwork->setText(tr("Readback"));
|
|||
|
ui->groupBox_3->setTitle(tr("WiFi On/Off"));
|
|||
|
ui->groupBox_4->setTitle(tr("Ap Mode"));
|
|||
|
ui->label_5->setText(tr("WIFI Configuration"));
|
|||
|
ui->lineEditApPassword->setPlaceholderText(tr("Input password"));
|
|||
|
ui->lineEditWifiPassword->setPlaceholderText(tr("Input password"));
|
|||
|
ui->lineEditHotspotName->setPlaceholderText(tr("Input ap name"));
|
|||
|
ui->label->setText(tr("4G/5G Configuration"));
|
|||
|
ui->label_8->setText(tr("Check SIM can automatically match to MCC, and then select carrier get apn param,if not found carrier,you can check the CUSTOM checkbox,then enter custom param."));
|
|||
|
ui->checkBox4g->setText(tr("Open 4G/5G"));
|
|||
|
|
|||
|
|
|||
|
ui->groupBox_5->setTitle(tr("Set Apn Info,Check SIM can automatically match to MCC, and then select carrier get apn param"));
|
|||
|
ui->checkBoxCustom->setText(tr("CUSTOM"));
|
|||
|
ui->pushButtonGetMcc->setText(tr("Check SIM"));
|
|||
|
ui->label_2->setText(tr("Country ID(mcc):"));
|
|||
|
ui->label_3->setText(tr("Carrier Name"));
|
|||
|
ui->label_4->setText(tr("APN:"));
|
|||
|
ui->label_6->setText(tr("User:"));
|
|||
|
ui->label_7->setText(tr("Password:"));
|
|||
|
ui->pushButtonSet4GInfo->setText(tr("Set"));
|
|||
|
ui->lineEditAPN->setPlaceholderText(tr("APN(Required)"));
|
|||
|
ui->lineEditUser->setPlaceholderText(tr("Not required"));
|
|||
|
ui->lineEditPassword->setPlaceholderText(tr("Not required"));
|
|||
|
ui->pushButtonReadback4G->setText(tr("Readback APN Info"));
|
|||
|
ui->pushButtonReadbackFlightModel->setText(tr("Readback"));
|
|||
|
ui->label_10->setText(tr("Flight Mode"));
|
|||
|
}
|
|||
|
|
|||
|
void ControlNetConfigWidget::OnDhcpOrSpecifyIp(int iIndex)
|
|||
|
{
|
|||
|
if(iIndex==0)
|
|||
|
{
|
|||
|
ui->groupBox->setEnabled(false);
|
|||
|
ui->lineEditDns->setStyleSheet("QLineEdit{background:rgba(216,216,216,1);}");
|
|||
|
ui->lineEditWireIP->setStyleSheet("QLineEdit{background:rgba(216,216,216,1);}");
|
|||
|
ui->lineEditWireMask->setStyleSheet("QLineEdit{background:rgba(216,216,216,1);}");
|
|||
|
ui->lineEditWireGateway->setStyleSheet("QLineEdit{background:rgba(216,216,216,1);}");
|
|||
|
ui->lineEditDns->MySetColor(QColor::fromRgb(216,216,216));
|
|||
|
ui->lineEditWireIP->MySetColor(QColor::fromRgb(216,216,216));
|
|||
|
ui->lineEditWireMask->MySetColor(QColor::fromRgb(216,216,216));
|
|||
|
ui->lineEditWireGateway->MySetColor(QColor::fromRgb(216,216,216));
|
|||
|
}
|
|||
|
else {
|
|||
|
ui->groupBox->setEnabled(true);
|
|||
|
ui->lineEditDns->setStyleSheet("QLineEdit{background:rgba(255,255,255,1);}");
|
|||
|
ui->lineEditWireIP->setStyleSheet("QLineEdit{background:rgba(255,255,255,1);}" );
|
|||
|
ui->lineEditWireMask->setStyleSheet("QLineEdit{background:rgba(255,255,255,1);}" );
|
|||
|
ui->lineEditWireGateway->setStyleSheet("QLineEdit{background:rgba(255,255,255,1);}");
|
|||
|
ui->lineEditDns->MySetColor(QColor::fromRgb(255,255,255));
|
|||
|
ui->lineEditWireIP->MySetColor(QColor::fromRgb(255,255,255));
|
|||
|
ui->lineEditWireMask->MySetColor(QColor::fromRgb(255,255,255));
|
|||
|
ui->lineEditWireGateway->MySetColor(QColor::fromRgb(255,255,255));
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::onSelectedDeviceList(QList<LedCard*> *list)
|
|||
|
{
|
|||
|
m_pLedlist=list;
|
|||
|
if(m_pLedlist==nullptr)
|
|||
|
return;
|
|||
|
if(m_pLedlist->count()==1)
|
|||
|
{
|
|||
|
ui->pushButtonSetWireNetwork->setEnabled(true);
|
|||
|
if(ui->groupBox_3->isChecked())
|
|||
|
ui->pushButtonScan->setEnabled(true);
|
|||
|
}
|
|||
|
else {
|
|||
|
ui->pushButtonSetWireNetwork->setEnabled(false);
|
|||
|
if(ui->groupBox_3->isChecked())
|
|||
|
ui->pushButtonScan->setEnabled(false);
|
|||
|
}
|
|||
|
//MACRO_DEFINE_CONTROL_FUNC3
|
|||
|
if(m_pLedlist->count()==1)
|
|||
|
{
|
|||
|
m_pLedCard=list->at(0);
|
|||
|
m_strUrl="http://"+m_pLedCard->m_strCardIp+":2016/settings";
|
|||
|
if(m_oldLedlist!=m_pLedCard&&m_bSelected==true)
|
|||
|
{
|
|||
|
m_oldLedlist=m_pLedCard;
|
|||
|
onReadbackAllThisPage();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::onReadbackAllThisPage()
|
|||
|
{
|
|||
|
if(m_pLedlist==nullptr)
|
|||
|
return;
|
|||
|
if(m_pLedlist->count()!=1)
|
|||
|
return;
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "GetEthernet");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json);
|
|||
|
ui->lineEditWireIP->MyClear();
|
|||
|
ui->lineEditWireMask->MyClear();
|
|||
|
ui->lineEditWireGateway->MyClear();
|
|||
|
ui->lineEditDns->MyClear();
|
|||
|
QJsonObject json1;
|
|||
|
json1.insert("_id", getRandomString(10));
|
|||
|
json1.insert("_type", "GetWifiList");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json1);
|
|||
|
ui->comboBox->clear();
|
|||
|
QJsonObject json55;
|
|||
|
json55.insert("_id", getRandomString(10));
|
|||
|
json55.insert("_type", "GetSwitchSimData");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json55);
|
|||
|
QJsonObject json2;
|
|||
|
json2.insert("_id", getRandomString(10));
|
|||
|
json2.insert("_type", "IsPortableHotSpot");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json2);
|
|||
|
QJsonObject json66;
|
|||
|
json66.insert("_id", getRandomString(10));
|
|||
|
json66.insert("_type", "GetSwitchWiFi");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json66);
|
|||
|
QJsonObject json3;
|
|||
|
json3.insert("_id", getRandomString(10));
|
|||
|
json3.insert("_type", "GetAPNList");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json3);
|
|||
|
|
|||
|
QJsonObject json4;
|
|||
|
json4.insert("_id", getRandomString(10));
|
|||
|
json4.insert("_type", "GetCurrentAPN");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json4);
|
|||
|
|
|||
|
QJsonObject json5;
|
|||
|
json5.insert("_id", getRandomString(10));
|
|||
|
json5.insert("_type", "GetTimezone");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json5);
|
|||
|
|
|||
|
QJsonObject json6;
|
|||
|
json6.insert("_id", getRandomString(10));
|
|||
|
json6.insert("_type", "GetFlightModeState");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json6);
|
|||
|
|
|||
|
MACRO_DEFINE_TIPDLG_ALL_FUCN(tr("Readback"),tr("Success"),tr("failed"))
|
|||
|
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::onSetWireNetwork()
|
|||
|
{
|
|||
|
if(m_pLedlist==nullptr)
|
|||
|
return;
|
|||
|
if(m_pLedlist->count()<=0)
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("NoSelectedController"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
return;
|
|||
|
}
|
|||
|
if(m_buttonGroup->checkedId()==0)
|
|||
|
{
|
|||
|
QString strTempIp=ui->lineEditWireIP->text();
|
|||
|
QString strTempMask=ui->lineEditWireMask->text();
|
|||
|
QString strTempGateway=ui->lineEditWireGateway->text();
|
|||
|
QString strTempDns=ui->lineEditDns->text();
|
|||
|
if(strTempIp=="...")
|
|||
|
strTempIp="0.255.255.255";
|
|||
|
if(strTempMask=="...")
|
|||
|
strTempMask="0.255.255.255";
|
|||
|
if(strTempGateway=="...")
|
|||
|
strTempGateway="0.255.255.255";
|
|||
|
if(strTempDns=="...")
|
|||
|
strTempDns="0.255.255.255";
|
|||
|
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetEthernet");
|
|||
|
json.insert("dhcp", true);
|
|||
|
json.insert("ip", strTempIp);
|
|||
|
json.insert("gateWay", strTempMask);
|
|||
|
json.insert("netMask", strTempGateway);
|
|||
|
json.insert("dns", strTempDns);
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetEthernet"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
else {
|
|||
|
QString strTempIp=ui->lineEditWireIP->text();
|
|||
|
if(strTempIp=="...")
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Attention"), tr("Please input IP address!"), this,1);
|
|||
|
dlg->exec();
|
|||
|
ui->lineEditWireIP->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (!isTextValid(strTempIp))
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Attention"), tr("Your IP Address is Invalid!")+"["+strTempIp+"]", this,1);
|
|||
|
dlg->exec();
|
|||
|
ui->lineEditWireIP->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
QString strTempMask=ui->lineEditWireMask->text();
|
|||
|
if(strTempMask=="...")
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Attention"), tr("Please input Mask address!"), this,1);
|
|||
|
dlg->exec();
|
|||
|
ui->lineEditWireMask->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (!isTextValid(strTempMask))
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Attention"), tr("Your Mask Address is Invalid!"), this,1);
|
|||
|
dlg->exec();
|
|||
|
ui->lineEditWireMask->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
QString strTempGateway=ui->lineEditWireGateway->text();
|
|||
|
if(strTempGateway=="...")
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Attention"), tr("Please input Gateway address!"), this,1);
|
|||
|
dlg->exec();
|
|||
|
ui->lineEditWireGateway->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (!isTextValid(strTempGateway))
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Attention"), tr("Your Gateway Address is Invalid!"), this,1);
|
|||
|
dlg->exec();
|
|||
|
ui->lineEditWireGateway->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
QString strTempDns=ui->lineEditDns->text();
|
|||
|
if(strTempDns=="...")
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Attention"), tr("Please input DNS address!"), this,1);
|
|||
|
dlg->exec();
|
|||
|
ui->lineEditDns->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (!isTextValid(strTempDns))
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Attention"), tr("Your DNS Address is Invalid!"), this,1);
|
|||
|
dlg->exec();
|
|||
|
ui->lineEditDns->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetEthernet");
|
|||
|
json.insert("dhcp", false);
|
|||
|
json.insert("ip", strTempIp);
|
|||
|
json.insert("gateWay", strTempMask);
|
|||
|
json.insert("netMask", strTempGateway);
|
|||
|
json.insert("dns", strTempDns);
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetEthernet"),tr("Success"),tr("failed"))
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ControlNetConfigWidget::onReadbackWireNetwork()
|
|||
|
{
|
|||
|
if(m_pLedlist==nullptr)
|
|||
|
return;
|
|||
|
if(m_pLedlist->count()<=1)
|
|||
|
{
|
|||
|
if(m_pLedCard==nullptr||m_pLedlist->count()==0)
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("NoSelectedController"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "GetEthernet");
|
|||
|
ui->lineEditWireIP->MyClear();
|
|||
|
ui->lineEditWireMask->MyClear();
|
|||
|
ui->lineEditWireGateway->MyClear();
|
|||
|
ui->lineEditDns->MyClear();
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("GetEthernet"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
|
|||
|
void ControlNetConfigWidget::OnWiFiOpenChanged(bool b)
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetSwitchWiFi");
|
|||
|
json.insert("enable", b);
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetSwitchWiFi"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::onSetWiFiModel()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
|
|||
|
if(ui->groupBox_3->isChecked())
|
|||
|
{
|
|||
|
ui->comboBox->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
ui->lineEditWifiPassword->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
|
|||
|
}
|
|||
|
else {
|
|||
|
ui->comboBox->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
ui->lineEditWifiPassword->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
if(m_pLedlist->count()==1)
|
|||
|
{
|
|||
|
if(ui->groupBox_3->isChecked())
|
|||
|
{
|
|||
|
ui->comboBox->setStyleSheet("background:rgba(255,255,255,1);");
|
|||
|
ui->lineEditWifiPassword->setStyleSheet("background:rgba(255,255,255,1);");
|
|||
|
QJsonObject json1;
|
|||
|
json1.insert("_id", getRandomString(10));
|
|||
|
json1.insert("_type", "SetSwitchWiFi");
|
|||
|
json1.insert("enable", true);
|
|||
|
HttpPostByTypeJsonObject(pHpptClient,m_strUrl,json1);
|
|||
|
// MACRO_DEFINE_TIPDLG_FUCN(tr("SetSwitchWiFi"),tr("Success"),tr("failed"))
|
|||
|
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "ConfigurationWiFi");
|
|||
|
QString strSsid=ui->comboBox->currentText();
|
|||
|
if(strSsid.contains(tr("SignalPower")))
|
|||
|
{
|
|||
|
int itempOffset=strSsid.indexOf(tr("SignalPower"));
|
|||
|
strSsid=strSsid.left(itempOffset-4);
|
|||
|
}
|
|||
|
qDebug()<<"strSsid="<<strSsid;
|
|||
|
json.insert("ssid", strSsid);
|
|||
|
json.insert("password", ui->lineEditWifiPassword->text());
|
|||
|
HttpPostByTypeJsonObject(pHpptClient,m_strUrl,json);
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("ConfigurationWiFi"),tr("Success"),tr("failed"))
|
|||
|
|
|||
|
}
|
|||
|
// else {
|
|||
|
// QJsonObject json;
|
|||
|
// json.insert("_id", getRandomString(10));
|
|||
|
// json.insert("_type", "SetSwitchWiFi");
|
|||
|
// json.insert("enable", false);
|
|||
|
// MACRO_DEFINE_TIPDLG_FUCN(tr("SetSwitchWiFi"),tr("Success"),tr("failed"))
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
}
|
|||
|
else {
|
|||
|
if(ui->groupBox_3->isChecked())
|
|||
|
{
|
|||
|
// QJsonObject jsonOpenWifi;
|
|||
|
// jsonOpenWifi.insert("_id", getRandomString(10));
|
|||
|
// jsonOpenWifi.insert("_type", "SetSwitchWiFi");
|
|||
|
// jsonOpenWifi.insert("enable", true);
|
|||
|
// emit sigSend(jsonOpenWifi,tr("SetSwitchWiFi"));
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "ConfigurationWiFi");
|
|||
|
QString strSsid=ui->comboBox->currentText();
|
|||
|
if(strSsid.contains(tr("SignalPower")))
|
|||
|
{
|
|||
|
int itempOffset=strSsid.indexOf(tr("SignalPower"));
|
|||
|
strSsid=strSsid.left(itempOffset-4);
|
|||
|
}
|
|||
|
qDebug()<<"strSsid="<<strSsid;
|
|||
|
|
|||
|
json.insert("ssid", strSsid);
|
|||
|
json.insert("password", ui->lineEditWifiPassword->text());
|
|||
|
emit sigSend(json,tr("ConfigurationWiFi"));
|
|||
|
|
|||
|
}
|
|||
|
// else
|
|||
|
// {
|
|||
|
// QJsonObject jsonOpenWifi;
|
|||
|
// jsonOpenWifi.insert("_id", getRandomString(10));
|
|||
|
// jsonOpenWifi.insert("_type", "SetSwitchWiFi");
|
|||
|
// jsonOpenWifi.insert("enable", false);
|
|||
|
// emit sigSend(jsonOpenWifi,tr("SetSwitchWiFi"));
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ControlNetConfigWidget:: onReadbackWiFiModel()
|
|||
|
{
|
|||
|
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json66;
|
|||
|
json66.insert("_id", getRandomString(10));
|
|||
|
json66.insert("_type", "GetSwitchWiFi");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json66);
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "IsPortableHotSpot");
|
|||
|
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("IsPortableHotSpot"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlNetConfigWidget:: OnScanWifi()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "GetWifiList");
|
|||
|
ui->comboBox->clear();
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("GetWifiList"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlNetConfigWidget:: onSetAp()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
if(ui->groupBox_4->isChecked())
|
|||
|
{
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "ConfigurationHotSpot");
|
|||
|
json.insert("apName", ui->lineEditHotspotName->text());
|
|||
|
json.insert("password", ui->lineEditApPassword->text());
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("ConfigurationHotSpot"),tr("Success"),tr("failed"))
|
|||
|
|
|||
|
}
|
|||
|
// else
|
|||
|
// {
|
|||
|
// QJsonObject json;
|
|||
|
// json.insert("_id", getRandomString(10));
|
|||
|
// json.insert("_type", "SetSwitchWiFi");
|
|||
|
// json.insert("enable", true);
|
|||
|
// MACRO_DEFINE_TIPDLG_FUCN(tr("SetSwitchWiFi"),tr("Success"),tr("failed"))
|
|||
|
// }
|
|||
|
}
|
|||
|
|
|||
|
void ControlNetConfigWidget::onReadback4G()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
ui->lineEditApnInfo->setText("");
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "GetCurrentAPN");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("GetCurrentAPN"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::onGetMcc()
|
|||
|
{
|
|||
|
m_buttonFlagClick=1;
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "GetSIMStatus");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("GetSIMStatus"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::onGet4GStatus()
|
|||
|
{
|
|||
|
m_buttonFlagClick=0;
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "GetSIMStatus");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("GetSIMStatus"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::onSet4GInfo()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
|
|||
|
QJsonObject json;
|
|||
|
if(ui->checkBoxCustom->isChecked())
|
|||
|
{
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetAPN");
|
|||
|
json.insert("carrier", ui->comboBoxCarrierName->currentText());
|
|||
|
json.insert("apn",ui->lineEditAPN->text());
|
|||
|
json.insert("user", ui->lineEditUser->text());
|
|||
|
json.insert("password", ui->lineEditPassword->text());
|
|||
|
json.insert("type","");
|
|||
|
json.insert("server", "");
|
|||
|
json.insert("proxy", "");
|
|||
|
json.insert("port","");
|
|||
|
json.insert("mmsc","");
|
|||
|
json.insert("mmsproxy","");
|
|||
|
json.insert("mmsport","");
|
|||
|
}
|
|||
|
else {
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetAPN");
|
|||
|
json.insert("carrier", m_4gObj["carrier"].toString());
|
|||
|
json.insert("apn",ui->lineEditAPN->text());
|
|||
|
json.insert("user", ui->lineEditUser->text());
|
|||
|
json.insert("password", ui->lineEditPassword->text());
|
|||
|
json.insert("type", m_4gObj["type"].toString());
|
|||
|
json.insert("server", m_4gObj["server"].toString());
|
|||
|
json.insert("proxy", m_4gObj["proxy"].toString());
|
|||
|
json.insert("port", m_4gObj["port"].toString());
|
|||
|
json.insert("mmsc", m_4gObj["mmsc"].toString());
|
|||
|
json.insert("mmsproxy", m_4gObj["mmsproxy"].toString());
|
|||
|
json.insert("mmsport", m_4gObj["mmsport"].toString());
|
|||
|
}
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetAPN"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
//获取到httpPost的应答,如果参数变化需要出发修改控件item的内容
|
|||
|
void ControlNetConfigWidget::OnProHttpResponse(QString url, QString postMD5, QByteArray data)
|
|||
|
{
|
|||
|
Q_UNUSED(postMD5)
|
|||
|
//qDebug()<< url + "\r\n"+m_strUrl;
|
|||
|
if(url == m_strUrl)
|
|||
|
{
|
|||
|
QJsonParseError parseJsonErr;
|
|||
|
QJsonDocument document = QJsonDocument::fromJson(data,&parseJsonErr);
|
|||
|
if(!(parseJsonErr.error == QJsonParseError::NoError))
|
|||
|
{
|
|||
|
if(data.size()==0)
|
|||
|
qDebug()<<"json is empty";
|
|||
|
else
|
|||
|
qDebug()<<tr("wDevicesItem OnProHttpResponse 解析json文件错误!");
|
|||
|
return;
|
|||
|
}
|
|||
|
QJsonObject jsonObject = document.object();
|
|||
|
QString strType=jsonObject["_type"].toString();
|
|||
|
if(jsonObject["success"].toBool()==true)
|
|||
|
{
|
|||
|
//qDebug()<<m_pLedCard->m_strCardId +"---------"+ strType;
|
|||
|
if(strType == "GetEthernet")
|
|||
|
{
|
|||
|
if(jsonObject["dhcp"].toBool())
|
|||
|
{
|
|||
|
ui->radioButtonDhcp->setChecked(true);
|
|||
|
emit sigGetDhcpOrSpecifyIp(0);
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
ui->radioButtonSpecifyIp->setChecked(true);
|
|||
|
emit sigGetDhcpOrSpecifyIp(1);
|
|||
|
|
|||
|
}
|
|||
|
if(jsonObject["ipAddr"].toString()!="")
|
|||
|
ui->lineEditWireIP->setText(jsonObject["ipAddr"].toString());
|
|||
|
if(jsonObject["gateWay"].toString()!="")
|
|||
|
ui->lineEditWireMask->setText(jsonObject["gateWay"].toString());
|
|||
|
if(jsonObject["netMask"].toString()!="")
|
|||
|
ui->lineEditWireGateway->setText(jsonObject["netMask"].toString());
|
|||
|
if(jsonObject["dnsAddr"].toString()!="")
|
|||
|
ui->lineEditDns->setText(jsonObject["dnsAddr"].toString());
|
|||
|
}
|
|||
|
else if(strType == "SetEthernet"||strType == "ConfigurationWiFi"||strType == "ConfigurationHotSpot")
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "SetSwitchWiFi")
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "GetSwitchWiFi")
|
|||
|
{
|
|||
|
ui->groupBox_3->setChecked(jsonObject["enable"].toBool());
|
|||
|
}
|
|||
|
else if(strType == "GetWifiList")
|
|||
|
{
|
|||
|
//QVariant iTemp=jsonObject["wifiList"].toVariant();
|
|||
|
QJsonValue value = jsonObject.take("wifiList");
|
|||
|
QJsonArray array= value.toArray();
|
|||
|
int iSize=array.size();
|
|||
|
QList<wifiInfo> wifInfoiList;
|
|||
|
for(int i=0;i<iSize;i++)
|
|||
|
{
|
|||
|
QJsonObject obj=array.at(i).toObject();
|
|||
|
wifiInfo tempwifiInfo;
|
|||
|
tempwifiInfo.encryptionMethod=obj["encryptionMethod"].toString();
|
|||
|
tempwifiInfo.signal=obj["signal"].toInt();
|
|||
|
tempwifiInfo.ssid=obj["ssid"].toString();
|
|||
|
wifInfoiList.append(tempwifiInfo);
|
|||
|
}
|
|||
|
// qSort(wifInfoiList.begin(),wifInfoiList.end(),[](const wifiInfo &infoA,const wifiInfo &infoB){
|
|||
|
// return infoA.signal > infoB.signal;});
|
|||
|
for(int j=0;j<iSize;j++)
|
|||
|
{
|
|||
|
|
|||
|
//QString strSignalPower=QString("%1").arg(wifInfoiList.at(j).signal, 4, 10, QChar('0'));
|
|||
|
QString strSignalPower=QString::number(wifInfoiList.at(j).signal);
|
|||
|
ui->comboBox->addItem(wifInfoiList.at(j).ssid+"...["+tr("SignalPower")+":"+strSignalPower+"]");
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
else if(strType == "IsPortableHotSpot")
|
|||
|
{
|
|||
|
QString iTemp=jsonObject["wifi"].toString();
|
|||
|
// if(iTemp.isEmpty())
|
|||
|
// ui->groupBox_3->setChecked(false);
|
|||
|
// else
|
|||
|
// {
|
|||
|
// ui->groupBox_3->setChecked(true);
|
|||
|
// }
|
|||
|
QString strKong="";
|
|||
|
ui->comboBox->setCurrentText(iTemp+strKong);
|
|||
|
QString iTempHotSpot=jsonObject["hotSpots"].toString();
|
|||
|
if(iTempHotSpot.isEmpty())
|
|||
|
ui->groupBox_4->setChecked(false);
|
|||
|
else
|
|||
|
ui->groupBox_4->setChecked(true);
|
|||
|
ui->lineEditHotspotName->setText(iTempHotSpot);
|
|||
|
}
|
|||
|
else if(strType == "SetAPN")
|
|||
|
{
|
|||
|
onReadback4G();
|
|||
|
}
|
|||
|
else if(strType == "GetSIMStatus")
|
|||
|
{
|
|||
|
QString str4GStatus="";
|
|||
|
if(m_buttonFlagClick==0)
|
|||
|
{
|
|||
|
str4GStatus=tr("状态:");
|
|||
|
switch(jsonObject["state"].toInt())
|
|||
|
{
|
|||
|
case 0:
|
|||
|
str4GStatus+=tr("未知");
|
|||
|
break;
|
|||
|
case 1:
|
|||
|
str4GStatus+=tr("未知");
|
|||
|
break;
|
|||
|
case 2:
|
|||
|
str4GStatus+=tr("锁定状态,需要用户的PIN码解锁");
|
|||
|
break;
|
|||
|
case 3:
|
|||
|
str4GStatus+=tr("锁定状态,需要用户的PUK码解锁");
|
|||
|
break;
|
|||
|
case 4:
|
|||
|
str4GStatus+=tr("锁定状态,需要网络的PIN码解锁");
|
|||
|
break;
|
|||
|
case 5:
|
|||
|
str4GStatus+=tr("就绪");
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
QString strImsi=jsonObject["imsi"].toString();
|
|||
|
if(strImsi.isEmpty())
|
|||
|
{
|
|||
|
str4GStatus+="\r\n"+tr("no checked sim card");
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),str4GStatus,this,1);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
else {
|
|||
|
str4GStatus+="\r\nIMSI:";
|
|||
|
str4GStatus+=strImsi+"\r\n";
|
|||
|
m_mcc=strImsi.left(3);
|
|||
|
//ui->comboBoxCountryID->setCurrentText(m_mcc);
|
|||
|
ui->comboBoxCountryID->setCurrentText("");
|
|||
|
ui->comboBoxCarrierName->setCurrentText("");
|
|||
|
ui->lineEditAPN->setText("");
|
|||
|
ui->lineEditUser->setText("");
|
|||
|
ui->lineEditPassword->setText("");
|
|||
|
|
|||
|
//SetMcc(m_mcc);
|
|||
|
str4GStatus+=tr("国家码:");
|
|||
|
str4GStatus+=jsonObject["countryCode"].toString()+"\r\n";
|
|||
|
str4GStatus+=tr("号码:");
|
|||
|
str4GStatus+=jsonObject["phoneNumber"].toString()+"\r\n";
|
|||
|
if(m_buttonFlagClick==0)
|
|||
|
{
|
|||
|
str4GStatus+=tr("用户:");
|
|||
|
str4GStatus+=jsonObject["user"].toString()+"\r\n";
|
|||
|
str4GStatus+=tr("信号:");
|
|||
|
switch(jsonObject["serviceState"].toInt())
|
|||
|
{
|
|||
|
case 0: str4GStatus+=tr("信号正常")+"\r\n"; break;
|
|||
|
case 1: str4GStatus+=tr("不在服务区")+"\r\n"; break;
|
|||
|
case 2: str4GStatus+=tr("仅限紧急呼叫")+"\r\n"; break;
|
|||
|
case 3: str4GStatus+=tr("射频已经关闭")+"\r\n"; break;
|
|||
|
}
|
|||
|
str4GStatus+=tr("网络:");
|
|||
|
switch(jsonObject["networkType"].toInt())
|
|||
|
{
|
|||
|
case 0: str4GStatus+=tr("网络类型未知")+"\r\n"; break;
|
|||
|
case 1: str4GStatus+=tr("GPRS网络")+"\r\n"; break;
|
|||
|
case 2: str4GStatus+=tr("EDGE网络")+"\r\n"; break;
|
|||
|
case 3: str4GStatus+=tr("UMTS网络")+"\r\n"; break;
|
|||
|
case 4: str4GStatus+=tr("CDMA网络,IS95A 或 IS95B.")+"\r\n"; break;
|
|||
|
case 5: str4GStatus+=tr("EVDO网络, revision 0.")+"\r\n"; break;
|
|||
|
case 6: str4GStatus+=tr("EVDO网络, revision A.")+"\r\n"; break;
|
|||
|
case 7: str4GStatus+=tr("1xRTT网络")+"\r\n"; break;
|
|||
|
case 8: str4GStatus+=tr("HSDPA网络")+"\r\n"; break;
|
|||
|
case 9: str4GStatus+=tr("HSUPA网络")+"\r\n"; break;
|
|||
|
case 10: str4GStatus+=tr("HSPA网络")+"\r\n"; break;
|
|||
|
}
|
|||
|
str4GStatus+=tr("漫游:");
|
|||
|
|
|||
|
// 是否为漫游
|
|||
|
if(jsonObject["roaming"].toBool())
|
|||
|
{
|
|||
|
str4GStatus+=tr("Yes")+"\r\n";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
str4GStatus+=tr("No")+"\r\n";
|
|||
|
}
|
|||
|
str4GStatus+=tr("数据连接状态:");
|
|||
|
switch(jsonObject["dataState"].toInt())
|
|||
|
{
|
|||
|
case 0: str4GStatus+=tr("断开")+"\r\n"; break;
|
|||
|
case 1: str4GStatus+=tr("正在连接")+"\r\n"; break;
|
|||
|
case 2: str4GStatus+=tr("已连接")+"\r\n"; break;
|
|||
|
case 3: str4GStatus+=tr("暂停")+"\r\n"; break;
|
|||
|
}
|
|||
|
str4GStatus+=tr("数据活动休眠状态:");
|
|||
|
switch(jsonObject["dataActivity"].toInt())
|
|||
|
{
|
|||
|
case 0: str4GStatus+=tr("活动,但无数据发送和接收")+"\r\n"; break;
|
|||
|
case 1: str4GStatus+=tr("活动,正在接收数据")+"\r\n"; break;
|
|||
|
case 2: str4GStatus+=tr("活动,正在发送数据")+"\r\n"; break;
|
|||
|
case 3: str4GStatus+=tr("活动,正在接收和发送数据")+"\r\n"; break;
|
|||
|
case 4: str4GStatus+=tr("休眠状态")+"\r\n"; break;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
str4GStatus+=tr("信号强度:");
|
|||
|
QString strSignalStrength=QString::number(jsonObject["signalStrength"].toInt());
|
|||
|
str4GStatus+=strSignalStrength+"\r\n";
|
|||
|
|
|||
|
}
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),str4GStatus,this,1);
|
|||
|
pDlg->exec();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "GetCurrentAPN"){
|
|||
|
// ui->lineEditAPN->setText(jsonObject["apn"].toString());
|
|||
|
// ui->lineEditUser->setText(jsonObject["user"].toString());
|
|||
|
// ui->lineEditPassword->setText(jsonObject["password"].toString());
|
|||
|
if(jsonObject["user"].toString().isEmpty())
|
|||
|
ui->lineEditApnInfo->setText(jsonObject["apn"].toString());
|
|||
|
else
|
|||
|
ui->lineEditApnInfo->setText(jsonObject["apn"].toString()+",USER:"+jsonObject["user"].toString()+",PASSWORD:"+jsonObject["password"].toString());
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "SetSwitchSimData"){
|
|||
|
|
|||
|
}
|
|||
|
else if(strType=="ContrFlightMode")
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
else if(strType=="GetFlightModeState")
|
|||
|
{
|
|||
|
//ui->widgetFightModel->setChecked(jsonObject["result"].toBool());
|
|||
|
ui->widgetFightModel->setCheckedStatus(jsonObject["result"].toBool());
|
|||
|
ui->widgetFightModel->update();
|
|||
|
}
|
|||
|
else if(strType == "GetTimezone"){
|
|||
|
QString strtemp=jsonObject["timezone"].toString();
|
|||
|
// strtemp=strtemp.right(strtemp.length()-strtemp.indexOf("/")-1);
|
|||
|
//ui->comboBox_Timezone->setCurrentText(strtemp);
|
|||
|
}
|
|||
|
else if(strType == "SetTimezone"){
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
if(strType!="SetSwitchWiFi")
|
|||
|
{
|
|||
|
if(iEnableFlag==true)
|
|||
|
{
|
|||
|
iEnableFlag=false;
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ControlNetConfigWidget::OnProHttpResponseAll(QString url, QString postMD5, QByteArray data)
|
|||
|
{
|
|||
|
Q_UNUSED(postMD5)
|
|||
|
//qDebug()<< url + "\r\n"+m_strUrl;
|
|||
|
if(url == m_strUrl)
|
|||
|
{
|
|||
|
QJsonParseError parseJsonErr;
|
|||
|
QJsonDocument document = QJsonDocument::fromJson(data,&parseJsonErr);
|
|||
|
if(!(parseJsonErr.error == QJsonParseError::NoError))
|
|||
|
{
|
|||
|
if(data.size()==0)
|
|||
|
qDebug()<<"json is empty";
|
|||
|
else
|
|||
|
qDebug()<<tr("wDevicesItem OnProHttpResponse 解析json文件错误!");
|
|||
|
return;
|
|||
|
}
|
|||
|
QJsonObject jsonObject = document.object();
|
|||
|
QString strType=jsonObject["_type"].toString();
|
|||
|
if(jsonObject["success"].toBool()==true)
|
|||
|
{
|
|||
|
qDebug()<<m_pLedCard->m_strCardId +"---------"+ strType;
|
|||
|
if(strType == "GetEthernet")
|
|||
|
{
|
|||
|
if(jsonObject["dhcp"].toBool())
|
|||
|
{
|
|||
|
ui->radioButtonDhcp->setChecked(true);
|
|||
|
emit sigGetDhcpOrSpecifyIp(0);
|
|||
|
}
|
|||
|
else {
|
|||
|
ui->radioButtonSpecifyIp->setChecked(true);
|
|||
|
emit sigGetDhcpOrSpecifyIp(1);
|
|||
|
|
|||
|
}
|
|||
|
if(jsonObject["ipAddr"].toString()!="")
|
|||
|
ui->lineEditWireIP->setText(jsonObject["ipAddr"].toString());
|
|||
|
if(jsonObject["gateWay"].toString()!="")
|
|||
|
ui->lineEditWireMask->setText(jsonObject["gateWay"].toString());
|
|||
|
if(jsonObject["netMask"].toString()!="")
|
|||
|
ui->lineEditWireGateway->setText(jsonObject["netMask"].toString());
|
|||
|
if(jsonObject["dnsAddr"].toString()!="")
|
|||
|
ui->lineEditDns->setText(jsonObject["dnsAddr"].toString());
|
|||
|
}
|
|||
|
else if(strType == "GetSwitchWiFi")
|
|||
|
{
|
|||
|
ui->groupBox_3->setChecked(jsonObject["enable"].toBool());
|
|||
|
}
|
|||
|
else if(strType == "GetWifiList")
|
|||
|
{
|
|||
|
//QVariant iTemp=jsonObject["wifiList"].toVariant();
|
|||
|
QJsonValue value = jsonObject.take("wifiList");
|
|||
|
QJsonArray array= value.toArray();
|
|||
|
int iSize=array.size();
|
|||
|
QList<wifiInfo> wifInfoiList;
|
|||
|
for(int i=0;i<iSize;i++)
|
|||
|
{
|
|||
|
QJsonObject obj=array.at(i).toObject();
|
|||
|
wifiInfo tempwifiInfo;
|
|||
|
tempwifiInfo.encryptionMethod=obj["encryptionMethod"].toString();
|
|||
|
tempwifiInfo.signal=obj["signal"].toInt();
|
|||
|
tempwifiInfo.ssid=obj["ssid"].toString();
|
|||
|
wifInfoiList.append(tempwifiInfo);
|
|||
|
}
|
|||
|
for(int j=0;j<iSize;j++)
|
|||
|
{
|
|||
|
QString strSignalPower=QString::number(wifInfoiList.at(j).signal);
|
|||
|
ui->comboBox->addItem(wifInfoiList.at(j).ssid+"...["+tr("SignalPower")+":"+strSignalPower+"]");
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "IsPortableHotSpot")
|
|||
|
{
|
|||
|
QString iTemp=jsonObject["wifi"].toString();
|
|||
|
QString strKong="";
|
|||
|
ui->comboBox->setCurrentText(iTemp+strKong);
|
|||
|
QString iTempHotSpot=jsonObject["hotSpots"].toString();
|
|||
|
if(iTempHotSpot.isEmpty())
|
|||
|
ui->groupBox_4->setChecked(false);
|
|||
|
else
|
|||
|
ui->groupBox_4->setChecked(true);
|
|||
|
ui->lineEditHotspotName->setText(iTempHotSpot);
|
|||
|
if(iEnableFlag==true)
|
|||
|
{
|
|||
|
iEnableFlag=false;
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
}
|
|||
|
}
|
|||
|
else if(strType == "GetAPNList")
|
|||
|
{
|
|||
|
qDebug()<<"GetAPNList";
|
|||
|
if(m_ApnInfoiList.count()<=0)
|
|||
|
{
|
|||
|
// if(m_ApnInfoiList.count()>0)
|
|||
|
// m_ApnInfoiList.clear();
|
|||
|
// if(ui->comboBoxCountryID->count()>0)
|
|||
|
// ui->comboBoxCountryID->clear();
|
|||
|
// if(ui->comboBoxCarrierName->count()>0)
|
|||
|
// ui->comboBoxCarrierName->clear();
|
|||
|
foreach(QJsonValue value, jsonObject["apns"].toArray()) {
|
|||
|
QJsonObject oApn = value.toObject();
|
|||
|
QString strtempmcc=oApn["mcc"].toString();
|
|||
|
bool itempHave=false;
|
|||
|
for (int i=0;i<ui->comboBoxCountryID->count();i++) {
|
|||
|
if(strtempmcc==ui->comboBoxCountryID->itemText(i))
|
|||
|
{
|
|||
|
itempHave=true;
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
qDebug()<<strtempmcc;
|
|||
|
|
|||
|
if(!itempHave)
|
|||
|
ui->comboBoxCountryID->addItem(strtempmcc);
|
|||
|
m_ApnInfoiList.append(oApn);
|
|||
|
}
|
|||
|
}
|
|||
|
ui->comboBoxCountryID->setCurrentText("");
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
else if(strType=="GetFlightModeState")
|
|||
|
{
|
|||
|
//ui->widgetFightModel->setChecked(jsonObject["result"].toBool());
|
|||
|
ui->widgetFightModel->setCheckedStatus(jsonObject["result"].toBool());
|
|||
|
ui->widgetFightModel->update();
|
|||
|
//ui->
|
|||
|
}
|
|||
|
else if(strType == "GetCurrentAPN"){
|
|||
|
QString strApn=jsonObject["apn"].toString();
|
|||
|
// ui->lineEditAPN->setText(strApn);
|
|||
|
// ui->lineEditUser->setText(jsonObject["user"].toString());
|
|||
|
// ui->lineEditPassword->setText(jsonObject["password"].toString());
|
|||
|
if(jsonObject["user"].toString().isEmpty())
|
|||
|
ui->lineEditApnInfo->setText(jsonObject["apn"].toString());
|
|||
|
else
|
|||
|
ui->lineEditApnInfo->setText(jsonObject["apn"].toString()+",USER:"+jsonObject["user"].toString()+",PASSWORD:"+jsonObject["password"].toString());
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "GetTimezone"){
|
|||
|
QString strtemp=jsonObject["timezone"].toString();
|
|||
|
//ui->comboBox_Timezone->setCurrentText(strtemp);
|
|||
|
}
|
|||
|
else if(strType == "SetTimezone"){
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "GetSwitchSimData"){
|
|||
|
bool b=jsonObject["enable"].toBool();
|
|||
|
ui->checkBox4g->setChecked(b);
|
|||
|
ui->pushButtonSet4GInfo->setVisible(b);
|
|||
|
ui->pushButtonReadback4G->setVisible(b);
|
|||
|
ui->pushButtonGetMcc->setVisible(b);
|
|||
|
#ifndef MACRO_YUANHENG_VERSION
|
|||
|
ui->comboBoxCountryID->setVisible(b);
|
|||
|
ui->comboBoxCarrierName->setVisible(b);
|
|||
|
//ui->checkBoxCustom->setVisible(b);
|
|||
|
ui->lineEditAPN->setVisible(b);
|
|||
|
ui->lineEditUser->setVisible(b);
|
|||
|
ui->lineEditPassword->setVisible(b);
|
|||
|
ui->label_2->setVisible(b);
|
|||
|
ui->label_3->setVisible(b);
|
|||
|
ui->label_4->setVisible(b);
|
|||
|
ui->label_6->setVisible(b);
|
|||
|
ui->label_7->setVisible(b);
|
|||
|
ui->label_8->setVisible(b);
|
|||
|
#else
|
|||
|
ui->lineEditAPN->setVisible(b);
|
|||
|
|
|||
|
#endif
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::OnControlTypeSwitchIndexChanged(int index)
|
|||
|
{
|
|||
|
if(index==ENUM_CONTRL_WIDGET_NETCONFIG)
|
|||
|
{
|
|||
|
m_bSelected=true;
|
|||
|
if(m_pLedCard!=nullptr)
|
|||
|
onReadbackAllThisPage();
|
|||
|
}
|
|||
|
else {
|
|||
|
m_bSelected=false;
|
|||
|
}
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::OnComboMccChanged(int index)
|
|||
|
{
|
|||
|
Q_UNUSED(index);
|
|||
|
SetMcc(ui->comboBoxCountryID->currentText());
|
|||
|
}
|
|||
|
|
|||
|
void ControlNetConfigWidget::SetMcc(QString strMcc)
|
|||
|
{
|
|||
|
qDebug()<<"SetMcc:"<<strMcc;
|
|||
|
if(strMcc.isEmpty())
|
|||
|
return;
|
|||
|
m_MccCarrierInfoiList.clear();
|
|||
|
ui->comboBoxCarrierName->clear();
|
|||
|
foreach(QJsonObject obj, m_ApnInfoiList)
|
|||
|
{
|
|||
|
if(obj["mcc"].toString()==strMcc)
|
|||
|
{
|
|||
|
m_MccCarrierInfoiList.append(obj);
|
|||
|
ui->comboBoxCarrierName->addItem(obj["carrier"].toString());
|
|||
|
// ui->comboBoxCarrierName->insertItem(0,obj["carrier"].toString());
|
|||
|
}
|
|||
|
}
|
|||
|
ui->comboBoxCarrierName->clearEditText();
|
|||
|
// if(ui->comboBoxCarrierName->isEditable()==false)
|
|||
|
// {
|
|||
|
// ui->comboBoxCarrierName->setEditable(true);
|
|||
|
// ui->comboBoxCarrierName->setCurrentText("");
|
|||
|
// ui->comboBoxCarrierName->setEditable(false);
|
|||
|
// }
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::OnComboCarrierChanged(int index)
|
|||
|
{
|
|||
|
if(m_MccCarrierInfoiList.count()>0 && index<m_MccCarrierInfoiList.count())
|
|||
|
{
|
|||
|
m_4gObj=m_MccCarrierInfoiList.at(index);
|
|||
|
ui->lineEditAPN->setText(m_4gObj["apn"].toString());
|
|||
|
ui->lineEditUser->setText(m_4gObj["user"].toString());
|
|||
|
ui->lineEditPassword->setText(m_4gObj["password"].toString());
|
|||
|
}
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::OnCustom4G(bool b)
|
|||
|
{
|
|||
|
//ui->pushButtonGetMcc->setEnabled(b);
|
|||
|
ui->comboBoxCountryID->setEditable(b);
|
|||
|
ui->comboBoxCarrierName->setEditable(b);
|
|||
|
|
|||
|
ui->lineEditUser->setReadOnly(!b);
|
|||
|
ui->lineEditPassword->setReadOnly(!b);
|
|||
|
if(b)
|
|||
|
{
|
|||
|
ui->comboBoxCountryID->setStyleSheet("background:rgba(255,255,255,1);");
|
|||
|
ui->comboBoxCarrierName->setStyleSheet("background:rgba(255,255,255,1);");
|
|||
|
ui->lineEditAPN->setStyleSheet("background:rgba(255,255,255,1);");
|
|||
|
ui->lineEditUser->setStyleSheet("background:rgba(255,255,255,1);");
|
|||
|
ui->lineEditPassword->setStyleSheet("background:rgba(255,255,255,1);");
|
|||
|
|
|||
|
}
|
|||
|
else {
|
|||
|
ui->comboBoxCountryID->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
ui->comboBoxCarrierName->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
ui->lineEditAPN->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
ui->lineEditUser->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
ui->lineEditPassword->setStyleSheet("background:rgba(216,216,216,1);");
|
|||
|
|
|||
|
}
|
|||
|
#ifndef MACRO_YUANHENG_VERSION
|
|||
|
ui->lineEditAPN->setReadOnly(false);
|
|||
|
#else
|
|||
|
ui->lineEditAPN->setReadOnly(!b);
|
|||
|
ui->lineEditAPN->setStyleSheet("background:rgba(255,255,255,1);");
|
|||
|
|
|||
|
#endif
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::OnOpne4G(bool b)
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
|
|||
|
ui->pushButtonSet4GInfo->setVisible(b);
|
|||
|
ui->pushButtonReadback4G->setVisible(b);
|
|||
|
ui->pushButtonGetMcc->setVisible(b);
|
|||
|
ui->groupBox_5->setVisible(b);
|
|||
|
#ifndef MACRO_YUANHENG_VERSION
|
|||
|
ui->comboBoxCountryID->setVisible(b);
|
|||
|
ui->comboBoxCarrierName->setVisible(b);
|
|||
|
|
|||
|
//ui->checkBoxCustom->setVisible(b);
|
|||
|
ui->lineEditAPN->setVisible(b);
|
|||
|
ui->lineEditUser->setVisible(b);
|
|||
|
ui->lineEditPassword->setVisible(b);
|
|||
|
ui->label_2->setVisible(b);
|
|||
|
ui->label_3->setVisible(b);
|
|||
|
ui->label_4->setVisible(b);
|
|||
|
ui->label_6->setVisible(b);
|
|||
|
ui->label_7->setVisible(b);
|
|||
|
ui->label_8->setVisible(b);
|
|||
|
#else
|
|||
|
ui->lineEditAPN->setVisible(b);
|
|||
|
|
|||
|
#endif
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetSwitchSimData");
|
|||
|
json.insert("enable", b);
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetSwitchSimData"),tr("Success"),tr("failed"))
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::on_groupBox_3_clicked(bool checked)
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetSwitchWiFi");
|
|||
|
json.insert("enable", checked);
|
|||
|
HttpPostByTypeJsonObject(pHpptClient,m_strUrl,json);
|
|||
|
// MACRO_DEFINE_TIPDLG_FUCN(tr("SetSwitchWiFi"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
|
|||
|
void ControlNetConfigWidget::on_groupBox_4_clicked(bool checked)
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
if(checked)
|
|||
|
{
|
|||
|
// ui->groupBox_3->setChecked(false);
|
|||
|
// QJsonObject json;
|
|||
|
// json.insert("_id", getRandomString(10));
|
|||
|
// json.insert("_type", "SetSwitchWiFi");
|
|||
|
// json.insert("enable", false);
|
|||
|
// MACRO_DEFINE_TIPDLG_FUCN(tr("SetSwitchWiFi"),tr("Success"),tr("failed"))
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
// QJsonObject json;
|
|||
|
// json.insert("_id", getRandomString(10));
|
|||
|
// json.insert("_type", "SetSwitchWiFi");
|
|||
|
// json.insert("enable", true);
|
|||
|
// MACRO_DEFINE_TIPDLG_FUCN(tr("SetSwitchWiFi"),tr("Success"),tr("failed"))
|
|||
|
// ui->lineEditHotspotName->clear();
|
|||
|
// ui->lineEditApPassword->clear();
|
|||
|
// ui->groupBox_3->setChecked(false);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::OnSetYuanHengApn()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetAPN");
|
|||
|
json.insert("carrier", "");
|
|||
|
json.insert("apn","iot.cargo");
|
|||
|
json.insert("user", "");
|
|||
|
json.insert("password", "");
|
|||
|
json.insert("type","");
|
|||
|
json.insert("server", "");
|
|||
|
json.insert("proxy", "");
|
|||
|
json.insert("port","");
|
|||
|
json.insert("mmsc","");
|
|||
|
json.insert("mmsproxy","");
|
|||
|
json.insert("mmsport","");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetAPN"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void ControlNetConfigWidget::DeletePostingDlg()
|
|||
|
{
|
|||
|
qDebug()<<"ControlNetConfigWidget::DeletePostingDlg";
|
|||
|
if(m_PostingDlg!=nullptr)
|
|||
|
{
|
|||
|
delete m_PostingDlg;
|
|||
|
m_PostingDlg=nullptr;
|
|||
|
iEnableFlag=true;
|
|||
|
}
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::onFightModelChecked(bool b)
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "ContrFlightMode");
|
|||
|
json.insert("state", b);
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("ContrFlightMode"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlNetConfigWidget::onReadbackFlightModel()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "GetFlightModeState");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("GetFlightModeState"),tr("Success"),tr("failed"))
|
|||
|
}
|