-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapi-protocol.txt
89 lines (64 loc) · 1.56 KB
/
api-protocol.txt
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
API Frame
=========
Start|1 Length|2 Data|n Checksum|1
[ 0x7E ][ MSB|LSB ][ ][ ]
0 1 3 n n+1
Checksum
========
//Calculation
short result = 0, char checksum;
for(int i = 3 ; i < n+1 ; ++i)
result+=frame[i];
result&=0xFF;
checksum=0xFF-result;
//Check
short result = 0;
for(int i = 3 ; i <= n+1 ; ++i)
result+=frame[i];
result&=0xFF;
if(result == OxFF)
OK;
Data Types
==========
cmdId|1 Data
[ ][ ]
3 4 n
AT Command
----------
0x08
Frame ID|1 AT Command|2 Parameters|p
[ ][ ][ ]
4 5 7 p+7
(Parameter with a string finishes by 0x00)
AT Response
-----------
Ox88
Frame ID|1 AT Command|2 Status|1 Value|v
[ ][ ][ ][ ]
4 5 7 8 v+8
Transmit
--------
0x00
Frame ID|1 Destination|8 Options|1 Data|max 100,d
[ ][ ][ ][ ]
4 5 13 14 14+d
Transmit Status
---------------
0x89
Frame ID|1 Status|1
[ ][ ]
4 5 6
Status:
-0 Success
-1 No ACK
-2 CCA Failure
-3 Purged
Receive
-------
0x80
Source Address|8 RSSI|1 Options|1 Data|max 100,v
[ ][ ][ ][ ]
4 12 13 14 14+v
Options:
-bit 1 = address broadcast
-bit 2 = PAN broadcast