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

  \brief
    Inter-PAN commands frame formats for ZLL.

  \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:
    16.03.10 A. Taradov - Created.
******************************************************************************/
#ifndef _ZCLZLLFRAMEFORMAT_H
#define	_ZCLZLLFRAMEFORMAT_H

/******************************************************************************
                    Includes section
******************************************************************************/
#include <types.h>
#include <sspCommon.h>

/******************************************************************************
                    Definitions section
******************************************************************************/
#define MAX_DEVICE_INFO_ENTRIES_NUMBER   1

/******************************************************************************
                    Types section
******************************************************************************/
typedef enum _ZclZllCommandId_t
{
  ZCL_ZLL_SCAN_REQUEST_COMMAND_ID                    = 0x00,
  ZCL_ZLL_SCAN_RESPONSE_COMMAND_ID                   = 0x01,
  ZCL_ZLL_DEVICE_INFO_REQUEST_COMMAND_ID             = 0x02,
  ZCL_ZLL_DEVICE_INFO_RESPONSE_COMMAND_ID            = 0x03,
  ZCL_ZLL_IDENTIFY_REQUEST_COMMAND_ID                = 0x06,
  ZCL_ZLL_RESET_TO_FACTORY_NEW_REQUEST_COMMAND_ID    = 0x07,
  ZCL_ZLL_NETWORK_START_REQUEST_COMMAND_ID           = 0x10,
  ZCL_ZLL_NETWORK_START_RESPONSE_COMMAND_ID          = 0x11,
  ZCL_ZLL_NETWORK_JOIN_ROUTER_REQUEST_COMMAND_ID     = 0x12,
  ZCL_ZLL_NETWORK_JOIN_ROUTER_RESPONSE_COMMAND_ID    = 0x13,
  ZCL_ZLL_NETWORK_JOIN_ENDDEVICE_REQUEST_COMMAND_ID  = 0x14,
  ZCL_ZLL_NETWORK_JOIN_ENDDEVICE_RESPONSE_COMMAND_ID = 0x15,
  ZCL_ZLL_NETWORK_UPDATE_REQUEST_COMMAND_ID          = 0x16,
} ZclZllCommandId_t;

BEGIN_PACK
typedef struct PACK
{
  struct
  {
    uint8_t frameType            : 2; /*! Frame type sub-field */
    uint8_t manufacturerSpecific : 1; /*! Manufacturer specific sub-field */
    uint8_t direction            : 1; /*! Direction sub-field */
    uint8_t defaultResponse      : 1; /*! Disable default response sub-field */
    uint8_t reserved             : 3; /*! Reserved bits. Must have a zero value */
  } frameControl;
  uint8_t     seq;
  uint8_t     commandId;
} ZclZllFrameHeader_t;

typedef struct PACK
{
  uint8_t logicalType  : 2;
  uint8_t rxOnWhenIdle : 1;
  uint8_t reserved     : 5;
} ZclZllZigBeeInfo_t;

typedef struct PACK
{
  uint8_t factoryNew          : 1;
  uint8_t addressAssignment   : 1;
  uint8_t compoundDevice      : 1;
  uint8_t relayedScanRequest  : 1;
  uint8_t touchLinkInitiator  : 1;
  uint8_t touchLinkTimeWindow : 1; /*! This field is reserved in Scan Request frame */
  uint8_t reserved            : 2;
} ZclZllInfo_t;

typedef struct PACK
{
  uint64_t ieeeAddress;
  uint8_t  endpoint;
  uint16_t profileId;
  uint16_t deviceId;
  uint8_t  version;
  uint8_t  groupIds;
  uint8_t  sort;
} ZclZllDeviceInfoEntry_t;

typedef struct PACK
{
  ZclZllFrameHeader_t header;
  uint32_t            transactionId;
  ZclZllZigBeeInfo_t  zigBeeInfo;
  ZclZllInfo_t        zllInfo;
} ZclZllScanRequestFrame_t;

typedef struct PACK
{
  ZclZllFrameHeader_t header;
  uint32_t            transactionId;
  uint8_t             rssiCorrection;
  ZclZllZigBeeInfo_t  zigBeeInfo;
  ZclZllInfo_t        zllInfo;
  uint16_t            keyBitMask;
  uint32_t            responseId;
  uint64_t            extPanId;
  uint8_t             nwkUpdateId;
  uint8_t             channel;
  uint16_t            panId;
  uint16_t            networkAddress;
  uint8_t             numberSubDevices;
  uint8_t             totalGroupIds;
  // next fields are present only if numberSubDevices == 1
  union
  {
    struct
    {
      uint8_t         endpoint;
      uint16_t        profileId;
      uint16_t        deviceId;
      uint8_t         version;
      uint8_t         groupIds;
    };
    uint64_t          ieeeRelayerScanRequest1;
  };
  /*! This field is present only if zllInfo.relayedScanRequest == 1 */
  uint64_t            ieeeRelayerScanRequest2;
} ZclZllScanResponseFrame_t;

typedef struct PACK
{
  ZclZllFrameHeader_t header;
  uint32_t            transactionId;
  uint8_t             startIndex;
} ZclZllDeviceInfoRequestFrame_t;

typedef struct PACK
{
  ZclZllFrameHeader_t header;
  uint32_t            transactionId;
  uint8_t             numberSubDevices;
  uint8_t             startIndex;
  uint8_t             count;
  ZclZllDeviceInfoEntry_t entries[MAX_DEVICE_INFO_ENTRIES_NUMBER];
} ZclZllDeviceInfoResponseFrame_t;

typedef struct PACK
{
  ZclZllFrameHeader_t header;
  uint32_t            transactionId;
  uint16_t            identifyTime;
} ZclZllIdentifyRequestFrame_t;

typedef struct PACK
{
  ZclZllFrameHeader_t header;
  uint32_t            transactionId;
} ZclZllResetToFactoryNewRequestFrame_t;

typedef struct PACK
{
  ZclZllFrameHeader_t header;
  uint32_t            transactionId;
  uint64_t            extendedPanId;
  uint8_t             keyIndex;
  uint8_t             encryptedNwkKey[SECURITY_KEY_SIZE];
  uint8_t             channel;
  uint16_t            panId;
  uint16_t            nwkAddress;
  uint16_t            groupIdsBegin;
  uint16_t            groupIdsEnd;
  uint16_t            freeNwkAddressRangeBegin;
  uint16_t            freeNwkAddressRangeEnd;
  uint16_t            freeGroupIdRangeBegin;
  uint16_t            freeGroupIdRangeEnd;
  uint64_t            edIeeeAddress;
  uint16_t            edNwkAddress;
} ZclZllNetworkStartRequestFrame_t;

typedef struct PACK
{
  ZclZllFrameHeader_t header;
  uint32_t            transactionId;
  uint8_t             status;
  uint64_t            extendedPanId;
  uint8_t             nwkUpdateId;
  uint8_t             channel;
  uint16_t            panId;
} ZclZllNetworkStartResponseFrame_t;

typedef struct PACK
{
  ZclZllFrameHeader_t header;
  uint32_t            transactionId;
  uint64_t            extendedPanId;
  uint8_t             keyIndex;
  uint8_t             encryptedNwkKey[SECURITY_KEY_SIZE];
  uint8_t             nwkUpdateId;
  uint8_t             channel;
  uint16_t            panId;
  uint16_t            nwkAddress;
  uint16_t            groupIdsBegin;
  uint16_t            groupIdsEnd;
  uint16_t            freeNwkAddressRangeBegin;
  uint16_t            freeNwkAddressRangeEnd;
  uint16_t            freeGroupIdRangeBegin;
  uint16_t            freeGroupIdRangeEnd;
} ZclZllNetworkJoinRouterRequestFrame_t;

typedef struct PACK
{
  ZclZllFrameHeader_t header;
  uint32_t            transactionId;
  uint8_t             status;
} ZclZllNetworkJoinRouterResponseFrame_t;

typedef struct PACK
{
  ZclZllFrameHeader_t header;
  uint32_t            transactionId;
  uint64_t            extendedPanId;
  uint8_t             keyIndex;
  uint8_t             encryptedNwkKey[SECURITY_KEY_SIZE];
  uint8_t             nwkUpdateId;
  uint8_t             channel;
  uint16_t            panId;
  uint16_t            nwkAddress;
  uint16_t            groupIdsBegin;
  uint16_t            groupIdsEnd;
  uint16_t            freeNwkAddressRangeBegin;
  uint16_t            freeNwkAddressRangeEnd;
  uint16_t            freeGroupIdRangeBegin;
  uint16_t            freeGroupIdRangeEnd;
} ZclZllNetworkJoinEndDeviceRequestFrame_t;

typedef struct PACK
{
  ZclZllFrameHeader_t header;
  uint32_t            transactionId;
  uint8_t             status;
} ZclZllNetworkJoinEndDeviceResponseFrame_t;

typedef struct PACK
{
  ZclZllFrameHeader_t header;
  uint32_t            transactionId;
  uint64_t            extendedPanId;
  uint8_t             nwkUpdateId;
  uint8_t             channel;
  uint16_t            panId;
  uint16_t            nwkAddress;
} ZclZllNetworkUpdateRequestFrame_t;

END_PACK

#endif // _ZCLZLLFRAMEFORMAT_H

// eof zclZllFrameFormat.h