using System;
using System.Collections.Generic;
using System.Text;
using ZigBee.Device;
namespace Shared.Phone.UserCenter
{
///
/// 设备硬件信息的逻辑
///
public class HdlDeviceHardInfoLogic
{
#region ■ 变量声明___________________________
///
/// 设备硬件信息的逻辑
///
private static HdlDeviceHardInfoLogic m_Current = null;
///
/// 设备硬件信息的逻辑
///
public static HdlDeviceHardInfoLogic Current
{
get
{
if (m_Current == null)
{
m_Current = new HdlDeviceHardInfoLogic();
}
return m_Current;
}
}
#endregion
#region ■ 主入口函数_________________________
///
/// 读取以及设置设备硬件信息
///
/// 设备回路
/// 回调函数
public void SetAllHardFirmwareInfoToDevice(CommonDevice device)
{
if (device == null)
{
return;
}
var jObject = new Newtonsoft.Json.Linq.JObject
{
{ "DeviceAddr",device.DeviceAddr },
{ "Epoint", device.DeviceEpoint },
{ "Cluster_ID", (int)Cluster_ID.Basic },
{ "Command", 108 }
};
var attriBute = new Newtonsoft.Json.Linq.JArray
{
new Newtonsoft.Json.Linq.JObject
{
{ "AttriButeId", 4}//生产商名字
},
new Newtonsoft.Json.Linq.JObject
{
{ "AttriButeId", 5}//型号码(也叫模块ID)
},
new Newtonsoft.Json.Linq.JObject
{
{ "AttriButeId", 6}//生产日期
},
new Newtonsoft.Json.Linq.JObject
{
{ "AttriButeId", 7}//电源
},
new Newtonsoft.Json.Linq.JObject
{
{ "AttriButeId", 13}//序列号
}
};
var data = new Newtonsoft.Json.Linq.JObject { { "AttriBute", attriBute } };
jObject.Add("Data", data);
device.Gateway?.Send(("GetDeviceStatus"), jObject.ToString());
}
#endregion
}
}