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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Command, { TCommandExampleList } from '../../Command.js';
|
|
2
|
+
/**
|
|
3
|
+
* CorrectTime2000Response command parameters
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* {status: 1}
|
|
7
|
+
*/
|
|
8
|
+
interface ICorrectTime2000ResponseParameters {
|
|
9
|
+
status: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Uplink command.
|
|
13
|
+
*
|
|
14
|
+
* @example create command instance from command body hex dump
|
|
15
|
+
* ```js
|
|
16
|
+
* import CorrectTime2000Response from 'jooby-codec/commands/uplink/CorrectTime2000Response';
|
|
17
|
+
*
|
|
18
|
+
* // failure
|
|
19
|
+
* const commandBody = new Uint8Array([0x00]);
|
|
20
|
+
* const command = CorrectTime2000Response.fromBytes(commandBody);
|
|
21
|
+
*
|
|
22
|
+
* console.log(command.parameters);
|
|
23
|
+
* // output:
|
|
24
|
+
* {status: 0}
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/CorrectTime2000.md#response)
|
|
28
|
+
*/
|
|
29
|
+
declare class CorrectTime2000Response extends Command {
|
|
30
|
+
parameters: ICorrectTime2000ResponseParameters;
|
|
31
|
+
constructor(parameters: ICorrectTime2000ResponseParameters);
|
|
32
|
+
static readonly id = 12;
|
|
33
|
+
static readonly directionType = 2;
|
|
34
|
+
static readonly examples: TCommandExampleList;
|
|
35
|
+
static readonly hasParameters = true;
|
|
36
|
+
static fromBytes(data: Uint8Array): CorrectTime2000Response;
|
|
37
|
+
toBytes(): Uint8Array;
|
|
38
|
+
}
|
|
39
|
+
export default CorrectTime2000Response;
|
|
@@ -3,24 +3,32 @@ import BinaryBuffer from '../../BinaryBuffer.js';
|
|
|
3
3
|
import { UPLINK } from '../../constants/directions.js';
|
|
4
4
|
const COMMAND_ID = 0x0c;
|
|
5
5
|
const COMMAND_BODY_SIZE = 1;
|
|
6
|
+
const examples = [
|
|
7
|
+
{
|
|
8
|
+
name: 'failure',
|
|
9
|
+
parameters: { status: 0 },
|
|
10
|
+
hex: { header: '0c 01', body: '00' }
|
|
11
|
+
}
|
|
12
|
+
];
|
|
6
13
|
/**
|
|
7
14
|
* Uplink command.
|
|
8
15
|
*
|
|
9
|
-
* @example
|
|
16
|
+
* @example create command instance from command body hex dump
|
|
10
17
|
* ```js
|
|
11
|
-
* import
|
|
18
|
+
* import CorrectTime2000Response from 'jooby-codec/commands/uplink/CorrectTime2000Response';
|
|
12
19
|
*
|
|
13
20
|
* // failure
|
|
14
|
-
* const
|
|
15
|
-
* const command =
|
|
21
|
+
* const commandBody = new Uint8Array([0x00]);
|
|
22
|
+
* const command = CorrectTime2000Response.fromBytes(commandBody);
|
|
16
23
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
24
|
+
* console.log(command.parameters);
|
|
25
|
+
* // output:
|
|
26
|
+
* {status: 0}
|
|
20
27
|
* ```
|
|
28
|
+
*
|
|
21
29
|
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/CorrectTime2000.md#response)
|
|
22
30
|
*/
|
|
23
|
-
class
|
|
31
|
+
class CorrectTime2000Response extends Command {
|
|
24
32
|
constructor(parameters) {
|
|
25
33
|
super();
|
|
26
34
|
this.parameters = parameters;
|
|
@@ -37,7 +45,7 @@ class CorrectTime2000 extends Command {
|
|
|
37
45
|
if (!buffer.isEmpty) {
|
|
38
46
|
throw new Error(`${this.getName()}. BinaryBuffer is not empty.`);
|
|
39
47
|
}
|
|
40
|
-
return new
|
|
48
|
+
return new CorrectTime2000Response(parameters);
|
|
41
49
|
}
|
|
42
50
|
// returns full message - header with body
|
|
43
51
|
toBytes() {
|
|
@@ -47,8 +55,9 @@ class CorrectTime2000 extends Command {
|
|
|
47
55
|
return Command.toBytes(COMMAND_ID, buffer.toUint8Array());
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
CorrectTime2000Response.id = COMMAND_ID;
|
|
59
|
+
CorrectTime2000Response.directionType = UPLINK;
|
|
60
|
+
CorrectTime2000Response.examples = examples;
|
|
61
|
+
CorrectTime2000Response.hasParameters = true;
|
|
62
|
+
export default CorrectTime2000Response;
|
|
63
|
+
//# sourceMappingURL=CorrectTime2000Response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CorrectTime2000Response.js","sourceRoot":"","sources":["../../../src/commands/uplink/CorrectTime2000Response.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,kBAAkB,CAAC;AAC9D,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAC,MAAM,EAAC,MAAM,+BAA+B,CAAC;AAcrD,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,MAAM,QAAQ,GAAwB;IAClC;QACI,IAAI,EAAE,SAAS;QACf,UAAU,EAAE,EAAC,MAAM,EAAE,CAAC,EAAC;QACvB,GAAG,EAAE,EAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAC;KACrC;CACJ,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,uBAAwB,SAAQ,OAAO;IACzC,YAAqB,UAA8C;QAC/D,KAAK,EAAE,CAAC;QADS,eAAU,GAAV,UAAU,CAAoC;IAEnE,CAAC;IAYD,oCAAoC;IACpC,MAAM,CAAC,SAAS,CAAG,IAAgB;QAC/B,IAAK,IAAI,CAAC,UAAU,KAAK,iBAAiB,EAAG;YACzC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,wBAAwB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;SAChF;QAED,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC7C,MAAM,UAAU,GAAG;YACf,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE;SAC5B,CAAC;QAEF,IAAK,CAAC,MAAM,CAAC,OAAO,EAAG;YACnB,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,8BAA8B,CAAC,CAAC;SACpE;QAED,OAAO,IAAI,uBAAuB,CAAC,UAAU,CAAC,CAAC;IACnD,CAAC;IAED,0CAA0C;IAC1C,OAAO;QACH,MAAM,EAAC,MAAM,EAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QACjC,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;QAE1D,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAExB,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;;AAnCe,0BAAE,GAAG,UAAU,CAAC;AAEhB,qCAAa,GAAG,MAAM,CAAC;AAEvB,gCAAQ,GAAG,QAAQ,CAAC;AAEpB,qCAAa,GAAG,IAAI,CAAC;AAiCzC,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Command, { TCommandExampleList } from '../../Command.js';
|
|
2
|
+
import { IChannelValue } from '../../CommandBinaryBuffer.js';
|
|
3
|
+
/**
|
|
4
|
+
* CurrentMC command parameters.
|
|
5
|
+
*/
|
|
6
|
+
export interface ICurrentMCParameters {
|
|
7
|
+
channelList: Array<IChannelValue>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Uplink command.
|
|
11
|
+
*
|
|
12
|
+
* @example create command instance from command body hex dump
|
|
13
|
+
* ```js
|
|
14
|
+
* import CurrentMC from 'jooby-codec/commands/uplink/CurrentMC';
|
|
15
|
+
*
|
|
16
|
+
* const commandBody = new Uint8Array([0x01, 0x32]);
|
|
17
|
+
* const command = CurrentMC.fromBytes(commandBody);
|
|
18
|
+
*
|
|
19
|
+
* console.log(command.parameters);
|
|
20
|
+
* // output:
|
|
21
|
+
* {
|
|
22
|
+
* channelList: [
|
|
23
|
+
* {index: 1, value: 50}
|
|
24
|
+
* ]
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/GetCurrentMC.md#response)
|
|
29
|
+
*/
|
|
30
|
+
declare class CurrentMC extends Command {
|
|
31
|
+
parameters: ICurrentMCParameters;
|
|
32
|
+
constructor(parameters: ICurrentMCParameters);
|
|
33
|
+
static id: number;
|
|
34
|
+
static readonly directionType = 2;
|
|
35
|
+
static readonly examples: TCommandExampleList;
|
|
36
|
+
static readonly hasParameters = true;
|
|
37
|
+
static fromBytes(data: Uint8Array): CurrentMC;
|
|
38
|
+
toBytes(): Uint8Array;
|
|
39
|
+
}
|
|
40
|
+
export default CurrentMC;
|
|
@@ -9,25 +9,25 @@ const examples = [
|
|
|
9
9
|
name: '4 first channels',
|
|
10
10
|
parameters: {
|
|
11
11
|
channelList: [
|
|
12
|
-
{ index:
|
|
13
|
-
{ index:
|
|
14
|
-
{ index:
|
|
15
|
-
{ index:
|
|
12
|
+
{ index: 1, value: 131 },
|
|
13
|
+
{ index: 2, value: 8 },
|
|
14
|
+
{ index: 3, value: 10 },
|
|
15
|
+
{ index: 4, value: 12 }
|
|
16
16
|
]
|
|
17
17
|
},
|
|
18
|
-
hex: { header: '18 06', body: '0f
|
|
18
|
+
hex: { header: '18 06', body: '0f 83 01 08 0a 0c' }
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
name: 'single channel
|
|
21
|
+
name: 'single channel 2',
|
|
22
22
|
parameters: {
|
|
23
23
|
channelList: [
|
|
24
24
|
{ index: 2, value: 50 }
|
|
25
25
|
]
|
|
26
26
|
},
|
|
27
|
-
hex: { header: '18 02', body: '
|
|
27
|
+
hex: { header: '18 02', body: '02 32' }
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
name: 'channels
|
|
30
|
+
name: 'channels 5, 6, 12',
|
|
31
31
|
parameters: {
|
|
32
32
|
channelList: [
|
|
33
33
|
{ index: 5, value: 8146 },
|
|
@@ -35,31 +35,31 @@ const examples = [
|
|
|
35
35
|
{ index: 12, value: 75 }
|
|
36
36
|
]
|
|
37
37
|
},
|
|
38
|
-
hex: { header: '18 07', body: '
|
|
38
|
+
hex: { header: '18 07', body: 'b0 10 d2 3f a4 01 4b' }
|
|
39
39
|
}
|
|
40
40
|
];
|
|
41
41
|
/**
|
|
42
|
-
* Uplink command
|
|
42
|
+
* Uplink command.
|
|
43
43
|
*
|
|
44
|
-
* @example
|
|
44
|
+
* @example create command instance from command body hex dump
|
|
45
45
|
* ```js
|
|
46
|
-
* import
|
|
46
|
+
* import CurrentMC from 'jooby-codec/commands/uplink/CurrentMC';
|
|
47
47
|
*
|
|
48
|
-
* const
|
|
48
|
+
* const commandBody = new Uint8Array([0x01, 0x32]);
|
|
49
|
+
* const command = CurrentMC.fromBytes(commandBody);
|
|
50
|
+
*
|
|
51
|
+
* console.log(command.parameters);
|
|
52
|
+
* // output:
|
|
53
|
+
* {
|
|
49
54
|
* channelList: [
|
|
50
55
|
* {index: 1, value: 50}
|
|
51
56
|
* ]
|
|
52
|
-
* }
|
|
53
|
-
* const command = new GetCurrentMC(parameters);
|
|
54
|
-
*
|
|
55
|
-
* // output command binary in hex representation
|
|
56
|
-
* console.log(command.toHex());
|
|
57
|
-
* // 18 02 01 32
|
|
57
|
+
* }
|
|
58
58
|
* ```
|
|
59
59
|
*
|
|
60
60
|
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/GetCurrentMC.md#response)
|
|
61
61
|
*/
|
|
62
|
-
class
|
|
62
|
+
class CurrentMC extends Command {
|
|
63
63
|
constructor(parameters) {
|
|
64
64
|
super();
|
|
65
65
|
this.parameters = parameters;
|
|
@@ -74,7 +74,7 @@ class GetCurrentMC extends Command {
|
|
|
74
74
|
value: buffer.getExtendedValue(),
|
|
75
75
|
index: channelIndex
|
|
76
76
|
}));
|
|
77
|
-
return new
|
|
77
|
+
return new CurrentMC(parameters);
|
|
78
78
|
}
|
|
79
79
|
// returns full message - header with body
|
|
80
80
|
toBytes() {
|
|
@@ -85,9 +85,9 @@ class GetCurrentMC extends Command {
|
|
|
85
85
|
return Command.toBytes(COMMAND_ID, buffer.getBytesToOffset());
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
export default
|
|
93
|
-
//# sourceMappingURL=
|
|
88
|
+
CurrentMC.id = COMMAND_ID;
|
|
89
|
+
CurrentMC.directionType = UPLINK;
|
|
90
|
+
CurrentMC.examples = examples;
|
|
91
|
+
CurrentMC.hasParameters = true;
|
|
92
|
+
export default CurrentMC;
|
|
93
|
+
//# sourceMappingURL=CurrentMC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CurrentMC.js","sourceRoot":"","sources":["../../../src/commands/uplink/CurrentMC.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,kBAAkB,CAAC;AAC9D,OAAO,mBAAoC,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAC,MAAM,EAAC,MAAM,+BAA+B,CAAC;AAUrD,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,oFAAoF;AACpF,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC,MAAM,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ime2000 } from '../../utils/time.js';
|
|
3
|
+
import CurrentMC, { ICurrentMCParameters } from './CurrentMC.js';
|
|
4
|
+
/**
|
|
5
|
+
* DayMC command parameters.
|
|
6
|
+
*/
|
|
7
|
+
interface IDayMCParameters extends ICurrentMCParameters {
|
|
8
|
+
startTime: TTime2000;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Uplink command.
|
|
12
|
+
*
|
|
13
|
+
* @example create command instance from command body hex dump
|
|
14
|
+
* ```js
|
|
15
|
+
* import DayMC from 'jooby-codec/commands/uplink/DayMC';
|
|
16
|
+
*
|
|
17
|
+
* const commandBody = new Uint8Array([
|
|
18
|
+
* 0x2f, 0x97, 0x55, 0x0c, 0x83, 0x01, 0x08, 0x0a
|
|
19
|
+
* ]);
|
|
20
|
+
* const command = DayMC.fromBytes(commandBody);
|
|
21
|
+
*
|
|
22
|
+
* console.log(command.parameters);
|
|
23
|
+
* // output:
|
|
24
|
+
* {
|
|
25
|
+
* startTime: 756604800,
|
|
26
|
+
* channelList: [,
|
|
27
|
+
* {value: 12, index: 1}
|
|
28
|
+
* {value: 131, index: 3},
|
|
29
|
+
* {value: 8, index: 5},
|
|
30
|
+
* {value: 10, index: 7}
|
|
31
|
+
* ]
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/uplink/DayMC.md)
|
|
36
|
+
*/
|
|
37
|
+
declare class DayMC extends CurrentMC {
|
|
38
|
+
parameters: IDayMCParameters;
|
|
39
|
+
constructor(parameters: IDayMCParameters);
|
|
40
|
+
static readonly id = 22;
|
|
41
|
+
static readonly directionType = 2;
|
|
42
|
+
static readonly examples: TCommandExampleList;
|
|
43
|
+
static readonly hasParameters = true;
|
|
44
|
+
static fromBytes(data: Uint8Array): DayMC;
|
|
45
|
+
toBytes(): Uint8Array;
|
|
46
|
+
}
|
|
47
|
+
export default DayMC;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
2
|
+
import Command from '../../Command.js';
|
|
3
|
+
import CommandBinaryBuffer from '../../CommandBinaryBuffer.js';
|
|
4
|
+
import { getSecondsFromDate } from '../../utils/time.js';
|
|
5
|
+
import CurrentMC from './CurrentMC.js';
|
|
6
|
+
import { UPLINK } from '../../constants/directions.js';
|
|
7
|
+
const COMMAND_ID = 0x16;
|
|
8
|
+
// 2 byte for date + 2 for channels (max channels: 7)
|
|
9
|
+
// 4 + (7 * 4)
|
|
10
|
+
const COMMAND_BODY_MAX_SIZE = 32;
|
|
11
|
+
const examples = [
|
|
12
|
+
{
|
|
13
|
+
name: '4 channels at 2023.12.23 00:00:00 GMT',
|
|
14
|
+
parameters: {
|
|
15
|
+
startTime: 756604800,
|
|
16
|
+
channelList: [
|
|
17
|
+
{ index: 3, value: 131 },
|
|
18
|
+
{ index: 5, value: 8 },
|
|
19
|
+
{ index: 7, value: 10 },
|
|
20
|
+
{ index: 1, value: 12 }
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
hex: { header: '16 08', body: '2f 97 55 0c 83 01 08 0a' }
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Uplink command.
|
|
28
|
+
*
|
|
29
|
+
* @example create command instance from command body hex dump
|
|
30
|
+
* ```js
|
|
31
|
+
* import DayMC from 'jooby-codec/commands/uplink/DayMC';
|
|
32
|
+
*
|
|
33
|
+
* const commandBody = new Uint8Array([
|
|
34
|
+
* 0x2f, 0x97, 0x55, 0x0c, 0x83, 0x01, 0x08, 0x0a
|
|
35
|
+
* ]);
|
|
36
|
+
* const command = DayMC.fromBytes(commandBody);
|
|
37
|
+
*
|
|
38
|
+
* console.log(command.parameters);
|
|
39
|
+
* // output:
|
|
40
|
+
* {
|
|
41
|
+
* startTime: 756604800,
|
|
42
|
+
* channelList: [,
|
|
43
|
+
* {value: 12, index: 1}
|
|
44
|
+
* {value: 131, index: 3},
|
|
45
|
+
* {value: 8, index: 5},
|
|
46
|
+
* {value: 10, index: 7}
|
|
47
|
+
* ]
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/uplink/DayMC.md)
|
|
52
|
+
*/
|
|
53
|
+
class DayMC extends CurrentMC {
|
|
54
|
+
constructor(parameters) {
|
|
55
|
+
super(parameters);
|
|
56
|
+
this.parameters = parameters;
|
|
57
|
+
}
|
|
58
|
+
// data - only body (without header)
|
|
59
|
+
static fromBytes(data) {
|
|
60
|
+
const parameters = { channelList: [], startTime: 0 };
|
|
61
|
+
const buffer = new CommandBinaryBuffer(data);
|
|
62
|
+
const date = buffer.getDate();
|
|
63
|
+
const channelList = buffer.getChannels();
|
|
64
|
+
parameters.channelList = channelList.map(channelIndex => ({
|
|
65
|
+
value: buffer.getExtendedValue(),
|
|
66
|
+
index: channelIndex
|
|
67
|
+
}));
|
|
68
|
+
parameters.startTime = getSecondsFromDate(date);
|
|
69
|
+
return new DayMC(parameters);
|
|
70
|
+
}
|
|
71
|
+
// returns full message - header with body
|
|
72
|
+
toBytes() {
|
|
73
|
+
const buffer = new CommandBinaryBuffer(COMMAND_BODY_MAX_SIZE);
|
|
74
|
+
const { channelList, startTime } = this.parameters;
|
|
75
|
+
buffer.setDate(startTime);
|
|
76
|
+
buffer.setChannels(channelList);
|
|
77
|
+
channelList.forEach(({ value }) => buffer.setExtendedValue(value));
|
|
78
|
+
return Command.toBytes(COMMAND_ID, buffer.getBytesToOffset());
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
DayMC.id = COMMAND_ID;
|
|
82
|
+
DayMC.directionType = UPLINK;
|
|
83
|
+
DayMC.examples = examples;
|
|
84
|
+
DayMC.hasParameters = true;
|
|
85
|
+
export default DayMC;
|
|
86
|
+
//# sourceMappingURL=DayMC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QAC9B,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QAEzC,UAAU,CAAC,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YACtD,KAAK,EAAE,MAAM,CAAC,gBAAgB,EAAE;YAChC,KAAK,EAAE,YAAY;SACtB,CAAkB,CAAC,CAAC;QAErB,UAAU,CAAC,SAAS,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAEhD,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC;IACjC,CAAC;IAED,0CAA0C;IAC1C,OAAO;QACH,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;QAC9D,MAAM,EAAC,WAAW,EAAE,SAAS,EAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAEjD,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC1B,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAChC,WAAW,CAAC,OAAO,CAAC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;QAEjE,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAClE,CAAC;;AApCe,QAAE,GAAG,UAAU,CAAC;AAEhB,mBAAa,GAAG,MAAM,CAAC;AAEvB,cAAQ,GAAG,QAAQ,CAAC;AAEpB,mBAAa,GAAG,IAAI,CAAC;AAkCzC,eAAe,KAAK,CAAC"}
|
|
@@ -1,13 +1,39 @@
|
|
|
1
|
-
import Command from '../../Command.js';
|
|
1
|
+
import Command, { TCommandExampleList } from '../../Command.js';
|
|
2
2
|
import { IChannelAbsoluteValue } from '../../CommandBinaryBuffer.js';
|
|
3
|
-
interface
|
|
3
|
+
interface IExAbsCurrentMCParameters {
|
|
4
4
|
channelList: Array<IChannelAbsoluteValue>;
|
|
5
5
|
}
|
|
6
|
+
/**
|
|
7
|
+
* Uplink command.
|
|
8
|
+
*
|
|
9
|
+
* @example create command instance from command body hex dump
|
|
10
|
+
* ```js
|
|
11
|
+
* import ExAbsCurrentMC from 'jooby-codec/commands/uplink/ExAbsCurrentMC';
|
|
12
|
+
*
|
|
13
|
+
* const commandBody = new Uint8Array([0x04, 0x64, 0xd6, 0x02']);
|
|
14
|
+
* const command = ExAbsCurrentMC.fromBytes(commandBody);
|
|
15
|
+
*
|
|
16
|
+
* console.log(command.parameters);
|
|
17
|
+
* // output:
|
|
18
|
+
* {
|
|
19
|
+
* channelList: [
|
|
20
|
+
* {
|
|
21
|
+
* pulseCoefficient: 100,
|
|
22
|
+
* index: 3,
|
|
23
|
+
* value: 342
|
|
24
|
+
* }
|
|
25
|
+
* ]
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/uplink/ExAbsCurrentMC.md)
|
|
30
|
+
*/
|
|
6
31
|
declare class ExAbsCurrentMC extends Command {
|
|
7
|
-
parameters:
|
|
8
|
-
constructor(parameters:
|
|
32
|
+
parameters: IExAbsCurrentMCParameters;
|
|
33
|
+
constructor(parameters: IExAbsCurrentMCParameters);
|
|
9
34
|
static id: number;
|
|
10
35
|
static readonly directionType = 2;
|
|
36
|
+
static readonly examples: TCommandExampleList;
|
|
11
37
|
static readonly hasParameters = true;
|
|
12
38
|
static fromBytes(data: Uint8Array): ExAbsCurrentMC;
|
|
13
39
|
toBytes(): Uint8Array;
|
|
@@ -5,6 +5,49 @@ const COMMAND_ID = 0x0f1f;
|
|
|
5
5
|
// channelList 3 byte (max channelList: 14)
|
|
6
6
|
// 3 + (14 * (1 byte IPK + 5 bytes of day values))
|
|
7
7
|
const COMMAND_BODY_MAX_SIZE = 87;
|
|
8
|
+
const examples = [
|
|
9
|
+
{
|
|
10
|
+
name: 'absolute current value from 3 channel',
|
|
11
|
+
parameters: {
|
|
12
|
+
channelList: [
|
|
13
|
+
{
|
|
14
|
+
pulseCoefficient: 100,
|
|
15
|
+
index: 3,
|
|
16
|
+
value: 342
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
hex: {
|
|
21
|
+
header: '1f 0f 04',
|
|
22
|
+
body: '04 64 d6 02'
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Uplink command.
|
|
28
|
+
*
|
|
29
|
+
* @example create command instance from command body hex dump
|
|
30
|
+
* ```js
|
|
31
|
+
* import ExAbsCurrentMC from 'jooby-codec/commands/uplink/ExAbsCurrentMC';
|
|
32
|
+
*
|
|
33
|
+
* const commandBody = new Uint8Array([0x04, 0x64, 0xd6, 0x02']);
|
|
34
|
+
* const command = ExAbsCurrentMC.fromBytes(commandBody);
|
|
35
|
+
*
|
|
36
|
+
* console.log(command.parameters);
|
|
37
|
+
* // output:
|
|
38
|
+
* {
|
|
39
|
+
* channelList: [
|
|
40
|
+
* {
|
|
41
|
+
* pulseCoefficient: 100,
|
|
42
|
+
* index: 3,
|
|
43
|
+
* value: 342
|
|
44
|
+
* }
|
|
45
|
+
* ]
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/uplink/ExAbsCurrentMC.md)
|
|
50
|
+
*/
|
|
8
51
|
class ExAbsCurrentMC extends Command {
|
|
9
52
|
constructor(parameters) {
|
|
10
53
|
super();
|
|
@@ -26,6 +69,7 @@ class ExAbsCurrentMC extends Command {
|
|
|
26
69
|
}
|
|
27
70
|
ExAbsCurrentMC.id = COMMAND_ID;
|
|
28
71
|
ExAbsCurrentMC.directionType = UPLINK;
|
|
72
|
+
ExAbsCurrentMC.examples = examples;
|
|
29
73
|
ExAbsCurrentMC.hasParameters = true;
|
|
30
74
|
export default ExAbsCurrentMC;
|
|
31
75
|
//# sourceMappingURL=ExAbsCurrentMC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExAbsCurrentMC.js","sourceRoot":"","sources":["../../../src/commands/uplink/ExAbsCurrentMC.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ExAbsCurrentMC.js","sourceRoot":"","sources":["../../../src/commands/uplink/ExAbsCurrentMC.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,kBAAkB,CAAC;AAC9D,OAAO,mBAA4C,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAC,MAAM,EAAC,MAAM,+BAA+B,CAAC;AAOrD,MAAM,UAAU,GAAG,MAAM,CAAC;AAE1B,2CAA2C;AAC3C,kDAAkD;AAClD,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC,MAAM,QAAQ,GAAwB;IAClC;QACI,IAAI,EAAE,uCAAuC;QAC7C,UAAU,EAAE;YACR,WAAW,EAAE;gBACT;oBACI,gBAAgB,EAAE,GAAG;oBACrB,KAAK,EAAE,CAAC;oBACR,KAAK,EAAE,GAAG;iBACb;aACJ;SACJ;QACD,GAAG,EAAE;YACD,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,aAAa;SACtB;KACJ;CACJ,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,cAAe,SAAQ,OAAO;IAChC,YAAqB,UAAqC;QACtD,KAAK,EAAE,CAAC;QADS,eAAU,GAAV,UAAU,CAA2B;QAGtD,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,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAE7C,OAAO,IAAI,cAAc,CAAC,EAAC,WAAW,EAAE,MAAM,CAAC,6BAA6B,EAAE,EAAC,CAAC,CAAC;IACrF,CAAC;IAED,0CAA0C;IAC1C,OAAO;QACH,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;QAC9D,MAAM,EAAC,WAAW,EAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAEtC,MAAM,CAAC,6BAA6B,CAAC,WAAW,CAAC,CAAC;QAElD,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAClE,CAAC;;AAxBM,iBAAE,GAAG,UAAU,CAAC;AAEP,4BAAa,GAAG,MAAM,CAAC;AAEvB,uBAAQ,GAAG,QAAQ,CAAC;AAEpB,4BAAa,GAAG,IAAI,CAAC;AAsBzC,eAAe,cAAc,CAAC"}
|
|
@@ -1,15 +1,43 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { TCommandExampleList } from '../../Command.js';
|
|
2
|
+
import CurrentMC from './CurrentMC.js';
|
|
2
3
|
import { IChannelAbsoluteValue } from '../../CommandBinaryBuffer.js';
|
|
3
4
|
import { TTime2000 } from '../../utils/time.js';
|
|
4
5
|
interface IExAbsDayMCParameters {
|
|
5
6
|
channelList: Array<IChannelAbsoluteValue>;
|
|
6
7
|
startTime: TTime2000;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Uplink command.
|
|
11
|
+
*
|
|
12
|
+
* @example create command instance from command body hex dump
|
|
13
|
+
* ```js
|
|
14
|
+
* import ExAbsDayMC from 'jooby-codec/commands/uplink/ExAbsDayMC';
|
|
15
|
+
*
|
|
16
|
+
* const commandBody = new Uint8Array([0x2e, 0x6a, 0x01, 0x64, 0xd6, 0x02']);
|
|
17
|
+
* const command = ExAbsDayMC.fromBytes(commandBody);
|
|
18
|
+
*
|
|
19
|
+
* console.log(command.parameters);
|
|
20
|
+
* // output:
|
|
21
|
+
* {
|
|
22
|
+
* startTime: 731721600,
|
|
23
|
+
* channelList: [
|
|
24
|
+
* {
|
|
25
|
+
* pulseCoefficient: 100,
|
|
26
|
+
* index: 1,
|
|
27
|
+
* value: 342
|
|
28
|
+
* }
|
|
29
|
+
* ]
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/uplink/ExAbsDayMC.md)
|
|
34
|
+
*/
|
|
35
|
+
declare class ExAbsDayMC extends CurrentMC {
|
|
9
36
|
parameters: IExAbsDayMCParameters;
|
|
10
37
|
constructor(parameters: IExAbsDayMCParameters);
|
|
11
38
|
static id: number;
|
|
12
39
|
static readonly directionType = 2;
|
|
40
|
+
static readonly examples: TCommandExampleList;
|
|
13
41
|
static readonly hasParameters = true;
|
|
14
42
|
static fromBytes(data: Uint8Array): ExAbsDayMC;
|
|
15
43
|
toBytes(): Uint8Array;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Command from '../../Command.js';
|
|
2
|
-
import
|
|
2
|
+
import CurrentMC from './CurrentMC.js';
|
|
3
3
|
import CommandBinaryBuffer from '../../CommandBinaryBuffer.js';
|
|
4
4
|
import { UPLINK } from '../../constants/directions.js';
|
|
5
5
|
import { getSecondsFromDate } from '../../utils/time.js';
|
|
@@ -7,7 +7,52 @@ const COMMAND_ID = 0x0b1f;
|
|
|
7
7
|
// date 2 bytes, channelList 3 bytes (max channelList: 14)
|
|
8
8
|
// 5 + (14 channelList * (1 byte IPK + 5 bytes of day values))
|
|
9
9
|
const COMMAND_BODY_MAX_SIZE = 89;
|
|
10
|
-
|
|
10
|
+
const examples = [
|
|
11
|
+
{
|
|
12
|
+
name: 'absolute day value for 2023.03.10 00:00:00 GMT',
|
|
13
|
+
parameters: {
|
|
14
|
+
startTime: 731721600,
|
|
15
|
+
channelList: [
|
|
16
|
+
{
|
|
17
|
+
pulseCoefficient: 100,
|
|
18
|
+
index: 1,
|
|
19
|
+
value: 342
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
hex: {
|
|
24
|
+
header: '1f 0b 06',
|
|
25
|
+
body: '2e 6a 01 64 d6 02'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* Uplink command.
|
|
31
|
+
*
|
|
32
|
+
* @example create command instance from command body hex dump
|
|
33
|
+
* ```js
|
|
34
|
+
* import ExAbsDayMC from 'jooby-codec/commands/uplink/ExAbsDayMC';
|
|
35
|
+
*
|
|
36
|
+
* const commandBody = new Uint8Array([0x2e, 0x6a, 0x01, 0x64, 0xd6, 0x02']);
|
|
37
|
+
* const command = ExAbsDayMC.fromBytes(commandBody);
|
|
38
|
+
*
|
|
39
|
+
* console.log(command.parameters);
|
|
40
|
+
* // output:
|
|
41
|
+
* {
|
|
42
|
+
* startTime: 731721600,
|
|
43
|
+
* channelList: [
|
|
44
|
+
* {
|
|
45
|
+
* pulseCoefficient: 100,
|
|
46
|
+
* index: 1,
|
|
47
|
+
* value: 342
|
|
48
|
+
* }
|
|
49
|
+
* ]
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* [Command format documentation](https://github.com/jooby-dev/jooby-docs/blob/main/docs/commands/uplink/ExAbsDayMC.md)
|
|
54
|
+
*/
|
|
55
|
+
class ExAbsDayMC extends CurrentMC {
|
|
11
56
|
constructor(parameters) {
|
|
12
57
|
super(parameters);
|
|
13
58
|
this.parameters = parameters;
|
|
@@ -30,6 +75,7 @@ class ExAbsDayMC extends GetCurrentMC {
|
|
|
30
75
|
}
|
|
31
76
|
ExAbsDayMC.id = COMMAND_ID;
|
|
32
77
|
ExAbsDayMC.directionType = UPLINK;
|
|
78
|
+
ExAbsDayMC.examples = examples;
|
|
33
79
|
ExAbsDayMC.hasParameters = true;
|
|
34
80
|
export default ExAbsDayMC;
|
|
35
81
|
//# sourceMappingURL=ExAbsDayMC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExAbsDayMC.js","sourceRoot":"","sources":["../../../src/commands/uplink/ExAbsDayMC.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ExAbsDayMC.js","sourceRoot":"","sources":["../../../src/commands/uplink/ExAbsDayMC.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,kBAAkB,CAAC;AAC9D,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,mBAA4C,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAC,MAAM,EAAC,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAC,kBAAkB,EAAY,MAAM,qBAAqB,CAAC;AASlE,MAAM,UAAU,GAAG,MAAM,CAAC;AAE1B,0DAA0D;AAC1D,8DAA8D;AAC9D,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC,MAAM,QAAQ,GAAwB;IAClC;QACI,IAAI,EAAE,gDAAgD;QACtD,UAAU,EAAE;YACR,SAAS,EAAE,SAAS;YACpB,WAAW,EAAE;gBACT;oBACI,gBAAgB,EAAE,GAAG;oBACrB,KAAK,EAAE,CAAC;oBACR,KAAK,EAAE,GAAG;iBACb;aACJ;SACJ;QACD,GAAG,EAAE;YACD,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,mBAAmB;SAC5B;KACJ;CACJ,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAW,SAAQ,SAAS;IAC9B,YAAqB,UAAiC;QAClD,KAAK,CAAC,UAAU,CAAC,CAAC;QADD,eAAU,GAAV,UAAU,CAAuB;IAEtD,CAAC;IAYD,oCAAoC;IACpC,MAAM,CAAC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