ledok 修改指定ip功能
This commit is contained in:
parent
757655024d
commit
d145c6128e
|
@ -62,7 +62,6 @@ SOURCES += \
|
|||
basewin.cpp \
|
||||
cfg.cpp \
|
||||
communication/hpptclient.cpp \
|
||||
communication/network.cpp \
|
||||
communication/taserialthread.cpp \
|
||||
devicectrlpanel.cpp \
|
||||
deviceitem.cpp \
|
||||
|
@ -106,7 +105,6 @@ SOURCES += \
|
|||
wDevicesManager/ctrladvancedpanel.cpp \
|
||||
wDevicesManager/ctrlbrightpanel.cpp \
|
||||
wDevicesManager/ledcard.cpp \
|
||||
wDevicesManager/specialdlg.cpp \
|
||||
wDevicesManager/threadupgradeapk.cpp \
|
||||
wDevicesManager/upgradeapkdialog.cpp \
|
||||
wDevicesManager/wupgradeapkitem.cpp \
|
||||
|
@ -164,7 +162,6 @@ HEADERS += \
|
|||
basewin.h \
|
||||
cfg.h \
|
||||
communication/hpptclient.h \
|
||||
communication/network.h \
|
||||
communication/taserialthread.h \
|
||||
devicectrlpanel.h \
|
||||
deviceitem.h \
|
||||
|
@ -207,7 +204,6 @@ HEADERS += \
|
|||
wDevicesManager/ctrladvancedpanel.h \
|
||||
wDevicesManager/ctrlbrightpanel.h \
|
||||
wDevicesManager/ledcard.h \
|
||||
wDevicesManager/specialdlg.h \
|
||||
wDevicesManager/threadupgradeapk.h \
|
||||
wDevicesManager/upgradeapkdialog.h \
|
||||
wDevicesManager/wupgradeapkitem.h \
|
||||
|
@ -247,7 +243,6 @@ FORMS += \
|
|||
tipdialog.ui \
|
||||
wDevicesManager/controlencryptwidget.ui \
|
||||
wDevicesManager/controlhdmischedule.ui \
|
||||
wDevicesManager/controlhdmiwidget.ui \
|
||||
wDevicesManager/controlpowermanual.ui \
|
||||
wDevicesManager/controlpowerschedule.ui \
|
||||
wDevicesManager/controlpowerwidget.ui \
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
#include "network.h"
|
||||
#include <QMessageBox>
|
||||
#include <QTime>
|
||||
#include "string"
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
#include <QMetaEnum>
|
||||
#include <QNetworkDatagram>
|
||||
|
||||
NetComm::NetComm(QObject *p) : QObject(p) {
|
||||
}
|
||||
|
||||
STREAM_PACKET NetComm::LedOkMakeStreamPacket(int iComType,int iLen,unsigned char *ucBuf,QString str)
|
||||
{
|
||||
STREAM_PACKET Temp;
|
||||
memset(&Temp,0x00,sizeof(STREAM_PACKET));
|
||||
if(iLen>2048)
|
||||
return Temp;
|
||||
memset(Temp.SyncHead,STREAM_SYNC_HEAD,STREAM_SYNC_HEAD_NUM);
|
||||
memset(Temp.ucSerialCode,0x00,20);
|
||||
char* ch;
|
||||
QByteArray ba = str.toLatin1(); // must
|
||||
ch=ba.data();
|
||||
memcpy(Temp.ucSerialCode,ch,ba.size());
|
||||
Temp.iLength=iLen;
|
||||
Temp.ucCommType=iComType;
|
||||
memcpy(Temp.pDataBuffer,ucBuf,iLen);
|
||||
Temp.pDataBuffer[Temp.iLength]=
|
||||
GetCheckCodeIn8(&Temp.ucCommType,Temp.iLength+sizeof(Temp.ucCommType)+sizeof(char)*20+sizeof(Temp.iLength));
|
||||
return Temp;
|
||||
}
|
||||
void NetComm::RestoreLedCardIpByUdpCmd() {
|
||||
//UDP多网卡广播
|
||||
QList<QNetworkInterface> networkinterfaces = QNetworkInterface::allInterfaces();
|
||||
foreach (QNetworkInterface interfaces, networkinterfaces) //networkinterfaces负责提供主机的IP地址和网络接口的列表
|
||||
{
|
||||
{
|
||||
foreach (QNetworkAddressEntry entry, interfaces.addressEntries())//QNetworkAddressEntry存储了一个IP地址,子网掩码和广播地址
|
||||
{
|
||||
entry.setBroadcast(QHostAddress::Broadcast);
|
||||
QHostAddress broadcastAddress("255.255.255.255");
|
||||
{
|
||||
entry.setBroadcast(QHostAddress::Broadcast);
|
||||
|
||||
RESTORE_IP stTempIp;
|
||||
memset(&stTempIp,0x00,sizeof(RESTORE_IP));
|
||||
|
||||
QString strNew=entry.ip().toString();
|
||||
int itempOffset = strNew.lastIndexOf(".");
|
||||
QString sstrNew=strNew.left(itempOffset)+".254";
|
||||
if(sstrNew.length()<=20)
|
||||
memcpy(stTempIp.cNewIp,sstrNew.toLatin1().data(),sstrNew.length());
|
||||
QString strMask=entry.netmask().toString();
|
||||
if(strMask.length()<=20)
|
||||
memcpy(stTempIp.cMask,strMask.toLatin1().data(),strMask.length());
|
||||
QString strGateway=entry.ip().toString();
|
||||
if(strGateway.length()<=20)
|
||||
memcpy(stTempIp.cGateway,strGateway.toLatin1().data(),strGateway.length());
|
||||
if(strGateway.length()<=20)
|
||||
memcpy(stTempIp.cDns,strGateway.toLatin1().data(),strGateway.length());
|
||||
STREAM_PACKET tempStreadPacket=LedOkMakeStreamPacket(COMMAND_ONLY_RESET_CARD_IP,80,(unsigned char *)&stTempIp,"Broadcast!");
|
||||
int iLenPacket=tempStreadPacket.iLength+sizeof(int)+STREAM_SYNC_HEAD_NUM*sizeof(unsigned char)+sizeof(char)+20*sizeof(char)+sizeof(char);/////除正文外的协议结构大小;
|
||||
QUdpSocket *tempUdpSocket= new QUdpSocket(this);
|
||||
if(!tempUdpSocket->bind(entry.ip())) break;
|
||||
tempUdpSocket->writeDatagram((char *)&tempStreadPacket,iLenPacket,broadcastAddress,m_port);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NetComm::JieXiQJsonObjectOfLedCardInfoOld(const QString &strId,const QString &strIp){
|
||||
LedCard *pLedCard = new LedCard(this);//alahover 没有释放
|
||||
pLedCard->m_strCardId=strId;
|
||||
pLedCard->m_strCardIp=strIp;
|
||||
for(int i=0;i<LedCardList.count();i++) if(LedCardList.at(i)->m_strCardId==pLedCard->m_strCardId ) {//如果已经存在在列表中
|
||||
auto pOldLedCard = LedCardList.at(i);//获取到旧的对象指针
|
||||
pOldLedCard->m_bOnLine = true;
|
||||
if(pOldLedCard->CompareHTTPGetParam(pLedCard)==false) {//如果ip地址变化了
|
||||
pOldLedCard->copyLedCardHTTPGetParam(pLedCard);
|
||||
emit addLedCard(pOldLedCard);//发送信号到界面
|
||||
} else {
|
||||
//post失败的概率比较小,所以这里是否需要平凡的更新,不需要刻意屏蔽该操作改为在其他点击操作中进行
|
||||
emit ClearHeartbeatFlagByUdp(pOldLedCard);
|
||||
}
|
||||
delete pLedCard;
|
||||
return;
|
||||
}
|
||||
LedCardList.append(pLedCard);
|
||||
emit addLedCard(pLedCard);//发送信号到界面
|
||||
}
|
||||
|
||||
void NetComm::JieXiQJsonObjectOfLedCardInfo(const QJsonObject &subObj, const QString &strIp){
|
||||
LedCard *pLedCard = new LedCard(this);//alahover 没有释放
|
||||
pLedCard->m_strCardId=subObj["cardId"].toString();
|
||||
if(! strIp.isEmpty()) pLedCard->m_strCardIp = strIp;
|
||||
else {
|
||||
pLedCard->m_strCardIp = subObj["newIp"].toString();
|
||||
if(pLedCard->m_strCardIp.isEmpty()) pLedCard->m_strCardIp = subObj["ip"].toString();
|
||||
}
|
||||
pLedCard->m_iWidth=subObj["width"].toInt();
|
||||
pLedCard->m_iHeight=subObj["height"].toInt();
|
||||
pLedCard->starterversionName=subObj["versionName"].toString();
|
||||
pLedCard->starterPort=subObj["starterPort"].toInt();
|
||||
pLedCard->androidVersion=subObj["androidVersion"].toString();
|
||||
pLedCard->iHttpGetId=subObj["id"].toInt();
|
||||
pLedCard->androidHeight=subObj["androidHeight"].toInt();
|
||||
pLedCard->androidWidth=subObj["androidWidth"].toInt();
|
||||
pLedCard->lastActive=subObj["lastActive"].toInt();
|
||||
|
||||
for(int i=0;i<LedCardList.count();i++) if(LedCardList.at(i)->m_strCardId==pLedCard->m_strCardId ) { //如果已经存在在列表中
|
||||
auto pOldLedCard = LedCardList.at(i);//获取到旧的对象指针
|
||||
pOldLedCard->m_bOnLine = true;
|
||||
if(! pOldLedCard->CompareHTTPGetParam(pLedCard)) {//如果ip地址变化了
|
||||
pOldLedCard->copyLedCardHTTPGetParam(pLedCard);
|
||||
emit addLedCard(pOldLedCard);//发送信号到界面
|
||||
} else {
|
||||
//post失败的概率比较小,所以这里是否需要平凡的更新,不需要刻意屏蔽该操作改为在其他点击操作中进行
|
||||
emit ClearHeartbeatFlagByUdp(pOldLedCard);
|
||||
}
|
||||
delete pLedCard;
|
||||
return;
|
||||
}
|
||||
LedCardList.append(pLedCard);
|
||||
emit addLedCard(pLedCard);//发送信号到界面
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
#ifndef NETWORK_H
|
||||
#define NETWORK_H
|
||||
#include <QObject>
|
||||
#include <QUdpSocket>
|
||||
#include <QNetworkInterface>
|
||||
#include <QList>
|
||||
#include <wDevicesManager/ledcard.h>
|
||||
#include <communication/hpptclient.h>
|
||||
#include <globaldefine.h>
|
||||
#include <QTimer>
|
||||
#include <windows.h>
|
||||
|
||||
class NetComm : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
NetComm(QObject *p = nullptr);
|
||||
STREAM_PACKET LedOkMakeStreamPacket(int iComType,int iLen,unsigned char *ucBuf,QString str);
|
||||
|
||||
static DWORD WINAPI send(void *);
|
||||
|
||||
void JieXiQJsonObjectOfLedCardInfo(const QJsonObject &subObj,const QString &strIp);
|
||||
void JieXiQJsonObjectOfLedCardInfoOld(const QString &strId,const QString &strIp);
|
||||
|
||||
QList<LedCard *> LedCardList;
|
||||
QTimer mUdpTimer;
|
||||
QUdpSocket mUdpSocket;
|
||||
signals:
|
||||
void addLedCard(LedCard *);
|
||||
void ClearHeartbeatFlagByUdp(LedCard *);
|
||||
public slots:
|
||||
void RestoreLedCardIpByUdpCmd();
|
||||
private:
|
||||
QString m_strCardId;
|
||||
qint32 m_iWidth;
|
||||
LedCard *m_pLedCard;
|
||||
int m_port = 31296;
|
||||
};
|
||||
|
||||
extern NetComm *gUdp;
|
||||
|
||||
#endif // NETWORK_H
|
|
@ -1,18 +1,19 @@
|
|||
#include "devicepanel.h"
|
||||
#include "devicectrlpanel.h"
|
||||
#include "tools.h"
|
||||
#include "communication/network.h"
|
||||
#include "wDevicesManager/specialdlg.h"
|
||||
#include "gqt.h"
|
||||
#include <QAction>
|
||||
#include <QBoxLayout>
|
||||
#include <QEvent>
|
||||
#include <QHeaderView>
|
||||
#include <QLineEdit>
|
||||
#include <QNetworkDatagram>
|
||||
#include <QNetworkInterface>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
DevicePanel *gDevicePanel;
|
||||
QList<LedCard*> *gSelCards;
|
||||
NetComm *gUdp;
|
||||
//设备管理响应页面
|
||||
DevicePanel::DevicePanel(QWidget *parent) : QWidget(parent) {
|
||||
gDevicePanel = this;
|
||||
|
@ -68,10 +69,54 @@ DevicePanel::DevicePanel(QWidget *parent) : QWidget(parent) {
|
|||
bnSpecifyIP->setGeometry(0, 0, areaFlash->width(), areaFlash->height());
|
||||
bnSpecifyIP->setItemDelegate(new QStyledItemDelegate);
|
||||
connect(bnSpecifyIP, &QComboBox::textActivated, this, [this] {
|
||||
pNetComm->mUdpTimer.stop();
|
||||
SpecialDlg pDlg(this, pNetComm);
|
||||
pDlg.exec();
|
||||
pNetComm->mUdpTimer.start(30000);
|
||||
if(specifyIPDlg==0) {
|
||||
specifyIPDlg = new QDialog(this);
|
||||
specifyIPDlg->setWindowTitle(tr("Specify IP"));
|
||||
|
||||
auto vBox = new VBox(specifyIPDlg);
|
||||
vBox->addStretch();
|
||||
|
||||
auto label = new QLabel(tr("Specify IP list"));
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
vBox->addWidget(label);
|
||||
|
||||
fdIP = new QTextEdit(QSettings().value("SpecifyIP").toString());
|
||||
fdIP->setPlaceholderText("192.168.1.1\n192.168.1.2\n ...");
|
||||
fdIP->setMinimumWidth(160);
|
||||
vBox->addWidget(fdIP);
|
||||
|
||||
auto hBox = new HBox(vBox);
|
||||
hBox->addStretch();
|
||||
|
||||
auto bnSearch = new QPushButton(tr("Search"));
|
||||
connect(bnSearch, &QPushButton::clicked, this, [this] {
|
||||
QString ipsStr = fdIP->toPlainText();
|
||||
if(ipsStr.isEmpty()) {
|
||||
QMessageBox::warning(gMainWin, tr("Attention"), tr("Please input IP address!"));
|
||||
return;
|
||||
}
|
||||
auto ips = ipsStr.split("\n", Qt::SkipEmptyParts);
|
||||
if(ips.isEmpty()) {
|
||||
QMessageBox::warning(gMainWin, tr("Attention"), tr("Please input IP address!"));
|
||||
return;
|
||||
}
|
||||
QByteArray data = QJsonDocument({{"action", "getInfo"}}).toJson(QJsonDocument::Compact);
|
||||
foreach(auto ip, ips) {
|
||||
if(gDevicePanel->mUdpSocket.writeDatagram(data, QHostAddress(ip), 22222) != data.length()) qDebug() << "Specify IP write Failed." << ip;
|
||||
}
|
||||
specifyIPDlg->accept();
|
||||
});
|
||||
hBox->addWidget(bnSearch);
|
||||
|
||||
auto btnCancel = new QPushButton(tr("Cancel"));
|
||||
connect(btnCancel, &QPushButton::clicked, specifyIPDlg, &QDialog::reject);
|
||||
hBox->addWidget(btnCancel);
|
||||
|
||||
hBox->addStretch();
|
||||
}
|
||||
mUdpTimer.stop();
|
||||
specifyIPDlg->exec();
|
||||
mUdpTimer.start(30000);
|
||||
});
|
||||
bnSpecifyIP->setStyleSheet(R"rrr(
|
||||
QComboBox {
|
||||
|
@ -89,16 +134,16 @@ QComboBox QAbstractItemView::item {
|
|||
QComboBox QAbstractItemView::item:selected {background-color: #09c;}
|
||||
)rrr");
|
||||
|
||||
btnRefrash = new QPushButton(tr("Refresh"), areaFlash);
|
||||
btnRefrash->setGeometry(0, 0, 75, areaFlash->height());
|
||||
connect(btnRefrash, &QPushButton::clicked, this, [this] {
|
||||
pNetComm->LedCardList.clear();
|
||||
btnRefresh = new QPushButton(tr("Refresh"), areaFlash);
|
||||
btnRefresh->setGeometry(0, 0, 75, areaFlash->height());
|
||||
connect(btnRefresh, &QPushButton::clicked, this, [this] {
|
||||
LedCardList.clear();
|
||||
mDeviceTable->onCheckAll(false);
|
||||
mDeviceTable->clear();
|
||||
nDeviceNum->setText("0");
|
||||
sendGetInfo();
|
||||
});
|
||||
btnRefrash->setStyleSheet(R"rrr(
|
||||
btnRefresh->setStyleSheet(R"rrr(
|
||||
QPushButton {
|
||||
border-radius: 5px;
|
||||
background-color: #19c;
|
||||
|
@ -120,14 +165,12 @@ QPushButton:hover {background-color: #08b;}
|
|||
|
||||
vBox->addLayout(mHBox);
|
||||
|
||||
pNetComm = new NetComm(this);
|
||||
connect(&pNetComm->mUdpTimer, &QTimer::timeout, this, &DevicePanel::sendGetInfo);
|
||||
connect(&pNetComm->mUdpSocket, &QUdpSocket::readyRead, this, [this] {
|
||||
while(pNetComm->mUdpSocket.hasPendingDatagrams()) {
|
||||
auto gram = pNetComm->mUdpSocket.receiveDatagram();
|
||||
connect(&mUdpTimer, &QTimer::timeout, this, &DevicePanel::sendGetInfo);
|
||||
connect(&mUdpSocket, &QUdpSocket::readyRead, this, [this] {
|
||||
while(mUdpSocket.hasPendingDatagrams()) {
|
||||
auto gram = mUdpSocket.receiveDatagram();
|
||||
auto data = gram.data();
|
||||
if(data.isEmpty()) continue;
|
||||
qDebug() << "data" << data;
|
||||
auto senderAddress = gram.senderAddress();
|
||||
bool ok = true;
|
||||
if(senderAddress.protocol()==QUdpSocket::IPv6Protocol) senderAddress.setAddress(senderAddress.toIPv4Address(&ok));
|
||||
|
@ -139,39 +182,28 @@ QPushButton:hover {background-color: #08b;}
|
|||
qDebug()<<"DeviceItem OnProHttpResponse 解析json文件错误!";
|
||||
continue;
|
||||
}
|
||||
pNetComm->JieXiQJsonObjectOfLedCardInfo(document.object(), addr);
|
||||
parseInfo(document.object(), addr);
|
||||
} else {
|
||||
STREAM_PACKET *pStreamPacket = (STREAM_PACKET *)gram.data().data();
|
||||
pNetComm->JieXiQJsonObjectOfLedCardInfoOld(pStreamPacket->ucSerialCode, addr);
|
||||
LedCard *pLedCard = new LedCard(this);//alahover 没有释放
|
||||
pLedCard->m_strCardId = pStreamPacket->ucSerialCode;
|
||||
pLedCard->m_strCardIp = addr;
|
||||
for(int i=0;i<LedCardList.count();i++) if(LedCardList.at(i)->m_strCardId==pLedCard->m_strCardId ) {//如果已经存在在列表中
|
||||
auto pOldLedCard = LedCardList.at(i);//获取到旧的对象指针
|
||||
pOldLedCard->m_bOnLine = true;
|
||||
if(pOldLedCard->CompareHTTPGetParam(pLedCard)==false) {//如果ip地址变化了
|
||||
pOldLedCard->copyLedCardHTTPGetParam(pLedCard);
|
||||
emit addLedCard(pOldLedCard);//发送信号到界面
|
||||
} else {
|
||||
//post失败的概率比较小,所以这里是否需要平凡的更新,不需要刻意屏蔽该操作改为在其他点击操作中进行
|
||||
emit clearUdpHeartbeat(pOldLedCard);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
gUdp = pNetComm;
|
||||
connect(pNetComm, &NetComm::addLedCard, this, [this](LedCard *p){
|
||||
int cnt = mDeviceTable->topLevelItemCount();
|
||||
for(int i=0; i<cnt; i++) {
|
||||
auto item = static_cast<DeviceItem*>(mDeviceTable->topLevelItem(i));
|
||||
if(item->m_pLedCard->m_strCardId != p->m_strCardId) continue;
|
||||
item->setData(DeviceTable_ID, 0, p->m_strCardId);
|
||||
item->setData(DeviceTable_IP, 0, p->m_strCardIp);
|
||||
item->setData(DeviceTable_ScreenSize, 0, QString("%1 x %2").arg(p->m_iWidth).arg(p->m_iHeight));
|
||||
delete pLedCard;
|
||||
return;
|
||||
}
|
||||
new DeviceItem(p, mDeviceTable, this);
|
||||
nDeviceNum->setText(QString::number(mDeviceTable->topLevelItemCount()));
|
||||
});
|
||||
connect(pNetComm, &NetComm::ClearHeartbeatFlagByUdp, this, [this](LedCard *p) {
|
||||
int cnt = mDeviceTable->topLevelItemCount();
|
||||
for(int i=0; i<cnt; i++) {
|
||||
auto item = static_cast<DeviceItem*>(mDeviceTable->topLevelItem(i));
|
||||
if(item->m_pLedCard->m_strCardId != p->m_strCardId) continue;
|
||||
item->m_HeartbeatCount = 0;
|
||||
if(item->m_ImageOnline) {
|
||||
item->m_pLedCard->m_bOnLine = true;
|
||||
item->m_ImageOnline->setPixmap(QPixmap(":/res/DeviceManager/O_Online.png"));
|
||||
LedCardList.append(pLedCard);
|
||||
emit addLedCard(pLedCard);//发送信号到界面
|
||||
}
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -203,20 +235,20 @@ QPushButton:hover {background-color: #08b;}
|
|||
|
||||
//开始轮训查找局域网内的控制卡
|
||||
sendGetInfo();
|
||||
pNetComm->mUdpTimer.start(30000);
|
||||
mUdpTimer.start(30000);
|
||||
mDeviceTable->hideColumn(0);
|
||||
mDeviceTable->fdIsSelAll->hide();
|
||||
transUi();
|
||||
}
|
||||
|
||||
DevicePanel::~DevicePanel() {
|
||||
pNetComm->mUdpSocket.close();
|
||||
pNetComm->mUdpTimer.stop();
|
||||
mUdpSocket.close();
|
||||
mUdpTimer.stop();
|
||||
}
|
||||
|
||||
void DevicePanel::sendGetInfo() {
|
||||
QByteArray data = QJsonDocument({{"action", "getInfo"}}).toJson(QJsonDocument::Compact);
|
||||
// if(pNetComm->mUdpSocket.writeDatagram(data, QHostAddress("255.255.255.255"), 22222) != data.length()) {
|
||||
// if(mUdpSocket.writeDatagram(data, QHostAddress("255.255.255.255"), 22222) != data.length()) {
|
||||
// qDebug() << "getInfo writeDatagram to 255.255.255.255 Failed";
|
||||
// }
|
||||
QList<QNetworkInterface> networkinterfaces = QNetworkInterface::allInterfaces();
|
||||
|
@ -230,7 +262,7 @@ void DevicePanel::sendGetInfo() {
|
|||
auto ip = addrEntry.ip();
|
||||
if(ip.protocol()!=QAbstractSocket::IPv4Protocol) continue;
|
||||
auto broadcast = addrEntry.broadcast();
|
||||
if(pNetComm->mUdpSocket.writeDatagram(data, broadcast, 22222) != data.length()) qDebug() << "getInfo writeDatagram Failed." << ip.toString() << "->" << broadcast.toString();
|
||||
if(mUdpSocket.writeDatagram(data, broadcast, 22222) != data.length()) qDebug() << "getInfo writeDatagram Failed." << ip.toString() << "->" << broadcast.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -266,7 +298,7 @@ void DevicePanel::changeEvent(QEvent *event) {
|
|||
if(event->type() == QEvent::LanguageChange) transUi();
|
||||
}
|
||||
void DevicePanel::transUi() {
|
||||
btnRefrash->setText(tr("Refresh"));
|
||||
btnRefresh->setText(tr("Refresh"));
|
||||
bnSpecifyIP->setItemText(0,tr("Specify IP"));
|
||||
label_3->setText(tr("All"));
|
||||
|
||||
|
@ -348,12 +380,7 @@ void DevicePanel::FilterProgram(const QString &strtemp){
|
|||
|
||||
void DevicePanel::OnControlTcpSend(int iProgramIndex){
|
||||
int cnt = mDeviceTable->topLevelItemCount();
|
||||
QList<DeviceItem*> list;
|
||||
int iSelectCount=0;
|
||||
for(int i=0; i<cnt; i++) if(mDeviceTable->topLevelItem(i)->checkState(0) == Qt::Checked) {
|
||||
iSelectCount++;
|
||||
static_cast<DeviceItem*>(mDeviceTable->topLevelItem(i))->OnControlTcpSend(iProgramIndex);
|
||||
}
|
||||
for(int i=0; i<cnt; i++) if(mDeviceTable->topLevelItem(i)->checkState(0) == Qt::Checked) static_cast<DeviceItem*>(mDeviceTable->topLevelItem(i))->OnControlTcpSend(iProgramIndex);
|
||||
}
|
||||
|
||||
void DevicePanel::OnControlSendJson(QJsonObject &json,QString strFanYi){
|
||||
|
@ -387,3 +414,112 @@ void DevicePanel::onCheckStateChanged(int f){
|
|||
emit sigSelectedDeviceList(&mSelCards);
|
||||
}
|
||||
}
|
||||
void DevicePanel::addLedCard(LedCard *p){
|
||||
int cnt = mDeviceTable->topLevelItemCount();
|
||||
for(int i=0; i<cnt; i++) {
|
||||
auto item = static_cast<DeviceItem*>(mDeviceTable->topLevelItem(i));
|
||||
if(item->m_pLedCard->m_strCardId != p->m_strCardId) continue;
|
||||
item->setData(DeviceTable_ID, 0, p->m_strCardId);
|
||||
item->setData(DeviceTable_IP, 0, p->m_strCardIp);
|
||||
item->setData(DeviceTable_ScreenSize, 0, QString("%1 x %2").arg(p->m_iWidth).arg(p->m_iHeight));
|
||||
return;
|
||||
}
|
||||
new DeviceItem(p, mDeviceTable, this);
|
||||
nDeviceNum->setText(QString::number(mDeviceTable->topLevelItemCount()));
|
||||
}
|
||||
void DevicePanel::clearUdpHeartbeat(LedCard *p) {
|
||||
int cnt = mDeviceTable->topLevelItemCount();
|
||||
for(int i=0; i<cnt; i++) {
|
||||
auto item = static_cast<DeviceItem*>(mDeviceTable->topLevelItem(i));
|
||||
if(item->m_pLedCard->m_strCardId != p->m_strCardId) continue;
|
||||
item->m_HeartbeatCount = 0;
|
||||
if(item->m_ImageOnline) {
|
||||
item->m_pLedCard->m_bOnLine = true;
|
||||
item->m_ImageOnline->setPixmap(QPixmap(":/res/DeviceManager/O_Online.png"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void DevicePanel::parseInfo(const QJsonObject &subObj, const QString &strIp) {
|
||||
LedCard *pLedCard = new LedCard(this);//alahover 没有释放
|
||||
pLedCard->m_strCardId=subObj["cardId"].toString();
|
||||
if(! strIp.isEmpty()) pLedCard->m_strCardIp = strIp;
|
||||
else {
|
||||
pLedCard->m_strCardIp = subObj["newIp"].toString();
|
||||
if(pLedCard->m_strCardIp.isEmpty()) pLedCard->m_strCardIp = subObj["ip"].toString();
|
||||
}
|
||||
pLedCard->m_iWidth=subObj["width"].toInt();
|
||||
pLedCard->m_iHeight=subObj["height"].toInt();
|
||||
pLedCard->starterversionName=subObj["versionName"].toString();
|
||||
pLedCard->starterPort=subObj["starterPort"].toInt();
|
||||
pLedCard->androidVersion=subObj["androidVersion"].toString();
|
||||
pLedCard->iHttpGetId=subObj["id"].toInt();
|
||||
pLedCard->androidHeight=subObj["androidHeight"].toInt();
|
||||
pLedCard->androidWidth=subObj["androidWidth"].toInt();
|
||||
pLedCard->lastActive=subObj["lastActive"].toInt();
|
||||
|
||||
for(int i=0;i<LedCardList.count();i++) if(LedCardList.at(i)->m_strCardId==pLedCard->m_strCardId ) { //如果已经存在在列表中
|
||||
auto pOldLedCard = LedCardList.at(i);//获取到旧的对象指针
|
||||
pOldLedCard->m_bOnLine = true;
|
||||
if(! pOldLedCard->CompareHTTPGetParam(pLedCard)) {//如果ip地址变化了
|
||||
pOldLedCard->copyLedCardHTTPGetParam(pLedCard);
|
||||
addLedCard(pOldLedCard);//发送信号到界面
|
||||
} else {
|
||||
//post失败的概率比较小,所以这里是否需要平凡的更新,不需要刻意屏蔽该操作改为在其他点击操作中进行
|
||||
clearUdpHeartbeat(pOldLedCard);
|
||||
}
|
||||
delete pLedCard;
|
||||
return;
|
||||
}
|
||||
LedCardList.append(pLedCard);
|
||||
addLedCard(pLedCard);//发送信号到界面
|
||||
}
|
||||
|
||||
STREAM_PACKET LedOkMakeStreamPacket(int iComType,int iLen,unsigned char *ucBuf,QString str) {
|
||||
STREAM_PACKET Temp;
|
||||
memset(&Temp, 0, sizeof(STREAM_PACKET));
|
||||
if(iLen>2048) return Temp;
|
||||
memset(Temp.SyncHead,STREAM_SYNC_HEAD,STREAM_SYNC_HEAD_NUM);
|
||||
memset(Temp.ucSerialCode,0x00,20);
|
||||
char* ch;
|
||||
QByteArray ba = str.toLatin1(); // must
|
||||
ch=ba.data();
|
||||
memcpy(Temp.ucSerialCode,ch,ba.size());
|
||||
Temp.iLength=iLen;
|
||||
Temp.ucCommType=iComType;
|
||||
memcpy(Temp.pDataBuffer,ucBuf,iLen);
|
||||
Temp.pDataBuffer[Temp.iLength] = GetCheckCodeIn8(&Temp.ucCommType,Temp.iLength+sizeof(Temp.ucCommType)+sizeof(char)*20+sizeof(Temp.iLength));
|
||||
return Temp;
|
||||
}
|
||||
//UDP多网卡广播
|
||||
void DevicePanel::RestoreLedCardIpByUdpCmd() {
|
||||
QList<QNetworkInterface> networkinterfaces = QNetworkInterface::allInterfaces();
|
||||
foreach (QNetworkInterface interfaces, networkinterfaces) {//networkinterfaces负责提供主机的IP地址和网络接口的列表
|
||||
foreach (QNetworkAddressEntry entry, interfaces.addressEntries()) {//QNetworkAddressEntry存储了一个IP地址,子网掩码和广播地址
|
||||
entry.setBroadcast(QHostAddress::Broadcast);
|
||||
QHostAddress broadcastAddress("255.255.255.255");
|
||||
entry.setBroadcast(QHostAddress::Broadcast);
|
||||
RESTORE_IP stTempIp;
|
||||
memset(&stTempIp,0x00,sizeof(RESTORE_IP));
|
||||
QString strNew=entry.ip().toString();
|
||||
int itempOffset = strNew.lastIndexOf(".");
|
||||
QString sstrNew=strNew.left(itempOffset)+".254";
|
||||
if(sstrNew.length()<=20) memcpy(stTempIp.cNewIp,sstrNew.toLatin1().data(),sstrNew.length());
|
||||
QString strMask=entry.netmask().toString();
|
||||
if(strMask.length()<=20)
|
||||
memcpy(stTempIp.cMask,strMask.toLatin1().data(),strMask.length());
|
||||
QString strGateway=entry.ip().toString();
|
||||
if(strGateway.length()<=20)
|
||||
memcpy(stTempIp.cGateway,strGateway.toLatin1().data(),strGateway.length());
|
||||
if(strGateway.length()<=20)
|
||||
memcpy(stTempIp.cDns,strGateway.toLatin1().data(),strGateway.length());
|
||||
STREAM_PACKET tempStreadPacket = LedOkMakeStreamPacket(COMMAND_ONLY_RESET_CARD_IP, 80, (unsigned char *)&stTempIp,"Broadcast!");
|
||||
int iLenPacket=tempStreadPacket.iLength+sizeof(int)+STREAM_SYNC_HEAD_NUM*sizeof(unsigned char)+sizeof(char)+20*sizeof(char)+sizeof(char);/////除正文外的协议结构大小;
|
||||
QUdpSocket *tempUdpSocket = new QUdpSocket(this);
|
||||
if(!tempUdpSocket->bind(entry.ip())) break;
|
||||
tempUdpSocket->writeDatagram((char *)&tempStreadPacket,iLenPacket,broadcastAddress, 31296);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,15 @@
|
|||
#define DEVICEPANEL_H
|
||||
|
||||
#include "deviceitem.h"
|
||||
#include <QWidget>
|
||||
#include <QFile>
|
||||
#include <QBoxLayout>
|
||||
#include <QPainter>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <communication/network.h>
|
||||
#include <QUdpSocket>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <wDevicesManager/ctrlbrightpanel.h>
|
||||
#include <QTextEdit>
|
||||
|
||||
class DeviceCtrlPanel;
|
||||
class DevicePanel : public QWidget {
|
||||
|
@ -24,7 +23,15 @@ public:
|
|||
|
||||
QLabel *fdCardNumInfo;
|
||||
LoQTreeWidget *mDeviceTable;
|
||||
NetComm *pNetComm;
|
||||
QUdpSocket mUdpSocket;
|
||||
QTimer mUdpTimer;
|
||||
QDialog *specifyIPDlg{0};
|
||||
QTextEdit *fdIP{0};
|
||||
void addLedCard(LedCard *);
|
||||
void clearUdpHeartbeat(LedCard *);
|
||||
void parseInfo(const QJsonObject &subObj,const QString &strIp);
|
||||
void RestoreLedCardIpByUdpCmd();
|
||||
QList<LedCard *> LedCardList;
|
||||
protected:
|
||||
void changeEvent(QEvent *) override;
|
||||
void transUi();
|
||||
|
@ -42,7 +49,7 @@ signals:
|
|||
private:
|
||||
QLabel *label_3, *nDeviceNum;
|
||||
QComboBox *bnSpecifyIP;
|
||||
QPushButton *btnRefrash;
|
||||
QPushButton *btnRefresh;
|
||||
QTreeWidgetItem *m_headerItem;
|
||||
QHBoxLayout *mHBox{0};
|
||||
DeviceCtrlPanel *mDeviceCtrlPanel{0};
|
||||
|
|
|
@ -157,8 +157,8 @@ bool copyDir(const QString &source, const QString &destination, bool override)
|
|||
|
||||
return !error;
|
||||
}
|
||||
unsigned char GetCheckCodeIn8(unsigned char * pBuffer,unsigned int uiSize)
|
||||
{ unsigned int i=0;
|
||||
unsigned char GetCheckCodeIn8(unsigned char * pBuffer,unsigned int uiSize) {
|
||||
unsigned int i=0;
|
||||
unsigned char ucCheckCode=0;
|
||||
for (i=0;i<uiSize;i++) ucCheckCode+=pBuffer[i];
|
||||
return (~ucCheckCode)&0x0ff;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#include <QSettings>
|
||||
#include <QButtonGroup>
|
||||
|
||||
QWidget *gMainWin;
|
||||
extern QPoint gPlayPos;
|
||||
|
@ -271,7 +272,7 @@ MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
|
|||
curIndex = id;
|
||||
if(curIndex == MainPage_DeviceManager || curIndex == MainPage_Setting) {
|
||||
//开启UDP定时器
|
||||
gUdp->mUdpTimer.start(60000);
|
||||
mDevicePanel->mUdpTimer.start(60000);
|
||||
int cnt = mDevicePanel->mDeviceTable->topLevelItemCount();
|
||||
for(int i=0; i<cnt; i++) {
|
||||
auto item = static_cast<DeviceItem*>(mDevicePanel->mDeviceTable->topLevelItem(i));
|
||||
|
@ -289,7 +290,7 @@ MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
|
|||
m_pOneKeyCheckCard->setProperty("ssType", "progManageTool");
|
||||
connect(m_pOneKeyCheckCard, &QPushButton::clicked, this, [this] {
|
||||
auto res = QMessageBox::warning(this, tr("Tip Info"), tr("RestoreLedCardIpByUdpTip"), QMessageBox::Ok, QMessageBox::Cancel);
|
||||
if(res == QMessageBox::Ok) mDevicePanel->pNetComm->RestoreLedCardIpByUdpCmd();
|
||||
if(res == QMessageBox::Ok) mDevicePanel->RestoreLedCardIpByUdpCmd();
|
||||
});
|
||||
hBox->addWidget(m_pOneKeyCheckCard);
|
||||
hBox->addStretch();
|
||||
|
@ -396,7 +397,10 @@ MainWindow::~MainWindow() {
|
|||
settings.setValue("MainGeo", normalGeometry());
|
||||
settings.setValue("MainIsMax", isMaximized());
|
||||
settings.setValue("PlayPos", gPlayPos);
|
||||
|
||||
if(mDevicePanel->fdIP) {
|
||||
auto ips = mDevicePanel->fdIP->toPlainText();
|
||||
if(! ips.isEmpty()) settings.setValue("SpecifyIP", ips);
|
||||
}
|
||||
if(m_pTimerSendResoreIpOneKey!=nullptr) {
|
||||
if(m_pTimerSendResoreIpOneKey->isActive()) m_pTimerSendResoreIpOneKey->stop();
|
||||
delete m_pTimerSendResoreIpOneKey;
|
||||
|
|
|
@ -768,31 +768,19 @@ void mGuangYingPinWidget::MWSendCmdByUdp(unsigned char cmd,unsigned char *pUcVal
|
|||
foreach (QNetworkAddressEntry entry, interfaces.addressEntries())//QNetworkAddressEntry存储了一个IP地址,子网掩码和广播地址
|
||||
{
|
||||
QHostAddress broadcastAddress("255.255.255.255");
|
||||
|
||||
{
|
||||
entry.setBroadcast(QHostAddress::Broadcast);
|
||||
QUdpSocket *tempUdpSocket= new QUdpSocket(this);
|
||||
if(!tempUdpSocket->bind(entry.ip()))
|
||||
break;
|
||||
int iSendLength=tempUdpSocket->writeDatagram((char *)&tempStreadPakcet,iLenPacket,broadcastAddress,31296);
|
||||
if( iSendLength != iLenPacket)
|
||||
{
|
||||
// qDebug() << "error" << "RestoreLedCardIpByUdpCmd error!send restore led card ip by udp cmd";
|
||||
// // return;
|
||||
if(iSendLength != iLenPacket) {
|
||||
char *aa=reinterpret_cast<char*>(&tempStreadPakcet);
|
||||
tempUdpSocket->writeDatagram(&aa[iSendLength],iLenPacket-iSendLength,broadcastAddress,31296);
|
||||
}
|
||||
else {
|
||||
|
||||
// strIpAddress =entry.ip().toString();// broadcastAddress.toString();
|
||||
// qDebug() << strIpAddress << "send restore led card ip by udp cmd" ;
|
||||
}
|
||||
delete tempUdpSocket;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ui->checkBoxDebug->isChecked())
|
||||
{
|
||||
if(ui->checkBoxDebug->isChecked()) {
|
||||
ui->textEditReadBuf->append("udp:"+tr(databuf.toHex()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#include "controlhdmiwidget.h"
|
||||
#include "gqt.h"
|
||||
#include "tools.h"
|
||||
#include "globaldefine.h"
|
||||
#include "base/waitingdlg.h"
|
||||
#include <QMessageBox>
|
||||
#include <QButtonGroup>
|
||||
|
||||
ControlHdmiWidget::ControlHdmiWidget(QWidget *parent,QList<LedCard *> *list) : QWidget(parent) {
|
||||
auto vBox = new QVBoxLayout(this);
|
||||
|
|
|
@ -1,157 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ControlHdmiWidget</class>
|
||||
<widget class="QWidget" name="ControlHdmiWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>381</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelHdmiConfiguration">
|
||||
<property name="text">
|
||||
<string>HDMI Configuration</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonManual">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color:transparent</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Manual</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButtonSchedule">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Arial</family>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color:transparent</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Schedule</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -6,7 +6,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QMetaEnum>
|
||||
|
||||
SpecialDlg::SpecialDlg(QWidget *parent, NetComm *netComm) : QDialog(parent) {
|
||||
SpecialDlg::SpecialDlg(QWidget *parent) : QDialog(parent) {
|
||||
resize(300, 100);
|
||||
setWindowTitle(tr("Specify IP"));
|
||||
|
||||
|
@ -44,7 +44,7 @@ SpecialDlg::SpecialDlg(QWidget *parent, NetComm *netComm) : QDialog(parent) {
|
|||
vBox->addLayout(hBox);
|
||||
|
||||
//绑定信号和槽函数
|
||||
connect(bnSearch, &QPushButton::clicked, this, [this, fdIP, netComm] {
|
||||
connect(bnSearch, &QPushButton::clicked, this, [this, fdIP] {
|
||||
QString strTempIp = fdIP->text();
|
||||
if(strTempIp=="...") {
|
||||
QMessageBox::warning(gMainWin, tr("Attention"), tr("Please input IP address!"));
|
||||
|
@ -57,7 +57,7 @@ SpecialDlg::SpecialDlg(QWidget *parent, NetComm *netComm) : QDialog(parent) {
|
|||
waitingDlg->show();
|
||||
auto reply = Tools::netManager().get(reqForJson("http://"+strTempIp+":3000/deviceList?fromDetector=true"));
|
||||
//在该ip的3000端口get方法deviceList,可以一次性获取到局域网中设备列表的详细信息
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, this, waitingDlg, netComm] {
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, this, waitingDlg] {
|
||||
QJsonDocument json;
|
||||
QString err = parseReplyJson(reply);
|
||||
if(! err.isEmpty()) {
|
||||
|
@ -69,7 +69,7 @@ SpecialDlg::SpecialDlg(QWidget *parent, NetComm *netComm) : QDialog(parent) {
|
|||
close();
|
||||
QStringList keys = json.object().keys();
|
||||
qDebug()<<"json size"<<keys.size();
|
||||
for(auto key : keys) netComm->JieXiQJsonObjectOfLedCardInfo(json[key].toObject(), "");
|
||||
for(auto key : keys) gDevicePanel->parseInfo(json[key].toObject(), "");
|
||||
});
|
||||
});
|
||||
}
|
|
@ -2,12 +2,11 @@
|
|||
#define SPECIALDLG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <communication/network.h>
|
||||
|
||||
class SpecialDlg : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SpecialDlg(QWidget *, NetComm *);
|
||||
explicit SpecialDlg(QWidget *);
|
||||
};
|
||||
|
||||
#endif // SPECIALDLG_H
|
|
@ -2,7 +2,6 @@
|
|||
#include "tools.h"
|
||||
#include "ui_upgradeapkdialog.h"
|
||||
#include <QAction>
|
||||
#include <communication/network.h>
|
||||
#include <QFileDialog>
|
||||
#include <QKeyEvent>
|
||||
#include <QMessageBox>
|
||||
|
@ -190,11 +189,10 @@ UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) {
|
|||
pushButtonPublish->setEnabled(false);
|
||||
pushButtonUpgradeFpga->setEnabled(false);
|
||||
connect(pushButtonRefresh, &QPushButton::clicked, this, [this, label] {
|
||||
if(gUdp==nullptr) return;
|
||||
wDevicePublishList->clear();
|
||||
wDevicePublishList->onCheckAll(false);
|
||||
int iCount=gUdp->LedCardList.count();
|
||||
for(int i=0;i<iCount;i++) onAddLedCard(gUdp->LedCardList.at(i));
|
||||
int iCount = gDevicePanel->LedCardList.count();
|
||||
for(int i=0;i<iCount;i++) onAddLedCard(gDevicePanel->LedCardList.at(i));
|
||||
label->setText(tr("All")+":"+QString::number(iCount));
|
||||
});
|
||||
connect(pushButtonPublish, &QPushButton::clicked, this, [this, label_ApkPath] {
|
||||
|
@ -241,16 +239,14 @@ UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) {
|
|||
} else lineEditPackageName->setVisible(false);
|
||||
});
|
||||
|
||||
if(gUdp==nullptr) return;
|
||||
int iCount=gUdp->LedCardList.count();
|
||||
for(int i=0;i<iCount;i++) onAddLedCard(gUdp->LedCardList.at(i));
|
||||
int iCount = gDevicePanel->LedCardList.count();
|
||||
for(int i=0; i<iCount; i++) onAddLedCard(gDevicePanel->LedCardList.at(i));
|
||||
label->setText(tr("All")+":"+QString::number(iCount));
|
||||
|
||||
auto timer = new QTimer(this);
|
||||
connect(timer, &QTimer::timeout, this, [this, label] {
|
||||
if(gUdp==nullptr) return;
|
||||
int iCount=gUdp->LedCardList.count();
|
||||
for(int i=0;i<iCount;i++) onAddLedCard(gUdp->LedCardList.at(i));
|
||||
int iCount = gDevicePanel->LedCardList.count();
|
||||
for(int i=0;i<iCount;i++) onAddLedCard(gDevicePanel->LedCardList.at(i));
|
||||
label->setText(tr("All")+":"+QString::number(iCount));
|
||||
});
|
||||
timer->start(500000);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "sendprogramdialog.h"
|
||||
#include "communication/network.h"
|
||||
#include "tools.h"
|
||||
#include <QAction>
|
||||
#include <QLineEdit>
|
||||
#include <QHeaderView>
|
||||
|
@ -171,9 +171,8 @@ void SendProgramDialog::sendNext() {
|
|||
}
|
||||
|
||||
void SendProgramDialog::onRefresh() {
|
||||
if(gUdp==0) return;
|
||||
int iCount = gUdp->LedCardList.count();
|
||||
for(int i=0; i<iCount; i++) onAddLedCard(gUdp->LedCardList.at(i));
|
||||
int iCount = gDevicePanel->LedCardList.count();
|
||||
for(int i=0; i<iCount; i++) onAddLedCard(gDevicePanel->LedCardList.at(i));
|
||||
label->setText(tr("All")+":"+QString::number(iCount));
|
||||
}
|
||||
void SendProgramDialog::onAddLedCard(LedCard *p) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user