Welcome to mirror list, hosted at ThFree Co, Russian Federation.

zcl.ias_ace.h « security « zcl « include « stack « zigbee « STM32_WPAN « ST « Middlewares - github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8ca097a694f5bf2912253849017e280dafda3528 (plain)
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
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
/**
 * @file zcl.ias_ace.h
 * @heading IAS ACE
 * @brief ZCL Intruder Alarm Systems Ancillary Control Equipment cluster header
 * ZCL 7 section 8.3
 * ZCL 8 section 8.3
 * @copyright Copyright [2009 - 2020] Exegin Technologies Limited. All rights reserved.
 */

/*--------------------------------------------------------------------------
 *  DESCRIPTION
 *      The public header file for the Home Automation
 *      clusters of the ZCL.
 *--------------------------------------------------------------------------
 */
#ifndef ZCL_IAS_ACE_H
#define ZCL_IAS_ACE_H

/* @PICS.ZCL.IASACE
 *
 * IASACE.S | Server | True
 * IASACE.C | Client | True
 *
 * Server Attributes
 * IASACE.S.Afffd | ClusterRevision | True
 * IASACE.S.Afffe | AttributeReportingStatus | False
 *
 * Commands Received
 * IASACE.S.C00.Rsp | Arm | True
 * IASACE.S.C01.Rsp | Bypass | True
 * IASACE.S.C02.Rsp | Emergency | True
 * IASACE.S.C03.Rsp | Fire | True
 * IASACE.S.C04.Rsp | Panic | True
 * IASACE.S.C05.Rsp | Get Zone ID Map | True
 * IASACE.S.C06.Rsp | Get Zone Information | True
 * IASACE.S.C07.Rsp | Get Panel Status | True
 * IASACE.S.C08.Rsp | Get Bypassed Zone List | True
 * IASACE.S.C09.Rsp | Get Zone Status | True
 *
 * Commands Generated
 * IASACE.S.C00.Tx | Arm Response | True
 * IASACE.S.C01.Tx | Get Zone ID Map Response | True
 * IASACE.S.C02.Tx | Get Zone Information Response | True
 * IASACE.S.C03.Tx | Zone Status Changed | True
 * IASACE.S.C04.Tx | Panel Status Changed | True
 * IASACE.S.C05.Tx | Get Panel Status Response | True
 * IASACE.S.C06.Tx | Set Bypassed Zone List | True
 * IASACE.S.C07.Tx | Bypass Response | True
 * IASACE.S.C08.Tx | Get Zone Status Response | True
 *
 * Client Attributes
 * IASACE.C.Afffd | ClusterRevision | True
 * IASACE.C.Afffe | AttributeReportingStatus | False
 *
 * Coomands Generated
 * IASACE.C.C00.Tx | Arm | True
 * IASACE.C.C01.Tx | Bypass | True
 * IASACE.C.C02.Tx | Emergency | True
 * IASACE.C.C03.Tx | Fire | True
 * IASACE.C.C04.Tx | Panic | True
 * IASACE.C.C05.Tx | Get Zone ID Map | True
 * IASACE.C.C06.Tx | Get Zone Information | True
 * IASACE.C.C07.Tx | Get Panel Status | True
 * IASACE.C.C08.Tx | Get Bypassed Zone List | True
 * IASACE.C.C09.Tx | Get Zone Status | True
 *
 * Commands Received
 * IASACE.C.C00.Rsp | Arm Response | True
 * IASACE.C.C01.Rsp | Get Zone ID Map Response | True
 * IASACE.C.C02.Rsp | Get Zone Information Response | True
 * IASACE.C.C03.Rsp | Zone Status Changed | True
 * IASACE.C.C04.Rsp | Panel Status Changed | True
 * IASACE.C.C05.Rsp | Get Panel Status Response | True
 * IASACE.C.C06.Rsp | Set Bypassed Zone List | True
 * IASACE.C.C07.Rsp | Bypass Response | True
 * IASACE.C.C08.Rsp | Get Zone Status Response | True
 */

#include "zcl/zcl.h"
#include "zcl/security/zcl.ias_zone.h"

#define ZCL_IAS_ACE_SVR_MAX_ZONES             256

/* IAS ACE has no server or client attributes */

