| | |
| | | else if (strData == "#DeviceInfo END#")
|
| | | {
|
| | | //反序列化设备
|
| | | var device = CommonDevice.CommonDeviceByByteString(deviceType, this.strTempContentData);
|
| | | CommonDevice device = null;
|
| | | if (HdlCheckLogic.Current.CheckIsNumber(deviceType) == true)
|
| | | {
|
| | | //数值型为新数据,直接转换
|
| | | device = CommonDevice.CommonDeviceByByteString(Convert.ToInt32(deviceType), this.strTempContentData);
|
| | | }
|
| | | else
|
| | | {
|
| | | //字符串型为旧数据,需要特殊处理
|
| | | var myType = (DeviceType)Enum.Parse(typeof(DeviceType), deviceType);
|
| | | device = CommonDevice.CommonDeviceByByteString((int)myType, this.strTempContentData);
|
| | | }
|
| | | if (device != null)
|
| | | {
|
| | | if (this.modelData.dicDeviceInfo.ContainsKey(device.DeviceAddr) == false)
|
| | |
| | | foreach (var device in listDevice)
|
| | | {
|
| | | //设备端点
|
| | | writeText += "#DeviceInfo START#" + device.Type.ToString() + "\r\n";
|
| | | writeText += "#DeviceInfo START#" + (int)device.Type + "\r\n";
|
| | | string dataInfo = Newtonsoft.Json.JsonConvert.SerializeObject(device);
|
| | | writeText += dataInfo + "\r\n";
|
| | | writeText += "#DeviceInfo END#\r\n\r\n";
|
| | |
| | | var otaDevice = Common.LocalDevice.Current.GetOTADevice(device.DeviceAddr);
|
| | | if (otaDevice != null)
|
| | | {
|
| | | writeText += "#DeviceInfo START#" + otaDevice.Type.ToString() + "\r\n";
|
| | | writeText += "#DeviceInfo START#" + (int)otaDevice.Type + "\r\n";
|
| | | string dataInfo2 = Newtonsoft.Json.JsonConvert.SerializeObject(otaDevice);
|
| | | writeText += dataInfo2 + "\r\n";
|
| | | writeText += "#DeviceInfo END#\r\n\r\n";
|