黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
 
namespace ZigBee.Device
{
    [System.Serializable]
    public class BindObj : CommonDevice
    {
        #region 设备绑定
 
        [System.Serializable]
        public class AddedDeviceBindResponseAllData : ErrorResponCommon
        {
            /// <summary>
            /// 网关直接反馈绑定设备信息
            /// </summary>
            public AddedDeviceBindResponseData addedDeviceBindResponseData;
        }
 
        [System.Serializable]
        public class AddedDeviceSingleBindResponseAllData : ErrorResponCommon
        {
            /// <summary>
            /// 网关直接反馈绑定设备信息
            /// </summary>
            public AddedDeviceSingleBindResponseData addedDeviceSingleBindResponseData;
        }
 
        [System.Serializable]
        public class AddedDeviceBindResponseData
        {
            /// <summary>
            ///绑定名称
            /// </summary>
            public string BindName;
            /// <summary>
            ///绑定列表 ,当Status=0时存在
            /// </summary>
            public List<BindListResponseObj> BindList = new List<BindListResponseObj>();
            /// <summary>
            /// 0:绑定所有目标成功
            ///<para>1:绑定目标失败,绑定设备目标有漏掉</para> 
            /// </summary>
            public int Result = -1;
        }
 
        [System.Serializable]
        public class AddedDeviceSingleBindResponseData
        {
            /// <summary>
            /// 控制设备节点的mac地址
            /// </summary>
            public string DeviceAddr;
            /// <summary>
            /// 控制设备节点的端口号 
            /// </summary>
            public int Epoint;
            /// <summary>
            ///绑定名称
            /// </summary>
            public string BindName;
            /// <summary>
            /// 0:成功,针对场景和跨网关绑定 
            ///<para>1:失败,节点设备或场景不存在。</para>
            ///<para>2:同网关设备绑定,等待控制源设备写入反馈结果;以下面主题结果为准</para> 
            /// </summary>
            public int Result = -1;
            /// <summary>
            /// 绑定类型
            ///<para>0:绑定设备 </para>
            ///<para>1:绑定场景</para>
            /// </summary>
            public int BindType;
            /// <summary>
            ///绑定的cluster数组
            /// </summary>
            public List<int> BindClusterList = new List<int>();
            /// <summary>
            /// 绑定设备Mac地址, 当BindType=0时存在
            /// </summary>
            public string BindMacAddr;
            /// <summary>
            /// 绑定设备的端口号,当BindType=0时存在
            /// </summary>
            public int BindEpoint;
            /// <summary>
            /// 绑定场景,当BindType=2时存在
            /// </summary>
            public int BindScenesId;
            /// <summary>
            ///绑定的设备或场景的名称
            /// </summary>
            public string ESName;
        }
 
 
        /// <summary>
        /// 绑定列表的信息
        /// </summary>
        [System.Serializable]
        public class AddBindListResponseObj : BindListResponseObj
        {
            /// <summary>
            /// 0:加入成功(该状态只适用用于跨网关绑定和绑定场景。同网关设备间的绑定需要节点设备的确认成功信息,不会直接反馈成功。)
            ///<para>1:失败,节点设备或场景不存在。</para>
            ///<para>2:未知,由节点设备反馈发送“Bind/BindResult”主题消息确定是否成功。</para>
            ///<para>3:绑定已经存在。</para>
            /// </summary>
            public int Result;
        }
 
        /// <summary>
        /// 按键设备的确认的信息
        /// </summary>
        [System.Serializable]
        public class AddBindResultResponseData
        {
            /// <summary>
            ///绑定结果
            ///<para>0:成功</para>
            ///<para>140:失败,控制设备的绑定列表已满</para>
            ///<para>其他:失败</para>
            /// </summary>
            public int Result;
            /// <summary>
            /// 绑定的cluster
            /// </summary>
            public int BindCluster;
            /// <summary>
            /// 绑定设备Mac地址, 当BindType=0时存在
            /// </summary>
            public string BindMacAddr;
            /// <summary>
            /// 绑定设备的端口号,当BindType=0时存在
            /// </summary>
            public int BindEpoint;
            /// <summary>
            /// 绑定场景,当BindType=2时存在
            /// </summary>
            public int BindScenesId;
            /// <summary>
            /// 绑定设备的名称
            /// </summary>
            public string DeviceName;
        }
 