/* Server Generated Commands */
enum ZbZclIasAceServerCommandsT {
    ZCL_IAS_ACE_SVR_CMD_ARM_RSP = 0x00,
    ZCL_IAS_ACE_SVR_CMD_GET_ZONE_ID_MAP_RSP = 0x01,
    ZCL_IAS_ACE_SVR_CMD_GET_ZONE_INFO_RSP = 0x02,
    ZCL_IAS_ACE_SVR_CMD_ZONE_STATUS_CHANGED = 0x03,
    ZCL_IAS_ACE_SVR_CMD_PANEL_STATUS_CHANGED = 0x04,
    ZCL_IAS_ACE_SVR_CMD_GET_PANEL_STATUS_RSP = 0x05,
    ZCL_IAS_ACE_SVR_CMD_SET_BYPASSED_ZONE_LIST = 0x06,
    ZCL_IAS_ACE_SVR_CMD_BYPASS_RSP = 0x07,
    ZCL_IAS_ACE_SVR_CMD_GET_ZONE_STATUS_RSP = 0x08,
};

/* Client Generated Commands */
enum ZbZclIasAceClientCommandsT {
    ZCL_IAS_ACE_CLI_CMD_ARM = 0x00,
    ZCL_IAS_ACE_CLI_CMD_BYPASS = 0x01,
    ZCL_IAS_ACE_CLI_CMD_EMERGENCY = 0x02,
    ZCL_IAS_ACE_CLI_CMD_FIRE = 0x03,
    ZCL_IAS_ACE_CLI_CMD_PANIC = 0x04,
    ZCL_IAS_ACE_CLI_CMD_GET_ZONE_ID_MAP = 0x05,
    ZCL_IAS_ACE_CLI_CMD_GET_ZONE_INFO = 0x06,
    ZCL_IAS_ACE_CLI_CMD_GET_PANEL_STATUS = 0x07,
    ZCL_IAS_ACE_CLI_CMD_GET_BYPASSED_ZONE_LIST = 0x08,
    ZCL_IAS_ACE_CLI_CMD_GET_ZONE_STATUS = 0x09,
};

enum ZbZclIasAceArmModeT {
    ZCL_IAS_ACE_ARM_MODE_DISARM = 0x00,
    ZCL_IAS_ACE_ARM_MODE_ARM_DAY_ZONES = 0x01,
    ZCL_IAS_ACE_ARM_MODE_ARM_NIGHT_ZONES = 0x02,
    ZCL_IAS_ACE_ARM_MODE_ARM_ALL_ZONES = 0x03,
};

enum ZbZclIasAceArmNotifyT {
    ZCL_IAS_ACE_ARM_NOTIFY_ALL_ZONES_DISARMED = 0x00,
    ZCL_IAS_ACE_ARM_NOTIFY_ONLY_DAY_ZONES_ARMED = 0x01,
    ZCL_IAS_ACE_ARM_NOTIFY_ONLY_NIGHT_ZONES_ARMED = 0x02,
    ZCL_IAS_ACE_ARM_NOTIFY_ALL_ZONES_ARMED = 0x03,
    ZCL_IAS_ACE_ARM_NOTIFY_INVALID_ARM_CODE = 0x04,
    ZCL_IAS_ACE_ARM_NOTIFY_NOT_READY_TO_ARM = 0x05,
    ZCL_IAS_ACE_ARM_NOTIFY_ALREADY_DISARMED = 0x06,
};

enum ZbZclIasAcePanelStatusT {
    ZCL_IAS_ACE_PANEL_STATUS_PANEL_DISARMED = 0x00,
    ZCL_IAS_ACE_PANEL_STATUS_ARMED_STAY = 0x01,
    ZCL_IAS_ACE_PANEL_STATUS_ARMED_NIGHT = 0x02,
    ZCL_IAS_ACE_PANEL_STATUS_ARMED_AWAY = 0x03,
    ZCL_IAS_ACE_PANEL_STATUS_EXIT_DELAY = 0x04,
    ZCL_IAS_ACE_PANEL_STATUS_ENTRY_DELAY = 0x05,
    ZCL_IAS_ACE_PANEL_STATUS_NOT_READY_TO_ARM = 0x06,
    ZCL_IAS_ACE_PANEL_STATUS_IN_ALARM = 0x07,
    ZCL_IAS_ACE_PANEL_STATUS_ARMING_STAY = 0x08,
    ZCL_IAS_ACE_PANEL_STATUS_ARMING_NIGHT = 0x09,
    ZCL_IAS_ACE_PANEL_STATUS_ARMING_AWAY = 0x0a,
};

