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