forked from WirelessThings/devices
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUDP_schema.json
293 lines (291 loc) · 15.6 KB
/
UDP_schema.json
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
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://devices.wirelessthings.net/UDP_schema.json",
"title": "Language of Things JSON over UDP packet format",
"description": "Used to describe Language of Things messages and other interationc with the Message Bridge",
"oneOf":[
{"$ref":"#/definitions/WirelessMessage"},
{"$ref":"#/definitions/DeviceConfigurationRequest"},
{"$ref":"#/definitions/MessageBridge"}
],
"definitions": {
"validIDCharacters":{
"pattern":"^[A-Z0-9\\-@?*\\\\]+$"
},
"validDataCharacters":{
"pattern":"^[A-Z0-9 !#$%&'()*+,.:;<=>?@_`{|}~\"\\-\\[\\]^\\\\\/]+$"
},
"validTimestamp":{
"pattern":""
},
"WirelessMessage":{
"type":"object",
"required":["type","network","id","data"],
"additionalProperties": false,
"properties":{
"type":{
"enum":["WirelessMessage"],
"description":"Indicates this is a Language of Things message"
},
"network":{
"type":"string",
"description":"Inditactes the Message Bridge this packet is tied to, packets on port 50140 this is the source, packets on port 50141 this is the desitnation"
},
"timestamp":{
"type":"string",
"description":"Orignal time stamp of when this packet was created",
"$ref":"#/definitions/validTimestamp"
},
"id":{
"type":"string",
"description":"ID of the device",
"$ref":"#/definitions/validIDCharacters"
},
"data":{
"type":"array",
"description":"Array of one or more commands that will be processed by the MessageBridge, for packets on port 50141 each command is combine with the id field into a Language of Things message \"aIDDATA-----\" and sent out over the radio",
"items":{
"type":"string",
"definition":"Valid Lanugaue of Things data ",
"$ref":"#/definitions/validDataCharacters"
},
"minItems":1,
"additionalItems":false
}
}
},
"DeviceConfigurationRequest":{
"type":"object",
"required":["type","network","data"],
"additionalProperties": false,
"properties":{
"type":{
"enum":["DeviceConfigurationRequest"],
"description":"Indicates this is a Language of Things device configuration request"
},
"network":{
"type":"string",
"description":"Inditactes the Message Bridge this packet is tied to, packets on port 50140 this is the source, packets on port 50141 this is the desitnation"
},
"timestamp":{
"type":"string",
"descriotion":"Orignal time stamp of when this packet was created",
"$ref":"#/definitions/validTimestamp"
},
"data":{
"type":"object",
"description":"",
"required":["toQuery"],
"additionalProperties": false,
"properties":{
"id":{
"type":"string",
"description":"The id field can be use by Device Configuration Wizard to help track request and replies, it will not be altered by the Message Bridge"
},
"devType":{
"type":"string",
"description":"if set the device type will be checked before sending any command"
},
"timeout":{
"type":"integer",
"description":"time out for request, if not supplied the Message Bridge configured default value is used",
"minimum": 1.0
},
"keepAwake":{
"type":"integer",
"description":"use to request or show the state of the keepAwake, 0 off, 1 on",
"enum":[0,1]
},
"state":{
"type":"string",
"description":"use by Message Bridge to show state",
"oneOf":[
{"enum":["PASS"], "description":"Message Bridge belives all replies are good"},
{"enum":["FAIL_TIMEOUT"], "description":"request returned incomplete, as timeout T expired. Where T is DCR timeout is specified, otherwise the Message Bridge defualt timeout"},
{"enum":["FAIL_RETRY"], "description":"request returned incomplete, unable to get an answer to one or more questions after x retries. Where x retries is set via Message Bridge configuration"}
]
},
"toQuery":{
"type":"array",
"description":"ordered list of command and value pairs to be sent to a device",
"additionalItems":false,
"minimumItems":1,
"items":{
"type":"object",
"description":"each item must contain a command and optional may inclued a value",
"required":["command"],
"additionalProperties":false,
"properties":{
"command":{
"type":"string",
"description":"Language of Things command to send",
"$ref":"#/definitions/validDataCharacters"
},
"value":{
"type":"string",
"description":"value to combine with the command, if not set the command sent on its own",
"$ref":"#/definitions/validDataCharacters"
}
}
}
},
"replies":{
"type":"object",
"description":"responses passed back by the Message Bridge, detaling the radios replies to the commands, sotered in a dict keyed by the commands",
"patternProperties": {
"^[A-Z0-9 !#$%&'()*+,.:;<=>?@_`{|}~\"\\-\\[\\]^\\\\\/]+$": {
"type": "object",
"description":"single respons",
"required":["value","reply"],
"additionalProperties":false,
"properties":{
"value":{
"type":"string",
"description":"the value that was send with the command",
"$ref":"#/definitions/validDataCharacters"
},
"reply":{
"type":"string",
"description":"the replay from that command",
"$ref":"#/definitions/validDataCharacters"
}
}
}
}
}
}
}
}
},
"MessageBridge":{
"type":"object",
"required":["type","network"],
"additionalProperties": false,
"properties":{
"type":{
"enum":["MessageBridge"],
"description":"Indicates this is information exchange with the Message Bridge"
},
"network":{
"type":"string",
"description":"Inditactes the Message Bridge this packet is tied to, packets on port 50140 this is the source, packets on port 50141 this is the desitnation"
},
"timestamp":{
"type":"string",
"descriotion":"Orignal time stamp of when this packet was created",
"$ref":"#/definitions/validTimestamp"
},
"state":{
"type":"string",
"description":"Used by the Message Bridge to report its current state",
"oneOf":[
{"enum":["Running"], "description":""},
{"enum":["Error"], "description":""},
{"enum":["Unknown"], "description":""}
]
},
"data":{
"type":"object",
"description":"",
"additionalProperties": false,
"properties":{
"id":{
"type":"string",
"description":"The id field can be use by Device Configuration Wizard to help track request and replies, it will not be altered by the Message Bridge"
},
"request":{
"type":"array",
"description":"used to ask the Message Bridge for information",
"additionalItems":false,
"minItems":1,
"uniqueItems":true,
"items":{
"anyOf":[
{"enum":["deviceStore"], "description":"request the current device store"},
{"enum":["PANID"], "description":"request the networks PANID (used for seting up new devices ror the network)"},
{"enum":["encryptionSet"], "description":"request if encryption is enabled on the network"},
{"enum":["version"], "description":"request the Message Bridge code version"},
{"enum":["RadioFirmwareVersion"], "description":"request the Firmware version of the radio"}
]
}
},
"set":{
"type":"object",
"description":"used to set settings on the Message Bridge (not yet implemented)",
"additionalProperties":false,
"properties":{
"PANID":{
"type":"string",
"description":"",
"$ref":"#/definitions/validDataCharacters"
},
"encryptionSet":{
"type":"boolean",
"description":""
},
"encrptionKey":{
"type":"string",
"description":"",
"pattern":"^[A-F0-9]+$"
}
}
},
"result":{
"type":"object",
"description":"results from the Message Bridge to request",
"additionalProperties":false,
"properties":{
"PANID":{
"type":"string",
"description":"current PANID, or PANID as a result of a set",
"$ref":"#/definitions/validDataCharacters"
},
"encryptionSet":{
"type":"boolean",
"description":"current encryption state"
},
"encrptionKey":{
"type":"string",
"description":"Pass/Fail state for setting encryption key",
"enum":["Pass", "Fail"]
},
"version":{
"type":"number",
"description":"current Message Bridge version",
},
"RadioFirmwareVersion":{
"type":"string",
"description":"current Firmware version of the radio"
},
"deviceStore":{
"type":"object",
"description":"the device store contains information abbout the last Language of Things message a Message Bridge saw for every device it has heard from since its last reboot",
"additionalProperties":false,
"propertiesPattern":{
"^[A-Z0-9\\-@?*\\\\]+$":{
"type":"object",
"decsription":"information is store by device ID, the object will not grow bigger than 656 entries",
"additionalProperties":false,
"properties":{
"data":{
"type":"string",
"description":"last message seen from the device ID",
"$ref":"#/definitions/validDataCharacters"
},
"timestamp":{
"type":"string",
"description":"timestamp of last message",
"$ref":"#/definitions/validTimestamp"
}
}
}
}
}
}
}
}
}
}
}
}
}