enum ZbZclIasAceAudibleNotifyT {
    ZCL_IAS_ACE_AUDIBLE_NOTIFY_MUTE = 0x00,
    ZCL_IAS_ACE_AUDIBLE_NOTIFY_DEFAULT_SOUND = 0x01,
};

enum ZbZclIasAceAlarmStatusT {
    ZCL_IAS_ACE_ALARM_STATUS_NO_ALARM = 0x00,
    ZCL_IAS_ACE_ALARM_STATUS_BURGLAR = 0x01,
    ZCL_IAS_ACE_ALARM_STATUS_FIRE = 0x02,
    ZCL_IAS_ACE_ALARM_STATUS_EMERGENCY = 0x03,
    ZCL_IAS_ACE_ALARM_STATUS_POLICE_PANIC = 0x04,
    ZCL_IAS_ACE_ALARM_STATUS_FIRE_PANIC = 0x05,
    ZCL_IAS_ACE_ALARM_STATUS_EMERGENCY_PANIC = 0x06,
};

enum ZbZclIasAceBypassResultT {
    ZCL_IAS_ACE_BYPASS_RESULT_ZONE_BYPASSED = 0x00,
    ZCL_IAS_ACE_BYPASS_RESULT_ZONE_NOT_BYPASSED = 0x01,
    ZCL_IAS_ACE_BYPASS_RESULT_NOT_ALLOWED = 0x02,
    ZCL_IAS_ACE_BYPASS_RESULT_INVALID_ZONE_ID = 0x03,
    ZCL_IAS_ACE_BYPASS_RESULT_UNKNOWN_ZONE_ID = 0x04,
    ZCL_IAS_ACE_BYPASS_RESULT_INVALID_ARM_CODE = 0x05,
};

enum ZbZclIasAceBypassPermsT {
    ZCL_IAS_ACE_BYPASS_PERMS_ALLOWED = 0x00,
    ZCL_IAS_ACE_BYPASS_PERMS_NOT_ALLOWED = 0x01,
};

/*---------------------------------------------------------------
 * Client Command Structures
 *---------------------------------------------------------------
 */
/* Arbitrary max. "There is no minimum or maximum length to the
 * Arm/Disarm Code; however, the Arm/Disarm Code SHOULD be between
 * four and eight alphanumeric characters in length." */
#define ZCL_IAS_ACE_ARM_CODE_STRING_MAX_LEN          32

/** Arm command structure */
struct ZbZclIasAceClientCommandArmT {
    enum ZbZclIasAceArmModeT arm_mode; /**< Arm Mode */
    char arm_code[ZCL_IAS_ACE_ARM_CODE_STRING_MAX_LEN + 1U]; /**< Arm/Disarm Code */
    uint8_t zone_id; /**< Zone ID */
};

/* Arbitrary max. May want to convert to a list with a max of 255. */
#define ZCL_IAS_ACE_BYPASS_MAX_ZONES                 32

/** Bypass command structure */
struct ZbZclIasAceClientCommandBypassT {
    uint8_t num_zones; /**< Number of Zones */
    uint8_t zone_id_list[ZCL_IAS_ACE_BYPASS_MAX_ZONES]; /**< Zone ID List */
    char arm_code[ZCL_IAS_ACE_ARM_CODE_STRING_MAX_LEN + 1U]; /**< Arm/Disarm Code */
};

/** Get Zone Info command structure */
struct ZbZclIasAceClientCommandGetZoneInfoT {
    uint8_t zone_id; /**< Zone ID */
};

/** Get Zone Status command structure */
struct ZbZclIasAceClientCommandGetZoneStatusT {
    uint8_t starting_zone_id; /**< Starting Zone ID */
    uint8_t max_zone_ids; /**< Max Number of Zone IDs */
    uint8_t zone_status_mask_flag; /**< Zone Status Mask Flag */
    uint16_t zone_status_mask; /**< Zone Status Mask */
};

