-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample-api-radio.json
504 lines (504 loc) · 15.7 KB
/
example-api-radio.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
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
{
"afbidl": "0.1",
"info": {
"apiname": "radio",
"title": "Service for radio reception",
"description": "Radio service manages and reports radio configuration changes (eg. frequency, band, ....) and allows requesting infos (RDS,...)",
"version": "0.1",
"author": "AGL",
"maintainer": "Matt Ranostay (Konsulko)",
"homepage": "https://gerrit.automotivelinux.org/gerrit/apps/agl-service-radio"
},
"tools": {
"afb-genskel": {
"scope": "static",
"prefix": "req_",
"postfix": "_cb",
"init": "init"
},
"doc": {
"id": "radio-api",
"keywords": "radio",
"author": null,
"version": null,
"src_prefix": "api-radio",
"chapters": [
{
"name": "Abstract",
"url": "abstract.md"
},
{
"name": "User Guide",
"url": "userguide.md"
}
]
}
},
"verbs": {
"frequency": {
"description": "Set/Get frequency (NB: we can't just get the value on request)",
"request": "$/schemas/frequency/set",
"reply": {
"success": "$/schemas/frequency/get",
"_": "Fails if frequency value is NaN (but no check on the value, nor on set_frequency() return value...)"
}
},
"band": {
"description": "Set/Get band (NB : same as frequency, no standalone get)",
"request": "$/schemas/band/set",
"reply": {
"success": "$/schemas/band/get",
"_": "Fails if the band/modulation is invalid"
}
},
"rds": {
"description": "Get Radio Data System information",
"request": "$/schemas/none",
"reply": {
"success": "$/schemas/rds/reply",
"_": "Fails if not supported by the radio backend"
}
},
"band_supported": {
"description": "Check band support (NB : no way to get list all supported bands)",
"request": "$/schemas/band/get",
"reply": {
"success": "$/schemas/band/supported_bands",
"_": "Fails if the band/modulation is invalid"
}
},
"frequency_range": {
"description": "Get frequency range (for a given band/modulation)",
"request": "$/schemas/band/get",
"reply": {
"success": "$/schemas/frequency/range",
"_": "Fails if band/modulation is unknown."
}
},
"frequency_step": {
"description": "Get frequency step",
"request": "$/schemas/band/get",
"reply": {
"success": "$/schemas/frequency/step"
}
},
"start": {
"description": "Start radio playback",
"request": "$/schemas/none",
"reply": {
"success": {
"schema": "$/schemas/playing/status",
"description": "playing status must be \"playing\""
}
}
},
"stop": {
"description": "Stop radio playback",
"request": "$/schemas/none",
"reply": {
"success": {
"schema": "$/schemas/playing/status",
"description": "playing status must be \"stopped\""
}
}
},
"scan_start": {
"description": "Start station scan (in a given direction)",
"request": "$/schemas/start_scan",
"reply": {
"success": {
"when-state": {
"scanning": "idle"
},
"triggers": "scan-start",
"schema": "$/schemas/none"
},
"_": "Fails if direction is invalid"
}
},
"stop_scan": {
"description": "Stop station scan",
"request": "$/schemas/none",
"reply": {
"success": {
"triggers": "scan-stop",
"schema": "$/schemas/none"
}
}
},
"stereo_mode": {
"description": "Set/Get stereo_mode (NB: we can't just get the value on request)",
"request": "$/schemas/stereo_mode",
"reply": {
"success": {
"schema": "$/schemas/stereo_mode"
},
"_": "Fails if passed an invalid stereo mode"
}
},
"subscribe": {
"description": "Request subscription to an event",
"request": "$/schemas/subscription",
"reply": {
"success": {
"schema": "$/schemas/none",
"triggers": "start-signaling"
}
}
},
"unsubscribe": {
"description": "Cancel subscription to an event",
"request": "$/schemas/subscription",
"reply": {
"success": {
"schema": "$/schemas/none",
"triggers": "stop-signaling"
}
}
}
},
"state-machines": {
"scanning": {
"description": "Indicates if the backend is currently scanning frequency",
"scope": "global",
"states": [
"idle",
"progress"
],
"initial": "idle",
"transitions": {
"scan-start-transition": {
"from": "idle",
"to": "progress",
"trigged-by": "start-scan"
},
"scan-stop-transition": {
"from": "idle",
"to": "progress",
"trigged-by": "stop-scan"
}
}
},
"signaling": {
"description": "Emits events to listeners",
"scope": "session",
"states": [
"on",
"off"
],
"initial": "off",
"transitions": [
[
"on",
"off",
"start-signaling"
],
[
"off",
"on",
"stop-signaling"
]
]
}
},
"events": {
"frequency": {
"description": "event emitted when a new frequency is tuned (TBC)",
"schema": "$/schemas/frequency/event",
"when-state": {
"signaling": "on"
}
},
"station_found": {
"description": "event emitted when a valid station is tuned (frequency with a good S/N ration ? TBC)",
"schema": "$/schemas/frequency/event",
"when-state": {
"signaling": "on",
"scanning": "progress"
}
},
"status": {
"description": "event emitted when playing status changes.",
"schema": "$/schemas/playing/status",
"when-state": {
"signaling": "on"
}
}
},
"schemas": {
"types": {
"band": {
"title": "Frequency band (modulation)",
"description": "Enumeration of valid frquency bands/modulations values as string",
"type": "string",
"enum": [
"AM",
"FM"
]
},
"stereo_mode": {
"title": "Stereo mode",
"description": "Enumeration of valid stereo modes",
"type": "string",
"enum": [
"mono",
"stereo"
]
}
},
"frequency": {
"set": {
"title": null,
"description": "object used to set the tuned frequency",
"type": "object",
"properties": {
"value": {
"title": "frequency value",
"description": "desired frequency to be tuned",
"type": "number"
}
},
"required": [
"value"
]
},
"get": {
"title": null,
"description": "object used to retreive tuned frequency",
"type": "object",
"properties": {
"frequency": {
"title": "frequency value",
"description": "frequency currently tuned",
"type": "number"
}
},
"required": [
"frequency"
]
},
"range": {
"title": null,
"description": "object used to retreive minimum and maximum frequency for a given modulation",
"type": "object",
"properties": {
"min": {
"title": "Minimal frequency for the range",
"type": "number"
},
"max": {
"title": "Maximal frequency for the range",
"type": "number"
}
},
"required": [
"min",
"max"
]
},
"step": {
"title": null,
"description": "object used to retreive the increment between 2 tunable frequencies",
"type": "object",
"properties": {
"step": {
"title": "frequency step",
"type": "number"
}
},
"required": [
"step"
]
},
"event": {
"title": null,
"description": null,
"type": "object",
"properties": {
"value": {
"title": "frequency value",
"type": "number"
}
},
"required": [
"value"
]
}
},
"band": {
"set": {
"title": null,
"description": null,
"type": "object",
"properties": {
"value": "$/schemas/types/band"
},
"required": [
"value"
]
},
"get": {
"title": null,
"type": "object",
"properties": {
"value": "$/schemas/types/band"
},
"required": [
"value"
]
},
"supported_bands": {
"title": null,
"description": "list of bands/modulations supported by the radio backend",
"type": "array",
"contains": "$/schemas/types/band"
}
},
"rds": {
"reply": {
"success": {
"title": null,
"description": "object used to retreive Radio Data System information",
"type": "object",
"properties": {
"rds": {
"title": "\"playing now\" informations",
"type": "string"
}
},
"required": [
"rds"
]
}
}
},
"playing": {
"status": {
"title": null,
"description": "Object used to return the playing status",
"type": "object",
"properties": {
"value": {
"enum": [
"playing",
"stopped"
]
}
},
"required": [
"value"
]
}
},
"start_scan": {
"request": {
"title": null,
"description": "object used to pass the direction of the frequency scan",
"type": "object",
"properties": {
"direction": {
"enum": [
"forward, backward"
]
}
},
"required": [
"direction"
]
}
},
"stereo_mode": {
"title": null,
"description": "Object used to pass a stereo mode (NB : stereo is either true or false. Polyphony is more general, does it make sense here ?)",
"type": "object",
"properties": {
"value": "$/schemas/types/stereo_mode"
},
"required": [
"value"
]
},
"subscription": {
"title": null,
"description": "describes a subscription to an event",
"type": "object",
"properties": {
"value": {
"enum": [
"frequency",
"station_found",
"status"
]
}
},
"required": [
"value"
]
},
"none": {
"title": "no value, just null",
"description": null,
"const": null
}
},
"scenarios": [
{
"from": {
"scanning": "idle",
"signaling": "off"
},
"sequence": [
{
"request": "stop_scan",
"value": null
},
{
"reply": "success",
"value": null
},
{
"request": "subscribe",
"value": {
"value": "station_found"
}
},
{
"reply": "success",
"value": null
},
{
"request": "start_scan",
"value": null
},
{
"reply": "success",
"value": null
},
{
"event": "station_found",
"value": {
"value": 89.4
}
},
{
"request": "unsubscribe",
"value": {
"value": "station_found"
}
},
{
"reply": "success",
"value": null
},
{
"request": "stop_scan",
"value": null
},
{
"reply": "success",
"value": null
}
]
}
]
}