jooby-codec 1.15.0 → 2.0.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/analog/Command.d.ts +29 -0
- package/dist/analog/Command.js +34 -0
- package/dist/analog/Command.js.map +1 -0
- package/dist/{CommandBinaryBuffer.d.ts → analog/CommandBinaryBuffer.d.ts} +2 -211
- package/dist/{CommandBinaryBuffer.js → analog/CommandBinaryBuffer.js} +6 -80
- package/dist/analog/CommandBinaryBuffer.js.map +1 -0
- package/dist/{UnknownCommand.d.ts → analog/UnknownCommand.d.ts} +0 -8
- package/dist/{UnknownCommand.js → analog/UnknownCommand.js} +0 -5
- package/dist/analog/UnknownCommand.js.map +1 -0
- package/dist/analog/commands/downlink/CorrectTime2000.d.ts +16 -0
- package/dist/{commands → analog/commands}/downlink/CorrectTime2000.js +3 -23
- package/dist/analog/commands/downlink/CorrectTime2000.js.map +1 -0
- package/dist/analog/commands/downlink/GetArchiveDaysMC.d.ts +18 -0
- package/dist/{commands → analog/commands}/downlink/GetArchiveDaysMC.js +3 -27
- package/dist/analog/commands/downlink/GetArchiveDaysMC.js.map +1 -0
- package/dist/analog/commands/downlink/GetArchiveEvents.d.ts +17 -0
- package/dist/{commands → analog/commands}/downlink/GetArchiveEvents.js +0 -19
- package/dist/analog/commands/downlink/GetArchiveEvents.js.map +1 -0
- package/dist/analog/commands/downlink/GetArchiveHoursMC.d.ts +18 -0
- package/dist/{commands → analog/commands}/downlink/GetArchiveHoursMC.js +3 -22
- package/dist/analog/commands/downlink/GetArchiveHoursMC.js.map +1 -0
- package/dist/analog/commands/downlink/GetCurrentMC.d.ts +10 -0
- package/dist/analog/commands/downlink/GetCurrentMC.js +23 -0
- package/dist/analog/commands/downlink/GetCurrentMC.js.map +1 -0
- package/dist/analog/commands/downlink/GetExAbsArchiveDaysMC.d.ts +18 -0
- package/dist/{commands → analog/commands}/downlink/GetExAbsArchiveDaysMC.js +3 -24
- package/dist/analog/commands/downlink/GetExAbsArchiveDaysMC.js.map +1 -0
- package/dist/analog/commands/downlink/GetExAbsArchiveHoursMC.d.ts +18 -0
- package/dist/{commands → analog/commands}/downlink/GetExAbsArchiveHoursMC.js +3 -23
- package/dist/analog/commands/downlink/GetExAbsArchiveHoursMC.js.map +1 -0
- package/dist/analog/commands/downlink/GetExAbsCurrentMC.d.ts +11 -0
- package/dist/{commands → analog/commands}/downlink/GetExAbsCurrentMC.js +0 -20
- package/dist/analog/commands/downlink/GetExAbsCurrentMC.js.map +1 -0
- package/dist/analog/commands/downlink/GetLmicInfo.d.ts +10 -0
- package/dist/analog/commands/downlink/GetLmicInfo.js +23 -0
- package/dist/analog/commands/downlink/GetLmicInfo.js.map +1 -0
- package/dist/analog/commands/downlink/GetParameter.d.ts +15 -0
- package/dist/{commands → analog/commands}/downlink/GetParameter.js +0 -20
- package/dist/analog/commands/downlink/GetParameter.js.map +1 -0
- package/dist/analog/commands/downlink/GetStatus.d.ts +11 -0
- package/dist/{commands → analog/commands}/downlink/GetStatus.js +0 -19
- package/dist/analog/commands/downlink/GetStatus.js.map +1 -0
- package/dist/analog/commands/downlink/SetParameter.d.ts +13 -0
- package/dist/{commands → analog/commands}/downlink/SetParameter.js +0 -19
- package/dist/analog/commands/downlink/SetParameter.js.map +1 -0
- package/dist/analog/commands/downlink/SetTime2000.d.ts +16 -0
- package/dist/{commands → analog/commands}/downlink/SetTime2000.js +3 -22
- package/dist/analog/commands/downlink/SetTime2000.js.map +1 -0
- package/dist/analog/commands/downlink/SoftRestart.d.ts +10 -0
- package/dist/analog/commands/downlink/SoftRestart.js +23 -0
- package/dist/analog/commands/downlink/SoftRestart.js.map +1 -0
- package/dist/{commands → analog/commands}/downlink/index.d.ts +0 -5
- package/dist/{commands → analog/commands}/downlink/index.js +0 -5
- package/dist/analog/commands/downlink/index.js.map +1 -0
- package/dist/{commands → analog/commands}/index.d.ts +0 -5
- package/dist/{commands → analog/commands}/index.js +0 -5
- package/dist/analog/commands/index.js.map +1 -0
- package/dist/analog/commands/uplink/CorrectTime2000Response.d.ts +15 -0
- package/dist/{commands → analog/commands}/uplink/CorrectTime2000Response.js +3 -23
- package/dist/analog/commands/uplink/CorrectTime2000Response.js.map +1 -0
- package/dist/{commands → analog/commands}/uplink/CurrentMC.d.ts +0 -24
- package/dist/{commands → analog/commands}/uplink/CurrentMC.js +0 -24
- package/dist/analog/commands/uplink/CurrentMC.js.map +1 -0
- package/dist/analog/commands/uplink/DayMC.d.ts +17 -0
- package/dist/{commands → analog/commands}/uplink/DayMC.js +1 -33
- package/dist/analog/commands/uplink/DayMC.js.map +1 -0
- package/dist/analog/commands/uplink/ExAbsCurrentMC.d.ts +16 -0
- package/dist/{commands → analog/commands}/uplink/ExAbsCurrentMC.js +0 -29
- package/dist/analog/commands/uplink/ExAbsCurrentMC.js.map +1 -0
- package/dist/analog/commands/uplink/ExAbsDayMC.d.ts +19 -0
- package/dist/{commands → analog/commands}/uplink/ExAbsDayMC.js +1 -31
- package/dist/analog/commands/uplink/ExAbsDayMC.js.map +1 -0
- package/dist/analog/commands/uplink/ExAbsHourMC.d.ts +19 -0
- package/dist/{commands → analog/commands}/uplink/ExAbsHourMC.js +1 -36
- package/dist/analog/commands/uplink/ExAbsHourMC.js.map +1 -0
- package/dist/analog/commands/uplink/GetArchiveDaysMCResponse.d.ts +19 -0
- package/dist/{commands → analog/commands}/uplink/GetArchiveDaysMCResponse.js +1 -33
- package/dist/analog/commands/uplink/GetArchiveDaysMCResponse.js.map +1 -0
- package/dist/analog/commands/uplink/GetArchiveEventsResponse.d.ts +21 -0
- package/dist/{commands → analog/commands}/uplink/GetArchiveEventsResponse.js +0 -26
- package/dist/analog/commands/uplink/GetArchiveEventsResponse.js.map +1 -0
- package/dist/analog/commands/uplink/GetArchiveHoursMCResponse.d.ts +19 -0
- package/dist/{commands → analog/commands}/uplink/GetArchiveHoursMCResponse.js +0 -33
- package/dist/analog/commands/uplink/GetArchiveHoursMCResponse.js.map +1 -0
- package/dist/analog/commands/uplink/GetExAbsArchiveDaysMCResponse.d.ts +19 -0
- package/dist/{commands → analog/commands}/uplink/GetExAbsArchiveDaysMCResponse.js +1 -33
- package/dist/analog/commands/uplink/GetExAbsArchiveDaysMCResponse.js.map +1 -0
- package/dist/{commands → analog/commands}/uplink/GetExAbsArchiveHoursMCResponse.d.ts +1 -26
- package/dist/{commands → analog/commands}/uplink/GetExAbsArchiveHoursMCResponse.js +1 -31
- package/dist/analog/commands/uplink/GetExAbsArchiveHoursMCResponse.js.map +1 -0
- package/dist/analog/commands/uplink/GetLmicInfoResponse.d.ts +21 -0
- package/dist/{commands → analog/commands}/uplink/GetLmicInfoResponse.js +4 -29
- package/dist/analog/commands/uplink/GetLmicInfoResponse.js.map +1 -0
- package/dist/analog/commands/uplink/GetParameterResponse.d.ts +13 -0
- package/dist/{commands → analog/commands}/uplink/GetParameterResponse.js +0 -24
- package/dist/analog/commands/uplink/GetParameterResponse.js.map +1 -0
- package/dist/analog/commands/uplink/HourMC.d.ts +20 -0
- package/dist/{commands → analog/commands}/uplink/HourMC.js +1 -35
- package/dist/analog/commands/uplink/HourMC.js.map +1 -0
- package/dist/analog/commands/uplink/LastEvent.d.ts +21 -0
- package/dist/{commands → analog/commands}/uplink/LastEvent.js +22 -48
- package/dist/analog/commands/uplink/LastEvent.js.map +1 -0
- package/dist/{commands → analog/commands}/uplink/NewEvent.d.ts +1 -42
- package/dist/{commands → analog/commands}/uplink/NewEvent.js +2 -32
- package/dist/analog/commands/uplink/NewEvent.js.map +1 -0
- package/dist/analog/commands/uplink/SetTime2000Response.d.ts +15 -0
- package/dist/{commands → analog/commands}/uplink/SetTime2000Response.js +3 -22
- package/dist/analog/commands/uplink/SetTime2000Response.js.map +1 -0
- package/dist/analog/commands/uplink/SoftRestartResponse.d.ts +10 -0
- package/dist/analog/commands/uplink/SoftRestartResponse.js +23 -0
- package/dist/analog/commands/uplink/SoftRestartResponse.js.map +1 -0
- package/dist/analog/commands/uplink/Status.d.ts +23 -0
- package/dist/{commands → analog/commands}/uplink/Status.js +1 -33
- package/dist/analog/commands/uplink/Status.js.map +1 -0
- package/dist/analog/commands/uplink/Time2000.d.ts +17 -0
- package/dist/{commands → analog/commands}/uplink/Time2000.js +2 -22
- package/dist/analog/commands/uplink/Time2000.js.map +1 -0
- package/dist/{commands → analog/commands}/uplink/index.d.ts +0 -5
- package/dist/{commands → analog/commands}/uplink/index.js +0 -5
- package/dist/analog/commands/uplink/index.js.map +1 -0
- package/dist/analog/constants/deviceParameters.d.ts +18 -0
- package/dist/analog/constants/deviceParameters.js +19 -0
- package/dist/analog/constants/deviceParameters.js.map +1 -0
- package/dist/analog/constants/directions.js.map +1 -0
- package/dist/analog/constants/events.d.ts +21 -0
- package/dist/analog/constants/events.js +22 -0
- package/dist/analog/constants/events.js.map +1 -0
- package/dist/analog/constants/hardwareTypes.d.ts +13 -0
- package/dist/analog/constants/hardwareTypes.js +14 -0
- package/dist/analog/constants/hardwareTypes.js.map +1 -0
- package/dist/analog/constants/index.js.map +1 -0
- package/dist/{constants → analog/constants}/rx2SpreadFactors.d.ts +0 -5
- package/dist/{constants → analog/constants}/rx2SpreadFactors.js +0 -5
- package/dist/analog/constants/rx2SpreadFactors.js.map +1 -0
- package/dist/{utils → analog}/header.d.ts +1 -1
- package/dist/{utils → analog}/header.js +2 -4
- package/dist/analog/header.js.map +1 -0
- package/dist/analog/index.d.ts +3 -0
- package/dist/analog/index.js +4 -0
- package/dist/analog/index.js.map +1 -0
- package/dist/{utils → analog}/message.d.ts +8 -13
- package/dist/{utils → analog}/message.js +13 -32
- package/dist/analog/message.js.map +1 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/{Command.d.ts → obis-observer/Command.d.ts} +2 -27
- package/dist/obis-observer/Command.js +33 -0
- package/dist/obis-observer/Command.js.map +1 -0
- package/dist/obis-observer/CommandBinaryBuffer.d.ts +56 -0
- package/dist/obis-observer/CommandBinaryBuffer.js +138 -0
- package/dist/obis-observer/CommandBinaryBuffer.js.map +1 -0
- package/dist/obis-observer/UnknownCommand.d.ts +12 -0
- package/dist/obis-observer/UnknownCommand.js +17 -0
- package/dist/obis-observer/UnknownCommand.js.map +1 -0
- package/dist/obis-observer/commands/downlink/AddShortNameProfile.d.ts +17 -0
- package/dist/obis-observer/commands/downlink/AddShortNameProfile.js +55 -0
- package/dist/obis-observer/commands/downlink/AddShortNameProfile.js.map +1 -0
- package/dist/obis-observer/commands/downlink/GetArchiveProfile.d.ts +13 -0
- package/dist/obis-observer/commands/downlink/GetArchiveProfile.js +39 -0
- package/dist/obis-observer/commands/downlink/GetArchiveProfile.js.map +1 -0
- package/dist/obis-observer/commands/downlink/GetContentByObis.d.ts +16 -0
- package/dist/obis-observer/commands/downlink/GetContentByObis.js +48 -0
- package/dist/obis-observer/commands/downlink/GetContentByObis.js.map +1 -0
- package/dist/obis-observer/commands/downlink/GetContentByShortName.d.ts +17 -0
- package/dist/obis-observer/commands/downlink/GetContentByShortName.js +44 -0
- package/dist/obis-observer/commands/downlink/GetContentByShortName.js.map +1 -0
- package/dist/obis-observer/commands/downlink/GetShortNameInfo.d.ts +17 -0
- package/dist/obis-observer/commands/downlink/GetShortNameInfo.js +44 -0
- package/dist/obis-observer/commands/downlink/GetShortNameInfo.js.map +1 -0
- package/dist/obis-observer/commands/downlink/GetShortNameProfile.d.ts +16 -0
- package/dist/obis-observer/commands/downlink/GetShortNameProfile.js +45 -0
- package/dist/obis-observer/commands/downlink/GetShortNameProfile.js.map +1 -0
- package/dist/obis-observer/commands/downlink/GetShortNames.d.ts +16 -0
- package/dist/obis-observer/commands/downlink/GetShortNames.js +48 -0
- package/dist/obis-observer/commands/downlink/GetShortNames.js.map +1 -0
- package/dist/obis-observer/commands/downlink/ReadArchive.d.ts +17 -0
- package/dist/obis-observer/commands/downlink/ReadArchive.js +58 -0
- package/dist/obis-observer/commands/downlink/ReadArchive.js.map +1 -0
- package/dist/obis-observer/commands/downlink/Reboot.d.ts +13 -0
- package/dist/obis-observer/commands/downlink/Reboot.js +39 -0
- package/dist/obis-observer/commands/downlink/Reboot.js.map +1 -0
- package/dist/obis-observer/commands/downlink/RemoveShortNameProfile.d.ts +16 -0
- package/dist/obis-observer/commands/downlink/RemoveShortNameProfile.js +42 -0
- package/dist/obis-observer/commands/downlink/RemoveShortNameProfile.js.map +1 -0
- package/dist/obis-observer/commands/downlink/SetArchiveProfile.d.ts +17 -0
- package/dist/obis-observer/commands/downlink/SetArchiveProfile.js +45 -0
- package/dist/obis-observer/commands/downlink/SetArchiveProfile.js.map +1 -0
- package/dist/obis-observer/commands/downlink/SetSerialPort.d.ts +19 -0
- package/dist/obis-observer/commands/downlink/SetSerialPort.js +61 -0
- package/dist/obis-observer/commands/downlink/SetSerialPort.js.map +1 -0
- package/dist/obis-observer/commands/downlink/SetShortName.d.ts +17 -0
- package/dist/obis-observer/commands/downlink/SetShortName.js +51 -0
- package/dist/obis-observer/commands/downlink/SetShortName.js.map +1 -0
- package/dist/obis-observer/commands/downlink/index.d.ts +13 -0
- package/dist/obis-observer/commands/downlink/index.js +14 -0
- package/dist/obis-observer/commands/downlink/index.js.map +1 -0
- package/dist/obis-observer/commands/index.d.ts +2 -0
- package/dist/obis-observer/commands/index.js +3 -0
- package/dist/obis-observer/commands/index.js.map +1 -0
- package/dist/obis-observer/commands/uplink/AddShortNameProfileResponse.d.ts +16 -0
- package/dist/obis-observer/commands/uplink/AddShortNameProfileResponse.js +43 -0
- package/dist/obis-observer/commands/uplink/AddShortNameProfileResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/GetArchiveProfileResponse.d.ts +17 -0
- package/dist/obis-observer/commands/uplink/GetArchiveProfileResponse.js +45 -0
- package/dist/obis-observer/commands/uplink/GetArchiveProfileResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/GetContentByObisResponse.d.ts +16 -0
- package/dist/obis-observer/commands/uplink/GetContentByObisResponse.js +45 -0
- package/dist/obis-observer/commands/uplink/GetContentByObisResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/GetContentByShortNameResponse.d.ts +16 -0
- package/dist/obis-observer/commands/uplink/GetContentByShortNameResponse.js +44 -0
- package/dist/obis-observer/commands/uplink/GetContentByShortNameResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/GetContentByShortNameStringResponse.d.ts +16 -0
- package/dist/obis-observer/commands/uplink/GetContentByShortNameStringResponse.js +45 -0
- package/dist/obis-observer/commands/uplink/GetContentByShortNameStringResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/GetShortNameInfoResponse.d.ts +17 -0
- package/dist/obis-observer/commands/uplink/GetShortNameInfoResponse.js +74 -0
- package/dist/obis-observer/commands/uplink/GetShortNameInfoResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/GetShortNameProfileResponse.d.ts +16 -0
- package/dist/obis-observer/commands/uplink/GetShortNameProfileResponse.js +54 -0
- package/dist/obis-observer/commands/uplink/GetShortNameProfileResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/GetShortNamesResponse.d.ts +16 -0
- package/dist/obis-observer/commands/uplink/GetShortNamesResponse.js +45 -0
- package/dist/obis-observer/commands/uplink/GetShortNamesResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/ObservationReport.d.ts +17 -0
- package/dist/obis-observer/commands/uplink/ObservationReport.js +57 -0
- package/dist/obis-observer/commands/uplink/ObservationReport.js.map +1 -0
- package/dist/obis-observer/commands/uplink/ObservationReportString.d.ts +17 -0
- package/dist/obis-observer/commands/uplink/ObservationReportString.js +62 -0
- package/dist/obis-observer/commands/uplink/ObservationReportString.js.map +1 -0
- package/dist/obis-observer/commands/uplink/ReadArchiveResponse.d.ts +17 -0
- package/dist/obis-observer/commands/uplink/ReadArchiveResponse.js +61 -0
- package/dist/obis-observer/commands/uplink/ReadArchiveResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/RebootResponse.d.ts +13 -0
- package/dist/obis-observer/commands/uplink/RebootResponse.js +36 -0
- package/dist/obis-observer/commands/uplink/RebootResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/RemoveShortNameProfileResponse.d.ts +16 -0
- package/dist/obis-observer/commands/uplink/RemoveShortNameProfileResponse.js +43 -0
- package/dist/obis-observer/commands/uplink/RemoveShortNameProfileResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/SetArchiveProfileResponse.d.ts +16 -0
- package/dist/obis-observer/commands/uplink/SetArchiveProfileResponse.js +51 -0
- package/dist/obis-observer/commands/uplink/SetArchiveProfileResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/SetSerialPortResponse.d.ts +16 -0
- package/dist/obis-observer/commands/uplink/SetSerialPortResponse.js +51 -0
- package/dist/obis-observer/commands/uplink/SetSerialPortResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/SetShortNameResponse.d.ts +16 -0
- package/dist/obis-observer/commands/uplink/SetShortNameResponse.js +43 -0
- package/dist/obis-observer/commands/uplink/SetShortNameResponse.js.map +1 -0
- package/dist/obis-observer/commands/uplink/index.d.ts +16 -0
- package/dist/obis-observer/commands/uplink/index.js +17 -0
- package/dist/obis-observer/commands/uplink/index.js.map +1 -0
- package/dist/obis-observer/constants/archiveTypes.d.ts +3 -0
- package/dist/obis-observer/constants/archiveTypes.js +4 -0
- package/dist/obis-observer/constants/archiveTypes.js.map +1 -0
- package/dist/obis-observer/constants/contentTypes.d.ts +3 -0
- package/dist/obis-observer/constants/contentTypes.js +4 -0
- package/dist/obis-observer/constants/contentTypes.js.map +1 -0
- package/dist/obis-observer/constants/directions.d.ts +2 -0
- package/dist/obis-observer/constants/directions.js +3 -0
- package/dist/obis-observer/constants/directions.js.map +1 -0
- package/dist/obis-observer/constants/index.d.ts +5 -0
- package/dist/obis-observer/constants/index.js +6 -0
- package/dist/obis-observer/constants/index.js.map +1 -0
- package/dist/obis-observer/constants/parityTypes.d.ts +3 -0
- package/dist/obis-observer/constants/parityTypes.js +4 -0
- package/dist/obis-observer/constants/parityTypes.js.map +1 -0
- package/dist/obis-observer/constants/resultCodes.d.ts +6 -0
- package/dist/obis-observer/constants/resultCodes.js +7 -0
- package/dist/obis-observer/constants/resultCodes.js.map +1 -0
- package/dist/obis-observer/index.d.ts +3 -0
- package/dist/obis-observer/index.js +4 -0
- package/dist/obis-observer/index.js.map +1 -0
- package/dist/obis-observer/message.d.ts +18 -0
- package/dist/obis-observer/message.js +58 -0
- package/dist/obis-observer/message.js.map +1 -0
- package/dist/{BinaryBuffer.d.ts → utils/BinaryBuffer.d.ts} +3 -17
- package/dist/{BinaryBuffer.js → utils/BinaryBuffer.js} +17 -19
- package/dist/utils/BinaryBuffer.js.map +1 -0
- package/dist/utils/bitSet.d.ts +2 -36
- package/dist/utils/bitSet.js +10 -36
- package/dist/utils/bitSet.js.map +1 -1
- package/dist/utils/getBytesFromHex.d.ts +0 -9
- package/dist/utils/getBytesFromHex.js +0 -10
- package/dist/utils/getBytesFromHex.js.map +1 -1
- package/dist/utils/getHexFromBytes.d.ts +1 -25
- package/dist/utils/getHexFromBytes.js +2 -16
- package/dist/utils/getHexFromBytes.js.map +1 -1
- package/dist/utils/getHexFromNumber.d.ts +3 -0
- package/dist/utils/getHexFromNumber.js +20 -0
- package/dist/utils/getHexFromNumber.js.map +1 -0
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/time.d.ts +0 -24
- package/dist/utils/time.js +0 -12
- package/dist/utils/time.js.map +1 -1
- package/package.json +13 -9
- package/readme.md +19 -12
- package/dist/BinaryBuffer.js.map +0 -1
- package/dist/Command.js +0 -89
- package/dist/Command.js.map +0 -1
- package/dist/CommandBinaryBuffer.js.map +0 -1
- package/dist/UnknownCommand.js.map +0 -1
- package/dist/commands/downlink/CorrectTime2000.d.ts +0 -46
- package/dist/commands/downlink/CorrectTime2000.js.map +0 -1
- package/dist/commands/downlink/GetArchiveDaysMC.d.ts +0 -45
- package/dist/commands/downlink/GetArchiveDaysMC.js.map +0 -1
- package/dist/commands/downlink/GetArchiveEvents.d.ts +0 -40
- package/dist/commands/downlink/GetArchiveEvents.js.map +0 -1
- package/dist/commands/downlink/GetArchiveHoursMC.d.ts +0 -40
- package/dist/commands/downlink/GetArchiveHoursMC.js.map +0 -1
- package/dist/commands/downlink/GetCurrentMC.d.ts +0 -26
- package/dist/commands/downlink/GetCurrentMC.js +0 -42
- package/dist/commands/downlink/GetCurrentMC.js.map +0 -1
- package/dist/commands/downlink/GetExAbsArchiveDaysMC.d.ts +0 -41
- package/dist/commands/downlink/GetExAbsArchiveDaysMC.js.map +0 -1
- package/dist/commands/downlink/GetExAbsArchiveHoursMC.d.ts +0 -40
- package/dist/commands/downlink/GetExAbsArchiveHoursMC.js.map +0 -1
- package/dist/commands/downlink/GetExAbsCurrentMC.d.ts +0 -27
- package/dist/commands/downlink/GetExAbsCurrentMC.js.map +0 -1
- package/dist/commands/downlink/GetLmicInfo.d.ts +0 -26
- package/dist/commands/downlink/GetLmicInfo.js +0 -42
- package/dist/commands/downlink/GetLmicInfo.js.map +0 -1
- package/dist/commands/downlink/GetParameter.d.ts +0 -38
- package/dist/commands/downlink/GetParameter.js.map +0 -1
- package/dist/commands/downlink/GetStatus.d.ts +0 -27
- package/dist/commands/downlink/GetStatus.js.map +0 -1
- package/dist/commands/downlink/SetParameter.d.ts +0 -30
- package/dist/commands/downlink/SetParameter.js.map +0 -1
- package/dist/commands/downlink/SetTime2000.d.ts +0 -42
- package/dist/commands/downlink/SetTime2000.js.map +0 -1
- package/dist/commands/downlink/SoftRestart.d.ts +0 -26
- package/dist/commands/downlink/SoftRestart.js +0 -42
- package/dist/commands/downlink/SoftRestart.js.map +0 -1
- package/dist/commands/downlink/index.js.map +0 -1
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/uplink/CorrectTime2000Response.d.ts +0 -39
- package/dist/commands/uplink/CorrectTime2000Response.js.map +0 -1
- package/dist/commands/uplink/CurrentMC.js.map +0 -1
- package/dist/commands/uplink/DayMC.d.ts +0 -47
- package/dist/commands/uplink/DayMC.js.map +0 -1
- package/dist/commands/uplink/ExAbsCurrentMC.d.ts +0 -41
- package/dist/commands/uplink/ExAbsCurrentMC.js.map +0 -1
- package/dist/commands/uplink/ExAbsDayMC.d.ts +0 -45
- package/dist/commands/uplink/ExAbsDayMC.js.map +0 -1
- package/dist/commands/uplink/ExAbsHourMC.d.ts +0 -69
- package/dist/commands/uplink/ExAbsHourMC.js.map +0 -1
- package/dist/commands/uplink/GetArchiveDaysMCResponse.d.ts +0 -58
- package/dist/commands/uplink/GetArchiveDaysMCResponse.js.map +0 -1
- package/dist/commands/uplink/GetArchiveEventsResponse.d.ts +0 -54
- package/dist/commands/uplink/GetArchiveEventsResponse.js.map +0 -1
- package/dist/commands/uplink/GetArchiveHoursMCResponse.d.ts +0 -50
- package/dist/commands/uplink/GetArchiveHoursMCResponse.js.map +0 -1
- package/dist/commands/uplink/GetExAbsArchiveDaysMCResponse.d.ts +0 -47
- package/dist/commands/uplink/GetExAbsArchiveDaysMCResponse.js.map +0 -1
- package/dist/commands/uplink/GetExAbsArchiveHoursMCResponse.js.map +0 -1
- package/dist/commands/uplink/GetLmicInfoResponse.d.ts +0 -52
- package/dist/commands/uplink/GetLmicInfoResponse.js.map +0 -1
- package/dist/commands/uplink/GetParameterResponse.d.ts +0 -35
- package/dist/commands/uplink/GetParameterResponse.js.map +0 -1
- package/dist/commands/uplink/HourMC.d.ts +0 -48
- package/dist/commands/uplink/HourMC.js.map +0 -1
- package/dist/commands/uplink/LastEvent.d.ts +0 -54
- package/dist/commands/uplink/LastEvent.js.map +0 -1
- package/dist/commands/uplink/NewEvent.js.map +0 -1
- package/dist/commands/uplink/SetTime2000Response.d.ts +0 -38
- package/dist/commands/uplink/SetTime2000Response.js.map +0 -1
- package/dist/commands/uplink/SoftRestartResponse.d.ts +0 -28
- package/dist/commands/uplink/SoftRestartResponse.js +0 -44
- package/dist/commands/uplink/SoftRestartResponse.js.map +0 -1
- package/dist/commands/uplink/Status.d.ts +0 -55
- package/dist/commands/uplink/Status.js.map +0 -1
- package/dist/commands/uplink/Time2000.d.ts +0 -43
- package/dist/commands/uplink/Time2000.js.map +0 -1
- package/dist/commands/uplink/index.js.map +0 -1
- package/dist/constants/deviceParameters.d.ts +0 -53
- package/dist/constants/deviceParameters.js +0 -54
- package/dist/constants/deviceParameters.js.map +0 -1
- package/dist/constants/directions.js.map +0 -1
- package/dist/constants/events.d.ts +0 -42
- package/dist/constants/events.js +0 -43
- package/dist/constants/events.js.map +0 -1
- package/dist/constants/hardwareTypes.d.ts +0 -108
- package/dist/constants/hardwareTypes.js +0 -109
- package/dist/constants/hardwareTypes.js.map +0 -1
- package/dist/constants/index.js.map +0 -1
- package/dist/constants/rx2SpreadFactors.js.map +0 -1
- package/dist/utils/header.js.map +0 -1
- package/dist/utils/message.js.map +0 -1
- /package/dist/{constants → analog/constants}/directions.d.ts +0 -0
- /package/dist/{constants → analog/constants}/directions.js +0 -0
- /package/dist/{constants → analog/constants}/index.d.ts +0 -0
- /package/dist/{constants → analog/constants}/index.js +0 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { IHexFormatOptions } from '../config.js';
|
|
2
|
+
export interface ICommandExample {
|
|
3
|
+
name: string;
|
|
4
|
+
parameters?: object;
|
|
5
|
+
config?: {
|
|
6
|
+
hardwareType?: number;
|
|
7
|
+
};
|
|
8
|
+
hex: {
|
|
9
|
+
header: string;
|
|
10
|
+
body: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export type TCommandExampleList = Array<ICommandExample>;
|
|
14
|
+
declare abstract class Command {
|
|
15
|
+
static id: number;
|
|
16
|
+
static directionType: unknown;
|
|
17
|
+
static title: string;
|
|
18
|
+
static examples: TCommandExampleList;
|
|
19
|
+
static hasParameters: boolean;
|
|
20
|
+
parameters: unknown;
|
|
21
|
+
config: unknown;
|
|
22
|
+
static getId(): string;
|
|
23
|
+
static toBytes(id: number, commandData?: Uint8Array): Uint8Array;
|
|
24
|
+
getParameters(): unknown;
|
|
25
|
+
toBytes(): Uint8Array;
|
|
26
|
+
toHex(options?: IHexFormatOptions): string;
|
|
27
|
+
toJson(): string;
|
|
28
|
+
}
|
|
29
|
+
export default Command;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as header from './header.js';
|
|
2
|
+
import getHexFromBytes from '../utils/getHexFromBytes.js';
|
|
3
|
+
import getHexFromNumber from '../utils/getHexFromNumber.js';
|
|
4
|
+
class Command {
|
|
5
|
+
static getId() {
|
|
6
|
+
return getHexFromNumber(this.id);
|
|
7
|
+
}
|
|
8
|
+
static toBytes(id, commandData) {
|
|
9
|
+
const commandLength = commandData?.length ?? 0;
|
|
10
|
+
const headerData = header.toBytes(id, commandLength);
|
|
11
|
+
if (commandData && commandLength) {
|
|
12
|
+
const resultData = new Uint8Array(headerData.length + commandLength);
|
|
13
|
+
resultData.set(headerData);
|
|
14
|
+
resultData.set(commandData, headerData.length);
|
|
15
|
+
return resultData;
|
|
16
|
+
}
|
|
17
|
+
return headerData;
|
|
18
|
+
}
|
|
19
|
+
getParameters() {
|
|
20
|
+
return this.parameters;
|
|
21
|
+
}
|
|
22
|
+
toBytes() {
|
|
23
|
+
throw new Error('not implemented!');
|
|
24
|
+
}
|
|
25
|
+
toHex(options = {}) {
|
|
26
|
+
return getHexFromBytes(this.toBytes(), options);
|
|
27
|
+
}
|
|
28
|
+
toJson() {
|
|
29
|
+
return JSON.stringify(this.getParameters());
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
Command.hasParameters = false;
|
|
33
|
+
export default Command;
|
|
34
|
+
//# sourceMappingURL=Command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Command.js","sourceRoot":"","sources":["../../src/analog/Command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAqB5D,MAAe,OAAO;IAoBlB,MAAM,CAAC,KAAK;QACR,OAAO,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;IA+CD,MAAM,CAAC,OAAO,CAAG,EAAU,EAAE,WAAwB;QACjD,MAAM,aAAa,GAAG,WAAW,EAAE,MAAM,IAAI,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;QAErD,IAAK,WAAW,IAAI,aAAa,EAAG;YAChC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC;YAErE,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC3B,UAAU,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;YAE/C,OAAO,UAAU,CAAC;SACrB;QAGD,OAAO,UAAU,CAAC;IACtB,CAAC;IAGD,aAAa;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAGD,OAAO;QACH,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAG,UAA6B,EAAE;QACnC,OAAO,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;IAOD,MAAM;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IAChD,CAAC;;AAlGM,qBAAa,GAAG,KAAK,CAAC;AAsGjC,eAAe,OAAO,CAAC"}
|
|
@@ -1,299 +1,129 @@
|
|
|
1
|
-
import BinaryBuffer from '
|
|
2
|
-
import { TTime2000 } from '
|
|
1
|
+
import BinaryBuffer from '../utils/BinaryBuffer.js';
|
|
2
|
+
import { TTime2000 } from '../utils/time.js';
|
|
3
3
|
export interface IBatteryVoltage {
|
|
4
|
-
/**
|
|
5
|
-
* battery voltage value at low consumption, in mV
|
|
6
|
-
*
|
|
7
|
-
* `4095` - unknown value and becomes `undefined`
|
|
8
|
-
*/
|
|
9
4
|
low: number | undefined;
|
|
10
|
-
/**
|
|
11
|
-
* battery voltage value at hight consumption, in mV
|
|
12
|
-
*
|
|
13
|
-
* `4095` - unknown value and becomes `undefined`
|
|
14
|
-
*/
|
|
15
5
|
high: number | undefined;
|
|
16
6
|
}
|
|
17
7
|
export interface IChannel {
|
|
18
|
-
/** channel number */
|
|
19
8
|
index: number;
|
|
20
9
|
}
|
|
21
10
|
export interface IChannelValue extends IChannel {
|
|
22
|
-
/** pulse counter or absolute value of device channel */
|
|
23
11
|
value: number;
|
|
24
12
|
}
|
|
25
13
|
export interface IChannelHours extends IChannelValue {
|
|
26
|
-
/** values differences between hours */
|
|
27
14
|
diff: Array<number>;
|
|
28
15
|
}
|
|
29
16
|
export interface IChannelHourAbsoluteValue extends IChannelHours {
|
|
30
|
-
/** channel pulse coefficient */
|
|
31
17
|
pulseCoefficient: number;
|
|
32
18
|
}
|
|
33
19
|
export interface IChannelDays extends IChannel {
|
|
34
20
|
dayList: Array<number>;
|
|
35
21
|
}
|
|
36
22
|
export interface IChannelAbsoluteValue extends IChannelValue {
|
|
37
|
-
/** channel pulse coefficient */
|
|
38
23
|
pulseCoefficient: number;
|
|
39
24
|
}
|
|
40
25
|
export interface IChannelArchiveDaysAbsolute extends IChannel {
|
|
41
|
-
/** values by days */
|
|
42
26
|
dayList: Array<number>;
|
|
43
|
-
/** Channel pulse coefficient */
|
|
44
27
|
pulseCoefficient: number;
|
|
45
28
|
}
|
|
46
29
|
export interface IChannelArchiveDays extends IChannel {
|
|
47
|
-
/** values by days */
|
|
48
30
|
dayList: Array<number>;
|
|
49
31
|
}
|
|
50
32
|
export interface IEventGasStatus {
|
|
51
|
-
/** the battery voltage has dropped below the set threshold */
|
|
52
33
|
isBatteryLow?: boolean;
|
|
53
|
-
/** there is a magnetic field influence */
|
|
54
34
|
isMagneticInfluence?: boolean;
|
|
55
|
-
/** button is release (device is unmounted) */
|
|
56
35
|
isButtonReleased?: boolean;
|
|
57
|
-
/** the device has detected a loss of connection to the server */
|
|
58
36
|
isConnectionLost?: boolean;
|
|
59
37
|
}
|
|
60
38
|
export interface IEvent2ChannelStatus {
|
|
61
|
-
/** the battery voltage has dropped below the set threshold */
|
|
62
39
|
isBatteryLow?: boolean;
|
|
63
|
-
/** the device has detected a loss of connection to the server */
|
|
64
40
|
isConnectionLost?: boolean;
|
|
65
|
-
/** the first channel is not active */
|
|
66
41
|
isFirstChannelInactive?: boolean;
|
|
67
|
-
/** the second channel is not active */
|
|
68
42
|
isSecondChannelInactive?: boolean;
|
|
69
43
|
}
|
|
70
44
|
export interface IEventElimpStatus {
|
|
71
|
-
/** the device has detected a loss of connection to the server */
|
|
72
45
|
isConnectionLost?: boolean;
|
|
73
46
|
}
|
|
74
47
|
export interface IEvent4ChannelStatus {
|
|
75
|
-
/** the battery voltage has dropped below the set threshold */
|
|
76
48
|
isBatteryLow?: boolean;
|
|
77
|
-
/** the device has detected a loss of connection to the server */
|
|
78
49
|
isConnectionLost?: boolean;
|
|
79
|
-
/** the first channel is not active */
|
|
80
50
|
isFirstChannelInactive?: boolean;
|
|
81
|
-
/** the second channel is not active */
|
|
82
51
|
isSecondChannelInactive?: boolean;
|
|
83
|
-
/** the third channel is not active */
|
|
84
52
|
isThirdChannelInactive?: boolean;
|
|
85
|
-
/** the forth channel is not active */
|
|
86
53
|
isForthChannelInactive?: boolean;
|
|
87
54
|
}
|
|
88
55
|
export interface IEventMtxStatus {
|
|
89
|
-
/** meter case is open */
|
|
90
56
|
isMeterCaseOpen?: boolean;
|
|
91
|
-
/** there is a magnetic field influence */
|
|
92
57
|
isMagneticInfluence?: boolean;
|
|
93
|
-
/** parameters set remotely */
|
|
94
58
|
isParametersSetRemotely?: boolean;
|
|
95
|
-
/** parameters set locally */
|
|
96
59
|
isParametersSetLocally?: boolean;
|
|
97
|
-
/** meter program restart */
|
|
98
60
|
isMeterProgramRestarted?: boolean;
|
|
99
|
-
/** incorrect password and lockout */
|
|
100
61
|
isLockedOut?: boolean;
|
|
101
|
-
/** time set */
|
|
102
62
|
isTimeSet?: boolean;
|
|
103
|
-
/** time correction */
|
|
104
63
|
isTimeCorrected?: boolean;
|
|
105
|
-
/** meter failure */
|
|
106
64
|
isMeterFailure?: boolean;
|
|
107
|
-
/** meter terminal box is open */
|
|
108
65
|
isMeterTerminalBoxOpen?: boolean;
|
|
109
|
-
/** meter module compartment is open */
|
|
110
66
|
isModuleCompartmentOpen?: boolean;
|
|
111
|
-
/** tariff plan changed */
|
|
112
67
|
isTariffPlanChanged?: boolean;
|
|
113
|
-
/** new tariff plan received */
|
|
114
68
|
isNewTariffPlanReceived?: boolean;
|
|
115
69
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Device send data periodically using this interval.
|
|
118
|
-
* deviceParameters.REPORTING_DATA_INTERVAL = `1`.
|
|
119
|
-
*/
|
|
120
70
|
interface IParameterReportingDataInterval {
|
|
121
|
-
/**
|
|
122
|
-
* Minimal interval for data sending from device (in seconds).
|
|
123
|
-
* Real value = value + pseudo-random value which is not more than `255` * `4`.
|
|
124
|
-
*/
|
|
125
71
|
value: number;
|
|
126
72
|
}
|
|
127
|
-
/**
|
|
128
|
-
* The parameter defines the hour of the day by which the daily consumption is calculated.
|
|
129
|
-
* deviceParameters.DAY_CHECKOUT_HOUR = `4`.
|
|
130
|
-
*/
|
|
131
73
|
interface IParameterDayCheckoutHour {
|
|
132
74
|
value: number;
|
|
133
75
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Type of data from device.
|
|
136
|
-
* deviceParameters.REPORTING_DATA_TYPE = `5`.
|
|
137
|
-
*/
|
|
138
76
|
interface IParameterReportingDataType {
|
|
139
|
-
/**
|
|
140
|
-
* `0` - hour, by default
|
|
141
|
-
* `1` - day
|
|
142
|
-
* `2` - current
|
|
143
|
-
* `3` - hour + day
|
|
144
|
-
*/
|
|
145
77
|
type: number;
|
|
146
78
|
}
|
|
147
|
-
/**
|
|
148
|
-
* Delivery type of priority data, with or without acknowledgment.
|
|
149
|
-
* Priority data - frames from uplink/NewEvent command.
|
|
150
|
-
* deviceParameters.PRIORITY_DATA_DELIVERY_TYPE = `8`.
|
|
151
|
-
*/
|
|
152
79
|
interface IParameterDeliveryTypeOfPriorityData {
|
|
153
|
-
/**
|
|
154
|
-
* `0` - delivery with confirmation
|
|
155
|
-
* `1` - delivery without confirmation
|
|
156
|
-
*/
|
|
157
80
|
value: number;
|
|
158
81
|
}
|
|
159
|
-
/**
|
|
160
|
-
* Device activation method in LoRaWAN network.
|
|
161
|
-
* deviceParameters.ACTIVATION_METHOD = `9`.
|
|
162
|
-
*/
|
|
163
82
|
interface IParameterActivationMethod {
|
|
164
|
-
/**
|
|
165
|
-
* `0` - OTAA, by default
|
|
166
|
-
* `1` - ABP
|
|
167
|
-
*
|
|
168
|
-
* @see https://www.thethingsindustries.com/docs/devices/abp-vs-otaa/
|
|
169
|
-
*/
|
|
170
83
|
type: number;
|
|
171
84
|
}
|
|
172
|
-
/**
|
|
173
|
-
* Channels config, only for universal 4-channels devices
|
|
174
|
-
* deviceParameters.CHANNELS_CONFIG = `13`.
|
|
175
|
-
*/
|
|
176
85
|
interface IParameterChannelsConfig {
|
|
177
|
-
/**
|
|
178
|
-
* value from 0 to 18, [values description](https://github.com/jooby-dev/jooby-docs/blob/main/docs/parameter-types.md#channels-config)
|
|
179
|
-
*/
|
|
180
86
|
value: number;
|
|
181
87
|
}
|
|
182
|
-
/**
|
|
183
|
-
* RX2 configuration.
|
|
184
|
-
* deviceParameters.RX2_CONFIG = `18`.
|
|
185
|
-
*
|
|
186
|
-
* @see https://www.thethingsindustries.com/docs/reference/glossary/
|
|
187
|
-
*/
|
|
188
88
|
interface IParameterRx2Config {
|
|
189
|
-
/**
|
|
190
|
-
* The transmission speed or Data Rate of a LoRaWAN message, ranging from `SF7` (highest Data Rate) to `SF12` (lowest Data Rate).
|
|
191
|
-
* Making the spreading factor `1` step lower (from `SF10` to `SF9`) allows you to roughly send the same amount of data use half the time on air.
|
|
192
|
-
* Lowering the spreading factor makes it more difficult for the gateway to receive a transmission, as it will be more sensitive to noise.
|
|
193
|
-
*
|
|
194
|
-
* @see https://www.thethingsnetwork.org/docs/lorawan/spreading-factors/
|
|
195
|
-
*/
|
|
196
89
|
spreadFactor: number;
|
|
197
|
-
/**
|
|
198
|
-
* RX2 data rate frequency.
|
|
199
|
-
* The second receive window (RX2) uses a fixed frequency and data rate.
|
|
200
|
-
* This value configures the frequency to use in RX2.
|
|
201
|
-
* Changing the desired value makes the Network Server transmit the RXParamSetupReq MAC command.
|
|
202
|
-
*/
|
|
203
90
|
frequency: number;
|
|
204
91
|
}
|
|
205
|
-
/**
|
|
206
|
-
* Device battery depassivation information.
|
|
207
|
-
* deviceParameters.BATTERY_DEPASSIVATION_INFO = `10`.
|
|
208
|
-
*/
|
|
209
92
|
interface IParameterBatteryDepassivationInfo {
|
|
210
|
-
/** battery load time in milliseconds */
|
|
211
93
|
loadTime: number;
|
|
212
|
-
/** battery internal resistance, in mΩ */
|
|
213
94
|
internalResistance: number;
|
|
214
|
-
/** battery low voltage, in mV */
|
|
215
95
|
lowVoltage: number;
|
|
216
96
|
}
|
|
217
|
-
/**
|
|
218
|
-
* Device battery minimum required battery load time per day to prevent passivation.
|
|
219
|
-
* deviceParameters.BATTERY_MINIMAL_LOAD_TIME = `11`.
|
|
220
|
-
*/
|
|
221
97
|
interface IParameterBatteryMinimalLoadTime {
|
|
222
98
|
value: number;
|
|
223
99
|
}
|
|
224
|
-
/**
|
|
225
|
-
* Absolute data for pulse devices.
|
|
226
|
-
* deviceParameters.ABSOLUTE_DATA = `23`.
|
|
227
|
-
*/
|
|
228
100
|
interface IParameterAbsoluteData {
|
|
229
|
-
/** 4 byte int BE */
|
|
230
101
|
value: number;
|
|
231
|
-
/** 4 byte int BE */
|
|
232
102
|
meterValue: number;
|
|
233
103
|
pulseCoefficient: number;
|
|
234
104
|
}
|
|
235
|
-
/**
|
|
236
|
-
* Data type sending from device - absolute or not.
|
|
237
|
-
* deviceParameters.ABSOLUTE_DATA_ENABLE = `24`
|
|
238
|
-
*/
|
|
239
105
|
interface IParameterAbsoluteDataEnable {
|
|
240
|
-
/**
|
|
241
|
-
* `1` - absolute data enabled
|
|
242
|
-
* `0` - absolute data disabled, device send pulse counter
|
|
243
|
-
*/
|
|
244
106
|
state: number;
|
|
245
107
|
}
|
|
246
|
-
/**
|
|
247
|
-
* Device serial number.
|
|
248
|
-
* deviceParameters.SERIAL_NUMBER = `25`
|
|
249
|
-
*/
|
|
250
108
|
interface IParameterSerialNumber {
|
|
251
|
-
/**
|
|
252
|
-
* hex string, 6 bytes
|
|
253
|
-
*/
|
|
254
109
|
value: string;
|
|
255
110
|
}
|
|
256
|
-
/**
|
|
257
|
-
* Device geolocation.
|
|
258
|
-
* deviceParameters.GEOLOCATION = `26`
|
|
259
|
-
*/
|
|
260
111
|
interface IParameterGeolocation {
|
|
261
112
|
latitude: number;
|
|
262
113
|
longitude: number;
|
|
263
114
|
altitude: number;
|
|
264
115
|
}
|
|
265
|
-
/**
|
|
266
|
-
* Absolute data for multi-channel devices.
|
|
267
|
-
* deviceParameters.ABSOLUTE_DATA_MULTI_CHANNEL = `29`.
|
|
268
|
-
*/
|
|
269
116
|
interface IParameterAbsoluteDataMC extends IParameterAbsoluteData {
|
|
270
|
-
/** set data for specific channel */
|
|
271
117
|
channel: number;
|
|
272
118
|
}
|
|
273
|
-
/**
|
|
274
|
-
* Data type sending from device - absolute or not, multi-channel devices.
|
|
275
|
-
* deviceParameters.ABSOLUTE_DATA_STATUS_MULTI_CHANNEL = `30`
|
|
276
|
-
*/
|
|
277
119
|
interface IParameterAbsoluteDataEnableMC extends IParameterAbsoluteDataEnable {
|
|
278
|
-
/** channel that accept status changing */
|
|
279
120
|
channel: number;
|
|
280
121
|
}
|
|
281
|
-
/**
|
|
282
|
-
* Channels scan config for pulse devices.
|
|
283
|
-
* deviceParameters.PULSE_CHANNELS_SCAN_CONFIG = `31`
|
|
284
|
-
*/
|
|
285
122
|
interface IParameterPulseChannelsScanConfig {
|
|
286
|
-
/** channels to set configuration */
|
|
287
123
|
channelList: Array<number>;
|
|
288
|
-
/** channel pull up time in microseconds */
|
|
289
124
|
pullUpTime: number;
|
|
290
|
-
/** channel scan time in microseconds */
|
|
291
125
|
scanTime: number;
|
|
292
126
|
}
|
|
293
|
-
/**
|
|
294
|
-
* Set channels for pulse devices.
|
|
295
|
-
* deviceParameters.PULSE_CHANNELS_SET_CONFIG = `32`
|
|
296
|
-
*/
|
|
297
127
|
interface IParameterPulseChannelsSetConfig {
|
|
298
128
|
channel1: boolean;
|
|
299
129
|
channel2: boolean;
|
|
@@ -306,22 +136,7 @@ export interface IParameter {
|
|
|
306
136
|
}
|
|
307
137
|
export type TEventStatus = IEventGasStatus | IEvent2ChannelStatus | IEventElimpStatus | IEvent4ChannelStatus | IEventMtxStatus;
|
|
308
138
|
type TParameterData = IParameterReportingDataInterval | IParameterReportingDataType | IParameterDayCheckoutHour | IParameterDeliveryTypeOfPriorityData | IParameterActivationMethod | IParameterBatteryDepassivationInfo | IParameterBatteryMinimalLoadTime | IParameterChannelsConfig | IParameterRx2Config | IParameterAbsoluteData | IParameterAbsoluteDataEnable | IParameterSerialNumber | IParameterGeolocation | IParameterAbsoluteDataMC | IParameterAbsoluteDataEnableMC | IParameterPulseChannelsScanConfig | IParameterPulseChannelsSetConfig;
|
|
309
|
-
/**
|
|
310
|
-
* Command specific byte array manipulation.
|
|
311
|
-
*/
|
|
312
139
|
declare class CommandBinaryBuffer extends BinaryBuffer {
|
|
313
|
-
/**
|
|
314
|
-
* Get the number of bytes necessary to store an extended value.
|
|
315
|
-
*
|
|
316
|
-
* @param bits - the number of bits of original value
|
|
317
|
-
*
|
|
318
|
-
* @example
|
|
319
|
-
* ```js
|
|
320
|
-
* const bits = (16384).toString(2).length;
|
|
321
|
-
* const bytes = CommandBinaryBuffer.getExtendedValueSize(bits);
|
|
322
|
-
* // 16384 normally is stored in 2 bytes but for extended value 3 bytes are required
|
|
323
|
-
* ```
|
|
324
|
-
*/
|
|
325
140
|
static getExtendedValueSize(bits: number): number;
|
|
326
141
|
static getParameterSize(parameter: IParameter): number;
|
|
327
142
|
setInt12(value: number, isLittleEndian?: boolean): void;
|
|
@@ -330,34 +145,10 @@ declare class CommandBinaryBuffer extends BinaryBuffer {
|
|
|
330
145
|
getUint12(isLittleEndian?: boolean): number;
|
|
331
146
|
getExtendedValue(): number;
|
|
332
147
|
setExtendedValue(value: number): void;
|
|
333
|
-
/**
|
|
334
|
-
* Get array of channel indexes.
|
|
335
|
-
*/
|
|
336
148
|
getChannels(): Array<number>;
|
|
337
|
-
/**
|
|
338
|
-
* Set array of channel indexes.
|
|
339
|
-
*/
|
|
340
149
|
setChannels(channelList: Array<IChannel>): void;
|
|
341
|
-
/**
|
|
342
|
-
* Retrieve device time from byte array.
|
|
343
|
-
*
|
|
344
|
-
* @example
|
|
345
|
-
* ['00101111', '10010111'] -> [47, 151] will be '2023-12-23'
|
|
346
|
-
*
|
|
347
|
-
* @returns Date object instance
|
|
348
|
-
*/
|
|
349
150
|
getDate(): Date;
|
|
350
|
-
/**
|
|
351
|
-
* Convert date or seconds to bytes.
|
|
352
|
-
* '2023-12-23' will be 0010111-1100-10111, so bytes: ['00101111', '10010111'] -> [47, 151]
|
|
353
|
-
*/
|
|
354
151
|
setDate(dateOrTime: Date | TTime2000): void;
|
|
355
|
-
/**
|
|
356
|
-
* Retrieve device time from byte array.
|
|
357
|
-
*
|
|
358
|
-
* @example
|
|
359
|
-
* 0xb8 = 0b10111000 will be {hours: 0b101, hour: 0b11000} i.e. {hours: 5, hour: 24}
|
|
360
|
-
*/
|
|
361
152
|
getHours(): {
|
|
362
153
|
hours: number;
|
|
363
154
|
hour: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import BinaryBuffer from '
|
|
2
|
-
import * as bitSet from '
|
|
3
|
-
import { getDateFromSeconds, getSecondsFromDate } from '
|
|
4
|
-
import getHexFromBytes from '
|
|
5
|
-
import getBytesFromHex from '
|
|
6
|
-
import roundNumber from '
|
|
1
|
+
import BinaryBuffer from '../utils/BinaryBuffer.js';
|
|
2
|
+
import * as bitSet from '../utils/bitSet.js';
|
|
3
|
+
import { getDateFromSeconds, getSecondsFromDate } from '../utils/time.js';
|
|
4
|
+
import getHexFromBytes from '../utils/getHexFromBytes.js';
|
|
5
|
+
import getBytesFromHex from '../utils/getBytesFromHex.js';
|
|
6
|
+
import roundNumber from '../utils/roundNumber.js';
|
|
7
7
|
import * as hardwareTypes from './constants/hardwareTypes.js';
|
|
8
8
|
import * as deviceParameters from './constants/deviceParameters.js';
|
|
9
9
|
const INITIAL_YEAR = 2000;
|
|
@@ -14,7 +14,6 @@ const UNKNOWN_BATTERY_VOLTAGE = 4095;
|
|
|
14
14
|
const EXTEND_BIT_MASK = 0x80;
|
|
15
15
|
const LAST_BIT_INDEX = 7;
|
|
16
16
|
const DATA_SENDING_INTERVAL_SECONDS_COEFFICIENT = 600;
|
|
17
|
-
/** 'reserved' bytes which not used */
|
|
18
17
|
const DATA_SENDING_INTERVAL_RESERVED_BYTES = 3;
|
|
19
18
|
const PARAMETER_RX2_FREQUENCY_COEFFICIENT = 100;
|
|
20
19
|
const INT12_SIZE = 3;
|
|
@@ -34,9 +33,6 @@ const TWO_CHANNELS_HARDWARE_TYPES = [
|
|
|
34
33
|
const ELIMP_HARDWARE_TYPES = [
|
|
35
34
|
hardwareTypes.ELIMP
|
|
36
35
|
];
|
|
37
|
-
// const WATER_HARDWARE_TYPES = [
|
|
38
|
-
// hardwareTypes.WATER
|
|
39
|
-
// ];
|
|
40
36
|
const FOUR_CHANNELS_HARDWARE_TYPES = [
|
|
41
37
|
hardwareTypes.IMP4EU,
|
|
42
38
|
hardwareTypes.IMP4IN
|
|
@@ -60,10 +56,6 @@ const twoChannelBitMask = {
|
|
|
60
56
|
const elimpBitMask = {
|
|
61
57
|
isConnectionLost: 2 ** 3
|
|
62
58
|
};
|
|
63
|
-
// const waterBitMask = {
|
|
64
|
-
// isBatteryLow: 2 ** 0,
|
|
65
|
-
// isConnectionLost: 2 ** 3
|
|
66
|
-
// };
|
|
67
59
|
const fourChannelBitMask = {
|
|
68
60
|
isBatteryLow: 2 ** 0,
|
|
69
61
|
isConnectionLost: 2 ** 3,
|
|
@@ -87,11 +79,7 @@ const mtxBitMask = {
|
|
|
87
79
|
isTariffPlanChanged: 2 ** 11,
|
|
88
80
|
isNewTariffPlanReceived: 2 ** 12
|
|
89
81
|
};
|
|
90
|
-
/**
|
|
91
|
-
* device parameter data size + byte for parameter id
|
|
92
|
-
*/
|
|
93
82
|
const parametersSizeMap = new Map([
|
|
94
|
-
/* size: 1 byte of parameter id + parameter data*/
|
|
95
83
|
[deviceParameters.REPORTING_DATA_INTERVAL, 1 + 4],
|
|
96
84
|
[deviceParameters.DAY_CHECKOUT_HOUR, 1 + 1],
|
|
97
85
|
[deviceParameters.REPORTING_DATA_TYPE, 1 + 1],
|
|
@@ -128,22 +116,7 @@ const byteToPulseCoefficientMap = new Map([
|
|
|
128
116
|
]);
|
|
129
117
|
const pulseCoefficientToByteMap = new Map([...byteToPulseCoefficientMap.entries()].map(([key, value]) => [value, key]));
|
|
130
118
|
const isMSBSet = (value) => !!(value & 0x80);
|
|
131
|
-
/**
|
|
132
|
-
* Command specific byte array manipulation.
|
|
133
|
-
*/
|
|
134
119
|
class CommandBinaryBuffer extends BinaryBuffer {
|
|
135
|
-
/**
|
|
136
|
-
* Get the number of bytes necessary to store an extended value.
|
|
137
|
-
*
|
|
138
|
-
* @param bits - the number of bits of original value
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* ```js
|
|
142
|
-
* const bits = (16384).toString(2).length;
|
|
143
|
-
* const bytes = CommandBinaryBuffer.getExtendedValueSize(bits);
|
|
144
|
-
* // 16384 normally is stored in 2 bytes but for extended value 3 bytes are required
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
120
|
static getExtendedValueSize(bits) {
|
|
148
121
|
const extBits = Math.ceil(bits / 7);
|
|
149
122
|
const totalBits = bits + extBits;
|
|
@@ -159,7 +132,6 @@ class CommandBinaryBuffer extends BinaryBuffer {
|
|
|
159
132
|
}
|
|
160
133
|
setInt12(value, isLittleEndian = this.isLittleEndian) {
|
|
161
134
|
const view = new DataView(this.data, this.offset, INT12_SIZE);
|
|
162
|
-
// set first byte as signed value
|
|
163
135
|
if (isLittleEndian) {
|
|
164
136
|
view.setInt8(2, (value >> 16) & 0xFF);
|
|
165
137
|
view.setUint8(1, (value >> 8) & 0xFF);
|
|
@@ -189,7 +161,6 @@ class CommandBinaryBuffer extends BinaryBuffer {
|
|
|
189
161
|
byte2 = view.getUint8(2);
|
|
190
162
|
}
|
|
191
163
|
const value = (byte0 << 16) | (byte1 << 8) | byte2;
|
|
192
|
-
// setup sign if value negative
|
|
193
164
|
if (byte0 & 0x80) {
|
|
194
165
|
return value - (1 << 24);
|
|
195
166
|
}
|
|
@@ -223,7 +194,6 @@ class CommandBinaryBuffer extends BinaryBuffer {
|
|
|
223
194
|
getExtendedValue() {
|
|
224
195
|
let value = 0;
|
|
225
196
|
let isByteExtended = true;
|
|
226
|
-
// byte offset
|
|
227
197
|
let position = 0;
|
|
228
198
|
while (isByteExtended && this.offset <= this.data.byteLength) {
|
|
229
199
|
const byte = this.getUint8();
|
|
@@ -246,28 +216,20 @@ class CommandBinaryBuffer extends BinaryBuffer {
|
|
|
246
216
|
}
|
|
247
217
|
const lastByte = data.pop();
|
|
248
218
|
if (lastByte) {
|
|
249
|
-
// clear EXTENDED bit flag for last value
|
|
250
219
|
data.push(lastByte & 0x7f);
|
|
251
220
|
}
|
|
252
221
|
data.forEach(extendedValue => this.setUint8(extendedValue));
|
|
253
222
|
}
|
|
254
|
-
/**
|
|
255
|
-
* Get array of channel indexes.
|
|
256
|
-
*/
|
|
257
223
|
getChannels() {
|
|
258
224
|
const channelList = [];
|
|
259
225
|
let extended = true;
|
|
260
226
|
let channelIndex = 1;
|
|
261
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
262
227
|
while (extended) {
|
|
263
228
|
const byte = this.getUint8();
|
|
264
|
-
// original 0b00000001, reverse it to get first - `1`
|
|
265
229
|
const bits = byte.toString(2).padStart(LAST_BIT_INDEX + 1, '0').split('').reverse();
|
|
266
|
-
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
|
267
230
|
bits.forEach((bit, index) => {
|
|
268
231
|
const value = Number(bit);
|
|
269
232
|
if (index === LAST_BIT_INDEX) {
|
|
270
|
-
// highest bit in byte
|
|
271
233
|
extended = !!value;
|
|
272
234
|
}
|
|
273
235
|
else {
|
|
@@ -280,31 +242,22 @@ class CommandBinaryBuffer extends BinaryBuffer {
|
|
|
280
242
|
}
|
|
281
243
|
return channelList;
|
|
282
244
|
}
|
|
283
|
-
/**
|
|
284
|
-
* Set array of channel indexes.
|
|
285
|
-
*/
|
|
286
245
|
setChannels(channelList) {
|
|
287
|
-
// sort channels by index
|
|
288
246
|
channelList.sort((a, b) => a.index - b.index);
|
|
289
|
-
// find max channel index from 0 to detect the number of bytes
|
|
290
247
|
const maxChannel = Math.max(...channelList.map(({ index }) => index));
|
|
291
248
|
const size = (maxChannel - (maxChannel % 8)) / 8;
|
|
292
249
|
const data = new Array(size + 1).fill(0);
|
|
293
250
|
let byte = 0;
|
|
294
251
|
data.forEach((_, byteIndex) => {
|
|
295
|
-
// max channel index in one byte - 6
|
|
296
252
|
let channelIndex = (byteIndex * LAST_BIT_INDEX) + 1;
|
|
297
253
|
const maxChannelIndex = channelIndex + LAST_BIT_INDEX;
|
|
298
254
|
while (channelIndex < maxChannelIndex) {
|
|
299
|
-
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
|
300
255
|
const channel = channelList.find((item => item.index === channelIndex));
|
|
301
256
|
if (channel !== undefined) {
|
|
302
|
-
// set channel bit
|
|
303
257
|
byte |= 1 << ((channel.index - 1) % LAST_BIT_INDEX);
|
|
304
258
|
}
|
|
305
259
|
++channelIndex;
|
|
306
260
|
}
|
|
307
|
-
// set extended bit if next byte exist
|
|
308
261
|
if (data[byteIndex + 1] !== undefined) {
|
|
309
262
|
byte |= 1 << LAST_BIT_INDEX;
|
|
310
263
|
}
|
|
@@ -313,14 +266,6 @@ class CommandBinaryBuffer extends BinaryBuffer {
|
|
|
313
266
|
});
|
|
314
267
|
data.forEach((value) => this.setUint8(value));
|
|
315
268
|
}
|
|
316
|
-
/**
|
|
317
|
-
* Retrieve device time from byte array.
|
|
318
|
-
*
|
|
319
|
-
* @example
|
|
320
|
-
* ['00101111', '10010111'] -> [47, 151] will be '2023-12-23'
|
|
321
|
-
*
|
|
322
|
-
* @returns Date object instance
|
|
323
|
-
*/
|
|
324
269
|
getDate() {
|
|
325
270
|
const yearMonthByte = this.getUint8();
|
|
326
271
|
const monthDateByte = this.getUint8();
|
|
@@ -329,10 +274,6 @@ class CommandBinaryBuffer extends BinaryBuffer {
|
|
|
329
274
|
const monthDay = monthDateByte & 0x1f;
|
|
330
275
|
return new Date(Date.UTC(year + INITIAL_YEAR, month - 1, monthDay, 0, 0, 0, 0));
|
|
331
276
|
}
|
|
332
|
-
/**
|
|
333
|
-
* Convert date or seconds to bytes.
|
|
334
|
-
* '2023-12-23' will be 0010111-1100-10111, so bytes: ['00101111', '10010111'] -> [47, 151]
|
|
335
|
-
*/
|
|
336
277
|
setDate(dateOrTime) {
|
|
337
278
|
let date;
|
|
338
279
|
if (dateOrTime instanceof Date) {
|
|
@@ -344,28 +285,19 @@ class CommandBinaryBuffer extends BinaryBuffer {
|
|
|
344
285
|
const year = date.getUTCFullYear() - INITIAL_YEAR;
|
|
345
286
|
const month = date.getUTCMonth() + 1;
|
|
346
287
|
const day = date.getUTCDate();
|
|
347
|
-
// create year and month bytes
|
|
348
288
|
const yearMonthByte = (year << YEAR_START_INDEX) | (month >> MONTH_BIT_SIZE - YEAR_START_INDEX);
|
|
349
289
|
const monthDateByte = ((month & 0x07) << DATE_BIT_SIZE) | day;
|
|
350
290
|
[yearMonthByte, monthDateByte].forEach(byte => this.setUint8(byte));
|
|
351
291
|
}
|
|
352
|
-
/**
|
|
353
|
-
* Retrieve device time from byte array.
|
|
354
|
-
*
|
|
355
|
-
* @example
|
|
356
|
-
* 0xb8 = 0b10111000 will be {hours: 0b101, hour: 0b11000} i.e. {hours: 5, hour: 24}
|
|
357
|
-
*/
|
|
358
292
|
getHours() {
|
|
359
293
|
const byte = this.getUint8();
|
|
360
294
|
let hours = (byte & 0xe0) >> 5;
|
|
361
295
|
const hour = byte & 0x1f;
|
|
362
|
-
// TODO: add link to doc
|
|
363
296
|
hours = hours === 0 ? 1 : hours;
|
|
364
297
|
return { hours, hour };
|
|
365
298
|
}
|
|
366
299
|
setHours(hour, hours) {
|
|
367
300
|
let hourAmount = hours;
|
|
368
|
-
// TODO: add link to doc
|
|
369
301
|
if (hourAmount === 1) {
|
|
370
302
|
hourAmount = 0;
|
|
371
303
|
}
|
|
@@ -415,7 +347,6 @@ class CommandBinaryBuffer extends BinaryBuffer {
|
|
|
415
347
|
date.setUTCHours(hour);
|
|
416
348
|
channels.forEach(channelIndex => {
|
|
417
349
|
const diff = [];
|
|
418
|
-
// decode hour value for channel
|
|
419
350
|
const value = this.getExtendedValue();
|
|
420
351
|
for (let diffHour = 0; diffHour < hours; ++diffHour) {
|
|
421
352
|
diff.push(this.getExtendedValue());
|
|
@@ -445,7 +376,6 @@ class CommandBinaryBuffer extends BinaryBuffer {
|
|
|
445
376
|
channels.forEach(channelIndex => {
|
|
446
377
|
channelList.push({
|
|
447
378
|
pulseCoefficient: this.getPulseCoefficient(),
|
|
448
|
-
// day value
|
|
449
379
|
value: this.getExtendedValue(),
|
|
450
380
|
index: channelIndex
|
|
451
381
|
});
|
|
@@ -472,8 +402,6 @@ class CommandBinaryBuffer extends BinaryBuffer {
|
|
|
472
402
|
}
|
|
473
403
|
else if (ELIMP_HARDWARE_TYPES.includes(hardwareType)) {
|
|
474
404
|
status = bitSet.toObject(elimpBitMask, this.getUint8());
|
|
475
|
-
// } else if ( WATER_HARDWARE_TYPES.includes(hardwareType) ) {
|
|
476
|
-
// status = bitSet.toObject(waterBitMask, this.getUint8());
|
|
477
405
|
}
|
|
478
406
|
else if (FOUR_CHANNELS_HARDWARE_TYPES.includes(hardwareType)) {
|
|
479
407
|
status = bitSet.toObject(fourChannelBitMask, this.getExtendedValue());
|
|
@@ -495,8 +423,6 @@ class CommandBinaryBuffer extends BinaryBuffer {
|
|
|
495
423
|
}
|
|
496
424
|
else if (ELIMP_HARDWARE_TYPES.includes(hardwareType)) {
|
|
497
425
|
this.setUint8(bitSet.fromObject(elimpBitMask, status));
|
|
498
|
-
// } else if ( WATER_HARDWARE_TYPES.includes(hardwareType) ) {
|
|
499
|
-
// this.setUint8(bitSet.fromObject(waterBitMask, status as bitSet.TBooleanObject));
|
|
500
426
|
}
|
|
501
427
|
else if (FOUR_CHANNELS_HARDWARE_TYPES.includes(hardwareType)) {
|
|
502
428
|
this.setExtendedValue(bitSet.fromObject(fourChannelBitMask, status));
|