/*---------------------------------------------------------------
 * Server Command Structures
 *---------------------------------------------------------------
 */

/** Arm response structure */
struct ZbZclIasAceServerCommandArmRspT {
    enum ZbZclIasAceArmNotifyT arm_notify; /**< Arm Notification */
};

#define ZCL_IAS_ACE_ZONE_ID_MAP_NUM_SECTIONS         16

/** Get Zone ID Map response structure */
struct ZbZclIasAceServerCommandGetZoneIdMapRspT {
    uint16_t zond_id_map_list[ZCL_IAS_ACE_ZONE_ID_MAP_NUM_SECTIONS]; /**< Zone ID Map List */
};

/* Arbitrary max. "There is no minimum or maximum length to the Zone Label
 * field; however, the Zone Label SHOULD be between 16 to 24 alphanumeric
 * characters in length." */
#define ZCL_IAS_ACE_ZONE_LABEL_STRING_MAX_LEN        32

/** Get Zone Info response structure */
struct ZbZclIasAceServerCommandGetZoneInfoRspT {
    uint8_t zone_id; /**< Zone ID */
    enum ZbZclIasZoneServerZoneTypeT zone_type; /**< Zone Type */
    uint64_t zone_addr; /**< IEEE Address */
    char zone_label[ZCL_IAS_ACE_ZONE_LABEL_STRING_MAX_LEN + 1U]; /**< Zone Label */
};

/** Zone Status Changed command structure */
struct ZbZclIasAceServerCommandZoneStatusChangedT {
    uint8_t zone_id; /**< Zone ID */
    enum ZbZclIasZoneServerZoneStatusT zone_status; /**< Zone Status */
    enum ZbZclIasAceAudibleNotifyT audible_notify; /**< Audible Notification */
    char zone_label[ZCL_IAS_ACE_ZONE_LABEL_STRING_MAX_LEN + 1U]; /**< Zone Label */
};

/** Get Panel Status response structure */
struct ZbZclIasAceServerCommandGetPanelStatusRspT {
    enum ZbZclIasAcePanelStatusT panel_status; /**< Panel Status */
    uint8_t seconds_remain; /**< Seconds Remaining */
    enum ZbZclIasAceAudibleNotifyT audible_notify; /**< Audible Notification */
    enum ZbZclIasAceAlarmStatusT alarm_status; /**< Alarm Status */
};

/** Set Bypassed Zone List command structure */
struct ZbZclIasAceServerCommandSetBypassedZoneListT {
    uint8_t num_zones; /**< Number of Zones */
    uint8_t zone_id_list[ZCL_IAS_ACE_BYPASS_MAX_ZONES]; /**< Zone ID List */
};

/** Bypass Response response structure */
struct ZbZclIasAceServerCommandBypassRspT {
    uint8_t num_zones; /**< Number of Zones */
    enum ZbZclIasAceBypassResultT bypass_result_list[ZCL_IAS_ACE_BYPASS_MAX_ZONES]; /**< Bypass Result for Zone ID List */
};

#define ZCL_IAS_ACE_ZONE_STATUS_MAX_ZONES            10

/** Get Zone Status response structure */
/* ZCL_IAS_ACE_SVR_CMD_GET_ZONE_STATUS_RSP */
struct ZbZclIasAceServerCommandGetZoneStatusRspT {
    uint8_t zone_status_complete; /**< Zone Status Complete */
    uint8_t num_zones; /**< Number of Zones */
    struct {
        uint8_t zone_id; /**< Zone ID */
        enum ZbZclIasZoneServerZoneStatusT zone_status; /**< Zone Status */
    } zone_list[ZCL_IAS_ACE_ZONE_STATUS_MAX_ZONES]; /**< Zone List */
};

/*---------------------------------------------------------------
 * Server API
 *---------------------------------------------------------------
 */

/** IAS ACE Server callbacks configuration */
struct ZbZclIasAceServerCallbacksT {
    /* The callback for Arming should handle arming the system and
     * calling ZbZclIasAceServerPanelStatusConfig when the panel status changes */
    bool (*arm_req)(struct ZbZclClusterT *clusterPtr, void *arg,
        struct ZbZclIasAceClientCommandArmT *arm_req,
        struct ZbZclIasAceServerCommandArmRspT *arm_rsp);
    /**< Callback to application, invoked on receipt of Arm command */

