@ebusd/ebus-typespec 0.3.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/types.tsp CHANGED
@@ -23,7 +23,7 @@ union targets {
23
23
  Target,
24
24
  }
25
25
  /** the special broadcast target address. */
26
- alias BROADCAST = 0xfe; // todo should be possible as targets.Broadcast someday
26
+ alias BROADCAST = targets.Broadcast;
27
27
 
28
28
  /** the primary command symbol 'PB'. */
29
29
  scalar Pb extends Symbol;
@@ -31,139 +31,361 @@ scalar Pb extends Symbol;
31
31
  /** the secondary command symbol 'SB'. */
32
32
  scalar Sb extends Symbol;
33
33
 
34
- /** The known numeric base types. */
34
+ /** The known numeric base data types. */
35
35
  namespace num {
36
+ // 1 byte length
37
+
38
+ /** bit 0. */
36
39
  @encode("uint8")
37
40
  scalar BI0 extends boolean;
41
+ /** bit 1. */
38
42
  @encode("uint8")
39
43
  scalar BI1 extends boolean;
44
+ /** bit 2. */
40
45
  @encode("uint8")
41
46
  scalar BI2 extends boolean;
47
+ /** bit 3. */
42
48
  @encode("uint8")
43
49
  scalar BI3 extends boolean;
50
+ /** bit 4. */
44
51
  @encode("uint8")
45
52
  scalar BI4 extends boolean;
53
+ /** bit 5. */
46
54
  @encode("uint8")
47
55
  scalar BI5 extends boolean;
56
+ /** bit 6. */
48
57
  @encode("uint8")
49
58
  scalar BI6 extends boolean;
59
+ /** bit 7. */
50
60
  @encode("uint8")
51
61
  scalar BI7 extends boolean;
62
+ /** 6 bits starting from bit 0. */
63
+ @internal.maxBits(6)
64
+ scalar BI0_6 extends uint8;
65
+ /** 7 bits starting from bit 0. */
52
66
  @internal.maxBits(7)
53
67
  scalar BI0_7 extends uint8;
54
68
 
69
+ /** 1 byte unsigned integer, 0 - 254, replacement 0xff. */
55
70
  scalar UCH extends uint8;
71
+ /** 1 byte signed integer, -127 - +127, replacement 0x7f. */
56
72
  scalar SCH extends int8;
73
+ /** same as SCH. */
57
74
  alias D1B = SCH;
75
+ /** 1 byte unsigned decimal in BCD, 0 - 99, replacement 0xff. */
58
76
  @internal.bcd
59
77
  scalar BCD extends uint8;
78
+ /**
79
+ * 1 byte unsigned decimal digits in hex, 0 - 99
80
+ * (0x00 - 0x63).
81
+ */
60
82
  @internal.hex
61
83
  scalar HCD extends uint8;
84
+ /**
85
+ * 1 byte unsigned number (fraction 1/2), 0 - 100
86
+ * (0x00 - 0xc8, replacement 0xff).
87
+ */
62
88
  @divisor(2)
63
89
  scalar D1C extends uint8;
64
90
 
91
+ // 2 byte length
92
+
93
+ /** 2 byte unsigned decimal in BCD, shown as 4 digits, 0000 - 9999 (fixed length). */
65
94
  @internal.reverse
66
95
  @internal.bcd
67
96
  scalar PIN extends uint16;
97
+ /** 2 byte unsigned integer, 0 - 65534, replacement 0xffff. */
68
98
  scalar UIN extends uint16;
99
+ /** 2 byte unsigned integer, 0 - 65534, replacement 0xffff, big endian. */
69
100
  @internal.reverse
70
101
  scalar UIR extends UIN;
102
+ /** 2 byte signed integer, -32767 - +32767, replacement 0x7fff. */
71
103
  scalar SIN extends int16;
104
+ /** 2 byte signed integer, -32767 - +32767, replacement 0x7fff, big endian. */
72
105
  @internal.reverse
73
106
  scalar SIR extends SIN;
107
+ /** 2 byte unsigned decimal in BCD, 0 - 9999, replacement 0xffff. */
108
+ @internal.bcd
109
+ scalar BCD2 extends uint16;
110
+ /**
111
+ * 2 byte unsigned decimal digits in hex, 0 - 9999
112
+ * (0x00,0x00 - 0x63,0x63).
113
+ */
74
114
  @internal.hex
75
115
  scalar HCD2 extends uint16;
76
-
116
+ /**
117
+ * 2 byte signed number (fraction 1/256), -127.99 - +127.99 .
118
+ */
77
119
  @divisor(256)
78
120
  scalar D2B extends int16;
79
-
121
+ /**
122
+ * 2 byte signed number (fraction 1/16), -2047.9 - +2047.9 .
123
+ */
80
124
  @divisor(16)
81
125
  scalar D2C extends int16;
82
-
126
+ /**
127
+ * 2 byte signed number (fraction 1/1000), -32.767 - +32.767 .
128
+ */
83
129
  @divisor(1000)
84
130
  scalar FLT extends int16;
131
+ /**
132
+ * 2 byte signed number (fraction 1/1000), -32.767 - +32.767, big endian.
133
+ */
85
134
  @internal.reverse
86
135
  scalar FLR extends FLT;
87
136
 
137
+ // 3 byte length
138
+
88
139
  //todo 3 byte int
140
+ /** 3 byte unsigned decimal in BCD, 0 - 999999, replacement 0xffffff. */
89
141
  @internal.bcd
90
142
  scalar BCD3 extends uint32; // todo 3 bytes
143
+ /**
144
+ * 3 byte unsigned decimal digits in hex, 0 - 999999
145
+ * (0x00,0x00,0x00 - 0x63,0x63,0x63).
146
+ */
91
147
  @internal.hex
92
148
  scalar HCD3 extends uint32; // todo 3 bytes
93
149
 
150
+ // 4 byte length
151
+
152
+ /** 4 byte unsigned integer, 0 - 4294967294, replacement 0xffffffff. */
94
153
  scalar ULG extends uint32;
154
+ /** 4 byte unsigned integer, 0 - 4294967294, replacement 0xffffffff, big endian. */
95
155
  @internal.reverse
96
156
  scalar ULR extends ULG;
157
+ /** 4 byte signed integer, -2147483647 - +2147483647, replacement 0x7fffffff. */
97
158
  scalar SLG extends int32;
159
+ /** 4 byte signed integer, -2147483647 - +2147483647, replacement 0x7fffffff, big endian. */
98
160
  @internal.reverse
99
161
  scalar SLR extends SLG;
162
+ /** 4 byte unsigned decimal in BCD, 0 - 99999999, replacement 0xffffffff. */
100
163
  @internal.bcd
101
164
  scalar BCD4 extends uint32;
165
+ /**
166
+ * 4 byte unsigned decimal digits in hex, 0 - 99999999
167
+ * (0x00,0x00,0x00,0x00 - 0x63,0x63,0x63,0x63).
168
+ */
102
169
  @internal.hex
103
170
  scalar HCD4 extends uint32;
104
-
171
+ /**
172
+ * 4 byte signed number in IEEE 754
173
+ * (IEEE 754 binary32: 1 bit sign, 8 bits exponent, 23 bits significand).
174
+ */
105
175
  scalar EXP extends float32;
176
+ /**
177
+ * 4 byte signed number in IEEE 754, big endian
178
+ * (IEEE 754 binary32: 1 bit sign, 8 bits exponent, 23 bits significand).
179
+ */
106
180
  @internal.reverse
107
181
  scalar EXR extends EXP;
108
182
  }
