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
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
//! Declarative row and descriptor types for the catalogue.
//!
//! These types hold the declarative record of each subtype - a
//! restatement where the KNX source is plain, and the reading this
//! catalogue settled on where the source is silent, ambiguous or
//! prints figures that disagree - in a shape a consumer can read
//! without heap allocation or runtime text parsing. The types
//! deliberately distinguish structural dimensions the source
//! distinguishes - fixed fields, fixed arrays, repeated fixed-width
//! groups, genuinely variable length, reserved bits, named bits, special
//! values with distinct kinds - rather than collapsing them into a single
//! width number.
use fmt;
use crateDptId;
/// The transmitted width contract of a subtype.
/// An exact decimal number: `num * 10^exp`.
///
/// The source declares ranges and resolutions in decimal; a scaled integer
/// keeps them exact where a binary float would approximate.
/// Canonical decimal rendering: the exact value, a `.` only where the
/// exponent is negative, no exponent notation and no trimming.
/// The declared numeric range of a subtype's value.
/// A declared resolution.
/// The kind of special encoded value, as the source distinguishes them.
/// A receiver disposition the source assigns to declared data.
///
/// The vocabulary carries exactly the dispositions catalogued rows
/// declare and interpretation returns. Rejection needs no declared
/// data: an undeclared code or pattern already fails closed. The
/// source assigns further dispositions at other layers (refuse the
/// read, truncate, neglect the frame); those are not catalogue data
/// and no row can declare them. A population row declaring a
/// disposition outside this vocabulary is a source question that
/// extends it through review.
/// A special encoded value the reviewed data records beside the
/// field's ordinary domain: singled out by the source where the source
/// singles one out, and the reading this catalogue settled on where a
/// printed reference supplies it instead.
///
/// The kind carries the whole behavioral contract; any human-readable
/// designation is a projection concern derived from it.
/// One defined code in an enumeration code table.
/// A band of codes that share one collective meaning.
/// An enumeration code table: a set of defined codes, possibly sparse,
/// with source-stated bands over the remaining code space.
///
/// A code domain is a set, never a range with a default.
/// A named bit in a bit-set layout.
/// How a receiver treats declared reserved or unused bits.
///
/// Per-declaration data: the source obliges receivers to check some
/// reserved fields to be zero and to ignore other unused fields.
/// A bit-set layout with named positions and reserved bits.
///
/// Bit positions are anchored to the bit-group field node that
/// references this descriptor, not to the whole payload: bit 0 is the
/// group's last transmitted bit, so a group of N bits spans positions
/// N-1..0 whether or not it ends on an octet boundary. The group's
/// placement in the payload is the field tree's data; this descriptor
/// never restates it.
/// The numeric carrier of a scalar field, as the notation symbol
/// declares it.
/// A declared value-to-field mapping of an integer scalar field.
///
/// The DPT specification form's encoding conventions distinguish how a
/// field value relates to the value it carries, and the relationship is
/// a per-field fact: one subtype can hold fields of different mapping
/// kinds. The reviewed data declares the kind explicitly and generation
/// fails when a declared kind contradicts the field's printed
/// resolution or range, so no consumer ever re-derives it.
///
/// The declared range's domain follows the kind: identity, offset,
/// century and interval-exponential ranges bound the FIELD value
/// (19.001's Year prints 0..255), by this catalogue's own convention
/// for all 4; resolution and linear ranges bound the mapped VALUE
/// (7.003's 0..655350 ms, 5.001's 0..100 percent).
/// A scalar field's declarative record.
///
/// Resolution, range, codes and specials attach here because they are
/// per-field facts: multi-field rows (251.600's 4 colour components,
/// 204.001's main value) are only expressible at this level, and a
/// per-field absence is recorded rather than erased by a row-level
/// hoist. Each is a restatement where the source is plain and the
/// reading this catalogue settled on where it is not.
/// The shape of one field in a subtype's declared encoding.
///
/// Recursion appears exactly where the source structure requires it: a
/// repeated group and an embedded record contain fields; everything
/// else is flat. Print-level octet groupings are not nesting and are
/// flattened.
/// One field of a subtype's declared encoding, in transmission order
/// (most significant, first transmitted, first).
/// What the gating flag's active state declares about its target.
///
/// The source states both polarities: 251.600's mask bits and 235.001's
/// validity bits declare the component valid, while 19.001's "No ..."
/// flags declare the gated fields not valid. The sense is recorded per
/// edge because it cannot be derived from a bit name.
/// A validity association the reviewed data records: a named flag bit
/// gates a field (or another named bit) of the same row.
///
/// Source-declared where the defining clause declares one, and the
/// reading this catalogue settled on where the clause reaches its flags
/// through a reference instead. The reviewed data records no per-edge
/// provenance column; the kind is assigned per ROW, in the 2 paragraphs
/// below, and every per-row count is pinned by a test - so the totals
/// live where they are measured, not here - a moving figure restated
/// in prose goes stale the commit the set grows. Per row, the counts
/// below are fixed facts of each clause.
///
/// The clause-declared rows: 19.001 carries 8, 251.600 carries 4,
/// and 235.001 and 235.002 carry 2 each - each row's own field table
/// names the gating flag, its polarity and what it gates. The
/// structured compound rows whose own bit tables print a validity
/// declaration are clause-declared the same way, 1 edge per printed
/// declaration - a growing membership, so it is not enumerated here;
/// the per-row counts are pinned by tests.
///
/// The remainder rest on a reference. 265.001 and 247.600 carry 8 each,
/// under 2 same-shaped readings: 265.001 declares no validity association of
/// its own at all: its clause reaches 19.001 through a same-as cell in
/// the column that states how a field's value relates to its coded
/// value, and whether such a cell carries the named row's whole
/// definition or only its field encodings is a question the source
/// leaves open. Answering it broadly - so that the edges come across
/// with the layout - is a decision recorded for this catalogue rather
/// than a printed fact. 247.600's clause hands its octets 12 to 5 -
/// the whole date-and-time block, flags included - to 19.001 through
/// one see-cell, and its edges come across under the same broad
/// reading (its flag octets re-package 19.001's B16 as B8 plus B1r7,
/// so the layout could not come across as an instantiation - the
/// contract did). The DateTime-carrying register variants take the
/// SAME same-as reading for their date-and-time portion: each
/// carries 19.001's 8 flag edges through its embedded record,
/// exactly as 265.001 does. And every register-family row (277.1200,
/// its instantiation-count variants, and the DateTime variants
/// alike) carries its `E` and `T` pair under a qualified delegation:
/// the
/// family clause prints the validity octet's bit geometry and no bit
/// label, polarity or per-bit meaning at all, handing the repeated
/// record to 235.001 under a qualifier whose extension is printed as
/// prose with no encoding - so the pair is read off the delegation
/// target, and whether the referenced meanings survive the qualifier
/// stays an open reading. A DateTime register variant therefore
/// carries both classes: the 8 date-and-time edges and the pair.
///
/// The flag's active state is its declared `active_value`; the sense
/// says what that state means for the target. The value-level
/// consequences of an invalid target are semantic-layer concerns.
/// Within a repeated group, the association binds per instance - and
/// that is why both ends live in one scope: an association binding per
/// instance has no reading where one end sits outside the group, so an
/// edge whose flag and target are declared on opposite sides of a
/// repeated group is refused where the row is bound rather than
/// resolved per payload.
/// A source-declared relation between fields of one row.
///
/// The vocabulary is closed over the relations the reviewed rows
/// declare; a new source-declared relation form extends it through
/// review, never through a generic escape hatch. A rule's operands
/// all live in one scope - the row's top scope, or one repeated
/// group, where the relation binds every instance independently
/// (instance i's trigger obliges instance i's targets alone), the
/// same per-instance reading a [`ValidityEdge`] takes.
/// The target of a source-declared reference.
///
/// The source references both specific subtypes and whole families; a
/// family-level reference is not collapsed onto an arbitrary subtype.
/// Emits [`TextRepertoire`] and its `ALL` census from ONE variant
/// list, so a variant cannot exist outside the census: the
/// variant-live-census-short state is not expressible, on stable and
/// on this workspace's MSRV alike. A `macro_rules!` list, following
/// the tree's own precedent, not a derive.
) => ;
=> ;
=> ;
}
text_repertoires!
/// Whether a Z8 command's main value carries data.
///
/// The command table's own column: under some commands the main value
/// is valid, under others it is don't care (the source's term) - the
/// receiver reads no data from it.
/// One command of the Z8 command enumeration.
/// The standardised Z8 status/command contract, declared once.
///
/// A general clause defines the Z8 octet for every Z8-bearing subtype:
/// read as STATUS it is the DPT_StatusGen bit set, read as COMMAND it
/// is this command enumeration, and the reading is selected by the
/// Application Layer service, never by payload content. Under a set
/// Fault status bit the main value field carries failure information
/// whose codes this descriptor also names.
/// The operation context a subtype's interpretation requires.
/// The transport restriction the source states for this type.
///
/// The variants rest on different source statements; they are not
/// degrees of one rule, and a refusal names the rule the source
/// actually states.
/// One catalogued datapoint subtype: its declarative record - a
/// restatement where the KNX source is plain, and the reading this
/// catalogue settled on where the source is silent, ambiguous or prints
/// figures that disagree.
///
/// Per-field facts - resolutions, ranges, code tables, named bits,
/// specials, reserved declarations - live on the field nodes that own
/// them.