@ebusd/ebus-typespec 0.4.0 → 0.6.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
@@ -1,38 +1,38 @@
1
1
  namespace Ebus;
2
2
 
3
3
  /** A symbol on the bus. */
4
- scalar Symbol extends uint8;
4
+ scalar symbol extends uint8;
5
5
 
6
6
  /** List of special symbols. */
7
- union symbols {
7
+ union Symbols {
8
8
  SYN: 0xaa,
9
9
  ESC: 0xa9,
10
- Symbol,
10
+ symbol,
11
11
  }
12
12
 
13
13
  /** A source address 'QQ. */
14
- scalar Source extends Symbol;
14
+ scalar source extends symbol;
15
15
 
16
16
  /** A target address 'ZZ'. */
17
- scalar Target extends Symbol;
17
+ scalar target extends symbol;
18
18
 
19
19
  /** List of special target addresses. */
20
- union targets {
20
+ union Targets {
21
21
  /** the special broadcast target address. */
22
- Broadcast: 0xfe,
23
- Target,
22
+ broadcast: 0xfe,
23
+ target,
24
24
  }
25
25
  /** the special broadcast target address. */
26
- alias BROADCAST = targets.Broadcast;
26
+ alias BROADCAST = Targets.broadcast;
27
27
 
28
28
  /** the primary command symbol 'PB'. */
29
- scalar Pb extends Symbol;
29
+ scalar pb extends symbol;
30
30
 
31
31
  /** the secondary command symbol 'SB'. */
32
- scalar Sb extends Symbol;
32
+ scalar sb extends symbol;
33
33
 
34
34
  /** The known numeric base data types. */
35
- namespace num {
35
+ namespace Num {
36
36
  // 1 byte length
37
37
 
38
38
  /** bit 0. */
@@ -60,10 +60,10 @@ namespace num {
60
60
  @encode("uint8")
61
61
  scalar BI7 extends boolean;
62
62
  /** 6 bits starting from bit 0. */
63
- @internal.maxBits(6)
63
+ @Internal.maxBits(6)
64
64
  scalar BI0_6 extends uint8;
65
65
  /** 7 bits starting from bit 0. */
66
- @internal.maxBits(7)
66
+ @Internal.maxBits(7)
67
67
  scalar BI0_7 extends uint8;
68
68
 
69
69
  /** 1 byte unsigned integer, 0 - 254, replacement 0xff. */
@@ -73,13 +73,13 @@ namespace num {
73
73
  /** same as SCH. */
74
74
  alias D1B = SCH;
75
75
  /** 1 byte unsigned decimal in BCD, 0 - 99, replacement 0xff. */
76
- @internal.bcd
76
+ @Internal.bcd
77
77
  scalar BCD extends uint8;
78
78
  /**
79
79
  * 1 byte unsigned decimal digits in hex, 0 - 99
80
80
  * (0x00 - 0x63).
81
81
  */
82
- @internal.hex
82
+ @Internal.hex
83
83
  scalar HCD extends uint8;
84
84
  /**
85
85
  * 1 byte unsigned number (fraction 1/2), 0 - 100
@@ -91,27 +91,27 @@ namespace num {
91
91
  // 2 byte length
92
92
 
93
93
  /** 2 byte unsigned decimal in BCD, shown as 4 digits, 0000 - 9999 (fixed length). */
94
- @internal.reverse
95
- @internal.bcd
94
+ @Internal.reverse
95
+ @Internal.bcd
96
96
  scalar PIN extends uint16;
97
97
  /** 2 byte unsigned integer, 0 - 65534, replacement 0xffff. */
98
98
  scalar UIN extends uint16;
99
99
  /** 2 byte unsigned integer, 0 - 65534, replacement 0xffff, big endian. */
100
- @internal.reverse
100
+ @Internal.reverse
101
101
  scalar UIR extends UIN;
102
102
  /** 2 byte signed integer, -32767 - +32767, replacement 0x7fff. */
103
103
  scalar SIN extends int16;
104
104
  /** 2 byte signed integer, -32767 - +32767, replacement 0x7fff, big endian. */
105
- @internal.reverse
105
+ @Internal.reverse
106
106
  scalar SIR extends SIN;
107
107
  /** 2 byte unsigned decimal in BCD, 0 - 9999, replacement 0xffff. */
108
- @internal.bcd
108
+ @Internal.bcd
109
109
  scalar BCD2 extends uint16;
110
110
  /**
111
111
  * 2 byte unsigned decimal digits in hex, 0 - 9999
112
112
  * (0x00,0x00 - 0x63,0x63).
113
113
  */
114
- @internal.hex
114
+ @Internal.hex
115
115
  scalar HCD2 extends uint16;
116
116
  /**
117
117
  * 2 byte signed number (fraction 1/256), -127.99 - +127.99 .
@@ -131,20 +131,20 @@ namespace num {
131
131
  /**
132
132
  * 2 byte signed number (fraction 1/1000), -32.767 - +32.767, big endian.
133
133
  */
134
- @internal.reverse
134
+ @Internal.reverse
135
135
  scalar FLR extends FLT;
136
136
 
137
137
  // 3 byte length
138
138
 
139
139
  //todo 3 byte int
140
140
  /** 3 byte unsigned decimal in BCD, 0 - 999999, replacement 0xffffff. */
141
- @internal.bcd
141
+ @Internal.bcd
142
142
  scalar BCD3 extends uint32; // todo 3 bytes
143
143
  /**
144
144
  * 3 byte unsigned decimal digits in hex, 0 - 999999
145
145
  * (0x00,0x00,0x00 - 0x63,0x63,0x63).
146
146
  */
147
- @internal.hex
147
+ @Internal.hex
148
148
  scalar HCD3 extends uint32; // todo 3 bytes
149
149
 
150
150
  // 4 byte length
@@ -152,21 +152,21 @@ namespace num {
152
152
  /** 4 byte unsigned integer, 0 - 4294967294, replacement 0xffffffff. */
153
153
  scalar ULG extends uint32;
154
154
  /** 4 byte unsigned integer, 0 - 4294967294, replacement 0xffffffff, big endian. */
155
- @internal.reverse
155
+ @Internal.reverse
156
156
  scalar ULR extends ULG;
157
157
  /** 4 byte signed integer, -2147483647 - +2147483647, replacement 0x7fffffff. */
158
158
  scalar SLG extends int32;
159
159
  /** 4 byte signed integer, -2147483647 - +2147483647, replacement 0x7fffffff, big endian. */
160
- @internal.reverse
160
+ @Internal.reverse
161
161
  scalar SLR extends SLG;
162
162
  /** 4 byte unsigned decimal in BCD, 0 - 99999999, replacement 0xffffffff. */
163
- @internal.bcd
163
+ @Internal.bcd
164
164
  scalar BCD4 extends uint32;
165
165
  /**
166
166
  * 4 byte unsigned decimal digits in hex, 0 - 99999999
167
167
  * (0x00,0x00,0x00,0x00 - 0x63,0x63,0x63,0x63).
168
168
  */
169
- @internal.hex
169
+ @Internal.hex
170
170
  scalar HCD4 extends uint32;
171
171
  /**
172
172
  * 4 byte signed number in IEEE 754
@@ -177,12 +177,12 @@ namespace num {
177
177
  * 4 byte signed number in IEEE 754, big endian
178
178
  * (IEEE 754 binary32: 1 bit sign, 8 bits exponent, 23 bits significand).
179
179
  */
180
- @internal.reverse
180
+ @Internal.reverse
181
181
  scalar EXR extends EXP;
182
182
  }
183
183
 
184
184
  /** The known string base data types. */
185
- namespace str {
185
+ namespace Str {
186
186
  /** >= 1 byte character string filled up with space. */
187
187
  @maxLength(31)
188
188
  scalar STR extends string;
@@ -194,13 +194,13 @@ namespace str {
194
194
  @maxLength(31)
195
195
  scalar IGN extends string; // todo bytes would be more logical, but have not length limit
196
196
  /** >= 1 byte hex digit string, usually separated by space, e.g. 0a 1b 2c 3d. */
197
- @internal.hex
197
+ @Internal.hex
198
198
  @maxLength(31)
199
199
  scalar HEX extends string;
200
200
  }
201
201
 
202
202
  /** The known date/time base data types. */
203
- namespace dtm {
203
+ namespace Dtm {
204
204
  /**
205
205
  * 1 byte weekday, "Mon" - "Sun"
206
206
  * (0x00 - 0x06).
@@ -215,7 +215,7 @@ namespace dtm {
215
215
  * 4 byte date with weekday in BCD, 01.01.2000 - 31.12.2099
216
216
  * (0x01,0x01,WW,0x00 - 0x31,0x12,WW,0x99, WW is weekday Mon=0x01 - Sun=0x07, replacement 0xff).
217
217
  */
218
- @internal.bcd
218
+ @Internal.bcd
219
219
  @encode("", uint32)
220
220
  scalar BDA extends plainDate;
221
221
  /** same as BDA. */
@@ -234,7 +234,7 @@ namespace dtm {
234
234
  * 4 byte date with weekday, 01.01.2000 - 31.12.2099
235
235
  * (0x01,0x01,WW,0x00 - 0x1f,0x0c,WW,0x63, WW is weekday Mon=0x01 - Sun=0x07, replacement 0xff).
236
236
  */
237
- @internal.hex
237
+ @Internal.hex
238
238
  @encode("", uint32)
239
239
  scalar HDA extends plainDate;
240
240
  /** same as HDA. */
@@ -261,41 +261,41 @@ namespace dtm {
261
261
  * 3 byte time in BCD, 00:00:00 - 23:59:59, seconds first
262
262
  * (0x00,0x00,0x00 - 0x59,0x59,0x23).
263
263
  */
264
- @internal.bcd
265
- @internal.reverse
264
+ @Internal.bcd
265
+ @Internal.reverse
266
266
  scalar BTI extends plainTime; // todo 3 bytes
267
267
  /**
268
268
  * 3 byte time, 00:00:00 - 23:59:59
269
269
  * (0x00,0x00,0x00 - 0x17,0x3b,0x3b).
270
270
  */
271
- @internal.hex
271
+ @Internal.hex
272
272
  scalar HTI extends plainTime; // todo 3 bytes
273
273
  /**
274
274
  * 3 byte time, 00:00:00 - 23:59:59, seconds first [Vaillant type]
275
275
  * (0x00,0x00,0x00 - 0x3b,0x3b,0x17, replacement 0x63).
276
276
  */
277
- @internal.reverse
277
+ @Internal.reverse
278
278
  scalar VTI extends HTI;
279
279
  /**
280
280
  * 2 byte time as hh:mm in BCD, 00:00 - 23:59, minutes first
281
281
  * (0x00,0x00 - 0x59,0x23, replacement 0xff).
282
282
  */
283
- @internal.bcd
284
- @internal.reverse
283
+ @Internal.bcd
284
+ @Internal.reverse
285
285
  @encode("", uint16)
286
286
  scalar BTM extends plainTime;
287
287
  /**
288
288
  * 2 byte time as hh:mm, 00:00 - 23:59
289
289
  * (0x00,0x00 - 0x17,0x3b).
290
290
  */
291
- @internal.hex
291
+ @Internal.hex
292
292
  @encode("", uint16)
293
293
  scalar HTM extends plainTime;
294
294
  /**
295
295
  * 2 byte time as hh:mm, 00:00 - 23:59, minutes first [Vaillant type]
296
296
  * (0x00,0x00 - 0x3b,0x17, replacement 0xff)
297
297
  */
298
- @internal.reverse
298
+ @Internal.reverse
299
299
  scalar VTM extends BTM;
300
300
  /**
301
301
  * 2 byte time, minutes since last midnight, 00:00 - 24:00
@@ -315,77 +315,77 @@ namespace dtm {
315
315
  * (minutes div 30 + hour * 2 as integer).
316
316
  */
317
317
  @divisor(30)
318
- @encode("", num.BI0_6)
318
+ @encode("", Num.BI0_6)
319
319
  scalar TTH extends plainTime;
320
320
  /**
321
321
  * 7 bit truncated time (only multiple of 15 minutes), 00:00 - 24:00
322
322
  * (minutes div 15 + hour * 4 as integer).
323
323
  */
324
324
  @divisor(15)
325
- @encode("", num.BI0_7)
325
+ @encode("", Num.BI0_7)
326
326
  scalar TTQ extends plainTime;
327
327
  }
328
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
- // // }
329
+ // /** All known base data types. */
330
+ // namespace All {
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.4.0",
3
+ "version": "0.6.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,6 +46,7 @@
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",
@@ -54,6 +55,9 @@
54
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",