dlink
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "CommandUI.h"
|
||||
#include "CommandUI.h"
|
||||
#include "ui_CommandUI.h"
|
||||
|
||||
|
||||
@@ -214,8 +214,8 @@ void CommandUI::on_commandClicked()
|
||||
command = info.toObject().find(_commandJsonKey).value().toInt();
|
||||
confirm = info.toObject().find(_confirmJsonKey).value().toInt();
|
||||
|
||||
//如果confirm == 1,那么弹出确认对话框
|
||||
if(confirm == 1)
|
||||
//如果confirm 不为0,那么弹出确认对话框
|
||||
if(confirm != 0)
|
||||
{
|
||||
Confirm *confirmor = new Confirm(this);
|
||||
confirmor->setGeometry(0,0,this->width(),this->height());
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -370,7 +370,7 @@
|
||||
<location filename="ComponentUI/Confirm/Confirm.cpp" line="41"/>
|
||||
<source>Notice:<byte value="xd"/>
|
||||
</source>
|
||||
<translation>注意:
|
||||
<translation>注意:
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
|
||||
+17
-3
@@ -13,7 +13,11 @@ DLink::DLink(QObject *parent) : QObject(parent)
|
||||
//mavlink协议节点
|
||||
mavlinknode = new MavLinkNode();//不允许带参数,因为这是单独的线程
|
||||
connect(mavlinknode,SIGNAL(SendMessageTo(quint8,quint8*,quint16)),
|
||||
this,SLOT(SendMessageTo(quint8,quint8*,quint16)),Qt::DirectConnection);//采用直连的方式,因为是多线程
|
||||
this,SLOT(SendMessageTo(quint8,quint8*,quint16)),Qt::DirectConnection);//采用直连的方式,因为是多线程
|
||||
|
||||
//connect(mavlinknode,&MavLinkNode::SendMessageTo,
|
||||
// this,&DLink::SendMessageTo);
|
||||
|
||||
|
||||
connect(mavlinknode,SIGNAL(showMessage(QString,int)),
|
||||
this,SIGNAL(showMessage(QString,int)),Qt::DirectConnection);
|
||||
@@ -33,13 +37,15 @@ int DLink::SendMessageTo(quint8 ch, quint8 *msg, quint16 len)
|
||||
{
|
||||
Q_UNUSED(ch);
|
||||
|
||||
qDebug() << "发送数据";
|
||||
|
||||
if (DLink::Clientsock)
|
||||
{
|
||||
foreach(Node node,clientSockets)
|
||||
{
|
||||
DLink::Clientsock->writeDatagram((const char *)msg, len,
|
||||
node.addr, node.port);
|
||||
//qDebug() << "Client Send Msg";
|
||||
qDebug() << "Client Send Msg";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +69,8 @@ int DLink::SendMessageTo(quint8 ch, quint8 *msg, quint16 len)
|
||||
qDebug() << flag;
|
||||
//serialPort->write()
|
||||
|
||||
qDebug() << QThread::currentThread();
|
||||
|
||||
//qDebug() << "serialPort Send Msg" << msg;
|
||||
|
||||
}
|
||||
@@ -94,7 +102,11 @@ bool DLink::setupPort(const QString port, qint32 baudrate, QSerialPort::Parity p
|
||||
serialPort->setDataBits(QSerialPort::Data8);
|
||||
serialPort->setStopBits(QSerialPort::OneStop);
|
||||
|
||||
mavlinknode->start();
|
||||
DLink::serialPort->write("serial connet ok",16);
|
||||
|
||||
qDebug() << QThread::currentThread();
|
||||
|
||||
mavlinknode->start();//启动之后串口就找不到了
|
||||
|
||||
connect(serialPort, SIGNAL(readyRead()), this, SLOT(readPendingDatagramsSerialPort()));
|
||||
|
||||
@@ -204,6 +216,8 @@ bool DLink::setupClient(const QHostAddress &remote_addr, int remote_port, int lo
|
||||
Clientsock = new QUdpSocket(this);
|
||||
if (Clientsock->bind(QHostAddress::Any, local_port))
|
||||
{
|
||||
Clientsock->joinMulticastGroup(remote_addr);//加入组播
|
||||
|
||||
if(Clientsock->open(QIODevice::ReadWrite))
|
||||
{
|
||||
connect(Clientsock, SIGNAL(readyRead()),
|
||||
|
||||
+3
-1
@@ -42,6 +42,8 @@ public:
|
||||
|
||||
MavLinkNode *mavlinknode = nullptr;
|
||||
|
||||
int SendMessageTo(quint8 ch, quint8 *msg, quint16 len);
|
||||
|
||||
signals:
|
||||
void showMessage(const QString &message,int TimeOut = 0);
|
||||
|
||||
@@ -65,7 +67,7 @@ public slots:
|
||||
|
||||
void readPendingDatagramsClient(void);
|
||||
|
||||
int SendMessageTo(quint8 ch, quint8 *msg, quint16 len);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user