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: af18dece61c4b3324b0c46534c6f0f4d8cd868a7 (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
/**
 * @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 /**< IdentifyTime */
};

/* 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 start and stop events
 * @param cluster Cluster instance from which this callback will be invoked
 * @param state Identification state: start or stop
 * @param arg Pointer to application data provided in initiating API call
 * @return Void
 */
typedef void (*ZbZclIdentifyCallbackT)(struct ZbZclClusterT *cluster,
    enum ZbZclIdentifyServerStateT state, void *arg);

/**
 * Create a new instance of the Identify Server 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 function when invoked
 * @return Cluster pointer, or NULL if there is 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 which will later invoke the callback
 * @param callback Callback function that will be invoked later when the identification state changes
 * @return Void
 */
void ZbZclIdentifyServerSetCallback(struct ZbZclClusterT *cluster,
    ZbZclIdentifyCallbackT callback);

/**
 * Set the local Identify Server time
 *
 * If BDB_COMMISSION_MODE_FIND_BIND is enabled and seconds > 0, seconds
 * is adjusted to be >= ZB_BDBC_MinCommissioningTime
 * @param cluster Cluster instance with timer to set
 * @param seconds Seconds for updating the identify time counter
 * @return Void
 */
void ZbZclIdentifyServerSetTime(struct ZbZclClusterT *cluster, uint16_t seconds);

/**
 * Get the local Identify Server time
 * @param cluster Cluster instance with timer to get
 * @return uint16_t Time remaining in zigbee timer
 */
uint16_t ZbZclIdentifyServerGetTime(struct ZbZclClusterT *cluster);

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

/**
 * Create a new instance of the Identify Client cluster
 * @param zb Zigbee stack instance
 * @param endpoint Endpoint on which to create cluster
 * @return Cluster pointer, or NULL if there is an error
 */
struct ZbZclClusterT * ZbZclIdentifyClientAlloc(struct ZigBeeT *zb, uint8_t endpoint);

/**
 * Send an Identify command
 * @param cluster Cluster instance from which to send this command
 * @param dst Destination address for request
 * @param identify_time Time which will be used to set the IdentifyTime attribute
 * @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 function when invoked
 * @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);

/**
 * Send an Identify Query 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 function when invoked
 * @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 */