    void (*bypass_req)(struct ZbZclClusterT *clusterPtr, void *arg,
        struct ZbZclIasAceClientCommandBypassT *bypass_req,
        struct ZbZclIasAceServerCommandBypassRspT *bypass_rsp);
    /**< Callback to application, invoked on receipt of Bypass command */

    /* Emergency, Fire and Panic callbacks return a ZCL status to
     * return in the Default Response (e.g. ZCL_STATUS_SUCCESS) */
    uint8_t (*emerg_req)(struct ZbZclClusterT *clusterPtr, void *arg, struct ZbZclAddrInfoT *srcInfo);
    /**< Callback to application, invoked on receipt of Emergency command */
    uint8_t (*fire_req)(struct ZbZclClusterT *clusterPtr, void *arg, struct ZbZclAddrInfoT *srcInfo);
    /**< Callback to application, invoked on receipt of Fire command */
    uint8_t (*panic_req)(struct ZbZclClusterT *clusterPtr, void *arg, struct ZbZclAddrInfoT *srcInfo);
    /**< Callback to application, invoked on receipt of Panic command */
};

/**
 * Create a new instance of the IAS ACE Server cluster
 *
 * If 'use_trip_pair' is true, application must call ZbZclIasAceServerEnrollRequest
 * to perform the 'trip-to-pair' process, unless the IAS CIE has sent us an
 * unsolicited Auto-Enroll-Response
 * @param zb Zigbee stack instance
 * @param endpoint Endpoint on which to create cluster
 * @param callbacks Structure containing any callback function pointers for this cluster
 * @param arg Pointer to application data that will later be provided back to the callback functions when invoked
 * @return Cluster pointer, or NULL if there is an error
 */
struct ZbZclClusterT * ZbZclIasAceServerAlloc(struct ZigBeeT *zb, uint8_t endpoint,
    struct ZbZclIasAceServerCallbacksT *callbacks, void *arg);

/**
 * Change the Panel Arm/Disarm Code
 * @param cluster Cluster instance from which to send this command
 * @param arm_code Arm code
 * @return True on success, false otherwise
 */
bool ZbZclIasAceServerPanelCodeConfig(struct ZbZclClusterT *cluster,
    const char *arm_code);

/**
 * Update the Panel Status
 * @param cluster Cluster instance from which to send this command
 * @param panel_status Panel Status enumeration
 * @param seconds_remain Seconds remaining
 * @return True on success, false otherwise
 */
bool ZbZclIasAceServerPanelStatusConfig(struct ZbZclClusterT *cluster,
    enum ZbZclIasAcePanelStatusT panel_status, uint8_t seconds_remain,
    enum ZbZclIasAceAudibleNotifyT audible_notify);

/**
 * Returns the first free Zone ID not already in the Zone Table
 * @param cluster Cluster instance from which to send this command
 * @param zone_id_ptr Zone ID value
 * @return True on success, false otherwise
 */
bool ZbZclIasAceServerGetFreeZoneId(struct ZbZclClusterT *cluster, uint8_t *zone_id_ptr);

/** Zone Table Add request structure */
struct ZbZclIasAceServerZoneTableAddT {
    enum ZbZclIasZoneServerZoneTypeT zone_type; /**< Zone Type */
    uint64_t zone_addr; /**< Zone Address */
    const char *zone_label; /**< Zone Label - May be NULL, Max length = ZCL_IAS_ACE_ZONE_LABEL_STRING_MAX_LEN */
    uint8_t zone_id; /**< Zone ID - can use ZbZclIasAceServerGetFreeZoneId */
};

/**
 * Add new zone entry
 * @param cluster Cluster instance from which to send this command
 * @param req Zone Table Add request structure
 * @return True on success, false otherwise
 */
bool ZbZclIasAceServerZoneTableAdd(struct ZbZclClusterT *cluster,
    struct ZbZclIasAceServerZoneTableAddT *req);

/**
 * Delete a zone by zone ID
 * @param cluster Cluster instance from which to send this command
 * @param zone_id ID of zone to be deleted
 * @return True on success, false otherwise
 */
