mirror of
https://github.com/x-tools-author/x-tools.git
synced 2025-09-15 15:28:40 +08:00
fix: message type error
This commit is contained in:
parent
43e64852e7
commit
76c69dea84
@ -9,6 +9,7 @@
|
|||||||
#include "xToolsWebSocketClientTool.h"
|
#include "xToolsWebSocketClientTool.h"
|
||||||
|
|
||||||
#include "xToolsCompatibility.h"
|
#include "xToolsCompatibility.h"
|
||||||
|
#include "xToolsDataStructure.h"
|
||||||
|
|
||||||
xToolsWebSocketClientTool::xToolsWebSocketClientTool(QObject *parent)
|
xToolsWebSocketClientTool::xToolsWebSocketClientTool(QObject *parent)
|
||||||
: xToolsSocketClientTool{parent}
|
: xToolsSocketClientTool{parent}
|
||||||
@ -87,7 +88,7 @@ void xToolsWebSocketClientTool::writeBytes(const QByteArray &bytes)
|
|||||||
qint64 ret = -1;
|
qint64 ret = -1;
|
||||||
QString hex;
|
QString hex;
|
||||||
|
|
||||||
if (m_messageType == 0) {
|
if (m_messageType == xToolsDataStructure::WebSocketSendingTypeBinary) {
|
||||||
hex = QString::fromLatin1(xToolsByteArrayToHex(bytes, ' '));
|
hex = QString::fromLatin1(xToolsByteArrayToHex(bytes, ' '));
|
||||||
ret = m_webSocket->sendBinaryMessage(bytes);
|
ret = m_webSocket->sendBinaryMessage(bytes);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
#include <QWebSocket>
|
#include <QWebSocket>
|
||||||
|
|
||||||
#include "xToolsCompatibility.h"
|
#include "xToolsCompatibility.h"
|
||||||
|
#include "xToolsDataStructure.h"
|
||||||
|
|
||||||
xToolsWebSocketServerTool::xToolsWebSocketServerTool(QObject *parent)
|
xToolsWebSocketServerTool::xToolsWebSocketServerTool(QObject *parent)
|
||||||
: xToolsSocketServerTool{parent}
|
: xToolsSocketServerTool{parent}
|
||||||
@ -116,7 +117,7 @@ void xToolsWebSocketServerTool::writeBytesInner(QWebSocket *client, const QByteA
|
|||||||
{
|
{
|
||||||
qint64 ret = -1;
|
qint64 ret = -1;
|
||||||
QString hex;
|
QString hex;
|
||||||
if (m_messageType == 0) {
|
if (m_messageType == xToolsDataStructure::WebSocketSendingTypeBinary) {
|
||||||
hex = QString::fromLatin1(xToolsByteArrayToHex(bytes, ' '));
|
hex = QString::fromLatin1(xToolsByteArrayToHex(bytes, ' '));
|
||||||
ret = client->sendBinaryMessage(bytes);
|
ret = client->sendBinaryMessage(bytes);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -85,6 +85,13 @@ void xToolsSocketClientToolUi::onBaseToolUiInitialized(xToolsBaseTool *tool,
|
|||||||
ui->labelUserName->hide();
|
ui->labelUserName->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tool->inherits("xToolsWebSocketClientTool")) {
|
||||||
|
ui->label->hide();
|
||||||
|
ui->label_2->hide();
|
||||||
|
ui->comboBoxClientAddress->hide();
|
||||||
|
ui->spinBoxClientPort->hide();
|
||||||
|
}
|
||||||
|
|
||||||
m_tool = qobject_cast<xToolsSocketClientTool *>(tool);
|
m_tool = qobject_cast<xToolsSocketClientTool *>(tool);
|
||||||
if (!m_tool) {
|
if (!m_tool) {
|
||||||
Q_ASSERT_X(m_tool, __FUNCTION__, "Invalid xToolsSocketClientTool object!");
|
Q_ASSERT_X(m_tool, __FUNCTION__, "Invalid xToolsSocketClientTool object!");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user