109
183
 
110
- /** The known string base types. */
184
+ /** The known string base data types. */
111
185
  namespace str {
186
+ /** >= 1 byte character string filled up with space. */
112
187
  @maxLength(31)
113
188
  scalar STR extends string;
189
+ /** >= 1 byte character string filled up with 0x00 (null terminated string). */
114
190
  @encode("nullterm") // todo
115
191
  @maxLength(31)
116
192
  scalar NTS extends string;
193
+ /** >= 1 byte ignored data. */
117
194
  @maxLength(31)
118
195
  scalar IGN extends string; // todo bytes would be more logical, but have not length limit
196
+ /** >= 1 byte hex digit string, usually separated by space, e.g. 0a 1b 2c 3d. */
119
197
  @internal.hex
120
198
  @maxLength(31)
121
199
  scalar HEX extends string;
122
200
  }
123
201
 
124
- /** The known date/time base types. */
202
+ /** The known date/time base data types. */
125
203
  namespace dtm {
204
+ /**
205
+ * 1 byte weekday, "Mon" - "Sun"
206
+ * (0x00 - 0x06).
207
+ */
126
208
  scalar BDY extends uint8; // todo weekday
209
+ /**
210
+ * 1 byte weekday, "Mon" - "Sun" [Vaillant type]
211
+ * (0x01 - 0x07).
212
+ */
127
213
  scalar HDY extends uint8; // todo weekday
214
+ /**
215
+ * 4 byte date with weekday in BCD, 01.01.2000 - 31.12.2099
216
+ * (0x01,0x01,WW,0x00 - 0x31,0x12,WW,0x99, WW is weekday Mon=0x01 - Sun=0x07, replacement 0xff).
217
+ */
128
218
  @internal.bcd
129
219
  @encode("", uint32)
130
220
  scalar BDA extends plainDate;
221
+ /** same as BDA. */
131
222
  alias BDA4 = BDA;
223
+ /**
224
+ * 3 byte date in BCD, 01.01.2000 - 31.12.2099
225
+ * (0x01,0x01,0x00 - 0x31,0x12,0x99, replacement 0xff).
226
+ */
132
227
  scalar BDA3 extends BDA; // todo 3 bytes
228
+ /**
229
+ * 3 byte date with zero-based weekday in BCD, 01.01.2000 - 31.12.2099
230
+ * (0x01,0x01,WZ,0x00 - 0x31,0x12,WZ,0x99, WZ is zero-based weekday Mon=0x00 - Sun=0x06, replacement 0xff).
231
+ */
133
232
  scalar BDZ extends BDA;
233
+ /**
234
+ * 4 byte date with weekday, 01.01.2000 - 31.12.2099
235
+ * (0x01,0x01,WW,0x00 - 0x1f,0x0c,WW,0x63, WW is weekday Mon=0x01 - Sun=0x07, replacement 0xff).
236
+ */
134
237
  @internal.hex
135
238
  @encode("", uint32)
136
239
  scalar HDA extends plainDate;
240
+ /** same as HDA. */
137
241
  alias HDA4 = HDA;
138
- scalar HDA3 extends HDA;
242
+ /**
243
+ * 3 byte date, 01.01.2000 - 31.12.2099
244
+ * (0x01,0x01,0x00 - 0x1f,0x0c,0x63, replacement 0xff).
245
+ */
246
+ scalar HDA3 extends HDA; // todo 3 bytes
247
+ /**
248
+ * 2 byte date, days since 01.01.1900, 01.01.1900 - 06.06.2079
249
+ * (0x00,0x00 - 0xff,0xff).
250
+ */
139
251
  @encode("", uint16)
140
252
  scalar DAY extends plainDate;
253
+ /**
254
+ * 4 byte date+time in minutes since 01.01.2009, 01.01.2009 - 31.12.2099
255
+ * (0x00,0x00,0x00,0x00 - 0x02,0xda,0x4e,0x1f).
256
+ */
141
257
  @encode("", uint32)
142
258
  scalar DTM extends offsetDateTime;
143
259
 
260
+ /**
261
+ * 3 byte time in BCD, 00:00:00 - 23:59:59, seconds first
262
+ * (0x00,0x00,0x00 - 0x59,0x59,0x23).
263
+ */
144
264
  @internal.bcd
265
+ @internal.reverse
145
266
  scalar BTI extends plainTime; // todo 3 bytes
267
+ /**
268
+ * 3 byte time, 00:00:00 - 23:59:59
269
+ * (0x00,0x00,0x00 - 0x17,0x3b,0x3b).
270
+ */
146
271
  @internal.hex
147
272
  scalar HTI extends plainTime; // todo 3 bytes
273
+ /**
274
+ * 3 byte time, 00:00:00 - 23:59:59, seconds first [Vaillant type]
275
+ * (0x00,0x00,0x00 - 0x3b,0x3b,0x17, replacement 0x63).
276
+ */
148
277
  @internal.reverse
149
278
  scalar VTI extends HTI;
279
+ /**
280
+ * 2 byte time as hh:mm in BCD, 00:00 - 23:59, minutes first
281
+ * (0x00,0x00 - 0x59,0x23, replacement 0xff).
282
+ */
150
283
  @internal.bcd
284
+ @internal.reverse
151
285
  @encode("", uint16)
152
286
  scalar BTM extends plainTime;
153
- @internal.reverse
154
- scalar VTM extends BTM;
287
+ /**
288
+ * 2 byte time as hh:mm, 00:00 - 23:59
289
+ * (0x00,0x00 - 0x17,0x3b).
290
+ */
155
291
  @internal.hex
156
292
  @encode("", uint16)
157
293
  scalar HTM extends plainTime;
294
+ /**
295
+ * 2 byte time as hh:mm, 00:00 - 23:59, minutes first [Vaillant type]
296
+ * (0x00,0x00 - 0x3b,0x17, replacement 0xff)
297
+ */
298
+ @internal.reverse
299
+ scalar VTM extends BTM;
300
+ /**
301
+ * 2 byte time, minutes since last midnight, 00:00 - 24:00
302
+ * (minutes + hour * 60 as integer).
303
+ */
158
304
  @encode("", uint16)
159
305
  scalar MIN extends plainTime; // todo check if rather duration
306
+ /**
307
+ * 1 byte truncated time (only multiple of 10 minutes), 00:00 - 24:00
308
+ * (minutes div 10 + hour * 6 as integer).
309
+ */
160
310
  @divisor(10)
161
311
  @encode("", uint8)
162
312
  scalar TTM extends plainTime;
313
+ /**
314
+ * 6 bit truncated time (only multiple of 30 minutes), 00:00 - 24:00
315
+ * (minutes div 30 + hour * 2 as integer).
316
+ */
163
317
  @divisor(30)
164
- @encode("", uint8)
318
+ @encode("", num.BI0_6)
165
319
  scalar TTH extends plainTime;
320
+ /**
321
+ * 7 bit truncated time (only multiple of 15 minutes), 00:00 - 24:00
322
+ * (minutes div 15 + hour * 4 as integer).
323
+ */
166
324
  @divisor(15)
167
- @encode("", uint8) // todo actually 7 bits
325
+ @encode("", num.BI0_7)
168
326
  scalar TTQ extends plainTime;
169
327
  }