bool ZbZclIasAceServerZoneTableDeleteById(struct ZbZclClusterT *cluster, uint8_t zone_id);

/**
 * Delete a zone by address
 * @param cluster Cluster instance from which to send this command
 * @param addr Address of zone to be deleted
 * @return True on success, false otherwise
 */
bool ZbZclIasAceServerZoneTableDeleteByAddr(struct ZbZclClusterT *cluster, uint64_t addr);

/**
 * Returns address of paired zone, or 0 if not found
 * @param cluster Cluster instance from which to send this command
 * @param zone_id ID of zone to be returned
 * @return Address of zone if successful, 0 on error
 */
uint64_t ZbZclIasAceServerZoneTableAddrLookup(struct ZbZclClusterT *cluster, uint8_t zone_id);

/**
 * Attempts to find a zone based on extended address, and returns the zone Id if found
 * @param cluster Cluster instance from which to send this command
 * @param zone_addr Address of Zone being looked up
 * @param zone_id_ptr If successful, points to zone ID that was looked up
 * @return True on success, false otherwise
 */
bool ZbZclIasAceServerZoneTableIdLookup(struct ZbZclClusterT *cluster,
    uint64_t zone_addr, uint8_t *zone_id_ptr);

/**
 * Configure Zone Status
 * @param cluster Cluster instance from which to send this command
 * @param zone_id Zone ID of zone in question
 * @param zone_status Desired zone status
 * @param audible_notify Determines if zone notification is audible or not
 * @return True on success, false otherwise
 */
bool ZbZclIasAceServerZoneStatusConfig(struct ZbZclClusterT *cluster,
    uint8_t zone_id, enum ZbZclIasZoneServerZoneStatusT zone_status,
    enum ZbZclIasAceAudibleNotifyT audible_notify);

/**
 * Configure Bypass Permissions
 * @param cluster Cluster instance from which to send this command
 * @param zone_id Zone ID of zone in question
 * @param bypass_perms Desired bypass permissions
 * @return True on success, false otherwise
 */
bool ZbZclIasAceServerZoneBypassPerms(struct ZbZclClusterT *cluster,
    uint8_t zone_id, enum ZbZclIasAceBypassPermsT bypass_perms);

/**
 * Bypass zone if allowed
 * @param cluster Cluster instance from which to send this command
 * @param zone_id Zone ID of zone in question
 * @param bypass True if zone will be bypassed, false if not
 * @return Result of bypass config command
 */
enum ZbZclIasAceBypassResultT ZbZclIasAceServerZoneBypassConfig(struct ZbZclClusterT *cluster,
    uint8_t zone_id, bool bypass);

/*---------------------------------------------------------------
 * Client API
 *---------------------------------------------------------------
 */

/**
 * Allocate the IAS ACE Client cluster
 * @param zb Zigbee stack instance
 * @param endpoint Endpoint on which to create cluster
 * @param arg Pointer to application data that will later be provided back to the callback functions when invoked
 * @return Cluster pointer, or NULL if there is an error
 */
struct ZbZclClusterT * ZbZclIasAceClientAlloc(struct ZigBeeT *zb, uint8_t endpoint, void *arg);

/* ARM */

/**
 * Send an Arm command
 * @param cluster Cluster instance from which to send this command
 * @param dst Destination address for request
 * @param cmd_req Arm command request structure
 * @param callback Callback function that will be invoked later when the response is received
 * @param arg Pointer to application data that will later be provided back to the callback functions when invoked
 * @return ZCL_STATUS_SUCCESS if successful, or other ZclStatusCodeT value on error
 */
uint8_t ZbZclIasAceClientCommandArmReq(struct ZbZclClusterT *cluster,
    const struct ZbApsAddrT *dst, struct ZbZclIasAceClientCommandArmT *cmd_req,
    void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);

/**
 * Parse an Arm Response command payload into a data structure
 * @param buf Response buffer
 * @param len Length of response buffer
 * @param rsp Arm response structure
 * @return True on success, false otherwise
 */
bool ZbZclIasAceClientParseArmRsp(const uint8_t *buf, unsigned int len,
    struct ZbZclIasAceServerCommandArmRspT *rsp);

/* BYPASS */

