-
Notifications
You must be signed in to change notification settings - Fork 0
/
IMC.xsd
529 lines (529 loc) · 26.2 KB
/
IMC.xsd
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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="5.1.0">
<xs:annotation>
<xs:documentation>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Copyright (C) 2007-2020 Laboratório de Sistemas e Tecnologia Subaquática
+ Departamento de Engenharia Electrotécnica e de Computadores
+ Rua Dr. Roberto Frias, 4200-465 Porto, Portugal
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ author: Paulo Dias ([email protected])
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
</xs:documentation>
<xs:documentation>This is the schema to validate v5 of the embedded message protocol</xs:documentation>
</xs:annotation>
<xs:element name="messages">
<xs:annotation>
<xs:documentation>Root element for the definition of new embedded message protocol</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
<xs:element name="types" type="typesType">
<xs:annotation>
<xs:documentation>Just an indicative list of the types to be used. It's useful for documentation purposes.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="serialization" type="serializationType" minOccurs="0">
<xs:annotation>
<xs:documentation>Is only for documenting how to serialize the types above.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="units" type="unitsType" minOccurs="0">
<xs:annotation>
<xs:documentation>Documentation of the units to be used in 'unit' attribute of a message.</xs:documentation>
</xs:annotation>
<xs:unique name="uniqueUnitAbbrev">
<xs:selector xpath="unit"/>
<xs:field xpath="@abbrev"/>
</xs:unique>
</xs:element>
<xs:element name="enumerations" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="def" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
<xs:element name="value" type="enumBitmaskType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="abbrev" type="xs:string" use="required"/>
<xs:attribute name="prefix" type="xs:ID" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniqueDefEnumAbbrev">
<xs:selector xpath="def"/>
<xs:field xpath="@prefix"/>
</xs:unique>
</xs:element>
<xs:element name="bitfields" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="def" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
<xs:element name="value" type="enumBitmaskType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="abbrev" type="xs:string" use="required"/>
<xs:attribute name="prefix" type="xs:ID" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniqueDefBitMaskAbbrev">
<xs:selector xpath="def"/>
<xs:field xpath="@prefix"/>
</xs:unique>
</xs:element>
<xs:element name="message-groups" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="message-group" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="message-type" type="subtypeType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="abbrev" type="xs:string" use="required"/>
</xs:complexType>
<xs:unique name="keySubTypeMessageUnique">
<xs:selector xpath="message-type"/>
<xs:field xpath="@abbrev"/>
</xs:unique>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="keySubTypeAbbrevUnique">
<xs:selector xpath="message-group"/>
<xs:field xpath="@abbrev"/>
</xs:unique>
</xs:element>
<xs:element name="flags" type="flagsType" minOccurs="0">
<xs:annotation>
<xs:documentation>Indications of the possible flags to be used in 'flag' attribute on a message. This might be useful to classify a particular message. The meaning and it's implementation is out of this scope.</xs:documentation>
</xs:annotation>
<xs:unique name="keyFlagAbbrev">
<xs:selector xpath="flag"/>
<xs:field xpath="@abbrev"/>
</xs:unique>
</xs:element>
<xs:element name="header" type="headerType">
<xs:annotation>
<xs:documentation>The packet header contains handling information in the form of supplemental fields, it is always placed at the beginning of a packet.</xs:documentation>
</xs:annotation>
<xs:unique name="uniqueHeaderFieldAbbrev">
<xs:selector xpath="field"/>
<xs:field xpath="@abbrev"/>
</xs:unique>
</xs:element>
<xs:element name="footer" type="headerType" minOccurs="0">
<xs:annotation>
<xs:documentation>The packet footer contains validation information in the form of supplemental fields, it is always placed at the end of a packet.</xs:documentation>
</xs:annotation>
<xs:unique name="uniqueFooterFieldAbbrev">
<xs:selector xpath="field"/>
<xs:field xpath="@abbrev"/>
</xs:unique>
</xs:element>
<xs:element name="payload-header" type="headerType" minOccurs="0">
<xs:annotation>
<xs:documentation>This is a placeholder for helping to define fields that appear always in the beginning of the message payload.</xs:documentation>
</xs:annotation>
<xs:unique name="uniquePayloadHeaderFieldAbbrev">
<xs:selector xpath="field"/>
<xs:field xpath="@abbrev"/>
</xs:unique>
</xs:element>
<xs:element name="groups" minOccurs="0" maxOccurs="0">
<xs:annotation>
<xs:documentation>DEPRECATED. It's a facility to group messages. The grouping is made using windows of 'id' values.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
<xs:element name="group" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence minOccurs="0">
<xs:element name="description" type="documentationType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="abbrev" type="xs:string" use="required"/>
<xs:attribute name="min" type="xs:long" use="required"/>
<xs:attribute name="max" type="xs:long" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="keyGroupAbbrev">
<xs:selector xpath="group"/>
<xs:field xpath="@abbrev"/>
</xs:unique>
</xs:element>
<xs:element name="categories" minOccurs="1">
<xs:annotation>
<xs:documentation>It's a facility to categorise messages. It's purpose is for documentation, not for coding.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
<xs:element name="category" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence minOccurs="1">
<xs:element name="description" type="documentationType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="uniqueCategoryAbbrev">
<xs:selector xpath="category"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<xs:element name="message" type="messageType" maxOccurs="unbounded">
<xs:unique name="uniqueMessageFieldAbbrev">
<xs:selector xpath="field"/>
<xs:field xpath="@abbrev"/>
</xs:unique>
</xs:element>
</xs:sequence>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="2"/>
<xs:maxLength value="20"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="long-name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="2"/>
<xs:whiteSpace value="collapse"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="creation" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="revision" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="version" use="required">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:attribute>
<xs:attributeGroup ref="byteOrderAttribute"/>
</xs:complexType>
<xs:key name="keyType">
<xs:selector xpath="types/type"/>
<xs:field xpath="@name"/>
</xs:key>
<xs:keyref name="keyrefSerType" refer="keyType">
<xs:selector xpath="serialization/type"/>
<xs:field xpath="@name"/>
</xs:keyref>
<xs:keyref name="keyrefPayloadHeaderType" refer="keyType">
<xs:selector xpath="*/field"/>
<xs:field xpath="@type"/>
</xs:keyref>
<xs:unique name="uniqueMessageId">
<xs:selector xpath="message"/>
<xs:field xpath="@id"/>
</xs:unique>
<xs:unique name="uniqueMessageAbbrev">
<xs:selector xpath="message"/>
<xs:field xpath="@abbrev"/>
</xs:unique>
<xs:unique name="uniqueMessageOrSubTypeAbbrev">
<xs:selector xpath="message|message-groups/message-group"/>
<xs:field xpath="@abbrev"/>
</xs:unique>
<xs:key name="unitType">
<xs:selector xpath="units/unit"/>
<xs:field xpath="@abbrev"/>
</xs:key>
<xs:keyref name="unitrefPayloadHeaderType" refer="unitType">
<xs:selector xpath="*/field"/>
<xs:field xpath="@unit"/>
</xs:keyref>
<xs:keyref name="keySubTypeMessageRef" refer="uniqueMessageAbbrev">
<xs:selector xpath="message-groups/message-group/message-type"/>
<xs:field xpath="@abbrev"/>
</xs:keyref>
<xs:keyref name="keyMessageFieldSubTypeRef" refer="uniqueMessageOrSubTypeAbbrev">
<xs:selector xpath="message/field"/>
<xs:field xpath="@subtype"/>
</xs:keyref>
<xs:key name="categoryType">
<xs:selector xpath="categories/category"/>
<xs:field xpath="@name"/>
</xs:key>
<xs:keyref name="keyrefCategoryType" refer="categoryType">
<xs:selector xpath="message"/>
<xs:field xpath="@category"/>
</xs:keyref>
</xs:element>
<xs:element name="field" type="fieldType">
<xs:annotation>
<xs:documentation>Don't use this as a root element</xs:documentation>
</xs:annotation>
<xs:unique name="uniqueIdEnumBitF">
<xs:selector xpath="value"/>
<xs:field xpath="@id"/>
</xs:unique>
<xs:unique name="uniqueAbbrevEnumBitF">
<xs:selector xpath="value"/>
<xs:field xpath="@abbrev"/>
</xs:unique>
<xs:unique name="uniqueNameEnumBitF">
<xs:selector xpath="value"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
<xs:complexType name="fieldType">
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
<xs:choice>
<xs:choice minOccurs="0">
<xs:annotation>
<xs:documentation>By using this the attribute 'prefix' should exist also. This will get deprecated</xs:documentation>
</xs:annotation>
<xs:element name="value" type="enumBitmaskType" maxOccurs="unbounded"/>
</xs:choice>
</xs:choice>
</xs:sequence>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="abbrev" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attributeGroup ref="typeAttributes"/>
<xs:attribute name="unit">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="units" type="xs:string" use="prohibited">
<xs:annotation>
<xs:documentation>This element is being deprecated.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup ref="valueAttributes"/>
<xs:attributeGroup ref="minMaxAttributes"/>
<xs:attribute name="note" type="xs:string" use="optional"/>
<xs:attribute name="prefix" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>To be used with 'enum' or 'bitmask' elements.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup ref="enumBitmaskRefAttributes"/>
<xs:attributeGroup ref="messageTypeRefAttributes"/>
</xs:complexType>
<xs:complexType name="headerType">
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
<xs:element ref="field" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="messageType">
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
<xs:element ref="field" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="id" use="required">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="abbrev" use="required">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="flags" type="xs:token">
<xs:annotation>
<xs:documentation>This flags should be indicated in the 'flags' child element of 'messages'.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup ref="controlAttributes"/>
</xs:complexType>
<xs:complexType name="typeType">
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:whiteSpace value="replace"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="size">
<xs:annotation>
<xs:documentation>Should indicate the number of bits if known.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="description" type="xs:string"/>
<xs:attribute name="note" type="xs:string"/>
</xs:complexType>
<xs:complexType name="typesType">
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
<xs:element name="type" type="typeType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="serializationType">
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
<xs:element name="type" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="flagType">
<xs:attribute name="name" use="required"/>
<xs:attribute name="abbrev" use="required"/>
<xs:attribute name="note"/>
</xs:complexType>
<xs:complexType name="flagsType">
<xs:sequence>
<xs:element name="flag" type="flagType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="documentationType">
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="unitsType">
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
<xs:element name="unit" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="abbrev" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="subtypeType">
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="abbrev" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="enumBitmaskType">
<xs:sequence>
<xs:element name="description" type="documentationType" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="abbrev" type="xs:string" use="required"/>
<xs:attribute name="note" type="xs:string"/>
</xs:complexType>
<xs:attributeGroup name="byteOrderAttribute">
<xs:attribute name="byte-order" use="optional" default="LITTLE_ENDIAN">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="LITTLE_ENDIAN"/>
<xs:enumeration value="BIG_ENDIAN"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:attributeGroup>
<xs:attributeGroup name="valueAttributes">
<xs:attribute name="value" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="fixed" type="xs:boolean" use="optional" default="false">
<xs:annotation>
<xs:documentation>This is used to indicate that the value is fixed and should not be changed.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:attributeGroup>
<xs:attributeGroup name="typeAttributes">
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="subtype" type="xs:string"/>
<xs:attribute name="width" type="xs:int" use="optional"/>
</xs:attributeGroup>
<xs:attributeGroup name="minMaxAttributes">
<xs:attribute name="min" type="xs:string" use="optional"/>
<xs:attribute name="max" type="xs:string" use="optional"/>
</xs:attributeGroup>
<xs:attributeGroup name="controlAttributes">
<xs:attribute name="source" use="optional">
<xs:annotation>
<xs:documentation>Use comma separated values: ccu, vehicle, simulated.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="used-by" type="xs:string" use="optional"/>
<xs:attribute name="category" type="xs:string" use="required"/>
<xs:attribute name="stable" type="xs:boolean" use="optional" default="true"/>
<xs:attribute name="deprecated" type="xs:boolean" use="optional" default="false"/>
</xs:attributeGroup>
<xs:attributeGroup name="enumBitmaskAttributes">
<xs:attribute name="prefix" type="xs:ID" use="optional">
<xs:annotation>
<xs:documentation>Use coma separated values: ccu, vehicle, simulated.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:attributeGroup>
<xs:attributeGroup name="enumBitmaskRefAttributes">
<xs:attribute name="enum-def" type="xs:string" use="optional" default=""/>
<xs:attribute name="bitfield-def" type="xs:string" use="optional" default=""/>
</xs:attributeGroup>
<xs:attributeGroup name="messageTypeRefAttributes">
<xs:attribute name="message-type" type="xs:string" use="optional" default=""/>
</xs:attributeGroup>
</xs:schema>