summaryrefslogtreecommitdiffhomepage
path: root/digital/zigbit/bitcloud/stack/Components/ZCL/include/zclZllCommissioningCluster.h
blob: 75fd07cd5669f0bf3c7baee4f3a205f37d0d4e80 (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
/***************************************************************************//**
  \file zclZllCommissioningCluster.h

  \brief
    The header file describes the ZLL Commissioning Cluster and its interface

  \author
    Atmel Corporation: http://www.atmel.com \n
    Support email: avr@atmel.com

  Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
  Licensed under Atmel's Limited License Agreement (BitCloudTM).

  \internal
    History:
    04.07.11  A. Taradov - Created.
*******************************************************************************/

#ifndef _ZCLZLLCOMISSIONINGCLUSTER_H
#define _ZCLZLLCOMISSIONINGCLUSTER_H

/*!
Attributes and commands for determining basic information about a device,
setting user device information such as location, enabling a device and resetting it
to factory defaults.
*/

/*******************************************************************************
                   Includes section
*******************************************************************************/

#include <zcl.h>
#include <clusters.h>

/*******************************************************************************
                   Define(s) section
*******************************************************************************/

/**
 * \brief Commissioning Server Cluster attributes amount.
*/

#define ZCL_COMMISSIONING_CLUSTER_SERVER_ATTRIBUTES_AMOUNT 0

/**
 * \brief Commissioning Client Cluster attributes amount.
*/

#define ZCL_COMMISSIONING_CLUSTER_CLIENT_ATTRIBUTES_AMOUNT 0

/**
 * \brief Commissioning Client Cluster commands amount.
*/

#define ZCL_COMMISSIONING_CLUSTER_COMMANDS_AMOUNT 5

/**
 * \brief Commissioning Server Cluster commands identifiers.
*/

#define ZCL_COMMISSIONING_CLUSTER_ENDPOINT_INFORMATION_COMMAND_ID 0x40
#define ZCL_COMMISSIONING_CLUSTER_GET_GROUP_IDENTIFIERS_RESPONSE_COMMAND_ID 0x41
#define ZCL_COMMISSIONING_CLUSTER_GET_ENDPOINT_LIST_RESPONSE_COMMAND_ID 0x42

/**
 * \brief Commissioning Client Cluster commands identifiers.
*/

#define ZCL_COMMISSIONING_CLUSTER_GET_GROUP_IDENTIFIERS_COMMAND_ID 0x41
#define ZCL_COMMISSIONING_CLUSTER_GET_ENDPOINT_LIST_COMMAND_ID 0x42

/*
 * \brief ZCL Commissioning Cluster commands defining macros
 */

#define ZCL_DEFINE_COMMISSIONING_CLUSTER_COMMANDS(getGroupIdentifiersInd, getEndpointListInd, \
        endpointInformationResponseInd, getGroupIdentifiersResponseInd, getEndpointListResponseInd) \
    DEFINE_COMMAND(getGroupIdentifiersCommand, 0x41, COMMAND_OPTIONS(CLIENT_TO_SERVER, ZCL_THERE_IS_RELEVANT_RESPONSE, ZCL_COMMAND_ACK), getGroupIdentifiersInd), \
    DEFINE_COMMAND(getEndpointListCommand, 0x42, COMMAND_OPTIONS(CLIENT_TO_SERVER, ZCL_THERE_IS_RELEVANT_RESPONSE, ZCL_COMMAND_ACK), getEndpointListInd), \
    DEFINE_COMMAND(endpointInformationResponseCommand, 0x40, COMMAND_OPTIONS(SERVER_TO_CLIENT, ZCL_THERE_IS_NO_RELEVANT_RESPONSE, ZCL_COMMAND_ACK), endpointInformationResponseInd), \
    DEFINE_COMMAND(getGroupIdentifiersResponseCommand, 0x41, COMMAND_OPTIONS(SERVER_TO_CLIENT, ZCL_THERE_IS_NO_RELEVANT_RESPONSE, ZCL_COMMAND_ACK), getGroupIdentifiersResponseInd), \
    DEFINE_COMMAND(getEndpointListResponseCommand, 0x42, COMMAND_OPTIONS(SERVER_TO_CLIENT, ZCL_THERE_IS_NO_RELEVANT_RESPONSE, ZCL_COMMAND_ACK), getEndpointListResponseInd)


#define COMMISSIONING_CLUSTER_ZCL_CLIENT_CLUSTER_TYPE(clattributes, clcommands) \
  { \
    .id = ZLL_COMMISSIONING_CLUSTER_ID, \
    .options = {.type = ZCL_CLIENT_CLUSTER_TYPE, .security = ZCL_NETWORK_KEY_CLUSTER_SECURITY}, \
    .attributesAmount = ZCL_COMMISSIONING_CLUSTER_CLIENT_ATTRIBUTES_AMOUNT, \
    .attributes = (uint8_t *)clattributes, \
    .commandsAmount = ZCL_COMMISSIONING_CLUSTER_COMMANDS_AMOUNT, \
    .commands = (uint8_t *)clcommands \
  }

