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
@@ -1,12 +1,10 @@
1
- import Command from '../Command.js';
2
- import { IHexFormatOptions } from './getHexFromBytes.js';
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
- * Calculate LRC
22
- *
23
- * @param data - byte array
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, direction?: number, hardwareType?: number) => IMessage;
29
- export declare const fromHex: (data: string, direction?: number, hardwareType?: number) => IMessage;
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
- /* eslint-disable @typescript-eslint/no-unnecessary-condition */
2
- import UnknownCommand from '../UnknownCommand.js';
3
- import * as downlinkCommands from '../commands/downlink/index.js';
4
- import * as uplinkCommands from '../commands/uplink/index.js';
5
- import * as directionTypes from '../constants/directions.js';
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 './getBytesFromHex.js';
9
- import getHexFromBytes from './getHexFromBytes.js';
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
- // uplink should be more often
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, direction = AUTO, hardwareType) => {
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, direction = AUTO, hardwareType) => (fromBytes(getBytesFromHex(data), direction, hardwareType));
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","sourceRoot":"","sources":["../../src/analog/message.ts"],"names":[],"mappings":"AAGA,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,gBAAgB,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAE7D,OAAO,KAAK,cAAc,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,2BAA2B,CAAC;AAEjE,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAC1D,OAAO,eAAe,MAAM,6BAA6B,CAAC;AA4B1D,MAAM,eAAe,GAAG,CAAC,CAAC;AAG1B,MAAM,gBAAgB,GAAgB,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;AAGrF,MAAM,oBAAoB,GAAG,MAAM,CAAC,WAAW,CAC3C,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAC/D,CAAC;AACF,MAAM,kBAAkB,GAAG,MAAM,CAAC,WAAW,CACzC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAC7D,CAAC;AAUF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EAAE,EAAE,CAAC,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAGzF,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;IAC/C,IAAI,MAAM,GAAG,CAAC,CAAC;IAGf,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAClB,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,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"}
@@ -0,0 +1,5 @@
1
+ export interface IHexFormatOptions {
2
+ separator?: string;
3
+ prefix?: string;
4
+ }
5
+ export declare const hexFormatOptions: IHexFormatOptions;
package/dist/config.js ADDED
@@ -0,0 +1,5 @@
1
+ export const hexFormatOptions = {
2
+ separator: ' ',
3
+ prefix: ''
4
+ };
5
+ //# sourceMappingURL=config.js.map
@@ -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 commands from './commands/index.js';
2
- export * as message from './utils/message.js';
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 constants from './constants/index.js';
4
+ export * as config from './config.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- export * as commands from './commands/index.js';
2
- export * as message from './utils/message.js';
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 constants from './constants/index.js';
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,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC"}
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 './utils/getHexFromBytes.js';
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
- /** Get command ID in hex format. */
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,wBAAwB,EAAE,CAAC;CAC9B,CAAC;AAMF,MAAM,mBAAoB,SAAQ,YAAY;IAC1C,YAAc,YAA0C;QAEpD,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,CAAC,WAAW,CAAG,IAAW;QAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAuB,CAAC;QAErD,OAA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 @@
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;