配置区超大,超出了数据流范围,只同步前16字节
This commit is contained in:
parent
5c808657b0
commit
995f12cf89
|
@ -336,6 +336,8 @@ void TinyClient::Report(Message& msg)
|
||||||
// 0x01子功能,主数据区
|
// 0x01子功能,主数据区
|
||||||
void TinyClient::ReportPing0x01(Stream& ms)
|
void TinyClient::ReportPing0x01(Stream& ms)
|
||||||
{
|
{
|
||||||
|
TS("TinyClient::ReportPing0x01");
|
||||||
|
|
||||||
byte len = Store.Data.Length() - 1;
|
byte len = Store.Data.Length() - 1;
|
||||||
if(ms.Position() + 3 + len > Control->Port->MaxSize) return;
|
if(ms.Position() + 3 + len > Control->Port->MaxSize) return;
|
||||||
|
|
||||||
|
@ -349,8 +351,11 @@ void TinyClient::ReportPing0x01(Stream& ms)
|
||||||
// 0x02子功能,配置区
|
// 0x02子功能,配置区
|
||||||
void TinyClient::ReportPing0x02(Stream& ms)
|
void TinyClient::ReportPing0x02(Stream& ms)
|
||||||
{
|
{
|
||||||
|
TS("TinyClient::ReportPing0x02");
|
||||||
|
|
||||||
byte len2 = sizeof(Cfg->Length);
|
byte len2 = sizeof(Cfg->Length);
|
||||||
byte len = Cfg->Length - len2;
|
byte len = Cfg->Length - len2;
|
||||||
|
if(len > 0x10) len = 0x10;
|
||||||
if(ms.Position() + 1 + len2 + 1 + len > Control->Port->MaxSize) return;
|
if(ms.Position() + 1 + len2 + 1 + len > Control->Port->MaxSize) return;
|
||||||
|
|
||||||
ms.Write((byte)0x02); // 子功能码
|
ms.Write((byte)0x02); // 子功能码
|
||||||
|
@ -363,6 +368,8 @@ void TinyClient::ReportPing0x02(Stream& ms)
|
||||||
// 0x03子功能,硬件校验码
|
// 0x03子功能,硬件校验码
|
||||||
void TinyClient::ReportPing0x03(Stream& ms)
|
void TinyClient::ReportPing0x03(Stream& ms)
|
||||||
{
|
{
|
||||||
|
TS("TinyClient::ReportPing0x03");
|
||||||
|
|
||||||
if(ms.Position() + 3 > Control->Port->MaxSize) return;
|
if(ms.Position() + 3 > Control->Port->MaxSize) return;
|
||||||
|
|
||||||
ms.Write((byte)0x03); // 子功能码
|
ms.Write((byte)0x03); // 子功能码
|
||||||
|
|
|
@ -14,29 +14,29 @@
|
||||||
struct TinyConfig
|
struct TinyConfig
|
||||||
{
|
{
|
||||||
byte Length; // 数据长度
|
byte Length; // 数据长度
|
||||||
|
|
||||||
byte OfflineTime;// 离线阀值时间。秒
|
byte OfflineTime;// 离线阀值时间。秒
|
||||||
byte SleepTime; // 睡眠时间。秒
|
byte SleepTime; // 睡眠时间。秒
|
||||||
byte PingTime; // 心跳时间。秒
|
byte PingTime; // 心跳时间。秒
|
||||||
char Name[8]; //设备名称
|
char Name[8]; //设备名称
|
||||||
|
|
||||||
ushort Kind; // 类型
|
ushort Kind; // 类型
|
||||||
byte Address; // 分配得到的设备地址
|
byte Address; // 分配得到的设备地址
|
||||||
byte Server; // 网关ID
|
byte Server; // 网关ID
|
||||||
byte Channel; // 通道
|
byte Channel; // 通道
|
||||||
ushort Speed; // 传输速度
|
ushort Speed; // 传输速度
|
||||||
byte HardVer; // 硬件版本
|
byte HardVer; // 硬件版本
|
||||||
byte SoftVer; // 软件版本
|
byte SoftVer; // 软件版本
|
||||||
|
|
||||||
byte Password[16]; // 通信密码
|
byte Password[16]; // 通信密码
|
||||||
byte ServerKey[16]; // 服务端组网密码,退网时使用。一般6字节
|
byte ServerKey[16]; // 服务端组网密码,退网时使用。一般6字节
|
||||||
|
|
||||||
|
|
||||||
//初始化,各字段为0
|
//初始化,各字段为0
|
||||||
//TinyConfig();
|
//TinyConfig();
|
||||||
//const TinyConfig& Default();
|
//const TinyConfig& Default();
|
||||||
byte StartSet;
|
byte StartSet;
|
||||||
|
|
||||||
void LoadDefault();
|
void LoadDefault();
|
||||||
|
|
||||||
void Load();
|
void Load();
|
||||||
|
|
Loading…
Reference in New Issue