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

zcl.identify.h « 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: cd174b115bfaa58e2cc94ff6ceeca14fee6ce125 (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
/**
 * @file zcl.identify.h
 * @brief ZCL Identify cluster header
 * ZCL 7 section 3.5
 * ZCL 8 section 3.5
 * @copyright Copyright [2009 - 2020] Exegin Technologies Limited. All rights reserved.
 */

#ifndef ZCL_CORE_IDENTIFY_H
# define ZCL_CORE_IDENTIFY_H

/*--------------------------------------------------------------------------
 *  DESCRIPTION
 *      Interface definition for the ZCL Identify cluster.
 *--------------------------------------------------------------------------
 */

/* PICS.ZCL.Identify Cluster (0x0003)
 *
 * Server PICS
 * I.S | True
 * I.C | True
 *
 * Server Attributes
 * I.S.A0000 | True
 * I.S.Afffd | True
 *
 * Commands Received
 * I.S.C00.Rsp | True
 * I.S.C01.Rsp | True
 * I.S.C40.Rsp | False
 *
 * Commands Generated
 * I.S.C00.Tx | True
 *
 * Client Attributes
 * I.C.Afffd | True
 *
 * Commands Received
 * I.C.C00.Rsp | True
 *
 * Commands Generated
 * I.C.C00.Tx | True
 * I.C.C01.Tx | True
 * I.C.C40.Tx | False
 */

#include "zcl/zcl.h"

/* Identify Server Attribute IDs */
enum ZbZclIdentifySvrAttrT {
    ZCL_IDENTIFY_ATTR_TIME = 0x0000
};

/* Identify Command IDs  */
enum ZbZclIdentifyClientCommandT {
    ZCL_IDENTIFY_COMMAND_IDENTIFY = 0x00,
    ZCL_IDENTIFY_COMMAND_QUERY = 0x01
};

enum ZbZclIdentifyServerCommandT {
    ZCL_IDENTIFY_COMMAND_QUERY_RESP = 0x00
};

/*---------------------------------------------------------------
 * Identify Server Cluster
 *---------------------------------------------------------------
 */

enum ZbZclIdentifyServerStateT {
    ZCL_IDENTIFY_START = 0,
    ZCL_IDENTIFY_STOP
};

/** Callback to receive events to "start" or "stop" identifying. */
typedef void (*ZbZclIdentifyCallbackT)(struct ZbZclClusterT *cluster,
    enum ZbZclIdentifyServerStateT state, void *arg);

/**
 * Instantiate a new instance of the Identify server cluster.
 * @param zb Zigbee stack instance.
 * @param endpoint APS endpoint to create cluster on.
 * @param arg Application argument that gets assigned to ZbZclClusterSetCallbackArg.
 * @return Cluster pointer, or NULL if there as an error.
 */
struct ZbZclClusterT * ZbZclIdentifyServerAlloc(struct ZigBeeT *zb, uint8_t endpoint, void *arg);

/**
 * Set the callback in the cluster private structure
 * @param cluster Cluster instance to send this command from
 * @param callback Callback function to call with command response
 */
void ZbZclIdentifyServerSetCallback(struct ZbZclClusterT *cluster,
    ZbZclIdentifyCallbackT callback);

/**
 * Set the local identify server time. Same as writing to the
 * ZCL_IDENTIFY_ATTR_TIME attribute.
 *
 * If BDB_COMMISSION_MODE_FIND_BIND is enabled and seconds > 0, seconds
 * is adjusted to be >= ZB_BDBC_MinCommissioningTime.
 * @param clusterPtr Zigbee cluster instance.
 * @param seconds Seconds for updating the identify time counter
 */
void ZbZclIdentifyServerSetTime(struct ZbZclClusterT *cluster, uint16_t seconds);

/**
 * Get the local identify server time.
 * @param clusterPtr Zigbee cluster instance.
 * @return uint16_t Time remaining in zigbee timer
 */
uint16_t ZbZclIdentifyServerGetTime(struct ZbZclClusterT *cluster);

/*---------------------------------------------------------------
 * Identify Client Cluster
 *---------------------------------------------------------------
 */

/**
 * Instantiate a new instance of the Identify client cluster.
 * @param zb Zigbee stack instance.
 * @param endpoint APS endpoint to create cluster on.
 * @return Cluster pointer, or NULL if there as an error.
 */
struct ZbZclClusterT * ZbZclIdentifyClientAlloc(struct ZigBeeT *zb, uint8_t endpoint);

/**
 * Start or stop the receiving device identifying itself
 * @param cluster Cluster instance to send this command from
 * @param dst The destination address information
 * @param identify_time Time which will be used to set the IdentifyTime attribute
 * @param callback Callback function to call with command response
 * @param arg Application argument that will be included with the callback
 * @return ZCL_STATUS_SUCCESS if successful, or other ZclStatusCodeT value on error
 */
enum ZclStatusCodeT zcl_identify_identify_request(struct ZbZclClusterT *cluster, const struct ZbApsAddrT *dst,
    uint16_t identify_time, void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);

/**
 * Request target(s) to respond if they are currently identifying themselves
 * @param cluster Cluster instance to send this command from
 * @param dst The destination address information
 * @param callback Callback function to call with command response
 * @param arg Application argument that will be included with the callback
 * @return ZCL_STATUS_SUCCESS if successful, or other ZclStatusCodeT value on error
 */
enum ZclStatusCodeT zcl_identify_query_request(struct ZbZclClusterT *cluster, const struct ZbApsAddrT *dst,
    void (*callback)(struct ZbZclCommandRspT *rsp, void *arg), void *arg);

#endif /* __ZCL_IDENTIFY_H */