328
+
329
+ /** All known base data types. */
330
+ // // union types {
331
+ // alias BI0 = num.BI0;
332
+ // alias BI1 = num.BI1;
333
+ // alias BI2 = num.BI2;
334
+ // alias BI3 = num.BI3;
335
+ // alias BI4 = num.BI4;
336
+ // alias BI5 = num.BI5;
337
+ // alias BI6 = num.BI6;
338
+ // alias BI7 = num.BI7;
339
+ // alias BI0_7 = num.BI0_7;
340
+ // alias UCH = num.UCH;
341
+ // alias SCH = num.SCH;
342
+ // alias D1B = num.D1B;
343
+ // alias BCD = num.BCD;
344
+ // alias HCD = num.HCD;
345
+ // alias D1C = num.D1C;
346
+ // alias PIN = num.PIN;
347
+ // alias UIN = num.UIN;
348
+ // alias UIR = num.UIR;
349
+ // alias SIN = num.SIN;
350
+ // alias SIR = num.SIR;
351
+ // alias HCD2 = num.HCD2;
352
+ // alias D2B = num.D2B;
353
+ // alias D2C = num.D2C;
354
+ // alias FLT = num.FLT;
355
+ // alias FLR = num.FLR;
356
+ // alias BCD3 = num.BCD3;
357
+ // alias HCD3 = num.HCD3;
358
+ // alias ULG = num.ULG;
359
+ // alias ULR = num.ULR;
360
+ // alias SLG = num.SLG;
361
+ // alias SLR = num.SLR;
362
+ // alias BCD4 = num.BCD4;
363
+ // alias HCD4 = num.HCD4;
364
+ // alias EXP = num.EXP;
365
+ // alias EXR = num.EXR;
366
+ // alias STR = str.STR;
367
+ // alias NTS = str.NTS;
368
+ // alias IGN = str.IGN;
369
+ // alias HEX = str.HEX;
370
+ // alias BDY = dtm.BDY;
371
+ // alias HDY = dtm.HDY;
372
+ // alias BDA = dtm.BDA;
373
+ // alias BDA4 = dtm.BDA4;
374
+ // alias BDA3 = dtm.BDA3;
375
+ // alias BDZ = dtm.BDZ;
376
+ // alias HDA = dtm.HDA;
377
+ // alias HDA4 = dtm.HDA4;
378
+ // alias HDA3 = dtm.HDA3;
379
+ // alias DAY = dtm.DAY;
380
+ // alias DTM = dtm.DTM;
381
+ // alias BTI = dtm.BTI;
382
+ // alias HTI = dtm.HTI;
383
+ // alias VTI = dtm.VTI;
384
+ // alias BTM = dtm.BTM;
385
+ // alias VTM = dtm.VTM;
386
+ // alias HTM = dtm.HTM;
387
+ // alias MIN = dtm.MIN;
388
+ // alias TTM = dtm.TTM;
389
+ // alias TTH = dtm.TTH;
390
+ // alias TTQ = dtm.TTQ;
391
+ // // }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebusd/ebus-typespec",
3
- "version": "0.3.1",
3
+ "version": "0.5.0",
4
4
  "author": "John Baier",
5
5
  "description": "TypeSpec library for defining eBUS messages and emitting to ebusd CSV.",
6
6
  "homepage": "https://github.com/john30/ebus-typespec",
@@ -46,14 +46,18 @@
46
46
  "@typespec/compiler": "~0.57.0"
47
47
  },
48
48
  "devDependencies": {
49
+ "@types/js-yaml": "^4.0.9",
49
50
  "@typespec/compiler": "~0.57.0",
50
51
  "@typespec/library-linter": "~0.57.0",
51
52
  "@typespec/tspd": "latest",
52
53
  "@types/node": "latest",
53
- "typedoc": "^0.25.13",
54
- "typedoc-plugin-markdown": "^4.0.3",
54
+ "typedoc": "^0.26.1",
55
+ "typedoc-plugin-markdown": "^4.1.0",
55
56
  "typescript": "^5.4.5"
56
57
  },
58
+ "dependencies": {
59
+ "js-yaml": "^4.1.0"
60
+ },
57
61
  "scripts": {
58
62
  "build": "tsc && npm run build:tsp",
59
63
  "watch": "tsc --watch",