HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-12-31 fe3b2466c68b5db70d38e78039703add3b8b1dfe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
using System;
using System.Collections.Generic;
using System.Text;
using ZigBee.Device;
 
namespace Shared.Phone.UserCenter
{
    /// <summary>
    /// 设备硬件信息的逻辑
    /// </summary>
    public class HdlDeviceHardInfoLogic
    {
        #region ■ 变量声明___________________________
 
        /// <summary>
        /// 设备硬件信息的逻辑
        /// </summary>
        private static HdlDeviceHardInfoLogic m_Current = null;
        /// <summary>
        /// 设备硬件信息的逻辑
        /// </summary>
        public static HdlDeviceHardInfoLogic Current
        {
            get
            {
                if (m_Current == null)
                {
                    m_Current = new HdlDeviceHardInfoLogic();
                }
                return m_Current;
            }
        }
 
        #endregion
 
        #region ■ 主入口函数_________________________
 
        /// <summary>
        /// 读取以及设置设备硬件信息
        /// </summary>
        /// <param name="device">设备回路</param>
        /// <param name="backAction">回调函数</param>
        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
    }
}