改进部分代码
This commit is contained in:
@@ -42,11 +42,11 @@ void WebClient::textFrameReceived(const QString &data, bool isLastFrame)
|
||||
emit receiveData(ip, port, buffer);
|
||||
|
||||
//自动回复数据,可以回复的数据是以;隔开,每行可以带多个;所以这里不需要继续判断
|
||||
if (App::DebugWebServer) {
|
||||
int count = App::Keys.count();
|
||||
if (AppConfig::DebugWebServer) {
|
||||
int count = AppConfig::Keys.count();
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (App::Keys.at(i) == buffer) {
|
||||
sendData(App::Values.at(i));
|
||||
if (AppConfig::Keys.at(i) == buffer) {
|
||||
sendData(AppConfig::Values.at(i));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ void WebClient::textFrameReceived(const QString &data, bool isLastFrame)
|
||||
void WebClient::binaryFrameReceived(const QByteArray &data, bool isLastFrame)
|
||||
{
|
||||
QString buffer;
|
||||
if (App::HexReceiveWebClient) {
|
||||
if (AppConfig::HexReceiveWebClient) {
|
||||
buffer = QUIHelper::byteArrayToHexStr(data);
|
||||
} else {
|
||||
buffer = QString(data);
|
||||
@@ -78,13 +78,13 @@ void WebClient::binaryMessageReceived(const QByteArray &data)
|
||||
void WebClient::sendData(const QString &data)
|
||||
{
|
||||
QByteArray buffer;
|
||||
if (App::HexSendWebServer) {
|
||||
if (AppConfig::HexSendWebServer) {
|
||||
buffer = QUIHelper::hexStrToByteArray(data);
|
||||
} else {
|
||||
buffer = data.toUtf8();
|
||||
}
|
||||
|
||||
if (App::AsciiWebServer) {
|
||||
if (AppConfig::AsciiWebServer) {
|
||||
socket->sendTextMessage(data);
|
||||
} else {
|
||||
socket->sendBinaryMessage(buffer);
|
||||
|
||||
Reference in New Issue
Block a user