/**
 * Send a Bypass command
 * @param cluster Cluster instance from which to send this command
 * @param dst Destination address for request
 * @param cmd_req Bypass command request structure
 * @param callback Callback function that will be invoked later when the response is received
 * @param arg Pointer to application data that will later be provided back to the callback functions when invoked
 * @return ZCL_STATUS_SUCCESS if successful, or other ZclStatusCodeT value on error
 */
uint8_t ZbZclIasAceClientCommandBypassReq(struct ZbZclClusterT *cluster,
    const struct ZbApsAddrT *dst, struct ZbZclIasAceClientCommandBypassT *cmd_req,
    void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);

/**
 * Parse a Bypass Response command payload into a data structure
 * @param buf Response buffer
 * @param len Length of response buffer
 * @param rsp Bypass Response structure
 * @return True on success, false otherwise
 */
bool ZbZclIasAceClientParseBypassRsp(const uint8_t *buf, unsigned int len,
    struct ZbZclIasAceServerCommandBypassRspT *rsp);

/* Emergency / Fire / Panic */

/**
 * Send an Emergency command
 * @param cluster Cluster instance from which to send this command
 * @param dst Destination address for request
 * @param callback Callback function that will be invoked later when the response is received
 * @param arg Pointer to application data that will later be provided back to the callback functions when invoked
 * @return ZCL_STATUS_SUCCESS if successful, or other ZclStatusCodeT value on error
 */
uint8_t ZbZclIasAceClientCommandEmergencyReq(struct ZbZclClusterT *cluster,
    const struct ZbApsAddrT *dst, void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);

/**
 * Send a Fire command
 * @param cluster Cluster instance from which to send this command
 * @param dst Destination address for request
 * @param callback Callback function that will be invoked later when the response is received
 * @param arg Pointer to application data that will later be provided back to the callback functions when invoked
 * @return ZCL_STATUS_SUCCESS if successful, or other ZclStatusCodeT value on error
 */
uint8_t ZbZclIasAceClientCommandFireReq(struct ZbZclClusterT *cluster,
    const struct ZbApsAddrT *dst, void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);

/**
 * Send a Panic command
 * @param cluster Cluster instance from which to send this command
 * @param dst Destination address for request
 * @param callback Callback function that will be invoked later when the response is received
 * @param arg Pointer to application data that will later be provided back to the callback functions when invoked
 * @return ZCL_STATUS_SUCCESS if successful, or other ZclStatusCodeT value on error
 */
uint8_t ZbZclIasAceClientCommandPanicReq(struct ZbZclClusterT *cluster,
    const struct ZbApsAddrT *dst, void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);

/* Get Zone Id Map */

/**
 * Send a Get Zone ID Map command
 * @param cluster Cluster instance from which to send this command
 * @param dst Destination address for request
 * @param callback Callback function that will be invoked later when the response is received
 * @param arg Pointer to application data that will later be provided back to the callback functions when invoked
 * @return ZCL_STATUS_SUCCESS if successful, or other ZclStatusCodeT value on error
 */
uint8_t ZbZclIasAceClientCommandGetZoneIdMapReq(struct ZbZclClusterT *cluster,
    const struct ZbApsAddrT *dst, void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);

/**
 * Parse a Get Zone ID Map Response command payload into a data structure
 * @param buf Response buffer
 * @param len Length of response buffer
 * @param rsp Get Zone ID Map Response structure
 * @return True on success, false otherwise
 */
bool ZbZclIasAceClientParseGetZoneIdMapRsp(const uint8_t *buf, unsigned int len,
    struct ZbZclIasAceServerCommandGetZoneIdMapRspT *rsp);

/* Get Zone Info */

/**
 * Send a Get Zone Info command
 * @param cluster Cluster instance from which to send this command
 * @param dst Destination address for request
 * @param cmd_req Get Zone Info command request structure
 * @param callback Callback function that will be invoked later when the response is received
 * @param arg Pointer to application data that will later be provided back to the callback functions when invoked
 * @return ZCL_STATUS_SUCCESS if successful, or other ZclStatusCodeT value on error
 */
uint8_t ZbZclIasAceClientCommandGetZoneInfoReq(struct ZbZclClusterT *cluster,
    const struct ZbApsAddrT *dst, struct ZbZclIasAceClientCommandGetZoneInfoT *cmd_req,
    void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);

/**
 * Parse a Get Zone Info Response command payload into a data structure
 * @param buf Response buffer
 * @param len Length of response buffer
 * @param rsp Get Zone Info Response structure
 * @return True on success, false otherwise
 */
bool ZbZclIasAceClientParseGetZoneInfoRsp(const uint8_t *buf, unsigned int len,
    struct ZbZclIasAceServerCommandGetZoneInfoRspT *rsp);

/* Zone / Panel Status Changed */

/**
 * Parse a Zone Status Changed Response command payload into a data structure
 * @param buf Response buffer
 * @param len Length of response buffer
 * @param rsp Zone Status Changed Response structure
 * @return True on success, false otherwise
 */
bool ZbZclIasAceClientParseZoneStatusChanged(const uint8_t *buf, unsigned int len,
    struct ZbZclIasAceServerCommandZoneStatusChangedT *rsp);

/* Panel Status Changed command has same payload as Get Panel Status Response.
 * Use ZbZclIasAceClientParseGetPanelStatusRsp. */

/* Get Panel Status */

/**
 * Send a Get Panel Status changed request
 * @param cluster Cluster instance from which to send this command
 * @param dst Destination address for request
 * @param callback Callback function that will be invoked later when the response is received
 * @param arg Pointer to application data that will later be provided back to the callback functions when invoked
 * @return ZCL_STATUS_SUCCESS if successful, or other ZclStatusCodeT value on error
 */
uint8_t ZbZclIasAceClientCommandGetPanelStatusReq(struct ZbZclClusterT *cluster,
    const struct ZbApsAddrT *dst, void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);

/**
 * Parse a Get Panel Status Response command payload into a data structure
 * @param buf Response buffer
 * @param len Length of response buffer
 * @param rsp Zone Status Changed Response structure
 * @return True on success, false otherwise
 */
bool ZbZclIasAceClientParseGetPanelStatusRsp(const uint8_t *buf, unsigned int len,
    struct ZbZclIasAceServerCommandGetPanelStatusRspT *rsp);

/* Get Bypassed Zone List */

/**
 * Send a Get Bypassed Zone List command
 * @param cluster Cluster instance from which to send this command
 * @param dst Destination address for request
 * @param callback Callback function that will be invoked later when the response is received
 * @param arg Pointer to application data that will later be provided back to the callback functions when invoked
 * @return ZCL_STATUS_SUCCESS if successful, or other ZclStatusCodeT value on error
 */
uint8_t ZbZclIasAceClientCommandGetBypassedZoneListReq(struct ZbZclClusterT *cluster,
    const struct ZbApsAddrT *dst, void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);

/**
 * Parse a Set Bypassed Zone List Response command payload into a data structure
 * @param buf Response buffer
 * @param len Length of response buffer
 * @param rsp Set Bypassed Zone List Response structure
 * @return True on success, false otherwise
 */
bool ZbZclIasAceClientParseSetBypassedZoneList(const uint8_t *buf, unsigned int len,
    struct ZbZclIasAceServerCommandSetBypassedZoneListT *rsp);

/* Get Zone Status */

/**
 * Send a Get Zone Status command
 * @param cluster Cluster instance from which to send this command
 * @param dst Destination address for request
 * @param cmd_req Get Zone Status command request structure
 * @param callback Callback function that will be invoked later when the response is received
 * @param arg Pointer to application data that will later be provided back to the callback functions when invoked
 * @return ZCL_STATUS_SUCCESS if successful, or other ZclStatusCodeT value on error
 */
uint8_t ZbZclIasAceClientCommandGetZoneStatusReq(struct ZbZclClusterT *cluster,
    const struct ZbApsAddrT *dst, struct ZbZclIasAceClientCommandGetZoneStatusT *cmd_req,
    void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);

/**
 * Parse a Get Zone Status Response command payload into a data structure
 * @param buf Response buffer
 * @param len Length of response buffer
 * @param rsp Get Zone Status Response structure
 * @return True on success, false otherwise
 */
bool ZbZclIasAceClientParseGetZoneStatusRsp(const uint8_t *buf, unsigned int len,
    struct ZbZclIasAceServerCommandGetZoneStatusRspT *rsp);

#endif