添加定时输出设备列表,精简设备列表输出数据
This commit is contained in:
parent
b413ea19c5
commit
f9caf25c4f
|
@ -95,6 +95,10 @@ void Device::Load(Stream& ms)
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
String& Device::ToStr(String& str) const
|
String& Device::ToStr(String& str) const
|
||||||
{
|
{
|
||||||
|
str = str + "Addr=0x" + Address;
|
||||||
|
str = str + " Kind=" + (byte)(Kind >> 8) + (byte)(Kind & 0xFF);
|
||||||
|
str = str + " ID=" + HardID;
|
||||||
|
/*
|
||||||
str = str + "Address=0x" + Address;
|
str = str + "Address=0x" + Address;
|
||||||
str = str + " Kind=" + (byte)(Kind >> 8) + (byte)(Kind & 0xFF);
|
str = str + " Kind=" + (byte)(Kind >> 8) + (byte)(Kind & 0xFF);
|
||||||
str = str + " Name=" + Name;
|
str = str + " Name=" + Name;
|
||||||
|
@ -106,7 +110,7 @@ String& Device::ToStr(String& str) const
|
||||||
|
|
||||||
str = str + " DataSize=" + DataSize;
|
str = str + " DataSize=" + DataSize;
|
||||||
str = str + " ConfigSize=" + ConfigSize;
|
str = str + " ConfigSize=" + ConfigSize;
|
||||||
|
*/
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -60,6 +60,9 @@ void TinyServer::Start()
|
||||||
|
|
||||||
//LoadConfig();
|
//LoadConfig();
|
||||||
LoadDevices();
|
LoadDevices();
|
||||||
|
#if DEBUG
|
||||||
|
Sys.AddTask(DeviceShow,& Devices,1000,60000,"节点列表");
|
||||||
|
#endif
|
||||||
|
|
||||||
Control->Open();
|
Control->Open();
|
||||||
}
|
}
|
||||||
|
@ -686,3 +689,19 @@ void TinyServer::ClearConfig()
|
||||||
delete Devices[i];
|
delete Devices[i];
|
||||||
Devices.SetLength(0);
|
Devices.SetLength(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
// 输出所有设备
|
||||||
|
void TinyServer::DeviceShow(void * param)
|
||||||
|
{
|
||||||
|
TArray<Device*> &dv = *(TArray<Device*> *) param;
|
||||||
|
byte len = dv.Length();
|
||||||
|
debug_printf("\r\n\r\n 节点列表 \r\n");
|
||||||
|
for(int i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
(*dv[i]).Show();
|
||||||
|
debug_printf("\r\n");
|
||||||
|
}
|
||||||
|
debug_printf("\r\n\r\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -75,6 +75,11 @@ public:
|
||||||
|
|
||||||
// 写入
|
// 写入
|
||||||
bool OnWrite(TinyMessage& msg, Device& dv);
|
bool OnWrite(TinyMessage& msg, Device& dv);
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
// 输出所有设备
|
||||||
|
static void DeviceShow(void * param);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue