-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzigbee.c
More file actions
667 lines (577 loc) · 18.5 KB
/
zigbee.c
File metadata and controls
667 lines (577 loc) · 18.5 KB
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
#include <stdint.h>
#include <assert.h>
#include "zigbee.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <netinet/in.h>
#include <syslog.h>
const zigbee_panID zigbee_randomPanID = { 0, 0, 0, 0, 0, 0, 0, 0};
const zigbee_encryptionKey zigbee_randomEncryptionKey = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
const zigbee_linkKey zigbee_noLinkKey = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
typedef enum
{
AT_SET_PAN_ID,
AT_GET_PAN_ID,
AT_SCAN_CHAN,
AT_SCAN_DURATION,
AT_STACK_PROFILE,
AT_ENCRYPTION_ENABLED,
AT_SET_NETWORK_KEY,
AT_SET_LINK_KEY,
AT_ENCRYPTION_OPTS,
AT_SET_JOIN_TIME,
AT_SET_NODE_ID,
AT_GET_ASSOCIATION_IND,
AT_GET_HW_VERSION,
AT_GET_FW_VERSION,
AT_GET_SERIAL_HIGH,
AT_GET_SERIAL_LOW,
AT_SET_SLEEP_MODE,
AT_APPLY_CHANGES,
AT_GET_RF_PAYLOAD,
AT_GET_RECV_SIGNAL_STRENGHT,
AT_GET_NODE_DISCOVER,
AT_IO_D5,
AT_IO_P0_RSSI,
AT_IO_PWM_RSSI_TIMER,
AT_SET_BAUD_RATE,
AT_SET_NUMBER_OF_SLEEP_PERIOD,
AT_SET_SLEEP_PERIOD,
AT_WRITE,
AT_FORCE_DISASSOCIATION,
AT_OPERATING_CHANNEL,
AT_NB_COMMAND,
} zigbee_AT_COMMAND_LIST;
const char* zigbee_AT_COMMAND[AT_NB_COMMAND] =
{
/* AT_SET_PAN_ID */ "ID",
/* AT_GET_PAN_ID */ "OP",
/* AT_SCAN_CHAN */ "SC",
/* AT_SCAN_DURATION */ "SD",
/* AT_STACK_PROFILE */ "ZS",
/* AT_ENCRYPTION_ENABLED */ "EE",
/* AT_SET_NETWORK_KEY */ "NK",
/* AT_SET_LINK_KEY */ "KY",
/* AT_ENCRYPTION_OPTS */ "EO",
/* AT_SET_JOIN_TIME */ "NJ",
/* AT_SET_NODE_ID */ "NI",
/* AT_GET_ASSOCIATION_IND */ "AI",
/* AT_GET_HW_VERSION */ "HV",
/* AT_GET_FW_VERSION */ "VR",
/* AT_GET_SERIAL_HIGH */ "SH",
/* AT_GET_SERIAL_LOW */ "SL",
/* AT_SET_SLEEP_MODE */ "SM",
/* AT_APPLY_CHANGES */ "AC",
/* AT_GET_RF_PAYLOAD */ "NP",
/* AT_GET_RECV_SIGNAL_STRENGHT */ "DB",
/* AT_GET_NODE_DISCOVER */ "ND",
/* AT_IO_D5 */ "D5",
/* AT_IO_P0_RSSI */ "P0",
/* AT_IO_PWM_RSSI_TIMER */ "RP",
/* AT_SET_BAUD_RATE */ "BD",
/* AT_SET_NUMBER_OF_SLEEP_PERIOD*/ "SN",
/* AT_SET_SLEEP_PERIOD*/ "SP",
/* AT_WRITE */ "WR",
/* AT_FORCE_DISASSOCIATION */ "DA",
/* AT_OPERATING_CHANNEL */ "CH",
};
static uint8_t zigbee_doChecksum(uint8_t* frame, uint32_t size);
static void zigbee_appendChecksum(uint8_t* buffer, uint32_t* frameSize);
static void zigbee_setZigBeeFrameSize(uint8_t* buffer, uint32_t sizeFrame);
static bool zigbee_decodeATResponseFrame(uint8_t* frame, uint32_t size, zigbee_decodedFrame* decodedFrame);
static bool zibgee_decodeReceivePacket(uint8_t* frame, uint32_t size, zigbee_decodedFrame* decodedFrame);
#define ZIGBEE_START_DELIMITER (0x7E)
#define ZIGBEE_HEADER_SIZE (3)
#define ZIGBEE_ENCAPSULATION_SIZE (ZIGBEE_HEADER_SIZE + 1)
static uint32_t zigbee_encode_ATcmd(uint8_t* buffer, uint32_t size, uint8_t frameID, const char* atCmd, uint8_t* data,
uint32_t dataSize)
{
uint32_t i;
uint32_t sizeFrame;
sizeFrame = 0;
if (size >= (8 + dataSize))
{
buffer[sizeFrame++] = ZIGBEE_START_DELIMITER;
sizeFrame += 2; //for size frame insertion
buffer[sizeFrame++] = ZIGBEE_API_AT_CMD;
buffer[sizeFrame++] = frameID;
buffer[sizeFrame++] = atCmd[0];
buffer[sizeFrame++] = atCmd[1];
for (i = 0; i < dataSize; i++)
{
buffer[sizeFrame++] = data[i];
}
zigbee_appendChecksum(buffer, &sizeFrame);
zigbee_setZigBeeFrameSize(buffer, sizeFrame);
}
return sizeFrame;
}
static void zigbee_appendChecksum(uint8_t* buffer, uint32_t* sizeFrame)
{
buffer[*sizeFrame] = zigbee_doChecksum(&buffer[ZIGBEE_HEADER_SIZE], &buffer[*sizeFrame] - &buffer[ZIGBEE_HEADER_SIZE]);
(*sizeFrame)++;
}
static uint8_t zigbee_doChecksum(uint8_t* frame, uint32_t size)
{
uint8_t checksum;
checksum = 0xFF;
for (uint32_t i = 0; i < size; i++)
{
checksum -= frame[i];
}
return checksum;
}
static void zigbee_setZigBeeFrameSize(uint8_t* buffer, uint32_t sizeFrame)
{
buffer[1] = ((uint16_t) (sizeFrame - ZIGBEE_ENCAPSULATION_SIZE)) >> 8;
buffer[2] = (uint8_t) (sizeFrame - ZIGBEE_ENCAPSULATION_SIZE);
}
//AT ID
uint32_t zigbee_encode_SetPanID(uint8_t* buffer, uint32_t size, uint8_t frameID, zigbee_panID* panID)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_SET_PAN_ID],
(uint8_t*) panID, sizeof(zigbee_panID));
}
uint32_t zigbee_encode_getPanID(uint8_t* buffer, uint32_t size, uint8_t frameID)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_GET_PAN_ID],
NULL, 0);
}
uint32_t zigbee_encode_getOperatingChannel(uint8_t* buffer, uint32_t size, uint8_t frameID)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_OPERATING_CHANNEL],
NULL, 0);
}
uint32_t zigbee_encode_setNumberOfSleepPeriod(uint8_t* buffer, uint32_t size, uint8_t frameID, uint16_t nSleepPeriod)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_SET_NUMBER_OF_SLEEP_PERIOD],
(uint8_t*) &nSleepPeriod, sizeof(nSleepPeriod));
}
uint32_t zigbee_encode_setSleepPeriod(uint8_t* buffer, uint32_t size, uint8_t frameID, uint16_t sleepPeriod)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_SET_SLEEP_PERIOD],
(uint8_t*) &sleepPeriod, sizeof(sleepPeriod));
}
//AT SC
uint32_t zigbee_encode_setScanChannelBitmask(uint8_t* buffer, uint32_t size, uint8_t frameID, uint16_t bitmask)
{
bitmask = htons(bitmask);
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_SCAN_CHAN],
(uint8_t*) &bitmask, sizeof(uint16_t));
}
//AT SD
uint32_t zigbee_encode_setScanDurationExponent(uint8_t* buffer, uint32_t size, uint8_t frameID, uint8_t duration)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_SCAN_DURATION],
&duration, sizeof(uint8_t));
}
//AT ZS
uint32_t zigbee_encode_setStackProfile(uint8_t* buffer, uint32_t size, uint8_t frameID, uint8_t stackProfile)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_STACK_PROFILE],
&stackProfile, sizeof(uint8_t));
}
//AT EE
uint32_t zigbee_encode_setEncryptionEnabled(uint8_t* buffer, uint32_t size, uint8_t frameID, bool encryptionEnabled)
{
uint8_t encryption;
if (encryptionEnabled == true)
{
encryption = 1;
}
else
{
encryption = 0;
}
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_ENCRYPTION_ENABLED],
&encryption, sizeof(uint8_t));
}
//AT NK
uint32_t zigbee_encode_setNetworkEncryptionKey(uint8_t* buffer, uint32_t size, uint8_t frameID,
zigbee_encryptionKey* key)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_SET_NETWORK_KEY],
(uint8_t*) key, sizeof(zigbee_encryptionKey));
}
//AT KY
uint32_t zigbee_encode_setLinkKey(uint8_t* buffer, uint32_t size, uint8_t frameID, zigbee_linkKey* key)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_SET_LINK_KEY],
(uint8_t*) key, sizeof(zigbee_linkKey));
}
//AT NJ
uint32_t zigbee_encode_setEncryptionOptions(uint8_t* buffer, uint32_t size, uint8_t frameID, uint8_t options)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_ENCRYPTION_OPTS],
&options, sizeof(uint8_t));
}
//AT NJ
uint32_t zigbee_encode_SetJoinTime(uint8_t* buffer, uint32_t size, uint8_t frameID, uint8_t joinTimeInSecond)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_SET_JOIN_TIME],
&joinTimeInSecond, sizeof(uint8_t));
}
//AT NI
uint32_t zigbee_encode_SetNodeIdentifier(uint8_t* buffer, uint32_t size, uint8_t frameID, char* string)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_SET_NODE_ID],
(uint8_t*) string, strlen(string));
}
//AT AI
uint32_t zigbee_encode_getAssociationIndication(uint8_t* buffer, uint32_t size, uint8_t frameID)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_GET_ASSOCIATION_IND],
NULL, 0);
}
//AT HV
uint32_t zigbee_encode_getHardwareVersion(uint8_t* buffer, uint32_t size, uint8_t frameID)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_GET_HW_VERSION],
NULL, 0);
}
//AT VR
uint32_t zigbee_encode_getFirmwareVersion(uint8_t* buffer, uint32_t size, uint8_t frameID)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_GET_FW_VERSION],
NULL, 0);
}
//AT SH
uint32_t zigbee_encode_getSerialNumberHigh(uint8_t* buffer, uint32_t size, uint8_t frameID)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_GET_SERIAL_HIGH],
NULL, 0);
}
//AT SL
uint32_t zigbee_encode_getSerialNumberLow(uint8_t* buffer, uint32_t size, uint8_t frameID)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_GET_SERIAL_LOW],
NULL, 0);
}
//AT SM
uint32_t zigbee_encode_setSleepMode(uint8_t* buffer, uint32_t size, uint8_t frameID, zigbee_sleepMode sleepMode)
{
uint8_t slm;
slm = (uint8_t) sleepMode;
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_SET_SLEEP_MODE],
&slm, sizeof(uint8_t));
}
//AT AC
uint32_t zigbee_encode_applyChanges(uint8_t* buffer, uint32_t size, uint8_t frameID)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_APPLY_CHANGES],
NULL, 0);
}
//AT WR
uint32_t zigbee_encode_write(uint8_t* buffer, uint32_t size, uint8_t frameID)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_WRITE],
NULL, 0);
}
//AT NP
uint32_t zigbee_encode_getRFPayloadBytes(uint8_t* buffer, uint32_t size, uint8_t frameID)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_GET_RF_PAYLOAD],
NULL, 0);
}
//AT DB
uint32_t zigbee_encode_getReceivedSignalStrenght(uint8_t* buffer, uint32_t size, uint8_t frameID)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_GET_RECV_SIGNAL_STRENGHT],
NULL, 0);
}
// AT ND Node Discover
uint32_t zigbee_encode_nodeDiscover(uint8_t* buffer, uint32_t size, uint8_t frameID)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_GET_NODE_DISCOVER],
NULL, 0);
}
// AT D5 IO DIO5
uint32_t zigbee_encode_D5(uint8_t* buffer, uint32_t size, uint8_t frameID, uint8_t state)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_IO_D5],
&state, sizeof(uint8_t));
}
// AT PO IO PWM RRSI
uint32_t zigbee_encode_P0(uint8_t* buffer, uint32_t size, uint8_t frameID, uint8_t state)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_IO_P0_RSSI],
&state, sizeof(uint8_t));
}
// ATPWM TIMER I
uint32_t zigbee_encode_RSSI_PWM_Timer(uint8_t* buffer, uint32_t size, uint8_t frameID, uint8_t value)
{
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_IO_PWM_RSSI_TIMER],
&value, sizeof(uint8_t));
}
// AT BD
uint32_t zigbee_encode_setBaudRate(uint8_t* buffer, uint32_t size, uint8_t frameID, zigbee_baudrate baudrate)
{
uint8_t bd;
bd = (uint8_t) baudrate;
return
zigbee_encode_ATcmd(buffer, size,
frameID,
zigbee_AT_COMMAND[AT_SET_BAUD_RATE],
&bd, sizeof(uint8_t));
}
uint32_t zigbee_encode_transmitRequest(uint8_t* buffer, uint32_t sizeBuffer, uint8_t frameID,
zigbee_64bDestAddr* destAddr64b, uint16_t destAddr16b, uint8_t* payload, uint8_t size)
{
uint32_t sizeFrame;
uint32_t index;
sizeFrame = 0;
assert(sizeBuffer >= 8);
buffer[sizeFrame++] = ZIGBEE_START_DELIMITER;
sizeFrame += 2; //for size frame insertion
buffer[sizeFrame++] = ZIGBEE_API_TRANSMIT_REQUEST;
buffer[sizeFrame++] = frameID;
for (index = 0; index < 8; index++)
{
buffer[sizeFrame++] = (*destAddr64b)[index];
}
buffer[sizeFrame++] = (uint8_t) (destAddr16b >> 8);
buffer[sizeFrame++] = (uint8_t) (destAddr16b);
//broadcoast radius
buffer[sizeFrame++] = 0;
//options
buffer[sizeFrame++] = 0;
for (index = 0; index < size; index++)
{
buffer[sizeFrame++] = payload[index];
}
zigbee_appendChecksum(buffer, &sizeFrame);
zigbee_setZigBeeFrameSize(buffer, sizeFrame);
return sizeFrame;
}
bool zigbee_decodeHeader(uint8_t* frame, uint32_t size, uint16_t* sizeOfNextData)
{
bool bCorrectlyDecoded;
bCorrectlyDecoded = false;
if ((size == 3) && (frame[0] == ZIGBEE_START_DELIMITER))
{
*sizeOfNextData = (frame[1] << 8) | (frame[2]);
bCorrectlyDecoded = true;
}
return bCorrectlyDecoded;
}
bool zigbee_decodeFrame(uint8_t* frame, uint16_t frameSize, zigbee_decodedFrame* decodedFrame)
{
bool bCorrectlyDecoded;
uint8_t checksum;
bCorrectlyDecoded = false;
if (frameSize >= 1)
{
checksum = zigbee_doChecksum(frame, frameSize - 1);
if (checksum != frame[frameSize - 1])
{
syslog(LOG_ERR, "Checksum KO");
bCorrectlyDecoded = false;
}
else
{
bCorrectlyDecoded = true;
}
}
if (bCorrectlyDecoded)
{
decodedFrame->type = frame[0];
switch (decodedFrame->type)
{
case ZIGBEE_AT_COMMAND_RESPONSE:
decodedFrame->atCmd.frameID = frame[1];
bCorrectlyDecoded = zigbee_decodeATResponseFrame(frame, frameSize, decodedFrame);
break;
case ZIGBEE_MODEM_STATUS:
decodedFrame->modemStatus = frame[1];
bCorrectlyDecoded = true;
break;
case ZIGBEE_TRANSMIT_STATUS:
decodedFrame->transmitStatus.frameID = frame[1];
decodedFrame->transmitStatus.destAddr = ((uint16_t) frame[2]) << 8 | frame[3];
decodedFrame->transmitStatus.transmitRetryCount = frame[4];
decodedFrame->transmitStatus.deliveryStatus = frame[5];
decodedFrame->transmitStatus.discoveryStatus = frame[6];
break;
case ZIGBEE_RECEIVE_PACKET:
bCorrectlyDecoded = zibgee_decodeReceivePacket(frame, frameSize, decodedFrame);
break;
default:
bCorrectlyDecoded = false;
break;
}
}
return bCorrectlyDecoded;
}
static bool zigbee_decodeATResponseFrame(uint8_t* frame, uint32_t size, zigbee_decodedFrame* decodedFrame)
{
decodedFrame->atCmd.ATcmd[0] = frame[2];
decodedFrame->atCmd.ATcmd[1] = frame[3];
decodedFrame->atCmd.status = frame[4];
decodedFrame->atCmd.size = size - 6;
if (decodedFrame->atCmd.size == 0)
{
decodedFrame->atCmd.data = NULL;
}
else
{
decodedFrame->atCmd.data = &frame[5];
}
return true;
}
static bool zibgee_decodeReceivePacket(uint8_t* frame, uint32_t size, zigbee_decodedFrame* decodedFrame)
{
uint32_t i;
for (i = 0; i < 8; i++)
{
decodedFrame->receivedPacket.receiver64bAddr[i] = frame[1 + i];
}
decodedFrame->receivedPacket.receiver16bAddr = ((uint16_t) frame[9]) << 8 | frame[10];
decodedFrame->receivedPacket.receiveOptions = frame[11];
decodedFrame->receivedPacket.payloadSize = size - 13;
if (decodedFrame->receivedPacket.payloadSize == 0)
{
decodedFrame->receivedPacket.payload = NULL;
}
else
{
decodedFrame->receivedPacket.payload = &frame[12];
}
return true;
}
char* zigbee_get_indicationError(uint8_t indicationStatus)
{
char* errorString;
errorString = "uknown error";
switch (indicationStatus)
{
case 0x21:
errorString = "scan found no PANs";
break;
case 0x22:
errorString = "scan found no valid PANs based on current SC and ID settings";
break;
case 0x23:
errorString = "valid coordinator found, but NJ joining time expired";
break;
case 0x24:
errorString = "no joinable beacons were found";
break;
case 0x25:
errorString = "Unexpected state, node should not be attempting to join at this time";
break;
case 0x27:
errorString = "Node Joining attempt failed (typically due to incompatible security settings)";
break;
case 0x2A:
errorString = "Coordinator Start attempt failed";
break;
case 0x2B:
errorString = "Checking for an existing coordinator";
break;
case 0x2C:
errorString = "Attempt to leave the network failed";
break;
case 0xAB:
errorString = "Attempted to join a device that did not respond.";
break;
case 0xAC:
errorString = "Secure join error - network security key received unsecured";
break;
case 0xAD:
errorString = "Secure join error - network security key not received";
break;
case 0xAF:
errorString = "Secure join error - joining device does not have the right preconfigured link key";
break;
default:
errorString = "uknown error";
syslog(LOG_ERR, "indicationStatus = 0x%x", indicationStatus);
break;
}
return errorString;
}