jooby-codec 1.8.0 → 1.10.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/dist/BinaryBuffer.d.ts +2 -0
- package/dist/BinaryBuffer.js +9 -0
- package/dist/BinaryBuffer.js.map +1 -1
- package/dist/CommandBinaryBuffer.d.ts +108 -9
- package/dist/CommandBinaryBuffer.js +235 -31
- package/dist/CommandBinaryBuffer.js.map +1 -1
- package/dist/commands/downlink/CorrectTime2000.d.ts +4 -3
- package/dist/commands/downlink/CorrectTime2000.js +1 -0
- package/dist/commands/downlink/CorrectTime2000.js.map +1 -1
- package/dist/commands/downlink/GetArchiveDaysMC.d.ts +10 -12
- package/dist/commands/downlink/GetArchiveDaysMC.js +15 -3
- package/dist/commands/downlink/GetArchiveDaysMC.js.map +1 -1
- package/dist/commands/downlink/GetArchiveEvents.d.ts +4 -3
- package/dist/commands/downlink/GetArchiveEvents.js +3 -5
- package/dist/commands/downlink/GetArchiveEvents.js.map +1 -1
- package/dist/commands/downlink/GetArchiveHoursMC.d.ts +12 -10
- package/dist/commands/downlink/GetArchiveHoursMC.js +15 -3
- package/dist/commands/downlink/GetArchiveHoursMC.js.map +1 -1
- package/dist/commands/downlink/GetCurrentMC.d.ts +1 -0
- package/dist/commands/downlink/GetCurrentMC.js +1 -0
- package/dist/commands/downlink/GetCurrentMC.js.map +1 -1
- package/dist/commands/downlink/GetExAbsArchiveDaysMC.d.ts +41 -0
- package/dist/commands/downlink/{ExAbsArchiveDaysMC.js → GetExAbsArchiveDaysMC.js} +26 -13
- package/dist/commands/downlink/GetExAbsArchiveDaysMC.js.map +1 -0
- package/dist/commands/downlink/GetExAbsArchiveHoursMC.d.ts +40 -0
- package/dist/commands/downlink/{ExAbsArchiveHoursMC.js → GetExAbsArchiveHoursMC.js} +24 -12
- package/dist/commands/downlink/GetExAbsArchiveHoursMC.js.map +1 -0
- package/dist/commands/downlink/{ExAbsCurrentMC.d.ts → GetExAbsCurrentMC.d.ts} +8 -7
- package/dist/commands/downlink/{ExAbsCurrentMC.js → GetExAbsCurrentMC.js} +12 -11
- package/dist/commands/downlink/GetExAbsCurrentMC.js.map +1 -0
- package/dist/commands/downlink/{GetLmicVersion.d.ts → GetLmicInfo.d.ts} +7 -6
- package/dist/commands/downlink/{GetLmicVersion.js → GetLmicInfo.js} +12 -11
- package/dist/commands/downlink/GetLmicInfo.js.map +1 -0
- package/dist/commands/downlink/GetParameter.d.ts +4 -3
- package/dist/commands/downlink/GetParameter.js +3 -8
- package/dist/commands/downlink/GetParameter.js.map +1 -1
- package/dist/commands/downlink/GetStatus.d.ts +1 -0
- package/dist/commands/downlink/GetStatus.js +1 -1
- package/dist/commands/downlink/GetStatus.js.map +1 -1
- package/dist/commands/downlink/SetParameter.d.ts +1 -0
- package/dist/commands/downlink/SetParameter.js +94 -16
- package/dist/commands/downlink/SetParameter.js.map +1 -1
- package/dist/commands/downlink/SetTime2000.d.ts +4 -3
- package/dist/commands/downlink/SetTime2000.js +1 -0
- package/dist/commands/downlink/SetTime2000.js.map +1 -1
- package/dist/commands/downlink/SoftRestart.d.ts +1 -0
- package/dist/commands/downlink/SoftRestart.js +1 -0
- package/dist/commands/downlink/SoftRestart.js.map +1 -1
- package/dist/commands/downlink/index.d.ts +4 -4
- package/dist/commands/downlink/index.js +4 -4
- package/dist/commands/downlink/index.js.map +1 -1
- package/dist/commands/uplink/CorrectTime2000Response.d.ts +39 -0
- package/dist/commands/uplink/{CorrectTime2000.js → CorrectTime2000Response.js} +23 -14
- package/dist/commands/uplink/CorrectTime2000Response.js.map +1 -0
- package/dist/commands/uplink/CurrentMC.d.ts +40 -0
- package/dist/commands/uplink/{GetCurrentMC.js → CurrentMC.js} +27 -27
- package/dist/commands/uplink/CurrentMC.js.map +1 -0
- package/dist/commands/uplink/DayMC.d.ts +47 -0
- package/dist/commands/uplink/DayMC.js +86 -0
- package/dist/commands/uplink/DayMC.js.map +1 -0
- package/dist/commands/uplink/ExAbsCurrentMC.d.ts +30 -4
- package/dist/commands/uplink/ExAbsCurrentMC.js +44 -0
- package/dist/commands/uplink/ExAbsCurrentMC.js.map +1 -1
- package/dist/commands/uplink/ExAbsDayMC.d.ts +30 -2
- package/dist/commands/uplink/ExAbsDayMC.js +48 -2
- package/dist/commands/uplink/ExAbsDayMC.js.map +1 -1
- package/dist/commands/uplink/ExAbsHourMC.d.ts +17 -12
- package/dist/commands/uplink/ExAbsHourMC.js +33 -10
- package/dist/commands/uplink/ExAbsHourMC.js.map +1 -1
- package/dist/commands/uplink/GetArchiveDaysMCResponse.d.ts +58 -0
- package/dist/commands/uplink/{GetArchiveDaysMC.js → GetArchiveDaysMCResponse.js} +44 -20
- package/dist/commands/uplink/GetArchiveDaysMCResponse.js.map +1 -0
- package/dist/commands/uplink/GetArchiveEventsResponse.d.ts +54 -0
- package/dist/commands/uplink/{GetArchiveEvents.js → GetArchiveEventsResponse.js} +24 -18
- package/dist/commands/uplink/GetArchiveEventsResponse.js.map +1 -0
- package/dist/commands/uplink/GetArchiveHoursMCResponse.d.ts +50 -0
- package/dist/commands/uplink/GetArchiveHoursMCResponse.js +77 -0
- package/dist/commands/uplink/GetArchiveHoursMCResponse.js.map +1 -0
- package/dist/commands/uplink/GetExAbsArchiveDaysMCResponse.d.ts +47 -0
- package/dist/commands/uplink/{ExAbsArchiveDaysMC.js → GetExAbsArchiveDaysMCResponse.js} +52 -7
- package/dist/commands/uplink/GetExAbsArchiveDaysMCResponse.js.map +1 -0
- package/dist/commands/uplink/GetExAbsArchiveHoursMCResponse.d.ts +44 -0
- package/dist/commands/uplink/{ExAbsArchiveHoursMC.js → GetExAbsArchiveHoursMCResponse.js} +46 -7
- package/dist/commands/uplink/GetExAbsArchiveHoursMCResponse.js.map +1 -0
- package/dist/commands/uplink/GetLmicInfoResponse.d.ts +52 -0
- package/dist/commands/uplink/{GetLmicVersion.js → GetLmicInfoResponse.js} +27 -27
- package/dist/commands/uplink/GetLmicInfoResponse.js.map +1 -0
- package/dist/commands/uplink/GetParameterResponse.d.ts +35 -0
- package/dist/commands/uplink/{GetParameter.js → GetParameterResponse.js} +25 -32
- package/dist/commands/uplink/GetParameterResponse.js.map +1 -0
- package/dist/commands/uplink/HourMC.d.ts +48 -0
- package/dist/commands/uplink/{DataHourMC.js → HourMC.js} +55 -10
- package/dist/commands/uplink/HourMC.js.map +1 -0
- package/dist/commands/uplink/LastEvent.d.ts +19 -10
- package/dist/commands/uplink/LastEvent.js +21 -12
- package/dist/commands/uplink/LastEvent.js.map +1 -1
- package/dist/commands/uplink/NewEvent.d.ts +12 -8
- package/dist/commands/uplink/NewEvent.js +18 -12
- package/dist/commands/uplink/NewEvent.js.map +1 -1
- package/dist/commands/uplink/SetTime2000Response.d.ts +38 -0
- package/dist/commands/uplink/{SetTime2000.js → SetTime2000Response.js} +23 -15
- package/dist/commands/uplink/SetTime2000Response.js.map +1 -0
- package/dist/commands/uplink/SoftRestartResponse.d.ts +28 -0
- package/dist/commands/uplink/SoftRestartResponse.js +44 -0
- package/dist/commands/uplink/SoftRestartResponse.js.map +1 -0
- package/dist/commands/uplink/{GetStatus.d.ts → Status.d.ts} +19 -21
- package/dist/commands/uplink/{GetStatus.js → Status.js} +31 -37
- package/dist/commands/uplink/Status.js.map +1 -0
- package/dist/commands/uplink/Time2000.d.ts +11 -9
- package/dist/commands/uplink/Time2000.js +18 -8
- package/dist/commands/uplink/Time2000.js.map +1 -1
- package/dist/commands/uplink/index.d.ts +14 -14
- package/dist/commands/uplink/index.js +14 -14
- package/dist/commands/uplink/index.js.map +1 -1
- package/dist/constants/deviceParameters.d.ts +14 -0
- package/dist/constants/deviceParameters.js +14 -0
- package/dist/constants/deviceParameters.js.map +1 -1
- package/dist/constants/hardwareTypes.d.ts +55 -27
- package/dist/constants/hardwareTypes.js +55 -27
- package/dist/constants/hardwareTypes.js.map +1 -1
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +1 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/constants/rx2SpreadFactors.d.ts +12 -0
- package/dist/constants/rx2SpreadFactors.js +13 -0
- package/dist/constants/rx2SpreadFactors.js.map +1 -0
- package/package.json +4 -1
- package/readme.md +4 -4
- package/dist/commands/downlink/ExAbsArchiveDaysMC.d.ts +0 -42
- package/dist/commands/downlink/ExAbsArchiveDaysMC.js.map +0 -1
- package/dist/commands/downlink/ExAbsArchiveHoursMC.d.ts +0 -42
- package/dist/commands/downlink/ExAbsArchiveHoursMC.js.map +0 -1
- package/dist/commands/downlink/ExAbsCurrentMC.js.map +0 -1
- package/dist/commands/downlink/GetLmicVersion.js.map +0 -1
- package/dist/commands/uplink/CorrectTime2000.d.ts +0 -37
- package/dist/commands/uplink/CorrectTime2000.js.map +0 -1
- package/dist/commands/uplink/DataDayMC.d.ts +0 -18
- package/dist/commands/uplink/DataDayMC.js +0 -43
- package/dist/commands/uplink/DataDayMC.js.map +0 -1
- package/dist/commands/uplink/DataHourMC.d.ts +0 -18
- package/dist/commands/uplink/DataHourMC.js.map +0 -1
- package/dist/commands/uplink/ExAbsArchiveDaysMC.d.ts +0 -18
- package/dist/commands/uplink/ExAbsArchiveDaysMC.js.map +0 -1
- package/dist/commands/uplink/ExAbsArchiveHoursMC.d.ts +0 -18
- package/dist/commands/uplink/ExAbsArchiveHoursMC.js.map +0 -1
- package/dist/commands/uplink/GetArchiveDaysMC.d.ts +0 -50
- package/dist/commands/uplink/GetArchiveDaysMC.js.map +0 -1
- package/dist/commands/uplink/GetArchiveEvents.d.ts +0 -48
- package/dist/commands/uplink/GetArchiveEvents.js.map +0 -1
- package/dist/commands/uplink/GetArchiveHoursMC.d.ts +0 -69
- package/dist/commands/uplink/GetArchiveHoursMC.js +0 -72
- package/dist/commands/uplink/GetArchiveHoursMC.js.map +0 -1
- package/dist/commands/uplink/GetCurrentMC.d.ts +0 -40
- package/dist/commands/uplink/GetCurrentMC.js.map +0 -1
- package/dist/commands/uplink/GetLmicVersion.d.ts +0 -46
- package/dist/commands/uplink/GetLmicVersion.js.map +0 -1
- package/dist/commands/uplink/GetParameter.d.ts +0 -30
- package/dist/commands/uplink/GetParameter.js.map +0 -1
- package/dist/commands/uplink/GetStatus.js.map +0 -1
- package/dist/commands/uplink/SetTime2000.d.ts +0 -37
- package/dist/commands/uplink/SetTime2000.js.map +0 -1
- package/dist/commands/uplink/SoftRestart.d.ts +0 -24
- package/dist/commands/uplink/SoftRestart.js +0 -34
- package/dist/commands/uplink/SoftRestart.js.map +0 -1
|
@@ -6,7 +6,51 @@ const COMMAND_ID = 0x0d1f;
|
|
|
6
6
|
// date 2 bytes, channelList 1 byte (max channelList: 4), days 1 byte (max days - 255)
|
|
7
7
|
// 4 + (4 channelList * (1 byte pulse coefficient + 5 bytes of day values) * 255 max days)
|
|
8
8
|
const COMMAND_BODY_MAX_SIZE = 6124;
|
|
9
|
-
|
|
9
|
+
const examples = [
|
|
10
|
+
{
|
|
11
|
+
name: 'archive days values at 4 channel from 2023.03.10 00:00:00 GMT',
|
|
12
|
+
parameters: {
|
|
13
|
+
startTime: 731721600,
|
|
14
|
+
days: 2,
|
|
15
|
+
channelList: [
|
|
16
|
+
{
|
|
17
|
+
index: 4,
|
|
18
|
+
dayList: [5524, 5674]
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
hex: { header: '1f 0d 08', body: '2e 6a 08 02 94 2b aa 2c' }
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
/**
|
|
26
|
+
* Uplink command.
|
|
27
|
+
*
|
|
28
|
+
* @example create command instance from command body hex dump
|
|
29
|
+
* ```js
|
|
30
|
+
* import GetExAbsArchiveDaysMCResponse from 'jooby-codec/commands/uplink/GetExAbsArchiveDaysMCResponse';
|
|
31
|
+
*
|
|
32
|
+
* const commandBody = new Uint8Array([
|
|
33
|
+
* 0x2e, 0x6a, 0x08, 0x02, 0x94, 0x2b, 0xaa, 0x2c
|
|
34
|
+
* ]);
|
|
35
|
+
* const command = GetExAbsArchiveDaysMCResponse.fromBytes(commandBody);
|
|
36
|
+
*
|
|
37
|
+
* console.log(command.parameters);
|
|
38
|
+
* // output:
|
|
39
|
+
* {
|
|
40
|
+
* startTime: 731721600,
|
|
41
|
+
* days: 2,
|
|
42
|
+
* channelList: [
|
|
43
|
+
* {
|
|
44
|
+
* index: 4,
|
|
45
|
+
* dayList: [5524, 5674]
|
|
46
|
+
* }
|
|
47
|
+
* ]
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/GetExAbsArchiveDaysMC.md#response)
|
|
52
|
+
*/
|
|
53
|
+
class GetExAbsArchiveDaysMCResponse extends Command {
|
|
10
54
|
constructor(parameters) {
|
|
11
55
|
super();
|
|
12
56
|
this.parameters = parameters;
|
|
@@ -29,7 +73,7 @@ class ExAbsArchiveDaysMC extends Command {
|
|
|
29
73
|
dayList.push(buffer.getExtendedValue());
|
|
30
74
|
}
|
|
31
75
|
});
|
|
32
|
-
return new
|
|
76
|
+
return new GetExAbsArchiveDaysMCResponse({ channelList, days, startTime: getSecondsFromDate(date) });
|
|
33
77
|
}
|
|
34
78
|
// returns full message - header with body
|
|
35
79
|
toBytes() {
|
|
@@ -44,8 +88,9 @@ class ExAbsArchiveDaysMC extends Command {
|
|
|
44
88
|
return Command.toBytes(COMMAND_ID, buffer.getBytesToOffset());
|
|
45
89
|
}
|
|
46
90
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
91
|
+
GetExAbsArchiveDaysMCResponse.id = COMMAND_ID;
|
|
92
|
+
GetExAbsArchiveDaysMCResponse.directionType = UPLINK;
|
|
93
|
+
GetExAbsArchiveDaysMCResponse.examples = examples;
|
|
94
|
+
GetExAbsArchiveDaysMCResponse.hasParameters = true;
|
|
95
|
+
export default GetExAbsArchiveDaysMCResponse;
|
|
96
|
+
//# sourceMappingURL=GetExAbsArchiveDaysMCResponse.js.map
|
|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O,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAClE,CAAC;;AA/CM,gCAAE,GAAG,UAAU,CAAC;AAEP,2CAAa,GAAG,MAAM,CAAC;AAEvB,sCAAQ,GAAG,QAAQ,CAAC;AAEpB,2CAAa,GAAG,IAAI,CAAC;AA6CzC,eAAe,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import Command, { TCommandExampleList } from '../../Command.js';
|
|
2
|
+
import { TTime2000 } from '../../utils/time.js';
|
|
3
|
+
import { IChannelHours } from '../../CommandBinaryBuffer.js';
|
|
4
|
+
interface IGetExAbsArchiveHoursMCResponseParameters {
|
|
5
|
+
channelList: Array<IChannelHours>;
|
|
6
|
+
startTime: TTime2000;
|
|
7
|
+
hours: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Uplink command.
|
|
11
|
+
*
|
|
12
|
+
* @example create command instance from command body hex dump
|
|
13
|
+
* ```js
|
|
14
|
+
* import GetExAbsArchiveHoursMCResponse from 'jooby-codec/commands/uplink/GetExAbsArchiveHoursMCResponse';
|
|
15
|
+
*
|
|
16
|
+
* const commandBody = new Uint8Array([
|
|
17
|
+
* 0x2f, 0x97, 0x0c, 0x04, 0xea, 0x01, 0x02
|
|
18
|
+
* ]);
|
|
19
|
+
* const command = GetExAbsArchiveHoursMCResponse.fromBytes(commandBody);
|
|
20
|
+
*
|
|
21
|
+
* console.log(command.parameters);
|
|
22
|
+
* // output:
|
|
23
|
+
* {
|
|
24
|
+
* startTime: 756648000,
|
|
25
|
+
* hours: 1,
|
|
26
|
+
* channelList: [
|
|
27
|
+
* {value: 234, index: 2, diff: [2]}
|
|
28
|
+
* ]
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/GetExAbsArchiveHoursMC.md#response)
|
|
33
|
+
*/
|
|
34
|
+
declare class GetExAbsArchiveHoursMCResponse extends Command {
|
|
35
|
+
parameters: IGetExAbsArchiveHoursMCResponseParameters;
|
|
36
|
+
constructor(parameters: IGetExAbsArchiveHoursMCResponseParameters);
|
|
37
|
+
static readonly id = 3103;
|
|
38
|
+
static readonly directionType = 2;
|
|
39
|
+
static readonly examples: TCommandExampleList;
|
|
40
|
+
static readonly hasParameters = true;
|
|
41
|
+
static fromBytes(data: Uint8Array): GetExAbsArchiveHoursMCResponse;
|
|
42
|
+
toBytes(): Uint8Array;
|
|
43
|
+
}
|
|
44
|
+
export default GetExAbsArchiveHoursMCResponse;
|
|
@@ -7,7 +7,45 @@ const COMMAND_ID = 0x0c1f;
|
|
|
7
7
|
// date 2 bytes, hour 1 byte (max hours: 7), channelList 1 byte (max channelList: 4)
|
|
8
8
|
// 4 + (4 channelList * 1 byte pulse coefficient) + (4 channelList * 5 bytes of hour values) + (4 * 5 bytes of diff * 7 max hours diff)
|
|
9
9
|
const COMMAND_BODY_MAX_SIZE = 168;
|
|
10
|
-
|
|
10
|
+
const examples = [
|
|
11
|
+
{
|
|
12
|
+
name: '1 channel at 2023.12.23 12:00:00 GMT',
|
|
13
|
+
parameters: {
|
|
14
|
+
startTime: 756648000,
|
|
15
|
+
hours: 1,
|
|
16
|
+
channelList: [
|
|
17
|
+
{ value: 234, index: 2, diff: [2] }
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
hex: { header: '1f 0c 07', body: '2f 97 0c 02 ea 01 02' }
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* Uplink command.
|
|
25
|
+
*
|
|
26
|
+
* @example create command instance from command body hex dump
|
|
27
|
+
* ```js
|
|
28
|
+
* import GetExAbsArchiveHoursMCResponse from 'jooby-codec/commands/uplink/GetExAbsArchiveHoursMCResponse';
|
|
29
|
+
*
|
|
30
|
+
* const commandBody = new Uint8Array([
|
|
31
|
+
* 0x2f, 0x97, 0x0c, 0x04, 0xea, 0x01, 0x02
|
|
32
|
+
* ]);
|
|
33
|
+
* const command = GetExAbsArchiveHoursMCResponse.fromBytes(commandBody);
|
|
34
|
+
*
|
|
35
|
+
* console.log(command.parameters);
|
|
36
|
+
* // output:
|
|
37
|
+
* {
|
|
38
|
+
* startTime: 756648000,
|
|
39
|
+
* hours: 1,
|
|
40
|
+
* channelList: [
|
|
41
|
+
* {value: 234, index: 2, diff: [2]}
|
|
42
|
+
* ]
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/GetExAbsArchiveHoursMC.md#response)
|
|
47
|
+
*/
|
|
48
|
+
class GetExAbsArchiveHoursMCResponse extends Command {
|
|
11
49
|
constructor(parameters) {
|
|
12
50
|
super();
|
|
13
51
|
this.parameters = parameters;
|
|
@@ -33,7 +71,7 @@ class ExAbsArchiveHoursMC extends Command {
|
|
|
33
71
|
index: channelIndex
|
|
34
72
|
});
|
|
35
73
|
});
|
|
36
|
-
return new
|
|
74
|
+
return new GetExAbsArchiveHoursMCResponse({ channelList, hours, startTime: getSecondsFromDate(date) });
|
|
37
75
|
}
|
|
38
76
|
// returns full message - header with body
|
|
39
77
|
toBytes() {
|
|
@@ -51,8 +89,9 @@ class ExAbsArchiveHoursMC extends Command {
|
|
|
51
89
|
return Command.toBytes(COMMAND_ID, buffer.getBytesToOffset());
|
|
52
90
|
}
|
|
53
91
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
92
|
+
GetExAbsArchiveHoursMCResponse.id = COMMAND_ID;
|
|
93
|
+
GetExAbsArchiveHoursMCResponse.directionType = UPLINK;
|
|
94
|
+
GetExAbsArchiveHoursMCResponse.examples = examples;
|
|
95
|
+
GetExAbsArchiveHoursMCResponse.hasParameters = true;
|
|
96
|
+
export default GetExAbsArchiveHoursMCResponse;
|
|
97
|
+
//# sourceMappingURL=GetExAbsArchiveHoursMCResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetExAbsArchiveHoursMCResponse.js","sourceRoot":"","sources":["../../../src/commands/uplink/GetExAbsArchiveHoursMCResponse.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAC,kBAAkB,EAAE,kBAAkB,EAAY,MAAM,qBAAqB,CAAC;AACtF,OAAO,mBAAoC,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAC,MAAM,EAAC,MAAM,+BAA+B,CAAC;AAUrD,0CAA0C;AAC1C,MAAM,UAAU,GAAG,MAAM,CAAC;AAE1B,oFAAoF;AACpF,uIAAuI;AACvI,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,MAAM,QAAQ,GAAwB;IAClC;QACI,IAAI,EAAE,sCAAsC;QAC5C,UAAU,EAAE;YACR,SAAS,EAAE,SAAS;YACpB,KAAK,EAAE,CAAC;YACR,WAAW,EAAE;gBACT,EAAC,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAC;aACpC;SACJ;QACD,GAAG,EAAE,EAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,sBAAsB,EAAC;KAC1D;CACJ,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,8BAA+B,SAAQ,OAAO;IAChD,YAAqB,UAAqD;QACtE,KAAK,EAAE,CAAC;QADS,eAAU,GAAV,UAAU,CAA2C;QAGtE,IAAI,CAAC,UAAU,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IAChG,CAAC;IAYD,oCAAoC;IACpC,MAAM,CAAC,SAAS,CAAG,IAAgB;QAC/B,MA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MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC7B,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAEhC,KAAM,MAAM,EAAC,KAAK,EAAE,IAAI,EAAC,IAAI,WAAW,EAAG;YACvC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAC/B,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC;SACjE;QAED,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAClE,CAAC;;AAtDe,iCAAE,GAAG,UAAU,CAAC;AAEhB,4CAAa,GAAG,MAAM,CAAC;AAEvB,uCAAQ,GAAG,QAAQ,CAAC;AAEpB,4CAAa,GAAG,IAAI,CAAC;AAoDzC,eAAe,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import Command, { TCommandExampleList } from '../../Command.js';
|
|
2
|
+
import * as bitSet from '../../utils/bitSet.js';
|
|
3
|
+
interface ILmicCapabilities extends bitSet.TBooleanObject {
|
|
4
|
+
/** @see https://lora-alliance.org/resource_hub/lorawan-remote-multicast-setup-specification-v1-0-0/ */
|
|
5
|
+
isMulticastSupported: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* LoRaWAN Fragmented Data Block Transport
|
|
8
|
+
* @see https://lora-alliance.org/resource_hub/lorawan-fragmented-data-block-transport-specification-v1-0-0/
|
|
9
|
+
*/
|
|
10
|
+
isFragmentedDataSupported: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* GetLmicInfoResponse command parameters
|
|
14
|
+
*/
|
|
15
|
+
interface IGetLmicInfoResponseParameters {
|
|
16
|
+
capabilities: ILmicCapabilities;
|
|
17
|
+
version: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Uplink command.
|
|
21
|
+
*
|
|
22
|
+
* @example create command instance from command body hex dump
|
|
23
|
+
* ```js
|
|
24
|
+
* import GetLmicInfoResponse from 'jooby-codec/commands/uplink/GetLmicInfoResponse';
|
|
25
|
+
*
|
|
26
|
+
* const commandBody = new Uint8Array([0x01, 0x05]);
|
|
27
|
+
* const command = GetLmicInfoResponse.fromBytes(commandBody);
|
|
28
|
+
*
|
|
29
|
+
* console.log(command.parameters);
|
|
30
|
+
* // output:
|
|
31
|
+
* {
|
|
32
|
+
* version: 5,
|
|
33
|
+
* capabilities: {
|
|
34
|
+
* isMulticastSupported: true,
|
|
35
|
+
* isFragmentedDataSupported: false
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/GetLmicInfo.md#response)
|
|
41
|
+
*/
|
|
42
|
+
declare class GetLmicInfoResponse extends Command {
|
|
43
|
+
parameters: IGetLmicInfoResponseParameters;
|
|
44
|
+
constructor(parameters: IGetLmicInfoResponseParameters);
|
|
45
|
+
static readonly id = 543;
|
|
46
|
+
static readonly directionType = 2;
|
|
47
|
+
static readonly examples: TCommandExampleList;
|
|
48
|
+
static readonly hasParameters = true;
|
|
49
|
+
static fromBytes(data: Uint8Array): GetLmicInfoResponse;
|
|
50
|
+
toBytes(): Uint8Array;
|
|
51
|
+
}
|
|
52
|
+
export default GetLmicInfoResponse;
|
|
@@ -10,58 +10,58 @@ const lmicCapabilitiesBitMask = {
|
|
|
10
10
|
};
|
|
11
11
|
const examples = [
|
|
12
12
|
{
|
|
13
|
-
name: 'version:
|
|
13
|
+
name: 'version: 5, support only multicast',
|
|
14
14
|
parameters: {
|
|
15
|
-
version:
|
|
15
|
+
version: 5,
|
|
16
16
|
capabilities: {
|
|
17
17
|
isMulticastSupported: true,
|
|
18
18
|
isFragmentedDataSupported: false
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
-
hex: { header: '1f 02 02', body: '01
|
|
21
|
+
hex: { header: '1f 02 02', body: '01 05' }
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
name: 'version:
|
|
24
|
+
name: 'version: 8, support multicast and fragmented data',
|
|
25
25
|
parameters: {
|
|
26
|
-
version:
|
|
26
|
+
version: 8,
|
|
27
27
|
capabilities: {
|
|
28
28
|
isMulticastSupported: true,
|
|
29
29
|
isFragmentedDataSupported: true
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
hex: { header: '1f 02 02', body: '03
|
|
32
|
+
hex: { header: '1f 02 02', body: '03 08' }
|
|
33
33
|
}
|
|
34
34
|
];
|
|
35
35
|
/**
|
|
36
36
|
* Uplink command.
|
|
37
37
|
*
|
|
38
|
-
* @example
|
|
38
|
+
* @example create command instance from command body hex dump
|
|
39
39
|
* ```js
|
|
40
|
-
* import
|
|
40
|
+
* import GetLmicInfoResponse from 'jooby-codec/commands/uplink/GetLmicInfoResponse';
|
|
41
41
|
*
|
|
42
|
-
* const
|
|
43
|
-
*
|
|
42
|
+
* const commandBody = new Uint8Array([0x01, 0x05]);
|
|
43
|
+
* const command = GetLmicInfoResponse.fromBytes(commandBody);
|
|
44
|
+
*
|
|
45
|
+
* console.log(command.parameters);
|
|
46
|
+
* // output:
|
|
47
|
+
* {
|
|
48
|
+
* version: 5,
|
|
44
49
|
* capabilities: {
|
|
45
50
|
* isMulticastSupported: true,
|
|
46
|
-
* isFragmentedDataSupported:
|
|
51
|
+
* isFragmentedDataSupported: false
|
|
47
52
|
* }
|
|
48
|
-
* }
|
|
49
|
-
* const command = new GetLmicVersion(parameters);
|
|
50
|
-
*
|
|
51
|
-
* // output command binary in hex representation
|
|
52
|
-
* console.log(command.toHex());
|
|
53
|
-
* // 1f 02 02 03 22
|
|
53
|
+
* }
|
|
54
54
|
* ```
|
|
55
|
-
*
|
|
55
|
+
*
|
|
56
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/GetLmicInfo.md#response)
|
|
56
57
|
*/
|
|
57
|
-
class
|
|
58
|
+
class GetLmicInfoResponse extends Command {
|
|
58
59
|
constructor(parameters) {
|
|
59
60
|
super();
|
|
60
61
|
this.parameters = parameters;
|
|
61
62
|
}
|
|
62
63
|
// data - only body (without header)
|
|
63
64
|
static fromBytes(data) {
|
|
64
|
-
console.log({ data });
|
|
65
65
|
if (data.byteLength !== COMMAND_BODY_SIZE) {
|
|
66
66
|
throw new Error(`${this.getName()}. Wrong buffer size: ${data.byteLength}.`);
|
|
67
67
|
}
|
|
@@ -71,7 +71,7 @@ class GetLmicVersion extends Command {
|
|
|
71
71
|
if (!buffer.isEmpty) {
|
|
72
72
|
throw new Error(`${this.getName()}. BinaryBuffer is not empty.`);
|
|
73
73
|
}
|
|
74
|
-
return new
|
|
74
|
+
return new GetLmicInfoResponse({ capabilities, version });
|
|
75
75
|
}
|
|
76
76
|
// returns full message - header with body
|
|
77
77
|
toBytes() {
|
|
@@ -82,9 +82,9 @@ class GetLmicVersion extends Command {
|
|
|
82
82
|
return Command.toBytes(COMMAND_ID, buffer.toUint8Array());
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
export default
|
|
90
|
-
//# sourceMappingURL=
|
|
85
|
+
GetLmicInfoResponse.id = COMMAND_ID;
|
|
86
|
+
GetLmicInfoResponse.directionType = UPLINK;
|
|
87
|
+
GetLmicInfoResponse.examples = examples;
|
|
88
|
+
GetLmicInfoResponse.hasParameters = true;
|
|
89
|
+
export default GetLmicInfoResponse;
|
|
90
|
+
//# sourceMappingURL=GetLmicInfoResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetLmicInfoResponse.js","sourceRoot":"","sources":["../../../src/commands/uplink/GetLmicInfoResponse.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,kBAAkB,CAAC;AAC9D,OAAO,YAAY,MAAM,uBAAuB,CAA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AC;QAEtC,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAsB,CAAC;QACtG,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QAElC,IAAK,CAAC,MAAM,CAAC,OAAO,EAAG;YACnB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,8BAA8B,CAAC,CAAC;SACpE;QAED,OAAO,IAAI,mBAAmB,CAAC,EAAC,YAAY,EAAE,OAAO,EAAC,CAAC,CAAC;IAC5D,CAAC;IAED,0CAA0C;IAC1C,OAAO;QACH,MAAM,EAAC,YAAY,EAAE,OAAO,EAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAChD,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,iBAAiB,CAAC,CAAC;QAEnD,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAAC,CAAC;QAC1E,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEzB,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;;AApCe,sBAAE,GAAG,UAAU,CAAC;AAEhB,iCAAa,GAAG,MAAM,CAAC;AAEvB,4BAAQ,GAAG,QAAQ,CAAC;AAEpB,iCAAa,GAAG,IAAI,CAAC;AAkCzC,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import Command, { TCommandExampleList } from '../../Command.js';
|
|
2
|
+
import { IParameter } from '../../CommandBinaryBuffer.js';
|
|
3
|
+
/**
|
|
4
|
+
* Uplink command.
|
|
5
|
+
*
|
|
6
|
+
* @example create command instance from command body hex dump
|
|
7
|
+
* ```js
|
|
8
|
+
* import GetParameterResponse from 'jooby-codec/commands/uplink/GetParameterResponse';
|
|
9
|
+
*
|
|
10
|
+
* const commandBody = new Uint8Array([
|
|
11
|
+
* 0x1d, 0x01, 0x00, 0x00, 0x01, 0x92, 0x80, 0x00, 0x00, 0x07, 0xf0
|
|
12
|
+
* ]);
|
|
13
|
+
* const command = GetParameterResponse.fromBytes(commandBody);
|
|
14
|
+
*
|
|
15
|
+
* console.log(command.parameters);
|
|
16
|
+
* // output:
|
|
17
|
+
* {
|
|
18
|
+
* id: 29,
|
|
19
|
+
* data: {value: 2032, meterValue: 402, pulseCoefficient: 1000, channel: 1}
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/GetParameter.md#response)
|
|
24
|
+
*/
|
|
25
|
+
declare class GetParameterResponse extends Command {
|
|
26
|
+
parameters: IParameter;
|
|
27
|
+
constructor(parameters: IParameter);
|
|
28
|
+
static readonly id = 4;
|
|
29
|
+
static readonly directionType = 2;
|
|
30
|
+
static readonly examples: TCommandExampleList;
|
|
31
|
+
static readonly hasParameters = true;
|
|
32
|
+
static fromBytes(data: Uint8Array): GetParameterResponse;
|
|
33
|
+
toBytes(): Uint8Array;
|
|
34
|
+
}
|
|
35
|
+
export default GetParameterResponse;
|
|
@@ -10,10 +10,7 @@ const examples = [
|
|
|
10
10
|
id: deviceParameters.INITIAL_DATA,
|
|
11
11
|
data: { value: 2023, meterValue: 204, pulseCoefficient: 100 }
|
|
12
12
|
},
|
|
13
|
-
hex: {
|
|
14
|
-
header: '04 0a',
|
|
15
|
-
body: '17 00 00 00 cc 82 00 00 07 e7'
|
|
16
|
-
}
|
|
13
|
+
hex: { header: '04 0a', body: '17 00 00 00 cc 82 00 00 07 e7' }
|
|
17
14
|
},
|
|
18
15
|
{
|
|
19
16
|
name: 'device sending absolute data',
|
|
@@ -21,10 +18,7 @@ const examples = [
|
|
|
21
18
|
id: deviceParameters.ABSOLUTE_DATA_STATUS,
|
|
22
19
|
data: { status: 1 }
|
|
23
20
|
},
|
|
24
|
-
hex: {
|
|
25
|
-
header: '04 02',
|
|
26
|
-
body: '18 01'
|
|
27
|
-
}
|
|
21
|
+
hex: { header: '04 02', body: '18 01' }
|
|
28
22
|
},
|
|
29
23
|
{
|
|
30
24
|
name: 'initial data from 1 channel',
|
|
@@ -32,10 +26,7 @@ const examples = [
|
|
|
32
26
|
id: deviceParameters.INITIAL_DATA_MULTI_CHANNEL,
|
|
33
27
|
data: { value: 2032, meterValue: 402, pulseCoefficient: 1000, channel: 1 }
|
|
34
28
|
},
|
|
35
|
-
hex: {
|
|
36
|
-
header: '04 0b',
|
|
37
|
-
body: '1d 01 00 00 01 92 80 00 00 07 f0'
|
|
38
|
-
}
|
|
29
|
+
hex: { header: '04 0b', body: '1d 01 00 00 01 92 80 00 00 07 f0' }
|
|
39
30
|
},
|
|
40
31
|
{
|
|
41
32
|
name: 'absolute data sending is disabled for 2 channel',
|
|
@@ -43,30 +34,32 @@ const examples = [
|
|
|
43
34
|
id: deviceParameters.ABSOLUTE_DATA_STATUS_MULTI_CHANNEL,
|
|
44
35
|
data: { status: 0, channel: 2 }
|
|
45
36
|
},
|
|
46
|
-
hex: {
|
|
47
|
-
header: '04 03',
|
|
48
|
-
body: '1e 02 00'
|
|
49
|
-
}
|
|
37
|
+
hex: { header: '04 03', body: '1e 02 00' }
|
|
50
38
|
}
|
|
51
39
|
];
|
|
52
40
|
/**
|
|
53
41
|
* Uplink command.
|
|
54
42
|
*
|
|
55
|
-
* @example
|
|
43
|
+
* @example create command instance from command body hex dump
|
|
56
44
|
* ```js
|
|
57
|
-
* import
|
|
58
|
-
* import {constants} from 'jooby-codec';
|
|
45
|
+
* import GetParameterResponse from 'jooby-codec/commands/uplink/GetParameterResponse';
|
|
59
46
|
*
|
|
60
|
-
* const
|
|
61
|
-
*
|
|
47
|
+
* const commandBody = new Uint8Array([
|
|
48
|
+
* 0x1d, 0x01, 0x00, 0x00, 0x01, 0x92, 0x80, 0x00, 0x00, 0x07, 0xf0
|
|
49
|
+
* ]);
|
|
50
|
+
* const command = GetParameterResponse.fromBytes(commandBody);
|
|
62
51
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
52
|
+
* console.log(command.parameters);
|
|
53
|
+
* // output:
|
|
54
|
+
* {
|
|
55
|
+
* id: 29,
|
|
56
|
+
* data: {value: 2032, meterValue: 402, pulseCoefficient: 1000, channel: 1}
|
|
57
|
+
* }
|
|
66
58
|
* ```
|
|
59
|
+
*
|
|
67
60
|
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/GetParameter.md#response)
|
|
68
61
|
*/
|
|
69
|
-
class
|
|
62
|
+
class GetParameterResponse extends Command {
|
|
70
63
|
constructor(parameters) {
|
|
71
64
|
super();
|
|
72
65
|
this.parameters = parameters;
|
|
@@ -74,7 +67,7 @@ class GetParameter extends Command {
|
|
|
74
67
|
// data - only body (without header)
|
|
75
68
|
static fromBytes(data) {
|
|
76
69
|
const buffer = new CommandBinaryBuffer(data);
|
|
77
|
-
return new
|
|
70
|
+
return new GetParameterResponse(buffer.getParameter());
|
|
78
71
|
}
|
|
79
72
|
// returns full message - header with body
|
|
80
73
|
toBytes() {
|
|
@@ -83,9 +76,9 @@ class GetParameter extends Command {
|
|
|
83
76
|
return Command.toBytes(COMMAND_ID, buffer.getBytesToOffset());
|
|
84
77
|
}
|
|
85
78
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
export default
|
|
91
|
-
//# sourceMappingURL=
|
|
79
|
+
GetParameterResponse.id = COMMAND_ID;
|
|
80
|
+
GetParameterResponse.directionType = UPLINK;
|
|
81
|
+
GetParameterResponse.examples = examples;
|
|
82
|
+
GetParameterResponse.hasParameters = true;
|
|
83
|
+
export default GetParameterResponse;
|
|
84
|
+
//# sourceMappingURL=GetParameterResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetParameterResponse.js","sourceRoot":"","sources":["../../../src/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SAChC;QACD,GAAG,EAAE,EAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC;KAC3C;CACJ,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,oBAAqB,SAAQ,OAAO;IACtC,YAAqB,UAAsB;QACvC,KAAK,EAAE,CAAC;QADS,eAAU,GAAV,UAAU,CAAY;IAE3C,CAAC;IAYD,oCAAoC;IACpC,MAAM,CAAC,SAAS,CAAG,IAAgB;QAC/B,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAE7C,OAAO,IAAI,oBAAoB,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,0CAA0C;IAC1C,OAAO;QACH,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QAE9F,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAErC,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAClE,CAAC;;AAvBe,uBAAE,GAAG,UAAU,CAAC;AAEhB,kCAAa,GAAG,MAAM,CAAC;AAEvB,6BAAQ,GAAG,QAAQ,CAAC;AAEpB,kCAAa,GAAG,IAAI,CAAC;AAqBzC,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { TCommandExampleList } from '../../Command.js';
|
|
2
|
+
import CurrentMC from './CurrentMC.js';
|
|
3
|
+
import { TTime2000 } from '../../utils/time.js';
|
|
4
|
+
import { IChannelHours } from '../../CommandBinaryBuffer.js';
|
|
5
|
+
interface IHourMCParameters {
|
|
6
|
+
channelList: Array<IChannelHours>;
|
|
7
|
+
startTime: TTime2000;
|
|
8
|
+
hours: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Uplink command.
|
|
12
|
+
*
|
|
13
|
+
* @example create command instance from command body hex dump
|
|
14
|
+
* ```js
|
|
15
|
+
* import HourMC from 'jooby-codec/commands/uplink/HourMC';
|
|
16
|
+
*
|
|
17
|
+
* const commandBody = new Uint8Array([
|
|
18
|
+
* 0x2f, 0x97, 0x0c, 0x0f, 0x83, 0x01, 0x0a, 0xc0, 0x06, 0x0c, 0x26, 0x08, 0xea, 0x01, 0x0b
|
|
19
|
+
* ]);
|
|
20
|
+
* const command = HourMC.fromBytes(commandBody);
|
|
21
|
+
*
|
|
22
|
+
* console.log(command.parameters);
|
|
23
|
+
* // output:
|
|
24
|
+
* {
|
|
25
|
+
* startTime: 756648000,
|
|
26
|
+
* hours: 1,
|
|
27
|
+
* channelList: [
|
|
28
|
+
* {value: 131, index: 1, diff: [10]},
|
|
29
|
+
* {value: 832, index: 2, diff: [12]},
|
|
30
|
+
* {value: 38, index: 3, diff: [8]},
|
|
31
|
+
* {value: 234, index: 4, diff: [11]}
|
|
32
|
+
* ]
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/uplink/HourMC.md)
|
|
37
|
+
*/
|
|
38
|
+
declare class HourMC extends CurrentMC {
|
|
39
|
+
parameters: IHourMCParameters;
|
|
40
|
+
constructor(parameters: IHourMCParameters);
|
|
41
|
+
static readonly id = 23;
|
|
42
|
+
static readonly directionType = 2;
|
|
43
|
+
static readonly examples: TCommandExampleList;
|
|
44
|
+
static readonly hasParameters = true;
|
|
45
|
+
static fromBytes(data: Uint8Array): HourMC;
|
|
46
|
+
toBytes(): Uint8Array;
|
|
47
|
+
}
|
|
48
|
+
export default HourMC;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Command from '../../Command.js';
|
|
2
|
-
import
|
|
2
|
+
import CurrentMC from './CurrentMC.js';
|
|
3
3
|
import { getSecondsFromDate, getDateFromSeconds } from '../../utils/time.js';
|
|
4
4
|
import CommandBinaryBuffer from '../../CommandBinaryBuffer.js';
|
|
5
5
|
import { UPLINK } from '../../constants/directions.js';
|
|
@@ -8,7 +8,51 @@ const COMMAND_ID = 0x17;
|
|
|
8
8
|
// max hours diff - 7 (3 bit value)
|
|
9
9
|
// 4 + (4 channelList * 5 bytes of hour values) + (4 * 5 bytes of diff * 7 max hours diff)
|
|
10
10
|
const COMMAND_BODY_MAX_SIZE = 164;
|
|
11
|
-
|
|
11
|
+
const examples = [
|
|
12
|
+
{
|
|
13
|
+
name: '4 first channels at 2023.12.23 12:00:00 GMT',
|
|
14
|
+
parameters: {
|
|
15
|
+
startTime: 756648000,
|
|
16
|
+
hours: 1,
|
|
17
|
+
channelList: [
|
|
18
|
+
{ index: 1, value: 131, diff: [10] },
|
|
19
|
+
{ index: 2, value: 832, diff: [12] },
|
|
20
|
+
{ index: 3, value: 38, diff: [8] },
|
|
21
|
+
{ index: 4, value: 234, diff: [11] }
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
hex: { header: '17 0f', body: '2f 97 0c 0f 83 01 0a c0 06 0c 26 08 ea 01 0b' }
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* Uplink command.
|
|
29
|
+
*
|
|
30
|
+
* @example create command instance from command body hex dump
|
|
31
|
+
* ```js
|
|
32
|
+
* import HourMC from 'jooby-codec/commands/uplink/HourMC';
|
|
33
|
+
*
|
|
34
|
+
* const commandBody = new Uint8Array([
|
|
35
|
+
* 0x2f, 0x97, 0x0c, 0x0f, 0x83, 0x01, 0x0a, 0xc0, 0x06, 0x0c, 0x26, 0x08, 0xea, 0x01, 0x0b
|
|
36
|
+
* ]);
|
|
37
|
+
* const command = HourMC.fromBytes(commandBody);
|
|
38
|
+
*
|
|
39
|
+
* console.log(command.parameters);
|
|
40
|
+
* // output:
|
|
41
|
+
* {
|
|
42
|
+
* startTime: 756648000,
|
|
43
|
+
* hours: 1,
|
|
44
|
+
* channelList: [
|
|
45
|
+
* {value: 131, index: 1, diff: [10]},
|
|
46
|
+
* {value: 832, index: 2, diff: [12]},
|
|
47
|
+
* {value: 38, index: 3, diff: [8]},
|
|
48
|
+
* {value: 234, index: 4, diff: [11]}
|
|
49
|
+
* ]
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/uplink/HourMC.md)
|
|
54
|
+
*/
|
|
55
|
+
class HourMC extends CurrentMC {
|
|
12
56
|
constructor(parameters) {
|
|
13
57
|
super(parameters);
|
|
14
58
|
this.parameters = parameters;
|
|
@@ -19,9 +63,9 @@ class DataHourMC extends GetCurrentMC {
|
|
|
19
63
|
const date = buffer.getDate();
|
|
20
64
|
const { hour, hours } = buffer.getHours();
|
|
21
65
|
const channels = buffer.getChannels();
|
|
22
|
-
date.setUTCHours(hour);
|
|
23
|
-
let value;
|
|
24
66
|
const channelList = [];
|
|
67
|
+
let value;
|
|
68
|
+
date.setUTCHours(hour);
|
|
25
69
|
channels.forEach(channelIndex => {
|
|
26
70
|
// decode hour value for channel
|
|
27
71
|
value = buffer.getExtendedValue();
|
|
@@ -31,7 +75,7 @@ class DataHourMC extends GetCurrentMC {
|
|
|
31
75
|
}
|
|
32
76
|
channelList.push({ value, index: channelIndex, diff });
|
|
33
77
|
});
|
|
34
|
-
return new
|
|
78
|
+
return new HourMC({ channelList, hours, startTime: getSecondsFromDate(date) });
|
|
35
79
|
}
|
|
36
80
|
// returns full message - header with body
|
|
37
81
|
toBytes() {
|
|
@@ -49,8 +93,9 @@ class DataHourMC extends GetCurrentMC {
|
|
|
49
93
|
return Command.toBytes(COMMAND_ID, buffer.getBytesToOffset());
|
|
50
94
|
}
|
|
51
95
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
96
|
+
HourMC.id = COMMAND_ID;
|
|
97
|
+
HourMC.directionType = UPLINK;
|
|
98
|
+
HourMC.examples = examples;
|
|
99
|
+
HourMC.hasParameters = true;
|
|
100
|
+
export default HourMC;
|
|
101
|
+
//# sourceMappingURL=HourMC.js.map
|