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,51 @@
1
+ import Command from '../../Command.js';
2
+ import CommandBinaryBuffer, { REQUEST_ID_SIZE } from '../../CommandBinaryBuffer.js';
3
+ import { UPLINK } from '../../constants/directions.js';
4
+ import { resultCodes } from '../../constants/index.js';
5
+ const COMMAND_ID = 0x10;
6
+ const COMMAND_SIZE = REQUEST_ID_SIZE + 1;
7
+ const examples = [
8
+ {
9
+ name: 'successful request',
10
+ parameters: {
11
+ requestId: 156,
12
+ resultCode: resultCodes.OK
13
+ },
14
+ hex: { header: '10', body: '9c 00' }
15
+ },
16
+ {
17
+ name: 'failed request',
18
+ parameters: {
19
+ requestId: 49,
20
+ resultCode: resultCodes.PROFILE_NOT_FOUND
21
+ },
22
+ hex: { header: '10', body: '31 05' }
23
+ }
24
+ ];
25
+ class SetArchiveProfileResponse extends Command {
26
+ constructor(parameters) {
27
+ super();
28
+ this.parameters = parameters;
29
+ this.size = COMMAND_SIZE;
30
+ }
31
+ static fromBytes(data) {
32
+ const buffer = new CommandBinaryBuffer(data);
33
+ return new SetArchiveProfileResponse({
34
+ requestId: buffer.getUint8(),
35
+ resultCode: buffer.getUint8()
36
+ });
37
+ }
38
+ toBytes() {
39
+ const buffer = new CommandBinaryBuffer(COMMAND_SIZE);
40
+ const { requestId, resultCode } = this.parameters;
41
+ buffer.setUint8(requestId);
42
+ buffer.setUint8(resultCode);
43
+ return Command.toBytes(COMMAND_ID, buffer.toUint8Array());
44
+ }
45
+ }
46
+ SetArchiveProfileResponse.id = COMMAND_ID;
47
+ SetArchiveProfileResponse.directionType = UPLINK;
48
+ SetArchiveProfileResponse.examples = examples;
49
+ SetArchiveProfileResponse.hasParameters = true;
50
+ export default SetArchiveProfileResponse;
51
+ //# sourceMappingURL=SetArchiveProfileResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SetArchiveProfileResponse.js","sourceRoot":"","sources":["../../../../src/obis-observer/commands/uplink/SetArchiveProfileResponse.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,kBAAkB,CAAC;AAC9D,OAAO,mBAAmB,EAAE,EAAC,eAAe,EAAqB,MAAM,8BAA8B,CAAC;AACtG,OAAO,EAAC,MAAM,EAAC,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAWrD,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,YAAY,GAAG,eAAe,GAAG,CAAC,CAAC;AAEzC,MAAM,QAAQ,GAAwB;IAClC;QACI,IAAI,EAAE,oBAAoB;QAC1B,UAAU,EAAE;YACR,SAAS,EAAE,GAAG;YACd,UAAU,EAAE,WAAW,CAAC,EAAE;SAC7B;QACD,GAAG,EAAE,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAC;KACrC;IACD;QACI,IAAI,EAAE,gBAAgB;QACtB,UAAU,EAAE;YACR,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,WAAW,CAAC,iBAAiB;SAC5C;QACD,GAAG,EAAE,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAC;KACrC;CACJ,CAAC;AAuBF,MAAM,yBAA0B,SAAQ,OAAO;IAC3C,YAAqB,UAAgD;QACjE,KAAK,EAAE,CAAC;QADS,eAAU,GAAV,UAAU,CAAsC;QAGjE,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,yBAAyB,CAAC;YACjC,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAE;YAC5B,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE;SAChC,CAAC,CAAC;IACP,CAAC;IAGD,OAAO;QACH,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,YAAY,CAAC,CAAC;QACrD,MAAM,EAAC,SAAS,EAAE,UAAU,EAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAEhD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC3B,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAE5B,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;;AA5Be,4BAAE,GAAG,UAAU,CAAC;AAEhB,uCAAa,GAAG,MAAM,CAAC;AAEvB,kCAAQ,GAAG,QAAQ,CAAC;AAEpB,uCAAa,GAAG,IAAI,CAAC;AA0BzC,eAAe,yBAAyB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import Command, { TCommandExampleList } from '../../Command.js';
2
+ import { ICommandParameters } from '../../CommandBinaryBuffer.js';
3
+ interface ISetSerialPortResponseParameters extends ICommandParameters {
4
+ resultCode: number;
5
+ }
6
+ declare class SetSerialPortResponse extends Command {
7
+ parameters: ISetSerialPortResponseParameters;
8
+ constructor(parameters: ISetSerialPortResponseParameters);
9
+ static readonly id = 20;
10
+ static readonly directionType = 2;
11
+ static readonly examples: TCommandExampleList;
12
+ static readonly hasParameters = true;
13
+ static fromBytes(data: Uint8Array): SetSerialPortResponse;
14
+ toBytes(): Uint8Array;
15
+ }
16
+ export default SetSerialPortResponse;
@@ -0,0 +1,51 @@
1
+ import Command from '../../Command.js';
2
+ import CommandBinaryBuffer, { REQUEST_ID_SIZE } from '../../CommandBinaryBuffer.js';
3
+ import { UPLINK } from '../../constants/directions.js';
4
+ import { resultCodes } from '../../constants/index.js';
5
+ const COMMAND_ID = 0x14;
6
+ const COMMAND_SIZE = REQUEST_ID_SIZE + 1;
7
+ const examples = [
8
+ {
9
+ name: 'set serial port settings - succeed',
10
+ parameters: {
11
+ requestId: 32,
12
+ resultCode: resultCodes.OK
13
+ },
14
+ hex: { header: '14', body: '20 00' }
15
+ },
16
+ {
17
+ name: 'set serial port settings - failed',
18
+ parameters: {
19
+ requestId: 32,
20
+ resultCode: resultCodes.FAILURE
21
+ },
22
+ hex: { header: '14', body: '20 01' }
23
+ }
24
+ ];
25
+ class SetSerialPortResponse extends Command {
26
+ constructor(parameters) {
27
+ super();
28
+ this.parameters = parameters;
29
+ this.size = COMMAND_SIZE;
30
+ }
31
+ static fromBytes(data) {
32
+ const buffer = new CommandBinaryBuffer(data);
33
+ return new SetSerialPortResponse({
34
+ requestId: buffer.getUint8(),
35
+ resultCode: buffer.getUint8()
36
+ });
37
+ }
38
+ toBytes() {
39
+ const buffer = new CommandBinaryBuffer(COMMAND_SIZE);
40
+ const { requestId, resultCode } = this.parameters;
41
+ buffer.setUint8(requestId);
42
+ buffer.setUint8(resultCode);
43
+ return Command.toBytes(COMMAND_ID, buffer.toUint8Array());
44
+ }
45
+ }
46
+ SetSerialPortResponse.id = COMMAND_ID;
47
+ SetSerialPortResponse.directionType = UPLINK;
48
+ SetSerialPortResponse.examples = examples;
49
+ SetSerialPortResponse.hasParameters = true;
50
+ export default SetSerialPortResponse;
51
+ //# sourceMappingURL=SetSerialPortResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SetSerialPortResponse.js","sourceRoot":"","sources":["../../../../src/obis-observer/commands/uplink/SetSerialPortResponse.ts"],"names":[],"mappings":"AAAA,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UAAU,EAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAEhD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC3B,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAE5B,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;;AA5Be,wBAAE,GAAG,UAAU,CAAC;AAEhB,mCAAa,GAAG,MAAM,CAAC;AAEvB,8BAAQ,GAAG,QAAQ,CAAC;AAEpB,mCAAa,GAAG,IAAI,CAAC;AA0BzC,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import Command, { TCommandExampleList } from '../../Command.js';
2
+ import { ICommandParameters } from '../../CommandBinaryBuffer.js';
3
+ interface ISetShortNameResponseParameters extends ICommandParameters {
4
+ resultCode: number;
5
+ }
6
+ declare class SetShortNameResponse extends Command {
7
+ parameters: ISetShortNameResponseParameters;
8
+ constructor(parameters: ISetShortNameResponseParameters);
9
+ static readonly id = 4;
10
+ static readonly directionType = 2;
11
+ static readonly examples: TCommandExampleList;
12
+ static readonly hasParameters = true;
13
+ static fromBytes(data: Uint8Array): SetShortNameResponse;
14
+ toBytes(): Uint8Array;
15
+ }
16
+ export default SetShortNameResponse;
@@ -0,0 +1,43 @@
1
+ import Command from '../../Command.js';
2
+ import CommandBinaryBuffer, { REQUEST_ID_SIZE } from '../../CommandBinaryBuffer.js';
3
+ import { UPLINK } from '../../constants/directions.js';
4
+ import { resultCodes } from '../../constants/index.js';
5
+ const COMMAND_ID = 0x04;
6
+ const COMMAND_SIZE = 1 + REQUEST_ID_SIZE;
7
+ const examples = [
8
+ {
9
+ name: 'set short name - succeed',
10
+ parameters: {
11
+ requestId: 2,
12
+ resultCode: resultCodes.OK
13
+ },
14
+ hex: { header: '04', body: '02 00' }
15
+ }
16
+ ];
17
+ class SetShortNameResponse extends Command {
18
+ constructor(parameters) {
19
+ super();
20
+ this.parameters = parameters;
21
+ this.size = COMMAND_SIZE;
22
+ }
23
+ static fromBytes(data) {
24
+ const buffer = new CommandBinaryBuffer(data);
25
+ return new SetShortNameResponse({
26
+ requestId: buffer.getUint8(),
27
+ resultCode: buffer.getUint8()
28
+ });
29
+ }
30
+ toBytes() {
31
+ const buffer = new CommandBinaryBuffer(COMMAND_SIZE);
32
+ const { requestId, resultCode } = this.parameters;
33
+ buffer.setUint8(requestId);
34
+ buffer.setUint8(resultCode);
35
+ return Command.toBytes(COMMAND_ID, buffer.toUint8Array());
36
+ }
37
+ }
38
+ SetShortNameResponse.id = COMMAND_ID;
39
+ SetShortNameResponse.directionType = UPLINK;
40
+ SetShortNameResponse.examples = examples;
41
+ SetShortNameResponse.hasParameters = true;
42
+ export default SetShortNameResponse;
43
+ //# sourceMappingURL=SetShortNameResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SetShortNameResponse.js","sourceRoot":"","sources":["../../../../src/obis-observer/commands/uplink/SetShortNameResponse.ts"],"names":[],"mappings":"AAAA,OAAO,OAA8B,MAAM,kBAAkB,CAAC;AAC9D,OAAO,mBAAmB,EAAE,EAAC,eAAe,EAAqB,MAAM,8BAA8B,CAAC;AACtG,OAAO,EAAC,MAAM,EAAC,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAWrD,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,YAAY,GAAG,CAAC,GAAG,eAAe,CAAC;AAEzC,MAAM,QAAQ,GAAwB;IAClC;QACI,IAAI,EAAE,0BAA0B;QAChC,UAAU,EAAE;YACR,SAAS,EAAE,CAAC;YACZ,UAAU,EAAE,WAAW,CAAC,EAAE;SAC7B;QACD,GAAG,EAAE,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAC;KACrC;CACJ,CAAC;AAuBF,MAAM,oBAAqB,SAAQ,OAAO;IACtC,YAAqB,UAA2C;QAC5D,KAAK,EAAE,CAAC;QADS,eAAU,GAAV,UAAU,CAAiC;QAG5D,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,oBAAoB,CAAC;YAC5B,SAAS,EAAE,MAAM,CAAC,QAAQ,EAAE;YAC5B,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE;SAChC,CAAC,CAAC;IACP,CAAC;IAGD,OAAO;QACH,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,YAAY,CAAC,CAAC;QACrD,MAAM,EAAC,SAAS,EAAE,UAAU,EAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAEhD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QAC3B,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QAE5B,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IAC9D,CAAC;;AA5Be,uBAAE,GAAG,UAAU,CAAC;AAEhB,kCAAa,GAAG,MAAM,CAAC;AAEvB,6BAAQ,GAAG,QAAQ,CAAC;AAEpB,kCAAa,GAAG,IAAI,CAAC;AA0BzC,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,16 @@
1
+ export { default as AddShortNameProfileResponse } from './AddShortNameProfileResponse.js';
2
+ export { default as GetArchiveProfileResponse } from './GetArchiveProfileResponse.js';
3
+ export { default as GetContentByObisResponse } from './GetContentByObisResponse.js';
4
+ export { default as GetContentByShortNameResponse } from './GetContentByShortNameResponse.js';
5
+ export { default as GetContentByShortNameStringResponse } from './GetContentByShortNameStringResponse.js';
6
+ export { default as GetShortNameInfoResponse } from './GetShortNameInfoResponse.js';
7
+ export { default as GetShortNameProfileResponse } from './GetShortNameProfileResponse.js';
8
+ export { default as GetShortNamesResponse } from './GetShortNamesResponse.js';
9
+ export { default as ObservationReport } from './ObservationReport.js';
10
+ export { default as ObservationReportString } from './ObservationReportString.js';
11
+ export { default as ReadArchiveResponse } from './ReadArchiveResponse.js';
12
+ export { default as RebootResponse } from './RebootResponse.js';
13
+ export { default as RemoveShortNameProfileResponse } from './RemoveShortNameProfileResponse.js';
14
+ export { default as SetArchiveProfileResponse } from './SetArchiveProfileResponse.js';
15
+ export { default as SetSerialPortResponse } from './SetSerialPortResponse.js';
16
+ export { default as SetShortNameResponse } from './SetShortNameResponse.js';
@@ -0,0 +1,17 @@
1
+ export { default as AddShortNameProfileResponse } from './AddShortNameProfileResponse.js';
2
+ export { default as GetArchiveProfileResponse } from './GetArchiveProfileResponse.js';
3
+ export { default as GetContentByObisResponse } from './GetContentByObisResponse.js';
4
+ export { default as GetContentByShortNameResponse } from './GetContentByShortNameResponse.js';
5
+ export { default as GetContentByShortNameStringResponse } from './GetContentByShortNameStringResponse.js';
6
+ export { default as GetShortNameInfoResponse } from './GetShortNameInfoResponse.js';
7
+ export { default as GetShortNameProfileResponse } from './GetShortNameProfileResponse.js';
8
+ export { default as GetShortNamesResponse } from './GetShortNamesResponse.js';
9
+ export { default as ObservationReport } from './ObservationReport.js';
10
+ export { default as ObservationReportString } from './ObservationReportString.js';
11
+ export { default as ReadArchiveResponse } from './ReadArchiveResponse.js';
12
+ export { default as RebootResponse } from './RebootResponse.js';
13
+ export { default as RemoveShortNameProfileResponse } from './RemoveShortNameProfileResponse.js';
14
+ export { default as SetArchiveProfileResponse } from './SetArchiveProfileResponse.js';
15
+ export { default as SetSerialPortResponse } from './SetSerialPortResponse.js';
16
+ export { default as SetShortNameResponse } from './SetShortNameResponse.js';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/obis-observer/commands/uplink/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,OAAO,IAAI,2BAA2B,EAAC,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAC,OAAO,IAAI,yBAAyB,EAAC,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAC,OAAO,IAAI,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAC,OAAO,IAAI,6BAA6B,EAAC,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EAAC,OAAO,IAAI,mCAAmC,EAAC,MAAM,0CAA0C,CAAC;AACxG,OAAO,EAAC,OAAO,IAAI,wBAAwB,EAAC,MAAM,+BAA+B,CAAC;AAClF,OAAO,EAAC,OAAO,IAAI,2BAA2B,EAAC,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAC,OAAO,IAAI,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAC,OAAO,IAAI,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAC,OAAO,IAAI,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAC,OAAO,IAAI,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AACxE,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAC,OAAO,IAAI,8BAA8B,EAAC,MAAM,qCAAqC,CAAC;AAC9F,OAAO,EAAC,OAAO,IAAI,yBAAyB,EAAC,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAC,OAAO,IAAI,qBAAqB,EAAC,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAC,OAAO,IAAI,oBAAoB,EAAC,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const NONE = 0;
2
+ export declare const DETAILED = 1;
3
+ export declare const SUMMARY = 2;
@@ -0,0 +1,4 @@
1
+ export const NONE = 0;
2
+ export const DETAILED = 1;
3
+ export const SUMMARY = 2;
4
+ //# sourceMappingURL=archiveTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"archiveTypes.js","sourceRoot":"","sources":["../../../src/obis-observer/constants/archiveTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC;AACtB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC;AAC1B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const AUTO = 0;
2
+ export declare const FLOAT = 1;
3
+ export declare const STRING = 2;
@@ -0,0 +1,4 @@
1
+ export const AUTO = 0;
2
+ export const FLOAT = 1;
3
+ export const STRING = 2;
4
+ //# sourceMappingURL=contentTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contentTypes.js","sourceRoot":"","sources":["../../../src/obis-observer/constants/contentTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC;AACtB,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC;AACvB,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const DOWNLINK = 1;
2
+ export declare const UPLINK = 2;
@@ -0,0 +1,3 @@
1
+ export const DOWNLINK = 1;
2
+ export const UPLINK = 2;
3
+ //# sourceMappingURL=directions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directions.js","sourceRoot":"","sources":["../../../src/obis-observer/constants/directions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC;AAC1B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * as archiveTypes from './archiveTypes.js';
2
+ export * as contentTypes from './contentTypes.js';
3
+ export * as directions from './directions.js';
4
+ export * as parityTypes from './parityTypes.js';
5
+ export * as resultCodes from './resultCodes.js';
@@ -0,0 +1,6 @@
1
+ export * as archiveTypes from './archiveTypes.js';
2
+ export * as contentTypes from './contentTypes.js';
3
+ export * as directions from './directions.js';
4
+ export * as parityTypes from './parityTypes.js';
5
+ export * as resultCodes from './resultCodes.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/obis-observer/constants/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const NONE = 0;
2
+ export declare const ODD = 1;
3
+ export declare const EVEN = 2;
@@ -0,0 +1,4 @@
1
+ export const NONE = 0;
2
+ export const ODD = 1;
3
+ export const EVEN = 2;
4
+ //# sourceMappingURL=parityTypes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parityTypes.js","sourceRoot":"","sources":["../../../src/obis-observer/constants/parityTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC;AACtB,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;AACrB,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const OK = 0;
2
+ export declare const FAILURE = 1;
3
+ export declare const FORBIDDEN_TO_REASSIGN = 2;
4
+ export declare const SHORT_NAME_LIMIT_EXCEEDED = 3;
5
+ export declare const SHORT_NAME_NOT_FOUND = 4;
6
+ export declare const PROFILE_NOT_FOUND = 5;
@@ -0,0 +1,7 @@
1
+ export const OK = 0;
2
+ export const FAILURE = 1;
3
+ export const FORBIDDEN_TO_REASSIGN = 2;
4
+ export const SHORT_NAME_LIMIT_EXCEEDED = 3;
5
+ export const SHORT_NAME_NOT_FOUND = 4;
6
+ export const PROFILE_NOT_FOUND = 5;
7
+ //# sourceMappingURL=resultCodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resultCodes.js","sourceRoot":"","sources":["../../../src/obis-observer/constants/resultCodes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACpB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AACzB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AACvC,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * as commands from './commands/index.js';
2
+ export * as message from './message.js';
3
+ export * as constants from './constants/index.js';
@@ -0,0 +1,4 @@
1
+ export * as commands from './commands/index.js';
2
+ export * as message from './message.js';
3
+ export * as constants from './constants/index.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/obis-observer/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import Command from './Command.js';
2
+ import { IHexFormatOptions } from '../config.js';
3
+ interface IMessageCommand {
4
+ data: {
5
+ header: Uint8Array;
6
+ body: Uint8Array;
7
+ };
8
+ command: Command;
9
+ }
10
+ interface IMessage {
11
+ commands: Array<IMessageCommand>;
12
+ isValid: boolean;
13
+ }
14
+ export declare const fromBytes: (commandsData: Uint8Array) => IMessage;
15
+ export declare const fromHex: (data: string) => IMessage;
16
+ export declare const toBytes: (commands: Array<Command>) => Uint8Array;
17
+ export declare const toHex: (commands: Array<Command>, options?: IHexFormatOptions) => string;
18
+ export {};
@@ -0,0 +1,58 @@
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 getBytesFromHex from '../utils/getBytesFromHex.js';
5
+ import getHexFromBytes from '../utils/getHexFromBytes.js';
6
+ const HEADER_SIZE = 1;
7
+ const downlinkCommandsById = Object.fromEntries(Object.values(downlinkCommands).map(item => [item.id, item]));
8
+ const uplinkCommandsById = Object.fromEntries(Object.values(uplinkCommands).map(item => [item.id, item]));
9
+ const getCommand = (id, data) => {
10
+ const command = downlinkCommandsById[id] || uplinkCommandsById[id];
11
+ if (command) {
12
+ return command.fromBytes(data);
13
+ }
14
+ return new UnknownCommand({ id, data });
15
+ };
16
+ export const fromBytes = (commandsData) => {
17
+ const commands = [];
18
+ const result = {
19
+ commands,
20
+ isValid: true
21
+ };
22
+ let position = 0;
23
+ do {
24
+ const headerData = commandsData.slice(position, position + HEADER_SIZE);
25
+ const bodyData = commandsData.slice(position + HEADER_SIZE);
26
+ position += HEADER_SIZE;
27
+ const command = getCommand(headerData[0], bodyData);
28
+ commands.push({
29
+ data: { header: headerData, body: bodyData },
30
+ command
31
+ });
32
+ if (command instanceof UnknownCommand) {
33
+ break;
34
+ }
35
+ else if (typeof command.size === 'number') {
36
+ position += command.size;
37
+ }
38
+ else {
39
+ result.isValid = false;
40
+ break;
41
+ }
42
+ } while (position < commandsData.length);
43
+ return result;
44
+ };
45
+ export const fromHex = (data) => (fromBytes(getBytesFromHex(data)));
46
+ export const toBytes = (commands) => {
47
+ const arrays = commands.map(command => command.toBytes());
48
+ const totalLength = arrays.reduce((accumulator, item) => (accumulator + item.length), 0);
49
+ const result = new Uint8Array(totalLength);
50
+ let offset = 0;
51
+ arrays.forEach(item => {
52
+ result.set(item, offset);
53
+ offset += item.length;
54
+ });
55
+ return result;
56
+ };
57
+ export const toHex = (commands, options = {}) => getHexFromBytes(toBytes(commands), options);
58
+ //# sourceMappingURL=message.js.map
@@ -0,0 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zF,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAC;IAC3C,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;IAEH,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"}
@@ -1,17 +1,8 @@
1
- import { IHexFormatOptions } from './utils/getHexFromBytes.js';
2
- /**
3
- * Byte array manipulation.
4
- */
1
+ import { IHexFormatOptions } from '../config.js';
5
2
  declare class BinaryBuffer {
6
3
  data: ArrayBuffer;
7
4
  offset: number;
8
5
  isLittleEndian: boolean;
9
- /**
10
- * Create a buffer stream.
11
- *
12
- * @param data - the instance of Uint8Array or ArrayBuffer size
13
- * @param isLittleEndian - if true then little endian will be used, big endian otherwise
14
- */
15
6
  constructor(dataOrLength: Uint8Array | number | string, isLittleEndian?: boolean);
16
7
  toHex(options?: IHexFormatOptions): string;
17
8
  toUint8Array(): Uint8Array;
@@ -34,13 +25,8 @@ declare class BinaryBuffer {
34
25
  getUint32(isLittleEndian?: boolean): number;
35
26
  setFloat32(value: number, isLittleEndian?: boolean): void;
36
27
  getFloat32(isLittleEndian?: boolean): number;
37
- /**
38
- * Get bytes from start to offset.
39
- *
40
- * @param offset - current offset by default
41
- *
42
- * @returns sliced byte array
43
- */
28
+ setString(value: string): void;
29
+ getString(): string;
44
30
  getBytesToOffset(offset?: number): Uint8Array;
45
31
  }
46
32
  export default BinaryBuffer;
@@ -1,6 +1,5 @@
1
- import getBytesFromHex from './utils/getBytesFromHex.js';
2
- import getHexFromBytes from './utils/getHexFromBytes.js';
3
- // the number of bytes
1
+ import getBytesFromHex from './getBytesFromHex.js';
2
+ import getHexFromBytes from './getHexFromBytes.js';
4
3
  const INT8_SIZE = 1;
5
4
  const INT16_SIZE = 2;
6
5
  const INT32_SIZE = 4;
@@ -10,16 +9,7 @@ const createView = (buffer, numberSize) => {
10
9
  }
11
10
  return new DataView(buffer.data, buffer.offset, numberSize);
12
11
  };