        /// <summary>
        /// 绑定设备的数据
        /// </summary>
        [System.Serializable]
        public class AddBindData
        {
            /// <summary>
            /// 控制设备节点的mac地址
            /// </summary>
            public string DeviceAddr;
            /// <summary>
            /// 错误信息
            /// </summary>
            public int Epoint;
            /// <summary>
            ///绑定名称,不修改名称时忽略该选项
            /// </summary>
            public string BindName;
            /// <summary>
            ///绑定列表,不修改绑定列表时忽略该选项。
            /// </summary>
            public List<AddBindListObj> BindList = new List<AddBindListObj>();
        }
 
        /// <summary>
        /// 控制设备绑定的信息
        /// </summary>
        [System.Serializable]
        public class AddBindListObj
        {
            /// <summary>
            /// 绑定类型
            ///<para>0:绑定设备 </para>
            ///<para>1:绑定场景</para>
            /// </summary>
            public int BindType;
            /// <summary>
            /// 绑定的cluster,需要控制设备的OutCluster列表中存在该cluster。
            ///如绑定某个设备的on/off,为6。
            /// </summary>
            public int BindCluster;
            /// <summary>
            /// 绑定设备Mac地址, 当BindType=0时存在
            /// </summary>
            public string BindMacAddr;
            /// <summary>
            /// 绑定设备的端口号,当BindType=0时存在
            /// </summary>
            public int BindEpoint;
            /// <summary>
            /// 绑定场景,当BindType=1时存在
            /// </summary>
            public int BindScenesId;
        }
 
        /// <summary>
        /// 单个设备的数据
        /// </summary>
        [System.Serializable]
        public class AddSingleBindData
        {
            /// <summary>
            /// 控制设备节点的mac地址
            /// </summary>
            public string DeviceAddr;
            /// <summary>
            /// 错误信息
            /// </summary>
            public int Epoint;
            /// <summary>
            ///绑定名称,不修改名称时忽略该选项
            /// </summary>
            public string BindName;
            /// <summary>
            /// 绑定类型
            ///<para>0:绑定设备 </para>
            ///<para>1:绑定场景</para>
            /// </summary>
            public int BindType;
            /// <summary>
            ///绑定的clusters数组,需要控制设备的OutCluster列表中存在该cluster。如绑定某个设备的on/off,为6。如绑定场景,填族Id为6
            /// </summary>
            public List<int> BindClusterList = new List<int>();
            /// <summary>
            /// 绑定设备Mac地址, 当BindType=0时存在
            /// </summary>
            public string BindMacAddr;
            /// <summary>
            /// 绑定设备的端口号,当BindType=0时存在
            /// </summary>
            public int BindEpoint;
            /// <summary>
            /// 绑定场景,当BindType=1时存在
            /// </summary>
            public int BindScenesId;
 
        }
 
        #endregion
 
        #region 解除绑定
 
        /// <summary>
        ///解除绑定数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class DelDeviceBindResponseAllData : ErrorResponCommon
        {
            /// <summary>
            /// 解除绑定数据信息
            /// </summary>
            public DelDeviceBindResponseData delDeviceBindResponseData;
 
            /// <summary>
            /// 解除绑定按键确认数据信息
            /// </summary>
            public RemoveBindResultResponseData removeBindResultResponseData;
        }
 
        /// <summary>
        /// 解除绑定数据
        /// </summary>
        [System.Serializable]
        public class DelDeviceBindResponseData
        {
            /// <summary>
            ///绑定列表 ,当Status=0时存在
            /// </summary>
            public List<RemoveBindListResponseObj> RemoveBindList = new List<RemoveBindListResponseObj>();
        }
 
        /// <summary>
        /// 移除设备绑定的信息
        /// </summary>
        [System.Serializable]
        public class RemoveBindListResponseObj : BindListResponseObj
        {
            /// <summary>
            /// 0:移除成功(该状态只适用用于跨网关绑定、绑定场景、失效设备(设备已经从网关的设备列表中删除)。同网关设备间的解除绑定需要节点设备的确认成功信息,不会直接反馈成功。)
            ///<para>1:失败,设备不在绑定列表中</para>
            ///<para>3:失败,在等待节点设备确认是否解除绑定成功(当网关还在等待某节点设备确认是否解除绑定成功的反馈信息时,客户端再次发送解除绑定该节点设备的指令,将反馈该状态。)</para>
            ///<para>2:未知,由节点设备反馈发送“Bind/RemoveBindResult”主题消息确定是否成功。</para>
            /// </summary>
            public int Result;
 
        }
 
        /// <summary>
        /// 移除设备绑定按键确认的信息
        /// </summary>
        [System.Serializable]
        public class RemoveBindResultResponseData
        {
            /// <summary>
            ///绑定结果
            ///<para>0:成功</para>
            ///<para>136:控制设备本地绑定列表中无此绑定</para>
            ///<para>其他:失败</para>
            /// </summary>
            public int Result;
 
