1{
2  "$schema": "http://json-schema.org/draft-04/schema#",
3  "title": "redsea",
4  "description": "Array of RDS groups from redsea",
5
6  "definitions": {
7    "pi": {
8      "type": "string",
9      "pattern": "^0x[0-9A-F]{4}$"
10    },
11    "grouptype": {
12      "type": "string",
13      "pattern": "^([0-9]|1[0-5])[AB]$"
14    },
15    "di": {
16      "type": "object",
17      "properties": {
18        "compressed":      { "type": "boolean" },
19        "artificial_head": { "type": "boolean" },
20        "stereo":          { "type": "boolean" },
21        "dynamic_pty":     { "type": "boolean" }
22      },
23      "additionalProperties": false
24    },
25    "radiotext": {
26      "type": "string",
27      "maxLength": 64
28    },
29    "ps": {
30      "type": "string",
31      "minLength": 8,
32      "maxLength": 8
33    },
34    "rtplus": {
35      "type": "object",
36      "properties": {
37        "tags": {
38          "type": "array",
39          "items": {
40            "content-type": {
41              "type": "string",
42              "enum": ["dummy_class", "item.title", "item.album",
43                       "item.tracknumber", "item.artist", "item.composition",
44                       "item.movement", "item.conductor", "item.composer",
45                       "item.band", "item.comment", "item.genre", "info.news",
46                       "info.news.local", "info.stockmarket", "info.sport",
47                       "info.lottery", "info.horoscope", "info.daily_diversion",
48                       "info.health", "info.event", "info.scene", "info.cinema",
49                       "info.tv", "info.date_time", "info.weather", "info.traffic",
50                       "info.alarm", "info.advertisement", "info.url", "info.other",
51                       "stationname.short", "stationname.long", "programme.now",
52                       "programme.next", "programme.part", "programme.host",
53                       "programme.editorial_staff", "programme.frequency",
54                       "programme.homepage", "programme.subchannel",
55                       "phone.hotline", "phone.studio", "phone.other", "sms.studio",
56                       "sms.other", "email.hotline", "email.studio", "email.other",
57                       "mms.other", "chat", "chat.centre", "vote.question",
58                       "vote.centre", "unknown", "place", "appointment",
59                       "identifier", "purchase", "get_data"]
60            }
61          }
62        },
63        "data": {
64          "type": "string"
65        },
66        "item_running": {
67          "type": "boolean"
68        },
69        "item_toggle": {
70          "type": "integer",
71          "minimum": 0,
72          "maximum": 1
73        }
74      },
75      "additionalProperties": false
76    },
77    "pin": {
78      "type": "object",
79      "properties": {
80        "day": {
81          "type": "integer",
82          "minimum": 1,
83          "maximum": 31
84        },
85        "time": {
86          "type": "string",
87          "pattern": "^[0-2][0-9]:[0-5][0-9]$"
88        }
89      },
90      "additionalProperties": false
91    },
92    "tmc": {
93      "type": "object",
94      "oneOf": [{
95        "system_info": {
96          "type": "object",
97          "properties": {
98            "is_encrypted": { "type": "boolean" },
99            "is_on_alt_freq": {
100              "description": "Whether alternative frequencies carry TMC",
101              "type": "boolean"
102            },
103            "location_table": {
104              "description": "Location table number (LTN)",
105              "type": "integer",
106              "minimum": 0,
107              "maximum": 63
108            },
109            "encryption_id": {
110              "type": "integer",
111              "minimum": 0,
112              "maximum": 31
113            },
114            "scope": {
115              "type": "array",
116              "items": {
117                "type": "string",
118                "enum": ["inter-road", "national", "regional", "urban"]
119              }
120            },
121            "gap": {
122              "description": "Number of groups between successive 8A groups",
123              "type": "integer",
124              "enum": [3, 5, 8, 11]
125            },
126            "service_id": {
127              "type": "integer",
128              "minimum": 0,
129              "maximum": 63
130            },
131            "delay_time": {
132              "description": "Position of the start of the activity/window sequence, referenced from the minute's edge, in seconds",
133              "type": "integer",
134              "enum": [0, 1, 2, 3]
135            },
136            "activity_time": {
137              "description": "The time in a time slot during which 8A groups may be transmitted (seconds)",
138              "type": "integer",
139              "enum": [1, 2, 4, 8]
140            },
141            "window_time": {
142              "description": "The time in a time slot during which transmission of 8A groups is suspended (seconds)",
143              "type": "integer",
144              "enum": [1, 2, 4, 8]
145            }
146          },
147          "additionalProperties": false
148        },
149        "message": {
150          "type": "object",
151          "properties": {
152            "description": {
153              "description": "Human-readable message",
154              "type": "string"
155            },
156            "direction":   {
157              "description": "Whether this event affects only one direction",
158              "type": "string",
159              "enum": ["single", "both"]
160            },
161            "extent": {
162              "description": "The event affects this many points from location",
163              "type": "string",
164              "pattern": "^(\\+|-)[0-9]+$"
165            },
166            "location": {
167              "description": "Location code (reference to a location database)",
168              "type": "integer",
169              "minimum": 0,
170              "maximum": 65535
171            },
172            "encrypted_location": {
173              "description": "Location code in its encrypted form",
174              "type": "integer",
175              "minimum": 0,
176              "maximum": 65535
177            },
178            "event_codes": {
179              "description": "Event codes (references to event code list)",
180              "type": "array",
181              "items": {
182                "type": "number",
183                "minimum": 0,
184                "maximum": 2047
185              }
186            },
187            "road_number": {
188              "type": "integer"
189            },
190            "span_from": {
191              "type": "string"
192            },
193            "span_to": {
194              "type": "string"
195            },
196            "coordinates": {
197              "description": "Affected point or route",
198              "type": "object",
199              "properties": {
200                "lat": {
201                  "description": "Degrees North",
202                  "type": "number",
203                  "minimum": -90,
204                  "maximum": 90
205                },
206                "lon": {
207                  "description": "Degrees East",
208                  "type": "number",
209                  "minimum": -180,
210                  "maximum": 180
211                }
212              }
213            },
214            "urgency": {
215              "description": "Message urgency: normal/urgent/extremely urgent",
216              "type": "string",
217              "enum": ["none", "U", "X"]
218            },
219            "update_class": {
220              "description": "Message replaces previous messages of this class",
221              "type": "integer"
222            }
223          },
224          "additionalProperties": false
225        }
226      }]
227    }
228  },
229
230  "type": "array",
231  "items": {
232    "type": "object",
233    "properties": {
234
235      "group": {
236        "description": "Group type",
237        "$ref": "#/definitions/grouptype"
238      },
239      "pi": {
240        "description": "Program Identification code",
241        "$ref": "#/definitions/pi"
242      },
243      "callsign": {
244        "description": "Call sign letters for a North American (RBDS) station",
245        "type": "string"
246      },
247      "callsign_uncertain": {
248        "description": "Call sign letters for a North American (RBDS) station - probably erroneous due to a TMC workaround",
249        "type": "string"
250      },
251      "channel": {
252        "description": "Which channel of a multi-channel signal this group was received on",
253        "type": "integer",
254        "minimum": 1
255      },
256      "prog_type": {
257        "description": "Program Type",
258        "type": "string"
259      },
260      "tp": {
261        "description": "Traffic Program flag",
262        "type": "boolean"
263      },
264      "is_music": {
265        "description": "Music/Speech flag",
266        "type": "boolean"
267      },
268      "ta": {
269        "description": "Traffic Announcement flag",
270        "type": "boolean"
271      },
272      "radiotext": {
273        "$ref": "#/definitions/radiotext"
274      },
275      "ps": {
276        "description": "Program Service name",
277        "$ref": "#/definitions/ps"
278      },
279      "country": {
280        "description": "ISO country code",
281        "type": "string",
282        "minLength": 2,
283        "maxLength": 2
284      },
285      "has_linkage": {
286        "type": "boolean"
287      },
288      "di": {
289        "description": "Decoder identification code",
290        "$ref": "#/definitions/di"
291      },
292      "language": {
293        "description": "Program language",
294        "type": "string"
295      },
296      "radiotext_plus": {
297        "$ref": "#/definitions/rtplus"
298      },
299      "tmc": {
300        "description": "Traffic Message Channel",
301        "$ref": "#/definitions/tmc"
302      },
303      "alt_kilohertz": {
304        "description": "Alternative Frequencies",
305        "type": "array",
306        "items": {
307          "type": "integer"
308        }
309      },
310      "prog_item_number": {
311        "description": "A numeric identifier for the currently running program",
312        "type": "integer",
313        "minimum": 0,
314        "maximum": 65535
315      },
316      "prog_item_started": {
317        "description": "Program Item number (start time)",
318        "$ref": "#/definitions/pin"
319      },
320      "bler": {
321        "description": "Block Error Rate (averaged percentage of erroneous blocks)",
322        "type": "integer",
323        "minimum": 0,
324        "maximum": 100
325      },
326      "debug": {
327        "description": "Debug messages from redsea",
328        "type": "array",
329        "items": {
330          "type": "string"
331        }
332      },
333      "tmc_id": {
334        "type": "integer",
335        "minimum": 0,
336        "maximum": 4095
337      },
338      "ews": {
339        "description": "Emergency Warning System channel number",
340        "type": "integer",
341        "minimum": 0,
342        "maximum": 4095
343      },
344      "partial_radiotext": {
345        "description": "Incompletely received RadioText",
346        "$ref": "#/definitions/radiotext"
347      },
348      "partial_ps": {
349        "description": "Incompletely received Program Service name",
350        "$ref": "#/definitions/ps"
351      },
352      "partial_alt_kilohertz": {
353        "description": "Incomplete list of Alternative Frequencies",
354        "type": "array",
355        "items": {
356          "type": "integer"
357        }
358      },
359      "open_data_app": {
360        "type": "object",
361        "properties": {
362          "oda_group": {
363            "description": "The group that carries this Open Data Application",
364            "$ref": "#/definitions/grouptype"
365          },
366          "app_name": { "type": "string" },
367          "message": {
368            "type": "integer",
369            "minimum": 0,
370            "maximum": 65535
371          }
372        },
373        "additionalProperties": false
374      },
375      "unknown_oda": {
376        "description": "Data for an unsupported or unknown Open Data Application",
377        "type": "object",
378        "properties": {
379          "app_name": {
380            "description": "Name of the application, if available",
381            "type": "string"
382          },
383          "raw_data": {
384            "type": "string"
385          }
386        }
387      },
388      "clock_time": {
389        "description": "Time and date at transmitter (formatted to RFC 3339, section 5.6)",
390        "type": "string",
391        "pattern": "^....-..-..T..:..:..((\\+|-)..:..|Z)$"
392      },
393      "rx_time": {
394        "description": "Time of demodulation/decoding",
395        "type": "string"
396      },
397      "transparent_data": {
398        "description": "Freeform data",
399        "type": "object",
400        "properties": {
401          "address": {
402            "description": "Address of this transparent data channel",
403            "type": "integer",
404            "minimum": 0,
405            "maximum": 31
406          },
407          "raw": {
408            "description": "Hexadecimal values of the data bytes sent in this group",
409            "type": "string"
410          },
411          "as_text": {
412            "description": "The data interpreted as RDS text",
413            "type": "string"
414          },
415          "full_text": {
416            "description": "All channels concatenated when 128 bytes are received contiguously",
417            "type": "string"
418          },
419          "full_raw": {
420            "description": "All channels concatenated when 128 bytes are received contiguously (hexadecimal)",
421            "type": "string"
422          }
423        }
424      },
425      "dab": {
426        "description": "RDS/DAB cross-referencing",
427        "type": "object",
428        "properties": {
429          "mode": {
430            "type": "string"
431          },
432          "kilohertz": {
433            "type": "integer"
434          },
435          "ensemble_id": {
436            "type": "integer"
437          }
438        }
439      },
440      "pty_name": {
441        "description": "Programme type name",
442        "type": "string"
443      },
444      "in_house_data": {
445        "description": "The contents of these bits are defined by the operator",
446        "type": "array",
447        "items": {
448          "type": "integer",
449          "minimum": 0,
450          "maximum": 65535
451        }
452      },
453      "other_network": {
454        "description": "Information about programs on other networks",
455        "type": "object",
456        "properties": {
457          "pi": {
458            "$ref": "#/definitions/pi"
459          },
460          "tp": {
461            "type": "boolean"
462          },
463          "ta": {
464            "type": "boolean"
465          },
466          "ps": {
467            "$ref": "#/definitions/ps"
468          },
469          "prog_type": {
470            "type": "string"
471          },
472          "alt_kilohertz": {
473            "type": "array",
474            "items": {
475              "type": "integer"
476            }
477          },
478          "kilohertz": {
479            "type": "integer"
480          },
481          "has_linkage": {
482            "type": "boolean"
483          },
484          "linkage_set": {
485            "type": "integer",
486            "minimum": 0,
487            "maximum": 4095
488          },
489          "prog_item_number": {
490            "description": "A numeric identifier for the currently running program",
491            "type": "integer",
492            "minimum": 0,
493            "maximum": 65535
494          },
495          "prog_item_started": {
496            "$ref": "#/definitions/pin"
497          },
498          "broadcaster data": {
499            "type": "string"
500          }
501        },
502        "required": ["pi"],
503        "additionalProperties": false
504      }
505    },
506
507    "required": ["pi"],
508    "additionalProperties": false
509  }
510}
511