更新DeviceManage.dll
This commit is contained in:
parent
a78c30fdee
commit
e3b44605b3
BIN
3rdlib/DeviceManage/bin/DeviceManage.dll
Normal file
BIN
3rdlib/DeviceManage/bin/DeviceManage.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -14,13 +14,14 @@ MeasureTask::MeasureTask(int socketDescriptor, QObject *parent)
|
|||
|
||||
void MeasureTask::run()
|
||||
{
|
||||
QTcpSocket tcpSocket;
|
||||
if (!tcpSocket.setSocketDescriptor(socketDescriptor)) {
|
||||
QTcpSocket tcp_socket;
|
||||
if (!tcp_socket.setSocketDescriptor(socketDescriptor)) {
|
||||
emit errorOccurred(tcp_socket.errorString());
|
||||
return;
|
||||
}
|
||||
QByteArray buffer;
|
||||
while (tcpSocket.waitForReadyRead(500)) {
|
||||
buffer.append(tcpSocket.readAll());
|
||||
while (tcp_socket.waitForReadyRead(500)) {
|
||||
buffer.append(tcp_socket.readAll());
|
||||
}
|
||||
if ( buffer.size() ) {
|
||||
QDataStream requst_data_stream(buffer);
|
||||
|
|
@ -28,32 +29,32 @@ void MeasureTask::run()
|
|||
requst_data_stream >> cmd_type >> device_guid;
|
||||
if ( cmd_type == "START" ) {
|
||||
requst_data_stream >> cmd_data;
|
||||
processStartMeasureCmd(&tcpSocket, device_guid, cmd_data);
|
||||
processStartMeasureCmd(&tcp_socket, device_guid, cmd_data);
|
||||
} else if (cmd_type == "STOP") {
|
||||
processStopMeasureCmd(&tcpSocket, device_guid);
|
||||
processStopMeasureCmd(&tcp_socket, device_guid);
|
||||
} else if (cmd_type == "SET") {
|
||||
requst_data_stream >> cmd_data;
|
||||
processSetDeviceMeasureConfigParamsCmd(&tcpSocket, device_guid, cmd_data);
|
||||
processSetDeviceMeasureConfigParamsCmd(&tcp_socket, device_guid, cmd_data);
|
||||
} else if (cmd_type == "CLEAR") {
|
||||
processClearDataCmd(&tcpSocket, device_guid);
|
||||
processClearDataCmd(&tcp_socket, device_guid);
|
||||
} else if (cmd_type == "DEVICE") {
|
||||
processGetMeasureDeviceListCmd(&tcpSocket);
|
||||
processGetMeasureDeviceListCmd(&tcp_socket);
|
||||
} else {
|
||||
QByteArray replay_data;
|
||||
QDataStream replay_data_stream(replay_data);
|
||||
replay_data_stream << QString("UNKNOW") << false << QStringLiteral(u"未知请求");
|
||||
tcpSocket.write(replay_data);
|
||||
tcpSocket.flush();
|
||||
tcp_socket.write(replay_data);
|
||||
tcp_socket.flush();
|
||||
}
|
||||
} else {
|
||||
QByteArray replay_data;
|
||||
QDataStream replay_data_stream(replay_data);
|
||||
replay_data_stream << QString("UNKNOW") << false << QStringLiteral(u"未知请求");
|
||||
tcpSocket.write(replay_data);
|
||||
tcpSocket.flush();
|
||||
tcp_socket.write(replay_data);
|
||||
tcp_socket.flush();
|
||||
}
|
||||
tcpSocket.disconnectFromHost();
|
||||
tcpSocket.waitForDisconnected(1000);
|
||||
tcp_socket.disconnectFromHost();
|
||||
tcp_socket.waitForDisconnected(1000);
|
||||
}
|
||||
|
||||
void MeasureTask::processStartMeasureCmd(QTcpSocket* socket, const QString &device_guid, const QString &cmd_data)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ private:
|
|||
void processGetMeasureDeviceListCmd(QTcpSocket* socket);
|
||||
|
||||
signals:
|
||||
void error(QTcpSocket::SocketError socketError);
|
||||
void errorOccurred(const QString &errorString);
|
||||
|
||||
private:
|
||||
int socketDescriptor;
|
||||
|
|
|
|||
|
|
@ -24,11 +24,13 @@ SOURCES += \
|
|||
$${PWD}/MeasureServer.cpp \
|
||||
$${PWD}/MeasureTask.cpp \
|
||||
$${PWD}/main.cpp \
|
||||
MeasureClient.cpp \
|
||||
MeasureDeviceController.cpp
|
||||
|
||||
HEADERS += \
|
||||
$${PWD}/MeasureServer.h \
|
||||
$${PWD}/MeasureTask.h \
|
||||
MeasureClient.h \
|
||||
MeasureDeviceController.h
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user