            /// <summary>
            /// 绑定设备Mac地址
            /// </summary>
            public string BindMacAddr;
            /// <summary>
            /// 绑定设备的端口号
            /// </summary>
            public int BindEpoint;
            /// <summary>
            /// 绑定的cluster
            /// </summary>
            public int BindCluster;
            /// <summary>
            /// 绑定设备名称
            /// </summary>
            public string DeviceName;
        }
 
        /// <summary>
        /// 解除绑定数据
        /// </summary>
        [System.Serializable]
        public class DelDeviceBindData
        {
            /// <summary>
            /// 控制设备节点的mac地址
            /// </summary>
            public string DeviceAddr;
            /// <summary>
            /// 错误信息
            /// </summary>
            public int Epoint;
            /// <summary>
            ///绑定列表 ,当Status=0时存在
            /// </summary>
            public List<RemoveBindListObj> RemoveBindList = new List<RemoveBindListObj>();
        }
 
        /// <summary>
        /// 移除设备绑定的信息
        /// </summary>
        [System.Serializable]
        public class RemoveBindListObj
        {
 
            /// <summary>
            /// 绑定类型
            ///<para>0:移除设备 </para>
            ///<para>1:移除场景</para>
            /// </summary>
            public int BindType;
            /// <summary>
            /// 绑定的cluster
            /// </summary>
            public int BindCluster;
            /// <summary>
            /// 绑定设备Mac地址, 当BindType=0时存在
            /// </summary>
            public string BindMacAddr;
            /// <summary>
            /// 绑定设备的端口号,当BindType=0时存在
            /// </summary>
            public int BindEpoint;
            /// <summary>
            /// 绑定场景,当BindType=1时存在
            /// </summary>
            public int BindScenesId;
        }
        #endregion
 
        #region (从网关中)获取所有绑定
 
        /// <summary>
        ///获取所有绑定数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class GetDeviceBindResponseAllData : ErrorResponCommon
        {
            /// <summary>
            /// 控制设备绑定的设备列表回复数据
            /// </summary>
            public GetDeviceBindResponseData getAllBindResponseData;
        }
 
        /// <summary>
        /// 获取所有绑定回复的数据
        /// </summary>
        [System.Serializable]
        public class GetDeviceBindResponseData
        {
            /// <summary>
            /// 0:成功
            ///<para>1:绑定不存在</para>
            /// </summary>
            public int Result;
            /// <summary>
            /// 绑定列表 ,当Status=0时存在。
            /// </summary>
            public List<BindListResponseObj> BindList = new List<BindListResponseObj>();
        }
 
        /// <summary>
        /// 获取所有绑定的信息
        /// </summary>
        public class BindListResponseObj
        {
            /// <summary>
            /// 绑定类型
            ///<para>0:同网关设备</para>
            ///<para>1:跨网关设备间</para>
            ///<para>2:场景</para>
            /// </summary>
            public int BindType;
            /// <summary>
            /// 绑定的cluster
            /// </summary>
            public int BindCluster;
            /// <summary>
            /// 绑定设备Mac地址, 当BindType=0时存在
            /// </summary>
            public string BindMacAddr;
            /// <summary>
            /// 绑定设备的端口号,当BindType=0时存在
            /// </summary>
            public int BindEpoint;
            /// <summary>
            /// 绑定场景,当BindType=1时存在
            /// </summary>
            public int BindScenesId;
        }
 
        /// <summary>
        /// 获取所有绑定的信息
        /// </summary>
        public class BindListAllInfo
        {
            /// <summary>
            /// 控制源设备Mac地址
            /// </summary>
            public string KeyMacAddr;
            /// <summary>
            /// 控制源设备的端口号
            /// </summary>
            public int KeyEpoint;
            /// <summary>
            /// 绑定类型
            ///<para>0:同网关设备</para>
            ///<para>1:跨网关设备间</para>
            ///<para>2:场景</para>
            /// </summary>
            public int BindType;
            /// <summary>
            /// 绑定的cluster
            /// </summary>
            public int BindCluster;
            /// <summary>
            /// 绑定设备Mac地址, 当BindType=0时存在
            /// </summary>
            public string BindMacAddr;
            /// <summary>
            /// 绑定设备的端口号,当BindType=0时存在
            /// </summary>
            public int BindEpoint;
            /// <summary>
            /// 绑定场景,当BindType=1时存在
            /// </summary>
            public int BindScenesId;
            /// <summary>
            /// 绑定的设备或场景名称
            /// </summary>
            public string ESName;
        }
 
