jooby-codec 1.14.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.
Files changed (396) hide show
  1. package/dist/analog/Command.d.ts +29 -0
  2. package/dist/analog/Command.js +34 -0
  3. package/dist/analog/Command.js.map +1 -0
  4. package/dist/{CommandBinaryBuffer.d.ts → analog/CommandBinaryBuffer.d.ts} +3 -208
  5. package/dist/{CommandBinaryBuffer.js → analog/CommandBinaryBuffer.js} +8 -80
  6. package/dist/analog/CommandBinaryBuffer.js.map +1 -0
  7. package/dist/{UnknownCommand.d.ts → analog/UnknownCommand.d.ts} +0 -8
  8. package/dist/{UnknownCommand.js → analog/UnknownCommand.js} +0 -5
  9. package/dist/analog/UnknownCommand.js.map +1 -0
  10. package/dist/analog/commands/downlink/CorrectTime2000.d.ts +16 -0
  11. package/dist/{commands → analog/commands}/downlink/CorrectTime2000.js +3 -23
  12. package/dist/analog/commands/downlink/CorrectTime2000.js.map +1 -0
  13. package/dist/analog/commands/downlink/GetArchiveDaysMC.d.ts +18 -0
  14. package/dist/{commands → analog/commands}/downlink/GetArchiveDaysMC.js +3 -27
  15. package/dist/analog/commands/downlink/GetArchiveDaysMC.js.map +1 -0
  16. package/dist/analog/commands/downlink/GetArchiveEvents.d.ts +17 -0
  17. package/dist/{commands → analog/commands}/downlink/GetArchiveEvents.js +0 -19
  18. package/dist/analog/commands/downlink/GetArchiveEvents.js.map +1 -0
  19. package/dist/analog/commands/downlink/GetArchiveHoursMC.d.ts +18 -0
  20. package/dist/{commands → analog/commands}/downlink/GetArchiveHoursMC.js +3 -22
  21. package/dist/analog/commands/downlink/GetArchiveHoursMC.js.map +1 -0
  22. package/dist/analog/commands/downlink/GetCurrentMC.d.ts +10 -0
  23. package/dist/analog/commands/downlink/GetCurrentMC.js +23 -0
  24. package/dist/analog/commands/downlink/GetCurrentMC.js.map +1 -0
  25. package/dist/analog/commands/downlink/GetExAbsArchiveDaysMC.d.ts +18 -0
  26. package/dist/{commands → analog/commands}/downlink/GetExAbsArchiveDaysMC.js +3 -24
  27. package/dist/analog/commands/downlink/GetExAbsArchiveDaysMC.js.map +1 -0
  28. package/dist/analog/commands/downlink/GetExAbsArchiveHoursMC.d.ts +18 -0
  29. package/dist/{commands → analog/commands}/downlink/GetExAbsArchiveHoursMC.js +3 -23
  30. package/dist/analog/commands/downlink/GetExAbsArchiveHoursMC.js.map +1 -0
  31. package/dist/analog/commands/downlink/GetExAbsCurrentMC.d.ts +11 -0
  32. package/dist/{commands → analog/commands}/downlink/GetExAbsCurrentMC.js +0 -20
  33. package/dist/analog/commands/downlink/GetExAbsCurrentMC.js.map +1 -0
  34. package/dist/analog/commands/downlink/GetLmicInfo.d.ts +10 -0
  35. package/dist/analog/commands/downlink/GetLmicInfo.js +23 -0
  36. package/dist/analog/commands/downlink/GetLmicInfo.js.map +1 -0
  37. package/dist/analog/commands/downlink/GetParameter.d.ts +15 -0
  38. package/dist/{commands → analog/commands}/downlink/GetParameter.js +0 -20
  39. package/dist/analog/commands/downlink/GetParameter.js.map +1 -0
  40. package/dist/analog/commands/downlink/GetStatus.d.ts +11 -0
  41. package/dist/{commands → analog/commands}/downlink/GetStatus.js +0 -19
  42. package/dist/analog/commands/downlink/GetStatus.js.map +1 -0
  43. package/dist/analog/commands/downlink/SetParameter.d.ts +13 -0
  44. package/dist/{commands → analog/commands}/downlink/SetParameter.js +2 -21
  45. package/dist/analog/commands/downlink/SetParameter.js.map +1 -0
  46. package/dist/analog/commands/downlink/SetTime2000.d.ts +16 -0
  47. package/dist/{commands → analog/commands}/downlink/SetTime2000.js +3 -22
  48. package/dist/analog/commands/downlink/SetTime2000.js.map +1 -0
  49. package/dist/analog/commands/downlink/SoftRestart.d.ts +10 -0
  50. package/dist/analog/commands/downlink/SoftRestart.js +23 -0
  51. package/dist/analog/commands/downlink/SoftRestart.js.map +1 -0
  52. package/dist/{commands → analog/commands}/downlink/index.d.ts +0 -5
  53. package/dist/{commands → analog/commands}/downlink/index.js +0 -5
  54. package/dist/analog/commands/downlink/index.js.map +1 -0
  55. package/dist/{commands → analog/commands}/index.d.ts +0 -5
  56. package/dist/{commands → analog/commands}/index.js +0 -5
  57. package/dist/analog/commands/index.js.map +1 -0
  58. package/dist/analog/commands/uplink/CorrectTime2000Response.d.ts +15 -0
  59. package/dist/{commands → analog/commands}/uplink/CorrectTime2000Response.js +3 -23
  60. package/dist/analog/commands/uplink/CorrectTime2000Response.js.map +1 -0
  61. package/dist/{commands → analog/commands}/uplink/CurrentMC.d.ts +0 -24
  62. package/dist/{commands → analog/commands}/uplink/CurrentMC.js +0 -24
  63. package/dist/analog/commands/uplink/CurrentMC.js.map +1 -0
  64. package/dist/analog/commands/uplink/DayMC.d.ts +17 -0
  65. package/dist/{commands → analog/commands}/uplink/DayMC.js +1 -33
  66. package/dist/analog/commands/uplink/DayMC.js.map +1 -0
  67. package/dist/analog/commands/uplink/ExAbsCurrentMC.d.ts +16 -0
  68. package/dist/{commands → analog/commands}/uplink/ExAbsCurrentMC.js +0 -29
  69. package/dist/analog/commands/uplink/ExAbsCurrentMC.js.map +1 -0
  70. package/dist/analog/commands/uplink/ExAbsDayMC.d.ts +19 -0
  71. package/dist/{commands → analog/commands}/uplink/ExAbsDayMC.js +1 -31
  72. package/dist/analog/commands/uplink/ExAbsDayMC.js.map +1 -0
  73. package/dist/analog/commands/uplink/ExAbsHourMC.d.ts +19 -0
  74. package/dist/{commands → analog/commands}/uplink/ExAbsHourMC.js +1 -36
  75. package/dist/analog/commands/uplink/ExAbsHourMC.js.map +1 -0
  76. package/dist/analog/commands/uplink/GetArchiveDaysMCResponse.d.ts +19 -0
  77. package/dist/{commands → analog/commands}/uplink/GetArchiveDaysMCResponse.js +1 -33
  78. package/dist/analog/commands/uplink/GetArchiveDaysMCResponse.js.map +1 -0
  79. package/dist/analog/commands/uplink/GetArchiveEventsResponse.d.ts +21 -0
  80. package/dist/{commands → analog/commands}/uplink/GetArchiveEventsResponse.js +0 -26
  81. package/dist/analog/commands/uplink/GetArchiveEventsResponse.js.map +1 -0
  82. package/dist/analog/commands/uplink/GetArchiveHoursMCResponse.d.ts +19 -0
  83. package/dist/{commands → analog/commands}/uplink/GetArchiveHoursMCResponse.js +0 -33
  84. package/dist/analog/commands/uplink/GetArchiveHoursMCResponse.js.map +1 -0
  85. package/dist/analog/commands/uplink/GetExAbsArchiveDaysMCResponse.d.ts +19 -0
  86. package/dist/{commands → analog/commands}/uplink/GetExAbsArchiveDaysMCResponse.js +1 -33
  87. package/dist/analog/commands/uplink/GetExAbsArchiveDaysMCResponse.js.map +1 -0
  88. package/dist/{commands → analog/commands}/uplink/GetExAbsArchiveHoursMCResponse.d.ts +1 -26
  89. package/dist/{commands → analog/commands}/uplink/GetExAbsArchiveHoursMCResponse.js +1 -31
  90. package/dist/analog/commands/uplink/GetExAbsArchiveHoursMCResponse.js.map +1 -0
  91. package/dist/analog/commands/uplink/GetLmicInfoResponse.d.ts +21 -0
  92. package/dist/{commands → analog/commands}/uplink/GetLmicInfoResponse.js +4 -29
  93. package/dist/analog/commands/uplink/GetLmicInfoResponse.js.map +1 -0
  94. package/dist/analog/commands/uplink/GetParameterResponse.d.ts +13 -0
  95. package/dist/{commands → analog/commands}/uplink/GetParameterResponse.js +0 -24
  96. package/dist/analog/commands/uplink/GetParameterResponse.js.map +1 -0
  97. package/dist/analog/commands/uplink/HourMC.d.ts +20 -0
  98. package/dist/{commands → analog/commands}/uplink/HourMC.js +1 -35
  99. package/dist/analog/commands/uplink/HourMC.js.map +1 -0
  100. package/dist/analog/commands/uplink/LastEvent.d.ts +21 -0
  101. package/dist/{commands → analog/commands}/uplink/LastEvent.js +22 -48
  102. package/dist/analog/commands/uplink/LastEvent.js.map +1 -0
  103. package/dist/{commands → analog/commands}/uplink/NewEvent.d.ts +1 -42
  104. package/dist/{commands → analog/commands}/uplink/NewEvent.js +2 -32
  105. package/dist/analog/commands/uplink/NewEvent.js.map +1 -0
  106. package/dist/analog/commands/uplink/SetTime2000Response.d.ts +15 -0
  107. package/dist/{commands → analog/commands}/uplink/SetTime2000Response.js +3 -22
  108. package/dist/analog/commands/uplink/SetTime2000Response.js.map +1 -0
  109. package/dist/analog/commands/uplink/SoftRestartResponse.d.ts +10 -0
  110. package/dist/analog/commands/uplink/SoftRestartResponse.js +23 -0
  111. package/dist/analog/commands/uplink/SoftRestartResponse.js.map +1 -0
  112. package/dist/analog/commands/uplink/Status.d.ts +23 -0
  113. package/dist/{commands → analog/commands}/uplink/Status.js +1 -33
  114. package/dist/analog/commands/uplink/Status.js.map +1 -0
  115. package/dist/analog/commands/uplink/Time2000.d.ts +17 -0
  116. package/dist/{commands → analog/commands}/uplink/Time2000.js +2 -22
  117. package/dist/analog/commands/uplink/Time2000.js.map +1 -0
  118. package/dist/{commands → analog/commands}/uplink/index.d.ts +0 -5
  119. package/dist/{commands → analog/commands}/uplink/index.js +0 -5
  120. package/dist/analog/commands/uplink/index.js.map +1 -0
  121. package/dist/analog/constants/deviceParameters.d.ts +18 -0
  122. package/dist/analog/constants/deviceParameters.js +19 -0
  123. package/dist/analog/constants/deviceParameters.js.map +1 -0
  124. package/dist/analog/constants/directions.js.map +1 -0
  125. package/dist/analog/constants/events.d.ts +21 -0
  126. package/dist/analog/constants/events.js +22 -0
  127. package/dist/analog/constants/events.js.map +1 -0
  128. package/dist/analog/constants/hardwareTypes.d.ts +13 -0
  129. package/dist/analog/constants/hardwareTypes.js +14 -0
  130. package/dist/analog/constants/hardwareTypes.js.map +1 -0
  131. package/dist/analog/constants/index.js.map +1 -0
  132. package/dist/{constants → analog/constants}/rx2SpreadFactors.d.ts +0 -5
  133. package/dist/{constants → analog/constants}/rx2SpreadFactors.js +0 -5
  134. package/dist/analog/constants/rx2SpreadFactors.js.map +1 -0
  135. package/dist/{utils → analog}/header.d.ts +1 -1
  136. package/dist/{utils → analog}/header.js +2 -4
  137. package/dist/analog/header.js.map +1 -0
  138. package/dist/analog/index.d.ts +3 -0
  139. package/dist/analog/index.js +4 -0
  140. package/dist/analog/index.js.map +1 -0
  141. package/dist/{utils → analog}/message.d.ts +8 -13
  142. package/dist/{utils → analog}/message.js +13 -32
  143. package/dist/analog/message.js.map +1 -0
  144. package/dist/config.d.ts +5 -0
  145. package/dist/config.js +5 -0
  146. package/dist/config.js.map +1 -0
  147. package/dist/index.d.ts +3 -3
  148. package/dist/index.js +3 -3
  149. package/dist/index.js.map +1 -1
  150. package/dist/{Command.d.ts → obis-observer/Command.d.ts} +2 -27
  151. package/dist/obis-observer/Command.js +33 -0
  152. package/dist/obis-observer/Command.js.map +1 -0
  153. package/dist/obis-observer/CommandBinaryBuffer.d.ts +56 -0
  154. package/dist/obis-observer/CommandBinaryBuffer.js +138 -0
  155. package/dist/obis-observer/CommandBinaryBuffer.js.map +1 -0
  156. package/dist/obis-observer/UnknownCommand.d.ts +12 -0
  157. package/dist/obis-observer/UnknownCommand.js +17 -0
  158. package/dist/obis-observer/UnknownCommand.js.map +1 -0
  159. package/dist/obis-observer/commands/downlink/AddShortNameProfile.d.ts +17 -0
  160. package/dist/obis-observer/commands/downlink/AddShortNameProfile.js +55 -0
  161. package/dist/obis-observer/commands/downlink/AddShortNameProfile.js.map +1 -0
  162. package/dist/obis-observer/commands/downlink/GetArchiveProfile.d.ts +13 -0
  163. package/dist/obis-observer/commands/downlink/GetArchiveProfile.js +39 -0
  164. package/dist/obis-observer/commands/downlink/GetArchiveProfile.js.map +1 -0
  165. package/dist/obis-observer/commands/downlink/GetContentByObis.d.ts +16 -0
  166. package/dist/obis-observer/commands/downlink/GetContentByObis.js +48 -0
  167. package/dist/obis-observer/commands/downlink/GetContentByObis.js.map +1 -0
  168. package/dist/obis-observer/commands/downlink/GetContentByShortName.d.ts +17 -0
  169. package/dist/obis-observer/commands/downlink/GetContentByShortName.js +44 -0
  170. package/dist/obis-observer/commands/downlink/GetContentByShortName.js.map +1 -0
  171. package/dist/obis-observer/commands/downlink/GetShortNameInfo.d.ts +17 -0
  172. package/dist/obis-observer/commands/downlink/GetShortNameInfo.js +44 -0
  173. package/dist/obis-observer/commands/downlink/GetShortNameInfo.js.map +1 -0
  174. package/dist/obis-observer/commands/downlink/GetShortNameProfile.d.ts +16 -0
  175. package/dist/obis-observer/commands/downlink/GetShortNameProfile.js +45 -0
  176. package/dist/obis-observer/commands/downlink/GetShortNameProfile.js.map +1 -0
  177. package/dist/obis-observer/commands/downlink/GetShortNames.d.ts +16 -0
  178. package/dist/obis-observer/commands/downlink/GetShortNames.js +48 -0
  179. package/dist/obis-observer/commands/downlink/GetShortNames.js.map +1 -0
  180. package/dist/obis-observer/commands/downlink/ReadArchive.d.ts +17 -0
  181. package/dist/obis-observer/commands/downlink/ReadArchive.js +58 -0
  182. package/dist/obis-observer/commands/downlink/ReadArchive.js.map +1 -0
  183. package/dist/obis-observer/commands/downlink/Reboot.d.ts +13 -0
  184. package/dist/obis-observer/commands/downlink/Reboot.js +39 -0
  185. package/dist/obis-observer/commands/downlink/Reboot.js.map +1 -0
  186. package/dist/obis-observer/commands/downlink/RemoveShortNameProfile.d.ts +16 -0
  187. package/dist/obis-observer/commands/downlink/RemoveShortNameProfile.js +42 -0
  188. package/dist/obis-observer/commands/downlink/RemoveShortNameProfile.js.map +1 -0
  189. package/dist/obis-observer/commands/downlink/SetArchiveProfile.d.ts +17 -0
  190. package/dist/obis-observer/commands/downlink/SetArchiveProfile.js +45 -0
  191. package/dist/obis-observer/commands/downlink/SetArchiveProfile.js.map +1 -0
  192. package/dist/obis-observer/commands/downlink/SetSerialPort.d.ts +19 -0
  193. package/dist/obis-observer/commands/downlink/SetSerialPort.js +61 -0
  194. package/dist/obis-observer/commands/downlink/SetSerialPort.js.map +1 -0
  195. package/dist/obis-observer/commands/downlink/SetShortName.d.ts +17 -0
  196. package/dist/obis-observer/commands/downlink/SetShortName.js +51 -0
  197. package/dist/obis-observer/commands/downlink/SetShortName.js.map +1 -0
  198. package/dist/obis-observer/commands/downlink/index.d.ts +13 -0
  199. package/dist/obis-observer/commands/downlink/index.js +14 -0
  200. package/dist/obis-observer/commands/downlink/index.js.map +1 -0
  201. package/dist/obis-observer/commands/index.d.ts +2 -0
  202. package/dist/obis-observer/commands/index.js +3 -0
  203. package/dist/obis-observer/commands/index.js.map +1 -0
  204. package/dist/obis-observer/commands/uplink/AddShortNameProfileResponse.d.ts +16 -0
  205. package/dist/obis-observer/commands/uplink/AddShortNameProfileResponse.js +43 -0
  206. package/dist/obis-observer/commands/uplink/AddShortNameProfileResponse.js.map +1 -0
  207. package/dist/obis-observer/commands/uplink/GetArchiveProfileResponse.d.ts +17 -0
  208. package/dist/obis-observer/commands/uplink/GetArchiveProfileResponse.js +45 -0
  209. package/dist/obis-observer/commands/uplink/GetArchiveProfileResponse.js.map +1 -0
  210. package/dist/obis-observer/commands/uplink/GetContentByObisResponse.d.ts +16 -0
  211. package/dist/obis-observer/commands/uplink/GetContentByObisResponse.js +45 -0
  212. package/dist/obis-observer/commands/uplink/GetContentByObisResponse.js.map +1 -0
  213. package/dist/obis-observer/commands/uplink/GetContentByShortNameResponse.d.ts +16 -0
  214. package/dist/obis-observer/commands/uplink/GetContentByShortNameResponse.js +44 -0
  215. package/dist/obis-observer/commands/uplink/GetContentByShortNameResponse.js.map +1 -0
  216. package/dist/obis-observer/commands/uplink/GetContentByShortNameStringResponse.d.ts +16 -0
  217. package/dist/obis-observer/commands/uplink/GetContentByShortNameStringResponse.js +45 -0
  218. package/dist/obis-observer/commands/uplink/GetContentByShortNameStringResponse.js.map +1 -0
  219. package/dist/obis-observer/commands/uplink/GetShortNameInfoResponse.d.ts +17 -0
  220. package/dist/obis-observer/commands/uplink/GetShortNameInfoResponse.js +74 -0
  221. package/dist/obis-observer/commands/uplink/GetShortNameInfoResponse.js.map +1 -0
  222. package/dist/obis-observer/commands/uplink/GetShortNameProfileResponse.d.ts +16 -0
  223. package/dist/obis-observer/commands/uplink/GetShortNameProfileResponse.js +54 -0
  224. package/dist/obis-observer/commands/uplink/GetShortNameProfileResponse.js.map +1 -0
  225. package/dist/obis-observer/commands/uplink/GetShortNamesResponse.d.ts +16 -0
  226. package/dist/obis-observer/commands/uplink/GetShortNamesResponse.js +45 -0
  227. package/dist/obis-observer/commands/uplink/GetShortNamesResponse.js.map +1 -0
  228. package/dist/obis-observer/commands/uplink/ObservationReport.d.ts +17 -0
  229. package/dist/obis-observer/commands/uplink/ObservationReport.js +57 -0
  230. package/dist/obis-observer/commands/uplink/ObservationReport.js.map +1 -0
  231. package/dist/obis-observer/commands/uplink/ObservationReportString.d.ts +17 -0
  232. package/dist/obis-observer/commands/uplink/ObservationReportString.js +62 -0
  233. package/dist/obis-observer/commands/uplink/ObservationReportString.js.map +1 -0
  234. package/dist/obis-observer/commands/uplink/ReadArchiveResponse.d.ts +17 -0
  235. package/dist/obis-observer/commands/uplink/ReadArchiveResponse.js +61 -0
  236. package/dist/obis-observer/commands/uplink/ReadArchiveResponse.js.map +1 -0
  237. package/dist/obis-observer/commands/uplink/RebootResponse.d.ts +13 -0
  238. package/dist/obis-observer/commands/uplink/RebootResponse.js +36 -0
  239. package/dist/obis-observer/commands/uplink/RebootResponse.js.map +1 -0
  240. package/dist/obis-observer/commands/uplink/RemoveShortNameProfileResponse.d.ts +16 -0
  241. package/dist/obis-observer/commands/uplink/RemoveShortNameProfileResponse.js +43 -0
  242. package/dist/obis-observer/commands/uplink/RemoveShortNameProfileResponse.js.map +1 -0
  243. package/dist/obis-observer/commands/uplink/SetArchiveProfileResponse.d.ts +16 -0
  244. package/dist/obis-observer/commands/uplink/SetArchiveProfileResponse.js +51 -0
  245. package/dist/obis-observer/commands/uplink/SetArchiveProfileResponse.js.map +1 -0
  246. package/dist/obis-observer/commands/uplink/SetSerialPortResponse.d.ts +16 -0
  247. package/dist/obis-observer/commands/uplink/SetSerialPortResponse.js +51 -0
  248. package/dist/obis-observer/commands/uplink/SetSerialPortResponse.js.map +1 -0
  249. package/dist/obis-observer/commands/uplink/SetShortNameResponse.d.ts +16 -0
  250. package/dist/obis-observer/commands/uplink/SetShortNameResponse.js +43 -0
  251. package/dist/obis-observer/commands/uplink/SetShortNameResponse.js.map +1 -0
  252. package/dist/obis-observer/commands/uplink/index.d.ts +16 -0
  253. package/dist/obis-observer/commands/uplink/index.js +17 -0
  254. package/dist/obis-observer/commands/uplink/index.js.map +1 -0
  255. package/dist/obis-observer/constants/archiveTypes.d.ts +3 -0
  256. package/dist/obis-observer/constants/archiveTypes.js +4 -0
  257. package/dist/obis-observer/constants/archiveTypes.js.map +1 -0
  258. package/dist/obis-observer/constants/contentTypes.d.ts +3 -0
  259. package/dist/obis-observer/constants/contentTypes.js +4 -0
  260. package/dist/obis-observer/constants/contentTypes.js.map +1 -0
  261. package/dist/obis-observer/constants/directions.d.ts +2 -0
  262. package/dist/obis-observer/constants/directions.js +3 -0
  263. package/dist/obis-observer/constants/directions.js.map +1 -0
  264. package/dist/obis-observer/constants/index.d.ts +5 -0
  265. package/dist/obis-observer/constants/index.js +6 -0
  266. package/dist/obis-observer/constants/index.js.map +1 -0
  267. package/dist/obis-observer/constants/parityTypes.d.ts +3 -0
  268. package/dist/obis-observer/constants/parityTypes.js +4 -0
  269. package/dist/obis-observer/constants/parityTypes.js.map +1 -0
  270. package/dist/obis-observer/constants/resultCodes.d.ts +6 -0
  271. package/dist/obis-observer/constants/resultCodes.js +7 -0
  272. package/dist/obis-observer/constants/resultCodes.js.map +1 -0
  273. package/dist/obis-observer/index.d.ts +3 -0
  274. package/dist/obis-observer/index.js +4 -0
  275. package/dist/obis-observer/index.js.map +1 -0
  276. package/dist/obis-observer/message.d.ts +18 -0
  277. package/dist/obis-observer/message.js +58 -0
  278. package/dist/obis-observer/message.js.map +1 -0
  279. package/dist/{BinaryBuffer.d.ts → utils/BinaryBuffer.d.ts} +3 -17
  280. package/dist/{BinaryBuffer.js → utils/BinaryBuffer.js} +17 -19
  281. package/dist/utils/BinaryBuffer.js.map +1 -0
  282. package/dist/utils/bitSet.d.ts +2 -36
  283. package/dist/utils/bitSet.js +10 -36
  284. package/dist/utils/bitSet.js.map +1 -1
  285. package/dist/utils/getBytesFromHex.d.ts +0 -9
  286. package/dist/utils/getBytesFromHex.js +0 -10
  287. package/dist/utils/getBytesFromHex.js.map +1 -1
  288. package/dist/utils/getHexFromBytes.d.ts +1 -25
  289. package/dist/utils/getHexFromBytes.js +2 -16
  290. package/dist/utils/getHexFromBytes.js.map +1 -1
  291. package/dist/utils/getHexFromNumber.d.ts +3 -0
  292. package/dist/utils/getHexFromNumber.js +20 -0
  293. package/dist/utils/getHexFromNumber.js.map +1 -0
  294. package/dist/utils/index.d.ts +3 -1
  295. package/dist/utils/index.js +2 -0
  296. package/dist/utils/index.js.map +1 -1
  297. package/dist/utils/time.d.ts +0 -24
  298. package/dist/utils/time.js +0 -12
  299. package/dist/utils/time.js.map +1 -1
  300. package/package.json +13 -9
  301. package/readme.md +19 -12
  302. package/dist/BinaryBuffer.js.map +0 -1
  303. package/dist/Command.js +0 -89
  304. package/dist/Command.js.map +0 -1
  305. package/dist/CommandBinaryBuffer.js.map +0 -1
  306. package/dist/UnknownCommand.js.map +0 -1
  307. package/dist/commands/downlink/CorrectTime2000.d.ts +0 -46
  308. package/dist/commands/downlink/CorrectTime2000.js.map +0 -1
  309. package/dist/commands/downlink/GetArchiveDaysMC.d.ts +0 -45
  310. package/dist/commands/downlink/GetArchiveDaysMC.js.map +0 -1
  311. package/dist/commands/downlink/GetArchiveEvents.d.ts +0 -40
  312. package/dist/commands/downlink/GetArchiveEvents.js.map +0 -1
  313. package/dist/commands/downlink/GetArchiveHoursMC.d.ts +0 -40
  314. package/dist/commands/downlink/GetArchiveHoursMC.js.map +0 -1
  315. package/dist/commands/downlink/GetCurrentMC.d.ts +0 -26
  316. package/dist/commands/downlink/GetCurrentMC.js +0 -42
  317. package/dist/commands/downlink/GetCurrentMC.js.map +0 -1
  318. package/dist/commands/downlink/GetExAbsArchiveDaysMC.d.ts +0 -41
  319. package/dist/commands/downlink/GetExAbsArchiveDaysMC.js.map +0 -1
  320. package/dist/commands/downlink/GetExAbsArchiveHoursMC.d.ts +0 -40
  321. package/dist/commands/downlink/GetExAbsArchiveHoursMC.js.map +0 -1
  322. package/dist/commands/downlink/GetExAbsCurrentMC.d.ts +0 -27
  323. package/dist/commands/downlink/GetExAbsCurrentMC.js.map +0 -1
  324. package/dist/commands/downlink/GetLmicInfo.d.ts +0 -26
  325. package/dist/commands/downlink/GetLmicInfo.js +0 -42
  326. package/dist/commands/downlink/GetLmicInfo.js.map +0 -1
  327. package/dist/commands/downlink/GetParameter.d.ts +0 -38
  328. package/dist/commands/downlink/GetParameter.js.map +0 -1
  329. package/dist/commands/downlink/GetStatus.d.ts +0 -27
  330. package/dist/commands/downlink/GetStatus.js.map +0 -1
  331. package/dist/commands/downlink/SetParameter.d.ts +0 -30
  332. package/dist/commands/downlink/SetParameter.js.map +0 -1
  333. package/dist/commands/downlink/SetTime2000.d.ts +0 -42
  334. package/dist/commands/downlink/SetTime2000.js.map +0 -1
  335. package/dist/commands/downlink/SoftRestart.d.ts +0 -26
  336. package/dist/commands/downlink/SoftRestart.js +0 -42
  337. package/dist/commands/downlink/SoftRestart.js.map +0 -1
  338. package/dist/commands/downlink/index.js.map +0 -1
  339. package/dist/commands/index.js.map +0 -1
  340. package/dist/commands/uplink/CorrectTime2000Response.d.ts +0 -39
  341. package/dist/commands/uplink/CorrectTime2000Response.js.map +0 -1
  342. package/dist/commands/uplink/CurrentMC.js.map +0 -1
  343. package/dist/commands/uplink/DayMC.d.ts +0 -47
  344. package/dist/commands/uplink/DayMC.js.map +0 -1
  345. package/dist/commands/uplink/ExAbsCurrentMC.d.ts +0 -41
  346. package/dist/commands/uplink/ExAbsCurrentMC.js.map +0 -1
  347. package/dist/commands/uplink/ExAbsDayMC.d.ts +0 -45
  348. package/dist/commands/uplink/ExAbsDayMC.js.map +0 -1
  349. package/dist/commands/uplink/ExAbsHourMC.d.ts +0 -69
  350. package/dist/commands/uplink/ExAbsHourMC.js.map +0 -1
  351. package/dist/commands/uplink/GetArchiveDaysMCResponse.d.ts +0 -58
  352. package/dist/commands/uplink/GetArchiveDaysMCResponse.js.map +0 -1
  353. package/dist/commands/uplink/GetArchiveEventsResponse.d.ts +0 -54
  354. package/dist/commands/uplink/GetArchiveEventsResponse.js.map +0 -1
  355. package/dist/commands/uplink/GetArchiveHoursMCResponse.d.ts +0 -50
  356. package/dist/commands/uplink/GetArchiveHoursMCResponse.js.map +0 -1
  357. package/dist/commands/uplink/GetExAbsArchiveDaysMCResponse.d.ts +0 -47
  358. package/dist/commands/uplink/GetExAbsArchiveDaysMCResponse.js.map +0 -1
  359. package/dist/commands/uplink/GetExAbsArchiveHoursMCResponse.js.map +0 -1
  360. package/dist/commands/uplink/GetLmicInfoResponse.d.ts +0 -52
  361. package/dist/commands/uplink/GetLmicInfoResponse.js.map +0 -1
  362. package/dist/commands/uplink/GetParameterResponse.d.ts +0 -35
  363. package/dist/commands/uplink/GetParameterResponse.js.map +0 -1
  364. package/dist/commands/uplink/HourMC.d.ts +0 -48
  365. package/dist/commands/uplink/HourMC.js.map +0 -1
  366. package/dist/commands/uplink/LastEvent.d.ts +0 -54
  367. package/dist/commands/uplink/LastEvent.js.map +0 -1
  368. package/dist/commands/uplink/NewEvent.js.map +0 -1
  369. package/dist/commands/uplink/SetTime2000Response.d.ts +0 -38
  370. package/dist/commands/uplink/SetTime2000Response.js.map +0 -1
  371. package/dist/commands/uplink/SoftRestartResponse.d.ts +0 -28
  372. package/dist/commands/uplink/SoftRestartResponse.js +0 -44
  373. package/dist/commands/uplink/SoftRestartResponse.js.map +0 -1
  374. package/dist/commands/uplink/Status.d.ts +0 -55
  375. package/dist/commands/uplink/Status.js.map +0 -1
  376. package/dist/commands/uplink/Time2000.d.ts +0 -43
  377. package/dist/commands/uplink/Time2000.js.map +0 -1
  378. package/dist/commands/uplink/index.js.map +0 -1
  379. package/dist/constants/deviceParameters.d.ts +0 -53
  380. package/dist/constants/deviceParameters.js +0 -54
  381. package/dist/constants/deviceParameters.js.map +0 -1
  382. package/dist/constants/directions.js.map +0 -1
  383. package/dist/constants/events.d.ts +0 -42
  384. package/dist/constants/events.js +0 -43
  385. package/dist/constants/events.js.map +0 -1
  386. package/dist/constants/hardwareTypes.d.ts +0 -108
  387. package/dist/constants/hardwareTypes.js +0 -109
  388. package/dist/constants/hardwareTypes.js.map +0 -1
  389. package/dist/constants/index.js.map +0 -1
  390. package/dist/constants/rx2SpreadFactors.js.map +0 -1
  391. package/dist/utils/header.js.map +0 -1
  392. package/dist/utils/message.js.map +0 -1
  393. /package/dist/{constants → analog/constants}/directions.d.ts +0 -0
  394. /package/dist/{constants → analog/constants}/directions.js +0 -0
  395. /package/dist/{constants → analog/constants}/index.d.ts +0 -0
  396. /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,295 +1,129 @@
