🐞 fix(软总线): 暂时不处理未知类型

发现未知类型设备不处理设备信息
This commit is contained in:
huheng@kylinos.cn 2023-05-25 16:13:07 +08:00
parent e1a21fbafe
commit 844e1e45c7
1 changed files with 55 additions and 55 deletions

View File

@ -10,8 +10,7 @@
#include "generatetools.h" #include "generatetools.h"
#include "unix-util.h" #include "unix-util.h"
namespace KDiscovery namespace KDiscovery {
{
const char *SERVER_UNIX_SOCKET_ADDR = "/tmp/kylin.deviceDiscover.socket"; const char *SERVER_UNIX_SOCKET_ADDR = "/tmp/kylin.deviceDiscover.socket";
const int BUF_LEN = 1024; const int BUF_LEN = 1024;
@ -81,69 +80,70 @@ void Discovery::getDeviceInfo(char *buf, qint64 len)
} }
switch (value) { switch (value) {
case DEVICE_INFO: {
case DEVICE_INFO: { {
char value[128];
{ int length = 128;
char value[128]; if (!parsedBox.GetUuidValue(DEVICE_UUID, value, length)) {
int length = 128; qWarning() << "GetUuidValue Failed !\n";
if (!parsedBox.GetUuidValue(DEVICE_UUID, value, length)) { return;
qWarning() << "GetUuidValue Failed !\n"; }
return; qInfo() << "GetUuidValue Success " << value;
m_uuid = value;
} }
qInfo() << "GetUuidValue Success " << value;
m_uuid = value;
}
{ {
int value; int value;
if (!parsedBox.GetDevTypeValue(DEVICE_TYPE, value)) { if (!parsedBox.GetDevTypeValue(DEVICE_TYPE, value)) {
qWarning() << "GetDevTypeValue Failed !\n"; qWarning() << "GetDevTypeValue Failed !\n";
return; return;
}
qInfo() << "GetDevTypeValue Success " << value;
if (value != KCommon::DeviceType::PC || value != KCommon::DeviceType::Phone) {
return;
}
m_devType = value;
} }
qInfo() << "GetDevTypeValue Success " << value;
m_devType = value;
}
{ {
char value[128]; char value[128];
int length = 128; int length = 128;
if (!parsedBox.GetDevNameValue(DEVICE_NAME, value, length)) { if (!parsedBox.GetDevNameValue(DEVICE_NAME, value, length)) {
qWarning() << "GetDevNameValue Failed !\n"; qWarning() << "GetDevNameValue Failed !\n";
return; return;
}
qInfo() << "GetDevNameValue Success " << value;
m_deviceName = value;
} }
qInfo() << "GetDevNameValue Success " << value;
m_deviceName = value;
}
{ {
char value[128]; char value[128];
int length = 128; int length = 128;
if (!parsedBox.GetDevIpValue(DEVICE_IP, value, length)) { if (!parsedBox.GetDevIpValue(DEVICE_IP, value, length)) {
qWarning() << "GetDevIpValue Failed !\n"; qWarning() << "GetDevIpValue Failed !\n";
return; return;
}
qInfo() << "GetDevIpValue Success " << value;
m_clientIp = value;
} }
qInfo() << "GetDevIpValue Success " << value;
m_clientIp = value;
}
{ {
int value; int value;
if (!parsedBox.GetDevPortValue(DEVICE_PORT, value)) { if (!parsedBox.GetDevPortValue(DEVICE_PORT, value)) {
qWarning() << "GetDevPortValue Failed !\n"; qWarning() << "GetDevPortValue Failed !\n";
return; return;
}
qInfo() << "GetDevPortValue Success " << value;
m_clientport = value;
} }
qInfo() << "GetDevPortValue Success " << value;
m_clientport = value;
}
if (!m_currentDeviceIpList.contains(m_clientIp)) { if (!m_currentDeviceIpList.contains(m_clientIp)) {
getClientInfo(); getClientInfo();
}
break;
} }
break; default:
} break;
default:
break;
} }
} }
@ -189,4 +189,4 @@ void Discovery::sendRequest(RequestType type)
} }
} }
} // namespace KDiscovery } // namespace KDiscovery