        /// <summary>
        /// 获取面板绑定回复的数据【通过mac获取的回复]
        /// </summary>
        [System.Serializable]
        public class GetPanelBindResponseDataByMac
        {
            /// <summary>
            /// 0:成功
            ///<para>1:绑定不存在</para>
            /// </summary>
            public int Result;
            /// <summary>
            /// MaxNumItems
            /// </summary>
            public int MaxNumItems;
            /// <summary>
            /// StartIndex
            /// </summary>
            public int StartIndex;
            /// <summary>
            /// ReturnBindNum
            /// </summary>
            public int ReturnBindNum;
            /// <summary>
            /// 绑定列表 ,当Status=0时存在。
            /// </summary>
            public List<BindDeviceByMacObj> BindList = new List<BindDeviceByMacObj>();
        }
 
        /// <summary>
        /// 获取面板绑定回复的数据【通过mac获取的回复]
        /// </summary>
        public class BindDeviceByMacObj
        {
            /// <summary>
            /// ControllerEpoint
            /// </summary>
            public int ControllerEpoint;
            /// <summary>
            /// 绑定的cluster
            /// </summary>
            public int BindCluster;
            /// <summary>
            /// 绑定设备Mac地址, 当BindType=0时存在
            /// </summary>
            public string BindMacAddr;
            /// <summary>
            /// 绑定设备的端口号,当BindType=0时存在
            /// </summary>
            public int BindEpoint;
            /// <summary>
            /// BindMode
            /// </summary>
            public int BindMode;
        }
        #endregion
 
        #region 从节点设备本地记录读取绑定列表信息
 
        /// <summary>
        ///从节点设备本地记录读取绑定列表信息回复的数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class GetDeviceLocalBindResponseAllData : ErrorResponCommon
        {
            /// <summary>
            /// 从节点设备本地记录读取绑定列表信息回复的数据
            /// </summary>
            public GetDeviceLocalBindResponseData getDeviceLocalBindResponseData;
        }
 
        /// <summary>
        /// 从节点设备本地记录读取绑定列表信息回复的数据
        /// </summary>
        [System.Serializable]
        public class GetDeviceLocalBindResponseData
        {
            /// <summary>
            /// 0:成功
            ///<para>181:失败</para>
            /// </summary>
            public int Result;
            /// <summary>
            /// 该设备一共有多少个绑定列表
            /// </summary>
            public int MaxNumItems;
            /// <summary>
            ///开始索引号
            /// </summary>
            public int StartIndex;
            /// <summary>
            /// 该次读取返回绑定列表个数
            /// </summary>
            public int ReturnBindNum;
            /// <summary>
            /// 绑定列表,当Result=0时存在
            /// </summary>
            public List<BindDeviceLocalListResponseObj> BindList = new List<BindDeviceLocalListResponseObj>();
        }
 
        /// <summary>
        /// 从节点设备本地记录读取绑定列表的信息
        /// </summary>
        public class BindDeviceLocalListResponseObj
        {
            /// <summary>
            /// 绑定类型
            ///<para>0x01:绑定组(暂没用到组绑定,可忽略)</para>
            ///<para>0x03:绑定设备</para>
            /// </summary>
            public int BindMode;
            /// <summary>
            /// 控制设备的端口号
            /// </summary>
            public int ControllerEpoint;
            /// <summary>
            /// 绑定的cluster
            /// </summary>
            public int BindCluster;
            /// <summary>
            /// 绑定的组(暂没用到组绑定,可忽略)。当BindMode为1时存在
            /// </summary>
            public int GroupId;
            /// <summary>
            /// 绑定设备Mac地址, 当BindMode为3时存在
            /// </summary>
            public string BindMacAddr;
            /// <summary>
            /// 绑定设备的端口号,当BindMode 为3时存在
            /// </summary>
            public int BindEpoint;
        }
        #endregion
 
        #region 删除一个控制设备所有绑定信息
 
        /// <summary>
        ///删除一个控制设备所有绑定数据,网关反馈信息
        /// </summary>
        [System.Serializable]
        public class ClearBindInfoResponseAllData : ErrorResponCommon
        {
            /// <summary>
            /// 控制设备绑定的设备列表回复数据
            /// </summary>
            public ClearBindInfoResponseData clearBindInfoResponseData;
        }
 
        /// <summary>
        /// 删除一个控制设备所有绑定信息回复的数据
        /// </summary>
        [System.Serializable]
        public class ClearBindInfoResponseData
        {
            /// <summary>
            /// 0:成功
            ///<para>1:绑定信息不存在</para>
            /// </summary>
            public int Result;
        }
 
        #endregion
    }
}