#define COMMISSIONING_CLUSTER_ZCL_SERVER_CLUSTER_TYPE(clattributes, clcommands) \
  { \
    .id = ZLL_COMMISSIONING_CLUSTER_ID, \
    .options = {.type = ZCL_SERVER_CLUSTER_TYPE, .security = ZCL_NETWORK_KEY_CLUSTER_SECURITY}, \
    .attributesAmount = ZCL_COMMISSIONING_CLUSTER_SERVER_ATTRIBUTES_AMOUNT, \
    .attributes = (uint8_t *)clattributes, \
    .commandsAmount = ZCL_COMMISSIONING_CLUSTER_COMMANDS_AMOUNT, \
    .commands = (uint8_t *)clcommands \
  }

#define DEFINE_COMMISSIONING_CLUSTER(cltype, clattributes, clcommands) COMMISSIONING_CLUSTER_##cltype(clattributes, clcommands)

/******************************************************************************
                    Types section
******************************************************************************/

BEGIN_PACK

/**
 * \brief Get Group Identifiers command format
*/
typedef struct PACK
{
  uint8_t startIndex;
} ZCL_GetGroupIdentifiers_t;

/**
 * \brief Get Endpoint List command format
*/
typedef struct PACK
{
  uint8_t startIndex;
} ZCL_GetEndpointList_t;

/**
 * \brief Endpoint Information Response command format
*/
typedef struct PACK
{
  uint64_t ieeeAddress;
  uint16_t networkAddress;
  uint8_t  endpointId;
  uint16_t profileId;
  uint16_t deviceId;
  uint8_t  version;
} ZCL_EndpointInformationResponse_t;

/**
 * \brief Group Information Record format
*/
typedef struct PACK
{
  uint16_t groupId;
  uint8_t  groupType;
} ZCL_GroupInformationRecord_t;

/**
 * \brief Endpoint Information Record format
*/
typedef struct PACK
{
  uint16_t networkAddress;
  uint8_t  endpointId;
  uint16_t profileId;
  uint16_t deviceId;
  uint8_t  version;
} ZCL_EndpointInformationRecord_t;

/**
 * \brief Get Group Identifiers Response command format
*/
typedef struct PACK
{
  uint8_t  total;
  uint8_t  startIndex;
  uint8_t  count;
  ZCL_GroupInformationRecord_t recordList[5];
} ZCL_GetGroupIdentifiersResponse_t;

/**
 * \brief Get Endpoint List Response command format
*/
typedef struct PACK
{
  uint8_t  total;
  uint8_t  startIndex;
  uint8_t  count;
  ZCL_EndpointInformationRecord_t recordList[1];
} ZCL_GetEndpointListResponse_t;

END_PACK

typedef struct
{
  struct
  {
    ZCL_CommandId_t       id;
    ZclCommandOptions_t   options;
    ZCL_Status_t (*getGroupIdentifiersCommand)(ZCL_Addressing_t *addressing, uint8_t payloadLength, ZCL_GetGroupIdentifiers_t *payload);
  } getGroupIdentifiersCommand;

  struct
  {
    ZCL_CommandId_t       id;
    ZclCommandOptions_t   options;
    ZCL_Status_t (*getEndpointListCommand)(ZCL_Addressing_t *addressing, uint8_t payloadLength, ZCL_GetEndpointList_t *payload);
  } getEndpointListCommand;

  struct
  {
    ZCL_CommandId_t       id;
    ZclCommandOptions_t   options;
    ZCL_Status_t (*endpointInformationResponseCommand)(ZCL_Addressing_t *addressing, uint8_t payloadLength, ZCL_EndpointInformationResponse_t *payload);
  } endpointInformationResponseCommand;

  struct
  {
    ZCL_CommandId_t       id;
    ZclCommandOptions_t   options;
    ZCL_Status_t (*getGroupIdentifiersResponseCommand)(ZCL_Addressing_t *addressing, uint8_t payloadLength, ZCL_GetGroupIdentifiersResponse_t *payload);
  } getGroupIdentifiersResponseCommand;

  struct
  {
    ZCL_CommandId_t       id;
    ZclCommandOptions_t   options;
    ZCL_Status_t (*getEndpointListResponseCommand)(ZCL_Addressing_t *addressing, uint8_t payloadLength, ZCL_GetEndpointListResponse_t *payload);
  } getEndpointListResponseCommand;
} ZCL_CommissioningClusterCommands_t;


#endif // _ZCLZLLCOMISSIONINGCLUSTER_H

// eof zclZllCommissioningCluster.h