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
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import Command from '
|
|
2
|
-
import { IHexFormatOptions } from '
|
|
1
|
+
import Command from './Command.js';
|
|
2
|
+
import { IHexFormatOptions } from '../config.js';
|
|
3
3
|
interface IMessageCommand {
|
|
4
|
-
/** command source binary data */
|
|
5
4
|
data: {
|
|
6
5
|
header: Uint8Array;
|
|
7
6
|
body: Uint8Array;
|
|
8
7
|
};
|
|
9
|
-
/** specific command instance */
|
|
10
8
|
command: Command;
|
|
11
9
|
}
|
|
12
10
|
interface IMessage {
|
|
@@ -17,16 +15,13 @@ interface IMessage {
|
|
|
17
15
|
};
|
|
18
16
|
isValid: boolean;
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
* @return LRC
|
|
26
|
-
*/
|
|
18
|
+
interface IMessageConfig {
|
|
19
|
+
direction?: number;
|
|
20
|
+
hardwareType?: number;
|
|
21
|
+
}
|
|
27
22
|
export declare const calculateLrc: (data: Uint8Array, initialLrc?: number) => number;
|
|
28
|
-
export declare const fromBytes: (data: Uint8Array,
|
|
29
|
-
export declare const fromHex: (data: string,
|
|
23
|
+
export declare const fromBytes: (data: Uint8Array, config?: IMessageConfig) => IMessage;
|
|
24
|
+
export declare const fromHex: (data: string, config?: IMessageConfig) => IMessage;
|
|
30
25
|
export declare const toBytes: (commands: Array<Command>) => Uint8Array;
|
|
31
26
|
export declare const toHex: (commands: Array<Command>, options?: IHexFormatOptions) => string;
|
|
32
27
|
export {};
|
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
6
|
-
import { AUTO, DOWNLINK, UPLINK } from '../constants/directions.js';
|
|
1
|
+
import UnknownCommand from './UnknownCommand.js';
|
|
2
|
+
import * as downlinkCommands from './commands/downlink/index.js';
|
|
3
|
+
import * as uplinkCommands from './commands/uplink/index.js';
|
|
4
|
+
import * as directionTypes from './constants/directions.js';
|
|
5
|
+
import { AUTO, DOWNLINK, UPLINK } from './constants/directions.js';
|
|
7
6
|
import * as header from './header.js';
|
|
8
|
-
import getBytesFromHex from '
|
|
9
|
-
import getHexFromBytes from '
|
|
7
|
+
import getBytesFromHex from '../utils/getBytesFromHex.js';
|
|
8
|
+
import getHexFromBytes from '../utils/getHexFromBytes.js';
|
|
10
9
|
const HEADER_MAX_SIZE = 3;
|
|
11
|
-
// all allowed types
|
|
12
10
|
const directionTypeIds = new Set(Object.values(directionTypes));
|
|
13
|
-
// convert export namespace to dictionary {commandId: commandConstructor}
|
|
14
11
|
const downlinkCommandsById = Object.fromEntries(Object.values(downlinkCommands).map(item => [item.id, item]));
|
|
15
12
|
const uplinkCommandsById = Object.fromEntries(Object.values(uplinkCommands).map(item => [item.id, item]));
|
|
16
|
-
/**
|
|
17
|
-
* Calculate LRC
|
|
18
|
-
*
|
|
19
|
-
* @param data - byte array
|
|
20
|
-
*
|
|
21
|
-
* @return LRC
|
|
22
|
-
*/
|
|
23
13
|
export const calculateLrc = (data, initialLrc = 0x55) => {
|
|
24
14
|
let lrc = initialLrc;
|
|
25
15
|
data.forEach(item => {
|
|
@@ -33,28 +23,25 @@ const getCommand = (id, data, direction = AUTO, hardwareType) => {
|
|
|
33
23
|
}
|
|
34
24
|
const downlinkCommand = downlinkCommandsById[id];
|
|
35
25
|
const uplinkCommand = uplinkCommandsById[id];
|
|
36
|
-
// check command availability
|
|
37
26
|
if ((!downlinkCommand && !uplinkCommand)
|
|
38
27
|
|| (direction === DOWNLINK && !downlinkCommand)
|
|
39
28
|
|| (direction === UPLINK && !uplinkCommand)) {
|
|
40
|
-
// missing command implementation
|
|
41
29
|
return new UnknownCommand({ id, data });
|
|
42
30
|
}
|
|
43
|
-
// ths specific direction
|
|
44
31
|
if (direction === DOWNLINK || direction === UPLINK) {
|
|
45
32
|
const command = direction === UPLINK ? uplinkCommand : downlinkCommand;
|
|
46
|
-
return command.fromBytes(data, hardwareType);
|
|
33
|
+
return command.fromBytes(data, { hardwareType });
|
|
47
34
|
}
|
|
48
|
-
// direction autodetect
|
|
49
35
|
try {
|
|
50
|
-
|
|
51
|
-
return uplinkCommand.fromBytes(data, hardwareType);
|
|
36
|
+
return uplinkCommand.fromBytes(data, { hardwareType });
|
|
52
37
|
}
|
|
53
38
|
catch {
|
|
54
39
|
return downlinkCommand.fromBytes(data);
|
|
55
40
|
}
|
|
56
41
|
};
|
|
57
|
-
export const fromBytes = (data,
|
|
42
|
+
export const fromBytes = (data, config) => {
|
|
43
|
+
const direction = config?.direction ?? AUTO;
|
|
44
|
+
const hardwareType = config?.hardwareType;
|
|
58
45
|
const commandsData = data.slice(0, -1);
|
|
59
46
|
const commands = [];
|
|
60
47
|
const result = {
|
|
@@ -70,15 +57,12 @@ export const fromBytes = (data, direction = AUTO, hardwareType) => {
|
|
|
70
57
|
const headerData = commandsData.slice(position, position + headerInfo.headerSize);
|
|
71
58
|
const bodyData = commandsData.slice(position + headerInfo.headerSize, position + headerInfo.headerSize + headerInfo.commandSize);
|
|
72
59
|
let command;
|
|
73
|
-
// shift
|
|
74
60
|
position = position + headerInfo.headerSize + headerInfo.commandSize;
|
|
75
61
|
try {
|
|
76
62
|
command = getCommand(headerInfo.commandId, bodyData, direction, hardwareType);
|
|
77
63
|
}
|
|
78
64
|
catch (error) {
|
|
79
|
-
// the last command in the message
|
|
80
65
|
if (position >= commandsData.length) {
|
|
81
|
-
// LRC may be missing so try to add one
|
|
82
66
|
command = getCommand(headerInfo.commandId, new Uint8Array([...bodyData, ...data.slice(-1)]), direction, hardwareType);
|
|
83
67
|
actualLrc = calculateLrc(data);
|
|
84
68
|
expectedLrc = undefined;
|
|
@@ -97,19 +81,16 @@ export const fromBytes = (data, direction = AUTO, hardwareType) => {
|
|
|
97
81
|
result.isValid = expectedLrc === actualLrc;
|
|
98
82
|
return result;
|
|
99
83
|
};
|
|
100
|
-
export const fromHex = (data,
|
|
84
|
+
export const fromHex = (data, config) => (fromBytes(getBytesFromHex(data), config));
|
|
101
85
|
export const toBytes = (commands) => {
|
|
102
86
|
const arrays = commands.map(command => command.toBytes());
|
|
103
87
|
const totalLength = arrays.reduce((accumulator, item) => (accumulator + item.length), 0);
|
|
104
|
-
// 1 additional byte at the end is for LRC
|
|
105
88
|
const result = new Uint8Array(totalLength + 1);
|
|
106
89
|
let offset = 0;
|
|
107
|
-
// fill result with all chunks
|
|
108
90
|
arrays.forEach(item => {
|
|
109
91
|
result.set(item, offset);
|
|
110
92
|
offset += item.length;
|
|
111
93
|
});
|
|
112
|
-
// set last byte to LRC
|
|
113
94
|
result[result.length - 1] = calculateLrc(result.slice(0, result.length - 1));
|
|
114
95
|
return result;
|
|
115
96
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","s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CAAC,CAAC;QACzB,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC;IAC1B,CAAC,CAAC,CAAC;IAGH,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IAE7E,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,CAAE,QAAwB,EAAE,UAA6B,EAAE,EAAW,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC"}
|
package/dist/config.d.ts
ADDED
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAkCA,MAAM,CAAC,MAAM,gBAAgB,GAAsB;IAC/C,SAAS,EAAE,GAAG;IACd,MAAM,EAAE,EAAE;CACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * as
|
|
2
|
-
export * as
|
|
1
|
+
export * as analog from './analog/index.js';
|
|
2
|
+
export * as obisObserver from './obis-observer/index.js';
|
|
3
3
|
export * as utils from './utils/index.js';
|
|
4
|
-
export * as
|
|
4
|
+
export * as config from './config.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * as
|
|
2
|
-
export * as
|
|
1
|
+
export * as analog from './analog/index.js';
|
|
2
|
+
export * as obisObserver from './obis-observer/index.js';
|
|
3
3
|
export * as utils from './utils/index.js';
|
|
4
|
-
export * as
|
|
4
|
+
export * as config from './config.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IHexFormatOptions } from '
|
|
1
|
+
import { IHexFormatOptions } from '../config.js';
|
|
2
2
|
export interface ICommandExample {
|
|
3
3
|
name: string;
|
|
4
4
|
parameters?: object;
|
|
@@ -9,9 +9,6 @@ export interface ICommandExample {
|
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
export type TCommandExampleList = Array<ICommandExample>;
|
|
12
|
-
/**
|
|
13
|
-
* private
|
|
14
|
-
*/
|
|
15
12
|
declare abstract class Command {
|
|
16
13
|
static id: number;
|
|
17
14
|
static directionType: unknown;
|
|
@@ -19,34 +16,12 @@ declare abstract class Command {
|
|
|
19
16
|
static examples: TCommandExampleList;
|
|
20
17
|
static hasParameters: boolean;
|
|
21
18
|
parameters: unknown;
|
|
22
|
-
|
|
19
|
+
size: unknown;
|
|
23
20
|
static getId(): string;
|
|
24
|
-
/** Get command ID and title. */
|
|
25
|
-
static getName(): string;
|
|
26
|
-
/**
|
|
27
|
-
* Parse body without header.
|
|
28
|
-
*
|
|
29
|
-
* @param data command in binary form
|
|
30
|
-
*
|
|
31
|
-
* @returns command instance
|
|
32
|
-
*/
|
|
33
|
-
/**
|
|
34
|
-
* Build header with body.
|
|
35
|
-
*
|
|
36
|
-
* @param id command id
|
|
37
|
-
* @param commandData optional command binary data
|
|
38
|
-
* @returns merged data
|
|
39
|
-
*/
|
|
40
21
|
static toBytes(id: number, commandData?: Uint8Array): Uint8Array;
|
|
41
|
-
/** Get command parameters. */
|
|
42
22
|
getParameters(): unknown;
|
|
43
23
|
toBytes(): Uint8Array;
|
|
44
24
|
toHex(options?: IHexFormatOptions): string;
|
|
45
|
-
/**
|
|
46
|
-
* Returns the command in JSON format.
|
|
47
|
-
*
|
|
48
|
-
* @returns JSON string contains current parameters
|
|
49
|
-
*/
|
|
50
25
|
toJson(): string;
|
|
51
26
|
}
|
|
52
27
|
export default Command;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import getHexFromBytes from '../utils/getHexFromBytes.js';
|
|
2
|
+
import getHexFromNumber from '../utils/getHexFromNumber.js';
|
|
3
|
+
class Command {
|
|
4
|
+
static getId() {
|
|
5
|
+
return getHexFromNumber(this.id);
|
|
6
|
+
}
|
|
7
|
+
static toBytes(id, commandData) {
|
|
8
|
+
const commandLength = commandData?.length ?? 0;
|
|
9
|
+
const headerData = new Uint8Array([id]);
|
|
10
|
+
if (commandData && commandLength) {
|
|
11
|
+
const resultData = new Uint8Array(commandLength + headerData.length);
|
|
12
|
+
resultData.set(headerData);
|
|
13
|
+
resultData.set(commandData, headerData.length);
|
|
14
|
+
return resultData;
|
|
15
|
+
}
|
|
16
|
+
return headerData;
|
|
17
|
+
}
|
|
18
|
+
getParameters() {
|
|
19
|
+
return this.parameters;
|
|
20
|
+
}
|
|
21
|
+
toBytes() {
|
|
22
|
+
throw new Error('not implemented!');
|
|
23
|
+
}
|
|
24
|
+
toHex(options = {}) {
|
|
25
|
+
return getHexFromBytes(this.toBytes(), options);
|
|
26
|
+
}
|
|
27
|
+
toJson() {
|
|
28
|
+
return JSON.stringify(this.getParameters());
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
Command.hasParameters = false;
|
|
32
|
+
export default Command;
|
|
33
|
+
//# sourceMappingURL=Command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Command.js","sourceRoot":"","sources":["../../src/obis-observer/Command.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAC1D,OAAO,gBAAgB,MAAM,8BAA8B,CAAC;AAmB5D,MAAe,OAAO;IAmBlB,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,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAExC,IAAK,WAAW,IAAI,aAAa,EAAG;YAChC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,aAAa,GAAG,UAAU,CAAC,MAAM,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;;AAjGM,qBAAa,GAAG,KAAK,CAAC;AAqGjC,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import BinaryBuffer from '../utils/BinaryBuffer.js';
|
|
2
|
+
export interface ICommandParameters {
|
|
3
|
+
requestId: number;
|
|
4
|
+
}
|
|
5
|
+
export interface IObis {
|
|
6
|
+
a?: number;
|
|
7
|
+
b?: number;
|
|
8
|
+
c: number;
|
|
9
|
+
d: number;
|
|
10
|
+
e?: number;
|
|
11
|
+
f?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface IObisProfileFlags {
|
|
14
|
+
contentType: number;
|
|
15
|
+
sendOnlyOnChange: number;
|
|
16
|
+
archiveType: number;
|
|
17
|
+
}
|
|
18
|
+
export interface IObisProfile {
|
|
19
|
+
capturePeriod: number;
|
|
20
|
+
sendingPeriod: number;
|
|
21
|
+
sendingCounter: number;
|
|
22
|
+
flags: IObisProfileFlags;
|
|
23
|
+
}
|
|
24
|
+
export interface IShortNameFloat {
|
|
25
|
+
code: number;
|
|
26
|
+
content: number;
|
|
27
|
+
}
|
|
28
|
+
export interface IShortNameString {
|
|
29
|
+
code: number;
|
|
30
|
+
content: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const REQUEST_ID_SIZE = 1;
|
|
33
|
+
export declare const OBIS_PROFILE_SIZE = 6;
|
|
34
|
+
export declare const DATE_TIME_SIZE = 4;
|
|
35
|
+
declare class CommandBinaryBuffer extends BinaryBuffer {
|
|
36
|
+
constructor(dataOrLength: Uint8Array | number | string);
|
|
37
|
+
static getObisSize(obis: IObis): number;
|
|
38
|
+
static getShortNameContentSize(shortName: IShortNameFloat | IShortNameString): number;
|
|
39
|
+
getObis(): IObis;
|
|
40
|
+
setObis(obis: IObis): void;
|
|
41
|
+
getObisProfile(): IObisProfile;
|
|
42
|
+
setObisProfile(profile: IObisProfile): void;
|
|
43
|
+
getShortNameString(): IShortNameString;
|
|
44
|
+
setShortNameString(shortName: IShortNameString): void;
|
|
45
|
+
getShortNameFloat(): IShortNameFloat;
|
|
46
|
+
setShortNameFloat(shortName: IShortNameFloat): void;
|
|
47
|
+
getSerialPortFlags(): {
|
|
48
|
+
fixed: number;
|
|
49
|
+
parity: number;
|
|
50
|
+
};
|
|
51
|
+
setSerialPortFlags({ fixed, parity }: {
|
|
52
|
+
fixed: number;
|
|
53
|
+
parity: number;
|
|
54
|
+
}): void;
|
|
55
|
+
}
|
|
56
|
+
export default CommandBinaryBuffer;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import BinaryBuffer from '../utils/BinaryBuffer.js';
|
|
2
|
+
import * as bitSet from '../utils/bitSet.js';
|
|
3
|
+
import roundNumber from '../utils/roundNumber.js';
|
|
4
|
+
export const REQUEST_ID_SIZE = 1;
|
|
5
|
+
export const OBIS_PROFILE_SIZE = 6;
|
|
6
|
+
export const DATE_TIME_SIZE = 4;
|
|
7
|
+
const obisBitMask = {
|
|
8
|
+
f: 2 ** 0,
|
|
9
|
+
e: 2 ** 1,
|
|
10
|
+
b: 2 ** 2,
|
|
11
|
+
a: 2 ** 3
|
|
12
|
+
};
|
|
13
|
+
const obisProfileFlags = {
|
|
14
|
+
contentTypeBitsNumber: 2,
|
|
15
|
+
contentTypeBitStartIndex: 1,
|
|
16
|
+
sendingOnlyIfChangeBitsNumber: 1,
|
|
17
|
+
sendingOnlyIfChangeBitStartIndex: 3,
|
|
18
|
+
archiveTypeBitsNumber: 2,
|
|
19
|
+
archiveTypeBitStartIndex: 4
|
|
20
|
+
};
|
|
21
|
+
class CommandBinaryBuffer extends BinaryBuffer {
|
|
22
|
+
constructor(dataOrLength) {
|
|
23
|
+
super(dataOrLength, false);
|
|
24
|
+
}
|
|
25
|
+
static getObisSize(obis) {
|
|
26
|
+
const keys = Object.keys(obis);
|
|
27
|
+
return keys.filter(key => obis[key] !== undefined).length + 1;
|
|
28
|
+
}
|
|
29
|
+
static getShortNameContentSize(shortName) {
|
|
30
|
+
if (typeof shortName.content === 'number') {
|
|
31
|
+
return 5;
|
|
32
|
+
}
|
|
33
|
+
return 1 + shortName.content.length + 1;
|
|
34
|
+
}
|
|
35
|
+
getObis() {
|
|
36
|
+
const obis = {
|
|
37
|
+
c: 0,
|
|
38
|
+
d: 0
|
|
39
|
+
};
|
|
40
|
+
const flags = bitSet.toObject(obisBitMask, this.getUint8());
|
|
41
|
+
if (flags.a) {
|
|
42
|
+
obis.a = this.getUint8();
|
|
43
|
+
}
|
|
44
|
+
if (flags.b) {
|
|
45
|
+
obis.b = this.getUint8();
|
|
46
|
+
}
|
|
47
|
+
obis.c = this.getUint8();
|
|
48
|
+
obis.d = this.getUint8();
|
|
49
|
+
if (flags.e) {
|
|
50
|
+
obis.e = this.getUint8();
|
|
51
|
+
}
|
|
52
|
+
if (flags.f) {
|
|
53
|
+
obis.f = this.getUint8();
|
|
54
|
+
}
|
|
55
|
+
return obis;
|
|
56
|
+
}
|
|
57
|
+
setObis(obis) {
|
|
58
|
+
const flags = {
|
|
59
|
+
a: obis.a !== undefined,
|
|
60
|
+
b: obis.b !== undefined,
|
|
61
|
+
e: obis.e !== undefined,
|
|
62
|
+
f: obis.f !== undefined
|
|
63
|
+
};
|
|
64
|
+
this.setUint8(bitSet.fromObject(obisBitMask, flags));
|
|
65
|
+
if (obis.a) {
|
|
66
|
+
this.setUint8(obis.a);
|
|
67
|
+
}
|
|
68
|
+
if (obis.b) {
|
|
69
|
+
this.setUint8(obis.b);
|
|
70
|
+
}
|
|
71
|
+
this.setUint8(obis.c);
|
|
72
|
+
this.setUint8(obis.d);
|
|
73
|
+
if (obis.e) {
|
|
74
|
+
this.setUint8(obis.e);
|
|
75
|
+
}
|
|
76
|
+
if (obis.f) {
|
|
77
|
+
this.setUint8(obis.f);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
getObisProfile() {
|
|
81
|
+
const profile = {
|
|
82
|
+
capturePeriod: this.getUint16(),
|
|
83
|
+
sendingPeriod: this.getUint16(),
|
|
84
|
+
sendingCounter: this.getUint8(),
|
|
85
|
+
flags: {
|
|
86
|
+
contentType: 0,
|
|
87
|
+
sendOnlyOnChange: 0,
|
|
88
|
+
archiveType: 0
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const flags = this.getUint8();
|
|
92
|
+
const { contentTypeBitsNumber, contentTypeBitStartIndex, sendingOnlyIfChangeBitsNumber, sendingOnlyIfChangeBitStartIndex, archiveTypeBitsNumber, archiveTypeBitStartIndex } = obisProfileFlags;
|
|
93
|
+
profile.flags.contentType = bitSet.extractBits(flags, contentTypeBitsNumber, contentTypeBitStartIndex);
|
|
94
|
+
profile.flags.sendOnlyOnChange = bitSet.extractBits(flags, sendingOnlyIfChangeBitsNumber, sendingOnlyIfChangeBitStartIndex);
|
|
95
|
+
profile.flags.archiveType = bitSet.extractBits(flags, archiveTypeBitsNumber, archiveTypeBitStartIndex);
|
|
96
|
+
return profile;
|
|
97
|
+
}
|
|
98
|
+
setObisProfile(profile) {
|
|
99
|
+
this.setUint16(profile.capturePeriod);
|
|
100
|
+
this.setUint16(profile.sendingPeriod);
|
|
101
|
+
this.setUint8(profile.sendingCounter);
|
|
102
|
+
const { contentTypeBitsNumber, contentTypeBitStartIndex, sendingOnlyIfChangeBitsNumber, sendingOnlyIfChangeBitStartIndex, archiveTypeBitsNumber, archiveTypeBitStartIndex } = obisProfileFlags;
|
|
103
|
+
let flags = 0;
|
|
104
|
+
flags = bitSet.fillBits(flags, contentTypeBitsNumber, contentTypeBitStartIndex, profile.flags.contentType);
|
|
105
|
+
flags = bitSet.fillBits(flags, sendingOnlyIfChangeBitsNumber, sendingOnlyIfChangeBitStartIndex, profile.flags.sendOnlyOnChange);
|
|
106
|
+
flags = bitSet.fillBits(flags, archiveTypeBitsNumber, archiveTypeBitStartIndex, profile.flags.archiveType);
|
|
107
|
+
this.setUint8(flags);
|
|
108
|
+
}
|
|
109
|
+
getShortNameString() {
|
|
110
|
+
return { code: this.getUint8(), content: this.getString() };
|
|
111
|
+
}
|
|
112
|
+
setShortNameString(shortName) {
|
|
113
|
+
this.setUint8(shortName.code);
|
|
114
|
+
this.setString(shortName.content);
|
|
115
|
+
}
|
|
116
|
+
getShortNameFloat() {
|
|
117
|
+
return { code: this.getUint8(), content: roundNumber(this.getFloat32()) };
|
|
118
|
+
}
|
|
119
|
+
setShortNameFloat(shortName) {
|
|
120
|
+
this.setUint8(shortName.code);
|
|
121
|
+
this.setFloat32(roundNumber(shortName.content));
|
|
122
|
+
}
|
|
123
|
+
getSerialPortFlags() {
|
|
124
|
+
const flags = this.getUint8();
|
|
125
|
+
return {
|
|
126
|
+
fixed: bitSet.extractBits(flags, 1, 3),
|
|
127
|
+
parity: bitSet.extractBits(flags, 2, 1)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
setSerialPortFlags({ fixed, parity }) {
|
|
131
|
+
let flags = 0;
|
|
132
|
+
flags = bitSet.fillBits(flags, 1, 3, fixed);
|
|
133
|
+
flags = bitSet.fillBits(flags, 2, 1, parity);
|
|
134
|
+
this.setUint8(flags);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export default CommandBinaryBuffer;
|
|
138
|
+
//# sourceMappingURL=CommandBinaryBuffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandBinaryBuffer.js","sourceRoot":"","sources":["../../src/obis-observer/CommandBinaryBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,WAAW,MAAM,yBAAyB,CAAC;AA2ClD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AACnC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAGhC,MAAM,WAAW,GAAG;IAChB,CAAC,EAAE,CAAC,IAAI,CAAC;IACT,CAAC,EAAE,CAAC,IAAI,CAAC;IACT,CAAC,EAAE,CAAC,IAAI,CAAC;IACT,CAAC,EAAE,CAAC,IAAI,CAAC;CACZ,CAAC;AAEF,MAAM,gBAAgB,GAAG;IACrB,qBAAqB,EAAE,CAAC;IACxB,wBAAwB,EAAE,CAAC;IAC3B,6BAA6B,EAAE,CAAC;IAChC,gCAAgC,EAAE,CAAC;IACnC,qBAAqB,EAAE,CAAC;IACxB,wBAA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EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QAC5C,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;QAE7C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;CACJ;AAGD,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Command from './Command.js';
|
|
2
|
+
interface IUnknownCommandParameters {
|
|
3
|
+
id: number;
|
|
4
|
+
data: Uint8Array;
|
|
5
|
+
}
|
|
6
|
+
declare class UnknownCommand extends Command {
|
|
7
|
+
parameters: IUnknownCommandParameters;
|
|
8
|
+
constructor(parameters: IUnknownCommandParameters);
|
|
9
|
+
static fromBytes(data: Uint8Array, id: number): UnknownCommand;
|
|
10
|
+
toBytes(): Uint8Array;
|
|
11
|
+
}
|
|
12
|
+
export default UnknownCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Command from './Command.js';
|
|
2
|
+
class UnknownCommand extends Command {
|
|
3
|
+
constructor(parameters) {
|
|
4
|
+
super();
|
|
5
|
+
this.parameters = parameters;
|
|
6
|
+
}
|
|
7
|
+
static fromBytes(data, id) {
|
|
8
|
+
const parameters = { id, data };
|
|
9
|
+
return new UnknownCommand(parameters);
|
|
10
|
+
}
|
|
11
|
+
toBytes() {
|
|
12
|
+
const { id, data } = this.parameters;
|
|
13
|
+
return Command.toBytes(id, data);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export default UnknownCommand;
|
|
17
|
+
//# sourceMappingURL=UnknownCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnknownCommand.js","sourceRoot":"","sources":["../../src/obis-observer/UnknownCommand.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AAiBnC,MAAM,cAAe,SAAQ,OAAO;IAChC,YAAqB,UAAqC;QACtD,KAAK,EAAE,CAAC;QADS,eAAU,GAAV,UAAU,CAA2B;IAE1D,CAAC;IAGD,MAAM,CAAC,SAAS,CAAG,IAAgB,EAAE,EAAU;QAC3C,MAAM,UAAU,GAA8B,EAAC,EAAE,EAAE,IAAI,EAAC,CAAC;QAEzD,OAAO,IAAI,cAAc,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;IAGD,OAAO;QACH,MAAM,EAAC,EAAE,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAEnC,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;CACJ;AAGD,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Command, { TCommandExampleList } from '../../Command.js';
|
|
2
|
+
import { ICommandParameters, IObisProfile } from '../../CommandBinaryBuffer.js';
|
|
3
|
+
interface IAddShortNameProfileParameters extends ICommandParameters {
|
|
4
|
+
shortName: number;
|
|
5
|
+
obisProfile: IObisProfile;
|
|
6
|
+
}
|
|
7
|
+
declare class AddShortNameProfile extends Command {
|
|
8
|
+
parameters: IAddShortNameProfileParameters;
|
|
9
|
+
constructor(parameters: IAddShortNameProfileParameters);
|
|
10
|
+
static readonly id = 5;
|
|
11
|
+
static readonly directionType = 1;
|
|
12
|
+
static readonly examples: TCommandExampleList;
|
|
13
|
+
static readonly hasParameters = true;
|
|
14
|
+
static fromBytes(data: Uint8Array): AddShortNameProfile;
|
|
15
|
+
toBytes(): Uint8Array;
|
|
16
|
+
}
|
|
17
|
+
export default AddShortNameProfile;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import Command from '../../Command.js';
|
|
2
|
+
import CommandBinaryBuffer, { REQUEST_ID_SIZE } from '../../CommandBinaryBuffer.js';
|
|
3
|
+
import { DOWNLINK } from '../../constants/directions.js';
|
|
4
|
+
import { archiveTypes, contentTypes } from '../../constants/index.js';
|
|
5
|
+
const COMMAND_ID = 0x05;
|
|
6
|
+
const COMMAND_SIZE = 7 + REQUEST_ID_SIZE;
|
|
7
|
+
const examples = [
|
|
8
|
+
{
|
|
9
|
+
name: 'add profile for short name 32',
|
|
10
|
+
parameters: {
|
|
11
|
+
requestId: 3,
|
|
12
|
+
shortName: 32,
|
|
13
|
+
obisProfile: {
|
|
14
|
+
capturePeriod: 244,
|
|
15
|
+
sendingPeriod: 132,
|
|
16
|
+
sendingCounter: 38,
|
|
17
|
+
flags: {
|
|
18
|
+
contentType: contentTypes.AUTO,
|
|
19
|
+
sendOnlyOnChange: 1,
|
|
20
|
+
archiveType: archiveTypes.NONE
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
hex: { header: '05', body: '03 20 00 f4 00 84 26 04' }
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
class AddShortNameProfile extends Command {
|
|
28
|
+
constructor(parameters) {
|
|
29
|
+
super();
|
|
30
|
+
this.parameters = parameters;
|
|
31
|
+
this.size = COMMAND_SIZE;
|
|
32
|
+
}
|
|
33
|
+
static fromBytes(data) {
|
|
34
|
+
const buffer = new CommandBinaryBuffer(data);
|
|
35
|
+
return new AddShortNameProfile({
|
|
36
|
+
requestId: buffer.getUint8(),
|
|
37
|
+
shortName: buffer.getUint8(),
|
|
38
|
+
obisProfile: buffer.getObisProfile()
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
toBytes() {
|
|
42
|
+
const buffer = new CommandBinaryBuffer(COMMAND_SIZE);
|
|
43
|
+
const { requestId, shortName, obisProfile } = this.parameters;
|
|
44
|
+
buffer.setUint8(requestId);
|
|
45
|
+
buffer.setUint8(shortName);
|
|
46
|
+
buffer.setObisProfile(obisProfile);
|
|
47
|
+
return Command.toBytes(COMMAND_ID, buffer.toUint8Array());
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
AddShortNameProfile.id = COMMAND_ID;
|
|
51
|
+
AddShortNameProfile.directionType = DOWNLINK;
|
|
52
|
+
AddShortNameProfile.examples = examples;
|
|
53
|
+
AddShortNameProfile.hasParameters = true;
|
|
54
|
+
export default AddShortNameProfile;
|
|
55
|
+
//# sourceMappingURL=AddShortNameProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddShortNameProfile.js","sourceRoot":"","sources":["../../../../src/obis-observer/commands/downlink/AddShortNameProfile.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,kBAAkB,CAAC;AAC9D,OAAO,mBAAmB,EAAE,EAAC,eAAe,EAAmC,MAAM,8BAA8B,CAAC;AACpH,OAAO,EAAC,QAAQ,EAAC,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAYpE,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,YAAY,GAAG,CAAC,GAAG,eAAe,CAAC;AAEzC,MAAM,QAAQ,GAAwB;IAClC;QACI,IAAI,EAAE,+BAA+B;QACrC,UAAU,EAAE;YACR,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,EAAE;YACb,WAAW,EAAE;gBACT,aAAa,EAAE,GAAG;gBAClB,aAAa,EAAE,GAAG;gBAClB,cAAc,EAAE,EAAE;gBAClB,KAAK,EAAE;oBACH,WAAW,EAAE,YAAY,CAAC,IAAI;oBAC9B,gBAAgB,EAAE,CAAC;oBACnB,WAAW,EAAE,YAAY,CAAC,IAAI;iBACjC;aACJ;SACJ;QACD,GAAG,EAAE,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,yBAAyB,EAAC;KACvD;CACJ,CAAC;AAgCF,MAAM,mBAAoB,SAAQ,OAAO;IACrC,YAAqB,UAA0C;QAC3D,KAAK,EAAE,CAAC;QADS,eAAU,GAAV,UAAU,CAAgC;QAG3D,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC7B,CAAC;IAaD,MAAM,CAAC,SAAS,CAAG,IAAgB;QAC/B,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAE7C,OAAO,IAAI,mBAAmB,CAAC;YAC3B,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAE;YAC5B,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAE;YAC5B,WAAW,EAAE,MAAM,CAAC,cAAc,EAAE;SACvC,CAAC,CAAC;IACP,CAAC;IAGD,OAAO;QACH,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,YAAY,CAAC,CAAC;QACrD,MAAM,EAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAE5D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC3B,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC3B,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAEnC,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;;AA9Be,sBAAE,GAAG,UAAU,CAAC;AAEhB,iCAAa,GAAG,QAAQ,CAAC;AAEzB,4BAAQ,GAAG,QAAQ,CAAC;AAEpB,iCAAa,GAAG,IAAI,CAAC;AA4BzC,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Command, { TCommandExampleList } from '../../Command.js';
|
|
2
|
+
import { ICommandParameters } from '../../CommandBinaryBuffer.js';
|
|
3
|
+
declare class GetArchiveProfile extends Command {
|
|
4
|
+
parameters: ICommandParameters;
|
|
5
|
+
constructor(parameters: ICommandParameters);
|
|
6
|
+
static readonly id = 13;
|
|
7
|
+
static readonly directionType = 1;
|
|
8
|
+
static readonly examples: TCommandExampleList;
|
|
9
|
+
static readonly hasParameters = true;
|
|
10
|
+
static fromBytes(data: Uint8Array): GetArchiveProfile;
|
|
11
|
+
toBytes(): Uint8Array;
|
|
12
|
+
}
|
|
13
|
+
export default GetArchiveProfile;
|