@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/README.md +38 -7
- package/dist/src/csv_emitter.d.ts +5 -2
- package/dist/src/csv_emitter.js +92 -27
- package/dist/src/csv_emitter.js.map +1 -1
- package/dist/src/decorators.js +6 -2
- package/dist/src/decorators.js.map +1 -1
- package/dist/src/lib.d.ts +4 -6
- package/dist/src/lib.js +5 -6
- package/dist/src/lib.js.map +1 -1
- package/dist/src/tsp2ebusd.js +10 -0
- package/dist/src/tsp2ebusd.js.map +1 -1
- package/docs.md +28 -28
- package/lib/decorators.tsp +7 -7
- package/lib/models.tsp +11 -10
- package/lib/types.tsp +108 -108
- package/package.json +5 -1
package/lib/types.tsp
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
namespace Ebus;
|
|
2
2
|
|
|
3
3
|
/** A symbol on the bus. */
|
|
4
|
-
scalar
|
|
4
|
+
scalar symbol extends uint8;
|
|
5
5
|
|
|
6
6
|
/** List of special symbols. */
|
|
7
|
-
union
|
|
7
|
+
union Symbols {
|
|
8
8
|
SYN: 0xaa,
|
|
9
9
|
ESC: 0xa9,
|
|
10
|
-
|
|
10
|
+
symbol,
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/** A source address 'QQ. */
|
|
14
|
-
scalar
|
|
14
|
+
scalar source extends symbol;
|
|
15
15
|
|
|
16
16
|
/** A target address 'ZZ'. */
|
|
17
|
-
scalar
|
|
17
|
+
scalar target extends symbol;
|
|
18
18
|
|
|
19
19
|
/** List of special target addresses. */
|
|
20
|
-
union
|
|
20
|
+
union Targets {
|
|
21
21
|
/** the special broadcast target address. */
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
broadcast: 0xfe,
|
|
23
|
+
target,
|
|
24
24
|
}
|
|
25
25
|
/** the special broadcast target address. */
|
|
26
|
-
alias BROADCAST =
|
|
26
|
+
alias BROADCAST = Targets.broadcast;
|
|
27
27
|
|
|
28
28
|
/** the primary command symbol 'PB'. */
|
|
29
|
-
scalar
|
|
29
|
+
scalar pb extends symbol;
|
|
30
30
|
|
|
31
31
|
/** the secondary command symbol 'SB'. */
|
|
32
|
-
scalar
|
|
32
|
+
scalar sb extends symbol;
|
|
33
33
|
|
|
34
34
|
/** The known numeric base data types. */
|
|
35
|
-
namespace
|
|
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
|
-
@
|
|
63
|
+
@Internal.maxBits(6)
|
|
64
64
|
scalar BI0_6 extends uint8;
|
|
65
65
|
/** 7 bits starting from bit 0. */
|
|
66
|
-
@
|
|
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
|
-
@
|
|
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
|
-
@
|
|
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
|
-
@
|
|
95
|
-
@
|
|
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
|
-
@
|
|
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
|
-
@
|
|
105
|
+
@Internal.reverse
|
|
106
106
|
scalar SIR extends SIN;
|
|
107
107
|
/** 2 byte unsigned decimal in BCD, 0 - 9999, replacement 0xffff. */
|
|
108
|
-
@
|
|
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
|
-
@
|
|
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
|
-
@
|
|
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
|
-
@
|
|
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
|
-
@
|
|
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
|
-
@
|
|
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
|
-
@
|
|
160
|
+
@Internal.reverse
|
|
161
161
|
scalar SLR extends SLG;
|
|
162
162
|
/** 4 byte unsigned decimal in BCD, 0 - 99999999, replacement 0xffffffff. */
|
|
163
|
-
@
|
|
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
|
-
@
|
|
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
|
-
@
|
|
180
|
+
@Internal.reverse
|
|
181
181
|
scalar EXR extends EXP;
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
/** The known string base data types. */
|
|
185
|
-
namespace
|
|
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
|
-
@
|
|
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
|
|
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
|
-
@
|
|
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
|
-
@
|
|
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
|
-
@
|
|
265
|
-
@
|
|
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
|
-
@
|
|
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
|
-
@
|
|
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
|
-
@
|
|
284
|
-
@
|
|
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
|
-
@
|
|
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
|
-
@
|
|
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("",
|
|
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("",
|
|
325
|
+
@encode("", Num.BI0_7)
|
|
326
326
|
scalar TTQ extends plainTime;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
/** All known base data types. */
|
|
330
|
-
//
|
|
331
|
-
// alias BI0 =
|
|
332
|
-
// alias BI1 =
|
|
333
|
-
// alias BI2 =
|
|
334
|
-
// alias BI3 =
|
|
335
|
-
// alias BI4 =
|
|
336
|
-
// alias BI5 =
|
|
337
|
-
// alias BI6 =
|
|
338
|
-
// alias BI7 =
|
|
339
|
-
// alias BI0_7 =
|
|
340
|
-
// alias UCH =
|
|
341
|
-
// alias SCH =
|
|
342
|
-
// alias D1B =
|
|
343
|
-
// alias BCD =
|
|
344
|
-
// alias HCD =
|
|
345
|
-
// alias D1C =
|
|
346
|
-
// alias PIN =
|
|
347
|
-
// alias UIN =
|
|
348
|
-
// alias UIR =
|
|
349
|
-
// alias SIN =
|
|
350
|
-
// alias SIR =
|
|
351
|
-
// alias HCD2 =
|
|
352
|
-
// alias D2B =
|
|
353
|
-
// alias D2C =
|
|
354
|
-
// alias FLT =
|
|
355
|
-
// alias FLR =
|
|
356
|
-
// alias BCD3 =
|
|
357
|
-
// alias HCD3 =
|
|
358
|
-
// alias ULG =
|
|
359
|
-
// alias ULR =
|
|
360
|
-
// alias SLG =
|
|
361
|
-
// alias SLR =
|
|
362
|
-
// alias BCD4 =
|
|
363
|
-
// alias HCD4 =
|
|
364
|
-
// alias EXP =
|
|
365
|
-
// alias EXR =
|
|
366
|
-
// alias STR =
|
|
367
|
-
// alias NTS =
|
|
368
|
-
// alias IGN =
|
|
369
|
-
// alias HEX =
|
|
370
|
-
// alias BDY =
|
|
371
|
-
// alias HDY =
|
|
372
|
-
// alias BDA =
|
|
373
|
-
// alias BDA4 =
|
|
374
|
-
// alias BDA3 =
|
|
375
|
-
// alias BDZ =
|
|
376
|
-
// alias HDA =
|
|
377
|
-
// alias HDA4 =
|
|
378
|
-
// alias HDA3 =
|
|
379
|
-
// alias DAY =
|
|
380
|
-
// alias DTM =
|
|
381
|
-
// alias BTI =
|
|
382
|
-
// alias HTI =
|
|
383
|
-
// alias VTI =
|
|
384
|
-
// alias BTM =
|
|
385
|
-
// alias VTM =
|
|
386
|
-
// alias HTM =
|
|
387
|
-
// alias MIN =
|
|
388
|
-
// alias TTM =
|
|
389
|
-
// alias TTH =
|
|
390
|
-
// alias 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.
|
|
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",
|