13
- /**
14
- * Byte array manipulation.
15
- */
16
12
  class BinaryBuffer {
17
- /**
18
- * Create a buffer stream.
19
- *
20
- * @param data - the instance of Uint8Array or ArrayBuffer size
21
- * @param isLittleEndian - if true then little endian will be used, big endian otherwise
22
- */
23
13
  constructor(dataOrLength, isLittleEndian = true) {
24
14
  if (typeof dataOrLength === 'number') {
25
15
  this.data = new ArrayBuffer(dataOrLength);
@@ -121,13 +111,21 @@ class BinaryBuffer {
121
111
  this.offset += INT32_SIZE;
122
112
  return result;
123
113
  }
124
- /**
125
- * Get bytes from start to offset.
126
- *
127
- * @param offset - current offset by default
128
- *
129
- * @returns sliced byte array
130
- */
114
+ setString(value) {
115
+ this.setUint8(value.length);
116
+ for (let index = 0; index < value.length; ++index) {
117
+ this.setUint8(value.charCodeAt(index));
118
+ }
119
+ }
120
+ getString() {
121
+ const size = this.getUint8();
122
+ const endIndex = this.offset + size;
123
+ const chars = [];
124
+ while (this.offset < endIndex) {
125
+ chars.push(String.fromCharCode(this.getUint8()));
126
+ }
127
+ return chars.join('');
128
+ }
131
129
  getBytesToOffset(offset = this.offset) {
132
130
  const bytes = this.toUint8Array();
133
131
  return bytes.slice(0, offset);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BinaryBuffer.js","sourceRoot":"","sources":["../../src/utils/BinaryBuffer.ts"],"names":[],"mappings":"AACA,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,eAAe,MAAM,sBAAsB,CAAC;AAInD,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM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C;IAED,SAAS;QACL,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACpC,MAAM,KAAK,GAAG,EAAE,CAAC;QAEjB,OAAQ,IAAI,CAAC,MAAM,GAAG,QAAQ,EAAG;YAC7B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;SACpD;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IASD,gBAAgB,CAAG,MAAM,GAAG,IAAI,CAAC,MAAM;QACnC,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAElC,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;CACJ;AAGD,eAAe,YAAY,CAAC"}
@@ -1,40 +1,6 @@
1
1
  export type TBitSetMask = Record<string, number>;
2
2
  export type TBooleanObject = Record<string, boolean>;
3
- /**
4
- * Get integer number from object with boolean values values according to the given bit mask.
5
- *
6
- * @example
7
- * ```js
8
- * const bitMask: bitSet.TBitSetMask = {
9
- * a: 2 ** 0,
10
- * b: 2 ** 1,
11
- * c: 2 ** 2,
12
- * d: 2 ** 3,
13
- * g: 2 ** 6
14
- * };
15
- *
16
- * const result = fromObject(bitMask, {a: true, b: true, c: false, d: true, e: true, f: false, g: true});
17
- * console.log(result.toString(2));
18
- * // 1001011
19
- * ```
20
- */
21
3
  export declare const fromObject: (bitMask?: TBitSetMask, booleanObject?: TBooleanObject) => number;
22
- /**
23
- * Get object with boolean values values from integer number according to the given bit mask.
24
- *
25
- * @example
26
- * ```js
27
- * const bitMask: bitSet.TBitSetMask = {
28
- * a: 2 ** 0,
29
- * b: 2 ** 1,
30
- * c: 2 ** 2,
31
- * d: 2 ** 3,
32
- * g: 2 ** 6
33
- * };
34
- *
35
- * const result = toObject(bitMask, parseInt('0110100', 2));
36
- * console.log(result);
37
- * // {a: false, b: false, c: true, d: false, g: false}
38
- * ```
39
- */
40
4
  export declare const toObject: (bitMask?: TBitSetMask, value?: number) => TBooleanObject;
5
+ export declare const extractBits: (value: number, bitsNumber: number, startIndex: number) => number;
6
+ export declare const fillBits: (value: number, bitsNumber: number, startIndex: number, valueToSet: number) => number;