1
- import BinaryBuffer from './BinaryBuffer.js';
2
- import { TTime2000 } from './utils/time.js';
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
- * Scan config for pulse devices.
283
- * deviceParameters.PULSE_CHANNELS_SCAN_CONFIG = `31`
284
- */
285
122
  interface IParameterPulseChannelsScanConfig {
123
+ channelList: Array<number>;
286
124
  pullUpTime: number;
287
125
  scanTime: number;
288
126
  }
289
- /**
290
- * Set channels for pulse devices.
291
- * deviceParameters.PULSE_CHANNELS_SET_CONFIG = `32`
292
- */
293
127
  interface IParameterPulseChannelsSetConfig {
294
128
  channel1: boolean;
295
129
  channel2: boolean;
@@ -302,22 +136,7 @@ export interface IParameter {
302
136
  }
303
137
  export type TEventStatus = IEventGasStatus | IEvent2ChannelStatus | IEventElimpStatus | IEvent4ChannelStatus | IEventMtxStatus;
304
138
  type TParameterData = IParameterReportingDataInterval | IParameterReportingDataType | IParameterDayCheckoutHour | IParameterDeliveryTypeOfPriorityData | IParameterActivationMethod | IParameterBatteryDepassivationInfo | IParameterBatteryMinimalLoadTime | IParameterChannelsConfig | IParameterRx2Config | IParameterAbsoluteData | IParameterAbsoluteDataEnable | IParameterSerialNumber | IParameterGeolocation | IParameterAbsoluteDataMC | IParameterAbsoluteDataEnableMC | IParameterPulseChannelsScanConfig | IParameterPulseChannelsSetConfig;
305
- /**
306
- * Command specific byte array manipulation.
307
- */
308
139
  declare class CommandBinaryBuffer extends BinaryBuffer {
309
- /**
310
- * Get the number of bytes necessary to store an extended value.
311
- *
312
- * @param bits - the number of bits of original value
313
- *
314
- * @example
315
- * ```js
316
- * const bits = (16384).toString(2).length;
317
- * const bytes = CommandBinaryBuffer.getExtendedValueSize(bits);
318
- * // 16384 normally is stored in 2 bytes but for extended value 3 bytes are required
319
- * ```
320
- */
321
140
  static getExtendedValueSize(bits: number): number;
322
141
  static getParameterSize(parameter: IParameter): number;
323
142
  setInt12(value: number, isLittleEndian?: boolean): void;
@@ -326,34 +145,10 @@ declare class CommandBinaryBuffer extends BinaryBuffer {
326
145
  getUint12(isLittleEndian?: boolean): number;
327
146
  getExtendedValue(): number;
328
147
  setExtendedValue(value: number): void;
329
- /**
330
- * Get array of channel indexes.
331
- */
332
148
  getChannels(): Array<number>;
333
- /**
334
- * Set array of channel indexes.
335
- */
336
149
  setChannels(channelList: Array<IChannel>): void;
337
- /**
338
- * Retrieve device time from byte array.
339
- *
340
- * @example
341
- * ['00101111', '10010111'] -> [47, 151] will be '2023-12-23'
342
- *
343
- * @returns Date object instance
344
- */
345
150
  getDate(): Date;
346
- /**
347
- * Convert date or seconds to bytes.
348
- * '2023-12-23' will be 0010111-1100-10111, so bytes: ['00101111', '10010111'] -> [47, 151]
349
- */
350
151
  setDate(dateOrTime: Date | TTime2000): void;
351
- /**
352
- * Retrieve device time from byte array.
353
- *
354
- * @example
355
- * 0xb8 = 0b10111000 will be {hours: 0b101, hour: 0b11000} i.e. {hours: 5, hour: 24}
356
- */
357
152
  getHours(): {
358
153
  hours: number;
359
154
  hour: number;
@@ -1,9 +1,9 @@
1
- import BinaryBuffer from './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';
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));
@@ -693,6 +619,7 @@ class CommandBinaryBuffer extends BinaryBuffer {
693
619
  }
694
620
  getParameterPulseChannelsScanConfig() {
695
621
  return {
622
+ channelList: this.getChannels(),
696
623
  pullUpTime: this.getUint8(),
697
624
  scanTime: this.getUint8()
698
625
  };
@@ -704,6 +631,7 @@ class CommandBinaryBuffer extends BinaryBuffer {
704
631
  if (parameter.scanTime < 15) {
705
632
  throw new Error('minimal value for scanTime - 15');
706
633
  }
634
+ this.setChannels(parameter.channelList.map(index => ({ index })));
707
635
  this.setUint8(parameter.pullUpTime);
708
636
  this.setUint8(parameter.scanTime);
709
637
  }