@ovok/native 0.4.7 → 0.4.9

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 (245) hide show
  1. package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js +3 -1
  2. package/lib/commonjs/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
  3. package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js +1 -1
  4. package/lib/commonjs/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
  5. package/lib/commonjs/modules/bt-management/index.js +44 -0
  6. package/lib/commonjs/modules/bt-management/index.js.map +1 -1
  7. package/lib/commonjs/modules/bt-management/services/bt-manager.js +15 -13
  8. package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
  9. package/lib/commonjs/modules/bt-management/services/custom/compile-case-shape.js +52 -0
  10. package/lib/commonjs/modules/bt-management/services/custom/compile-case-shape.js.map +1 -0
  11. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-case.js +8 -2
  12. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-case.js.map +1 -1
  13. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-field.js +3 -0
  14. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-field.js.map +1 -1
  15. package/lib/commonjs/modules/bt-management/services/device-creator.js +12 -2
  16. package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
  17. package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js +184 -0
  18. package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js.map +1 -0
  19. package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-frame-parser.js +114 -0
  20. package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01-frame-parser.js.map +1 -0
  21. package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.device.js +113 -51
  22. package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.device.js.map +1 -1
  23. package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.main-services.js +41 -77
  24. package/lib/commonjs/modules/bt-management/services/devices/bc01/bc01.main-services.js.map +1 -1
  25. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js +15 -1
  26. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
  27. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +20 -1
  28. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
  29. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +30 -44
  30. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  31. package/lib/commonjs/modules/bt-management/services/devices/frame-parser.js +2 -1
  32. package/lib/commonjs/modules/bt-management/services/devices/frame-parser.js.map +1 -1
  33. package/lib/commonjs/modules/bt-management/services/devices/sentinel-frame-reader.js +84 -0
  34. package/lib/commonjs/modules/bt-management/services/devices/sentinel-frame-reader.js.map +1 -0
  35. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +27 -53
  36. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -1
  37. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js +55 -0
  38. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -0
  39. package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js +43 -0
  40. package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js.map +1 -0
  41. package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js +113 -0
  42. package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js.map +1 -0
  43. package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.js +120 -0
  44. package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.js.map +1 -0
  45. package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-device.js +92 -0
  46. package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-device.js.map +1 -0
  47. package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-samples.js +64 -0
  48. package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-samples.js.map +1 -0
  49. package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.js +94 -0
  50. package/lib/commonjs/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.js.map +1 -0
  51. package/lib/commonjs/modules/bt-management/types/integrated-devices.js +2 -0
  52. package/lib/commonjs/modules/bt-management/types/integrated-devices.js.map +1 -1
  53. package/lib/commonjs/modules/bt-management/utils/create-custom-field-parser.js +21 -0
  54. package/lib/commonjs/modules/bt-management/utils/create-custom-field-parser.js.map +1 -1
  55. package/lib/commonjs/modules/bt-management/utils/parse-measurement.js +10 -7
  56. package/lib/commonjs/modules/bt-management/utils/parse-measurement.js.map +1 -1
  57. package/lib/commonjs/modules/bt-management/utils/reject-custom-reading.js +34 -0
  58. package/lib/commonjs/modules/bt-management/utils/reject-custom-reading.js.map +1 -0
  59. package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js +3 -1
  60. package/lib/module/modules/bt-device/constants/device-instruction-pdfs.js.map +1 -1
  61. package/lib/module/modules/bt-management/constants/integrated-devices-map.js +1 -1
  62. package/lib/module/modules/bt-management/constants/integrated-devices-map.js.map +1 -1
  63. package/lib/module/modules/bt-management/index.js +4 -0
  64. package/lib/module/modules/bt-management/index.js.map +1 -1
  65. package/lib/module/modules/bt-management/services/bt-manager.js +15 -13
  66. package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
  67. package/lib/module/modules/bt-management/services/custom/compile-case-shape.js +48 -0
  68. package/lib/module/modules/bt-management/services/custom/compile-case-shape.js.map +1 -0
  69. package/lib/module/modules/bt-management/services/custom/compile-custom-case.js +8 -2
  70. package/lib/module/modules/bt-management/services/custom/compile-custom-case.js.map +1 -1
  71. package/lib/module/modules/bt-management/services/custom/compile-custom-field.js +3 -0
  72. package/lib/module/modules/bt-management/services/custom/compile-custom-field.js.map +1 -1
  73. package/lib/module/modules/bt-management/services/device-creator.js +12 -2
  74. package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
  75. package/lib/module/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js +180 -0
  76. package/lib/module/modules/bt-management/services/devices/bc01/bc01-command-sequencer.js.map +1 -0
  77. package/lib/module/modules/bt-management/services/devices/bc01/bc01-frame-parser.js +110 -0
  78. package/lib/module/modules/bt-management/services/devices/bc01/bc01-frame-parser.js.map +1 -0
  79. package/lib/module/modules/bt-management/services/devices/bc01/bc01.device.js +113 -51
  80. package/lib/module/modules/bt-management/services/devices/bc01/bc01.device.js.map +1 -1
  81. package/lib/module/modules/bt-management/services/devices/bc01/bc01.main-services.js +41 -77
  82. package/lib/module/modules/bt-management/services/devices/bc01/bc01.main-services.js.map +1 -1
  83. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js +15 -1
  84. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
  85. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +20 -1
  86. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
  87. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +31 -45
  88. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  89. package/lib/module/modules/bt-management/services/devices/frame-parser.js +2 -1
  90. package/lib/module/modules/bt-management/services/devices/frame-parser.js.map +1 -1
  91. package/lib/module/modules/bt-management/services/devices/sentinel-frame-reader.js +79 -0
  92. package/lib/module/modules/bt-management/services/devices/sentinel-frame-reader.js.map +1 -0
  93. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +19 -45
  94. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -1
  95. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js +50 -0
  96. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.js.map +1 -0
  97. package/lib/module/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js +38 -0
  98. package/lib/module/modules/bt-management/services/devices/veroval/veroval.bp-monitors.js.map +1 -0
  99. package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js +108 -0
  100. package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-device.js.map +1 -0
  101. package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.js +116 -0
  102. package/lib/module/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.js.map +1 -0
  103. package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-device.js +87 -0
  104. package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-device.js.map +1 -0
  105. package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-samples.js +60 -0
  106. package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-samples.js.map +1 -0
  107. package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.js +89 -0
  108. package/lib/module/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.js.map +1 -0
  109. package/lib/module/modules/bt-management/types/device-measurement-map.js +3 -3
  110. package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
  111. package/lib/module/modules/bt-management/types/integrated-devices.js +2 -0
  112. package/lib/module/modules/bt-management/types/integrated-devices.js.map +1 -1
  113. package/lib/module/modules/bt-management/utils/create-custom-field-parser.js +21 -0
  114. package/lib/module/modules/bt-management/utils/create-custom-field-parser.js.map +1 -1
  115. package/lib/module/modules/bt-management/utils/parse-measurement.js +10 -7
  116. package/lib/module/modules/bt-management/utils/parse-measurement.js.map +1 -1
  117. package/lib/module/modules/bt-management/utils/reject-custom-reading.js +29 -0
  118. package/lib/module/modules/bt-management/utils/reject-custom-reading.js.map +1 -0
  119. package/lib/typescript/commonjs/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
  120. package/lib/typescript/commonjs/src/modules/bt-management/constants/integrated-devices-map.d.ts.map +1 -1
  121. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +4 -0
  122. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
  123. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +0 -1
  124. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  125. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-case-shape.d.ts +19 -0
  126. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-case-shape.d.ts.map +1 -0
  127. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-case.d.ts.map +1 -1
  128. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-field.d.ts.map +1 -1
  129. package/lib/typescript/commonjs/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
  130. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts +53 -0
  131. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts.map +1 -0
  132. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-frame-parser.d.ts +53 -0
  133. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01-frame-parser.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts +33 -13
  135. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts.map +1 -1
  136. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.main-services.d.ts +11 -17
  137. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bc01/bc01.main-services.d.ts.map +1 -1
  138. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts +7 -0
  139. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
  140. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +11 -2
  141. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
  142. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +10 -13
  143. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  144. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/frame-parser.d.ts.map +1 -1
  145. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/sentinel-frame-reader.d.ts +52 -0
  146. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/sentinel-frame-reader.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +22 -13
  148. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -1
  149. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts +45 -0
  150. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts +18 -0
  152. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts.map +1 -0
  153. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.duo-control-device.d.ts +19 -0
  154. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.duo-control-device.d.ts.map +1 -0
  155. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.d.ts +45 -0
  156. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.d.ts.map +1 -0
  157. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-device.d.ts +30 -0
  158. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-device.d.ts.map +1 -0
  159. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-samples.d.ts +39 -0
  160. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-samples.d.ts.map +1 -0
  161. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.d.ts +35 -0
  162. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-case-spec.d.ts +30 -0
  164. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-case-spec.d.ts.map +1 -1
  165. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-field-encoding.d.ts +7 -1
  166. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-field-encoding.d.ts.map +1 -1
  167. package/lib/typescript/commonjs/src/modules/bt-management/types/dependent-result-handler-params.d.ts +7 -0
  168. package/lib/typescript/commonjs/src/modules/bt-management/types/dependent-result-handler-params.d.ts.map +1 -1
  169. package/lib/typescript/commonjs/src/modules/bt-management/types/device-command.d.ts +9 -0
  170. package/lib/typescript/commonjs/src/modules/bt-management/types/device-command.d.ts.map +1 -1
  171. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +2 -0
  172. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  173. package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts +3 -1
  174. package/lib/typescript/commonjs/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
  175. package/lib/typescript/commonjs/src/modules/bt-management/types/parsing-case.d.ts +8 -0
  176. package/lib/typescript/commonjs/src/modules/bt-management/types/parsing-case.d.ts.map +1 -1
  177. package/lib/typescript/commonjs/src/modules/bt-management/utils/create-custom-field-parser.d.ts.map +1 -1
  178. package/lib/typescript/commonjs/src/modules/bt-management/utils/parse-measurement.d.ts +4 -1
  179. package/lib/typescript/commonjs/src/modules/bt-management/utils/parse-measurement.d.ts.map +1 -1
  180. package/lib/typescript/commonjs/src/modules/bt-management/utils/reject-custom-reading.d.ts +15 -0
  181. package/lib/typescript/commonjs/src/modules/bt-management/utils/reject-custom-reading.d.ts.map +1 -0
  182. package/lib/typescript/module/src/modules/bt-device/constants/device-instruction-pdfs.d.ts.map +1 -1
  183. package/lib/typescript/module/src/modules/bt-management/constants/integrated-devices-map.d.ts.map +1 -1
  184. package/lib/typescript/module/src/modules/bt-management/index.d.ts +4 -0
  185. package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
  186. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +0 -1
  187. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  188. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-case-shape.d.ts +19 -0
  189. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-case-shape.d.ts.map +1 -0
  190. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-case.d.ts.map +1 -1
  191. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-field.d.ts.map +1 -1
  192. package/lib/typescript/module/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
  193. package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts +53 -0
  194. package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-command-sequencer.d.ts.map +1 -0
  195. package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-frame-parser.d.ts +53 -0
  196. package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01-frame-parser.d.ts.map +1 -0
  197. package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts +33 -13
  198. package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.device.d.ts.map +1 -1
  199. package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.main-services.d.ts +11 -17
  200. package/lib/typescript/module/src/modules/bt-management/services/devices/bc01/bc01.main-services.d.ts.map +1 -1
  201. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts +7 -0
  202. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
  203. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +11 -2
  204. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
  205. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +10 -13
  206. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  207. package/lib/typescript/module/src/modules/bt-management/services/devices/frame-parser.d.ts.map +1 -1
  208. package/lib/typescript/module/src/modules/bt-management/services/devices/sentinel-frame-reader.d.ts +52 -0
  209. package/lib/typescript/module/src/modules/bt-management/services/devices/sentinel-frame-reader.d.ts.map +1 -0
  210. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +22 -13
  211. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -1
  212. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts +45 -0
  213. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.profile.d.ts.map +1 -0
  214. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts +18 -0
  215. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.bp-monitors.d.ts.map +1 -0
  216. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.duo-control-device.d.ts +19 -0
  217. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.duo-control-device.d.ts.map +1 -0
  218. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.d.ts +45 -0
  219. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.duo-control-sequencer.d.ts.map +1 -0
  220. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-device.d.ts +30 -0
  221. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-device.d.ts.map +1 -0
  222. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-samples.d.ts +39 -0
  223. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-samples.d.ts.map +1 -0
  224. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.d.ts +35 -0
  225. package/lib/typescript/module/src/modules/bt-management/services/devices/veroval/veroval.ecg-transfer.d.ts.map +1 -0
  226. package/lib/typescript/module/src/modules/bt-management/types/custom-case-spec.d.ts +30 -0
  227. package/lib/typescript/module/src/modules/bt-management/types/custom-case-spec.d.ts.map +1 -1
  228. package/lib/typescript/module/src/modules/bt-management/types/custom-field-encoding.d.ts +7 -1
  229. package/lib/typescript/module/src/modules/bt-management/types/custom-field-encoding.d.ts.map +1 -1
  230. package/lib/typescript/module/src/modules/bt-management/types/dependent-result-handler-params.d.ts +7 -0
  231. package/lib/typescript/module/src/modules/bt-management/types/dependent-result-handler-params.d.ts.map +1 -1
  232. package/lib/typescript/module/src/modules/bt-management/types/device-command.d.ts +9 -0
  233. package/lib/typescript/module/src/modules/bt-management/types/device-command.d.ts.map +1 -1
  234. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +2 -0
  235. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  236. package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts +3 -1
  237. package/lib/typescript/module/src/modules/bt-management/types/integrated-devices.d.ts.map +1 -1
  238. package/lib/typescript/module/src/modules/bt-management/types/parsing-case.d.ts +8 -0
  239. package/lib/typescript/module/src/modules/bt-management/types/parsing-case.d.ts.map +1 -1
  240. package/lib/typescript/module/src/modules/bt-management/utils/create-custom-field-parser.d.ts.map +1 -1
  241. package/lib/typescript/module/src/modules/bt-management/utils/parse-measurement.d.ts +4 -1
  242. package/lib/typescript/module/src/modules/bt-management/utils/parse-measurement.d.ts.map +1 -1
  243. package/lib/typescript/module/src/modules/bt-management/utils/reject-custom-reading.d.ts +15 -0
  244. package/lib/typescript/module/src/modules/bt-management/utils/reject-custom-reading.d.ts.map +1 -0
  245. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["CaseType","BTManagedDevice","bc01MainServices","BC01Device","onStreamStart","mainServices","stuckDataTimeout","validatePackage","pkg","map","b","toLowerCase","headIndex","i","length","slice","lengthByte","parseInt","totalLen","handleSuccessResult","successResult","caseType","RESULT","measurementTypeKey","onError","Error","handleUrinalysisResult","error","checkIfHasError","onResult","analytes","hasAnyReading","some","key","undefined"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01.device.ts"],"mappings":";;AAEA,SAASA,QAAQ,QAAQ,6BAA0B;AAKnD,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,gBAAgB,QAAQ,yBAAsB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,SAASF,eAAe,CAAyB;EAC5DG,aAAa,GAAeA,CAAA,KAAM,CAAC,CAAC;EAEpCC,YAAY,GAAeH,gBAAgB;;EAErD;AACF;AACA;AACA;AACA;EACYI,gBAAgB,GAAG,MAAM;EAEzBC,eAAe,GAAgCC,GAAG,IAAK;IAC/DA,GAAG,GAAGA,GAAG,CAACC,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACC,WAAW,CAAC,CAAC,CAAC;IAErC,IAAIC,SAAS,GAAG,CAAC,CAAC;IAElB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,GAAG,CAACM,MAAM,GAA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F;AACA;AACA;AACA;EACUQ,eAAeA,CACrBR,aAA+D,EAC3C;IACpB,MAAMU,QAA8C,GAAG,CACrD,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,IAAI,EACJ,IAAI,CACL;IAED,MAAMC,aAAa,GAAGD,QAAQ,CAACE,IAAI,CAChCC,GAAG,IAAKb,aAAa,CAACa,GAAG,CAAC,KAAKC,SAClC,CAAC;IAED,IAAI,CAACH,aAAa,EAAE;MAClB,OAAO,sDAAsD;IAC/D;IAEA,OAAOG,SAAS;EAClB;AACF","ignoreList":[]}
1
+ {"version":3,"names":["MeasurementTypeKey","CaseType","hexToByte","BTManagedDevice","Bc01CommandSequencer","BC01_ANALYTE_ORDER","parseBc01Record","bc01MainServices","BC01_FRAME_MIN_LENGTH","BC01Device","onStreamStart","mainServices","stuckDataTimeout","constructor","device","params","createCommandSequencer","write","serviceUuid","uuid","characteristicUuid","writeUuid","onRefused","reason","onError","Error","validatePackage","pkg","length","opcode","minLength","undefined","handleDependentResult","data","frame","reportUrsRecord","parsingCase","caseType","OTHER","handleSuccessResult","parsed","measuredValues","reduce","acc","analyte","value","values","Object","keys","reading","RESULT","measurementTypeKey","uricAcid","urineValues","recordedAt","timestamp","onResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01.device.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAiC,YAAY;AAGxE,SAASC,QAAQ,QAAQ,6BAA0B;AAQnD,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,oBAAoB,QAAQ,6BAA0B;AAC/D,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,wBAAqB;AACzE,SAASC,gBAAgB,QAAQ,yBAAsB;;AAEvD;AACA,MAAMC,qBAA6C,GAAG;EACpD,IAAI,EAAE,CAAC;EAAE;EACT,IAAI,EAAE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AAGd;IACL,CAEC;IAED,IAAI,CAACe,QAAQ,GAAGP,OAAO,CAAC;EAC1B;AACF","ignoreList":[]}
@@ -5,93 +5,57 @@ import { CaseType } from "../../../types/case-type.js";
5
5
  /**
6
6
  * Contec BC401 (a.k.a. BC01) urine analyzer — GATT profile.
7
7
  *
8
- * The BC401 uses Contec's proprietary FF12 service, shared across their consumer
9
- * medical devices. A single result notification carries a 7-parameter URS-7
10
- * strip readout expanded into eleven analyte values on the wire.
8
+ * The BC401 uses Contec's proprietary FF12 service, shared across their
9
+ * consumer medical devices. Every stored URS-7 measurement is pushed as a
10
+ * 16-byte record on 0xFF02 after the host has walked the handshake documented
11
+ * in `bc01-command-sequencer.ts`.
11
12
  *
12
13
  * Service 0xFF12
13
- * Notify (result) 0xFF01 — CCCD 0x2902 must be written 01 00 to enable
14
- * Write (command) 0xFF02 — RESET / SET_UNIT / REQUEST_HISTORY
14
+ * Notify (result) 0xFF02 — CCCD 0x2902 must be written 01 00 to enable
15
+ * Write (command) 0xFF01 — RESET / SET_TIME / GET_COUNT / GET_RECORDS
15
16
  *
16
- * Wire layout of a result frame (Contec URS-7 firmware ≥ 1.2.x):
17
- * [0..1] header "aa 55" — Contec sentinel
18
- * [2] length byte after header
19
- * [3] command "a1" == RESULT_URS7
20
- * [4] strip type "07" == 7-panel
21
- * [5..15] values one byte per analyte, encoding the discrete
22
- * level index into diagnosticResults[key]
23
- * [16] checksum xor over [2..15]
24
- *
25
- * Byte positions calibrated against PHMS 3.0.03 Android app; older firmware
26
- * (< 1.2.x) uses a different command byte and is not supported by this driver
27
- * (the validator will reject those frames).
17
+ * On the wire a stored URS record opens with 0xE1 (single) or 0xE2 (paginated).
18
+ * The remaining fifteen bytes carry the flags nibble, timestamp, seven bytes of
19
+ * packed 3-bit analyte indices, and a checksum. `bc01-frame-parser.ts` decodes
20
+ * them; this file just declares the GATT surface and hands every E1/E2 frame
21
+ * to the driver's dependent-result path so the parser can run.
28
22
  */
29
23
  export const bc01MainServices = [{
30
24
  uuid: "0000ff12-0000-1000-8000-00805f9b34fb",
31
- monitorUuids: [{
25
+ /**
26
+ * PHMS 3.0.03 writes `[0x80, 0x00]` to 0xFF01 the moment its GATT
27
+ * subscription is up — decompiled at L1/f.java:694 ("发送复位命令" — "send
28
+ * reset command"). The device answers nothing until this reset lands. The
29
+ * `Bc01CommandSequencer` returns the same reset from `initialCommands()`
30
+ * so the SDK sends it whether or not the polling default is in play.
31
+ */
32
+ writeUuid: {
32
33
  uuid: "0000ff01-0000-1000-8000-00805f9b34fb",
34
+ mainCommandUuid: "8000"
35
+ },
36
+ monitorUuids: [{
37
+ uuid: "0000ff02-0000-1000-8000-00805f9b34fb",
38
+ /**
39
+ * We key on the first byte only. A `DEPENDENT` case fires
40
+ * `handleDependentResult` in the driver, which runs the real decoder
41
+ * (`parseBc01Record`) against the raw frame bytes and calls
42
+ * `onResult` directly. The parsing case itself carries no field
43
+ * definitions — the packed 3-bits-per-pad layout is not expressible
44
+ * with the ordinary declaration parser and would need the vendor's
45
+ * own decoding table pinned in a declaration to be so.
46
+ */
33
47
  parsingModel: {
34
- caseValuePosition: [0, 1, 3, 4],
48
+ caseValuePosition: [0],
35
49
  cases: [{
36
50
  measurementTypeKey: MeasurementTypeKey.uricAcid,
37
- caseType: CaseType.RESULT,
38
- caseValue: "aa55a107",
39
- parseDefinitions: [{
40
- name: "uro",
41
- parseType: "number",
42
- byteIndexes: [5],
43
- parseReference: 16
44
- }, {
45
- name: "bld",
46
- parseType: "number",
47
- byteIndexes: [6],
48
- parseReference: 16
49
- }, {
50
- name: "bil",
51
- parseType: "number",
52
- byteIndexes: [7],
53
- parseReference: 16
54
- }, {
55
- name: "ket",
56
- parseType: "number",
57
- byteIndexes: [8],
58
- parseReference: 16
59
- }, {
60
- name: "glu",
61
- parseType: "number",
62
- byteIndexes: [9],
63
- parseReference: 16
64
- }, {
65
- name: "pro",
66
- parseType: "number",
67
- byteIndexes: [10],
68
- parseReference: 16
69
- }, {
70
- name: "ph",
71
- parseType: "number",
72
- byteIndexes: [11],
73
- parseReference: 16
74
- }, {
75
- name: "nit",
76
- parseType: "number",
77
- byteIndexes: [12],
78
- parseReference: 16
79
- }, {
80
- name: "leu",
81
- parseType: "number",
82
- byteIndexes: [13],
83
- parseReference: 16
84
- }, {
85
- name: "sg",
86
- parseType: "number",
87
- byteIndexes: [14],
88
- parseReference: 16
89
- }, {
90
- name: "vc",
91
- parseType: "number",
92
- byteIndexes: [15],
93
- parseReference: 16
94
- }]
51
+ caseType: CaseType.DEPENDENT,
52
+ caseValue: "e1",
53
+ parseDefinitions: []
54
+ }, {
55
+ measurementTypeKey: MeasurementTypeKey.uricAcid,
56
+ caseType: CaseType.DEPENDENT,
57
+ caseValue: "e2",
58
+ parseDefinitions: []
95
59
  }]
96
60
  }
97
61
  }]
@@ -1 +1 @@
1
- {"version":3,"names":["MeasurementTypeKey","CaseType","bc01MainServices","uuid","monitorUuids","parsingModel","caseValuePosition","cases","measurementTypeKey","uricAcid","caseType","RESULT","caseValue","parseDefinitions","name","parseType","byteIndexes","parseReference"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01.main-services.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAE/C,SAASC,QAAQ,QAAQ,6BAA0B;AAGnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAA4B,GAAG,CAC1C;EACEC,IAAI,EAAE,sCAAsC;EAC5CC,YAAY,EAAE,CACZ;IACED,IAAI,EAAE,sCAAsC;IAC5CE,YAAY,EAAE;MACZC,iBAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;MAC/BC,KAAK,EAAE,CACL;QACEC,kBAAkB,EAAER,kBAAkB,CAACS,QAAQ;QAC/CC,QAAQ,EAAET,QAAQ,CAAC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E,CAAC,EAAE,CAAC;UACjBC,cAAc,EAAE;QAClB,CAAC,EACD;UACEH,IAAI,EAAE,IAAI;UACVC,SAAS,EAAE,QAAQ;UACnBC,WAAW,EAAE,CAAC,EAAE,CAAC;UACjBC,cAAc,EAAE;QAClB,CAAC;MAEL,CAAC;IAEL;EACF,CAAC;AAEL,CAAC,CACF","ignoreList":[]}
1
+ {"version":3,"names":["MeasurementTypeKey","CaseType","bc01MainServices","uuid","writeUuid","mainCommandUuid","monitorUuids","parsingModel","caseValuePosition","cases","measurementTypeKey","uricAcid","caseType","DEPENDENT","caseValue","parseDefinitions"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/bc01/bc01.main-services.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,YAAY;AAE/C,SAASC,QAAQ,QAAQ,6BAA0B;AAGnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAA4B,GAAG,CAC1C;EACEC,IAAI,EAAE,sCAAsC;EAE5C;AACJ;AACA;AACA;AACA;AACA;AACA;EACIC,SAAS,EAAE;IACTD,IAAI,EAAE,sCAAsC;IAC5CE,eAAe,EAAE;EACnB,CAAC;EACDC,YAAY,EAAE,CACZ;IACEH,IAAI,EAAE,sCAAsC;IAE5C;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACQI,YAAY,EAAE;MACZC,iBAAiB,EAAE,CAAC,CAAC,CAAC;MACtBC,KAAK,EAAE,CACL;QACEC,kBAAkB,EAAEV,kBAAkB,CAACW,QAAQ;QAC/CC,QAAQ,EAAEX,QAAQ,CAACY,SAAS;QAC5BC,SAAS,EAAE,IAAI;QACfC,gBAAgB,EAAE;MACpB,CAAC,EACD;QACEL,kBAAkB,EAAEV,kBAAkB,CAACW,QAAQ;QAC/CC,QAAQ,EAAEX,QAAQ,CAACY,SAAS;QAC5BC,SAAS,EAAE,IAAI;QACfC,gBAAgB,EAAE;MACpB,CAAC;IAEL;EACF,CAAC;AAEL,CAAC,CACF","ignoreList":[]}
@@ -87,6 +87,20 @@ export class BTCommandWriter {
87
87
  }
88
88
  };
89
89
 
90
+ /**
91
+ * Writes one chunk the way the characteristic accepts writes.
92
+ *
93
+ * A with-response write to a characteristic that only supports write-without-response
94
+ * fails outright, so the command says which it is rather than the transport guessing.
95
+ */
96
+ writeTo = async (command, value) => {
97
+ if (command.withoutResponse) {
98
+ await this.device.writeCharacteristicWithoutResponseForService(command.serviceUuid, command.characteristicUuid, value);
99
+ return;
100
+ }
101
+ await this.device.writeCharacteristicWithResponseForService(command.serviceUuid, command.characteristicUuid, value);
102
+ };
103
+
90
104
  /**
91
105
  * Splits a frame into writes the link will carry whole.
92
106
  *
@@ -116,7 +130,7 @@ export class BTCommandWriter {
116
130
  if (!isConnected) {
117
131
  return false;
118
132
  }
119
- await this.device.writeCharacteristicWithResponseForService(command.serviceUuid, command.characteristicUuid, hexToBase64(chunk.join("")));
133
+ await this.writeTo(command, hexToBase64(chunk.join("")));
120
134
  return true;
121
135
  } catch (error) {
122
136
  sentryLogger("error", "DEVICE: Error sending command", {
@@ -1 +1 @@
1
- {"version":3,"names":["slog","sentryLogger","hexToBase64","MAX_WRITE_ATTEMPTS","DEFAULT_ATT_MTU","ATT_WRITE_HEADER_BYTES","BTCommandWriter","pendingWrites","Promise","resolve","mtu","constructor","device","onError","useNegotiatedMtu","Number","isInteger","reset","send","commands","then","writeInOrder","catch","error","command","writeCommand","chunk","chunksOf","frame","written","writeChunk","size","Math","max","chunks","start","length","push","slice","attempt","isConnected","writeCharacteristicWithResponseForService","serviceUuid","characteristicUuid","join","Error","message","deviceName","name"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/bt-command-writer.ts"],"mappings":";;AAEA,SAASA,IAAI,QAAQ,iCAA8B;AACnD,SAASC,YAAY,QAAQ,yCAAsC;AAEnE,SAASC,WAAW,QAAQ,+BAA4B;AAExD,MAAMC,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AAK,CAACkB,IAAI,CAAC,EAAE,CAAC,CAC5B,CAAC;QAED,OAAO,IAAI;MACb,CAAC,CAAC,OAAOrB,KAAK,EAAE;QACdtB,YAAY,CAAC,OAAO,EAAE,+BAA+B,EAAE;UACrDsB,KAAK,EAAEA,KAAK,YAAYsB,KAAK,GAAGtB,KAAK,CAACuB,OAAO,GAAGvB,KAAK;UACrDwB,UAAU,EAAE,IAAI,CAACnC,MAAM,CAACoC;QAC1B,CAAC,CAAC;QAEF,IAAIT,OAAO,KAAKpC,kBAAkB,EAAE;UAClCH,IAAI,CAACuB,KAAK,EAAE,8CAA8C,EAAE;YAC1DwB,UAAU,EAAE,IAAI,CAACnC,MAAM,CAACoC;UAC1B,CAAC,CAAC;QACJ;MACF;IACF;IAEA,OAAO,KAAK;EACd,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["slog","sentryLogger","hexToBase64","MAX_WRITE_ATTEMPTS","DEFAULT_ATT_MTU","ATT_WRITE_HEADER_BYTES","BTCommandWriter","pendingWrites","Promise","resolve","mtu","constructor","device","onError","useNegotiatedMtu","Number","isInteger","reset","send","commands","then","writeInOrder","catch","error","command","writeCommand","chunk","chunksOf","frame","written","writeChunk","writeTo","value","withoutResponse","writeCharacteristicWithoutResponseForService","serviceUuid","characteristicUuid","writeCharacteristicWithResponseForService","size","Math","max","chunks","start","length","push","slice","attempt","isConnected","join","Error","message","deviceName","name"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/bt-command-writer.ts"],"mappings":";;AAEA,SAASA,IAAI,QAAQ,iCAA8B;AACnD,SAASC,YAAY,QAAQ,yCAAsC;AAEnE,SAASC,WAAW,QAAQ,+BAA4B;AAExD,MAAMC,kBAAkB,GAAG,CAAC;;AAE5B;AACA,MAAMC,eAAe,GAAG,EAAE;;AAE1B;AACA,MAAMC,sBAAsB,GAAG,CAAC;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,CAAC;E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,CAACmC,WAAW,CAAC,CAAC;QAEnD,IAAI,CAACA,WAAW,EAAE;UAChB,OAAO,KAAK;QACd;QAEA,MAAM,IAAI,CAAChB,OAAO,CAACP,OAAO,EAAEtB,WAAW,CAACwB,KAAK,CAACsB,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAExD,OAAO,IAAI;MACb,CAAC,CAAC,OAAOzB,KAAK,EAAE;QACdtB,YAAY,CAAC,OAAO,EAAE,+BAA+B,EAAE;UACrDsB,KAAK,EAAEA,KAAK,YAAY0B,KAAK,GAAG1B,KAAK,CAAC2B,OAAO,GAAG3B,KAAK;UACrD4B,UAAU,EAAE,IAAI,CAACvC,MAAM,CAACwC;QAC1B,CAAC,CAAC;QAEF,IAAIN,OAAO,KAAK3C,kBAAkB,EAAE;UAClCH,IAAI,CAACuB,KAAK,EAAE,8CAA8C,EAAE;YAC1D4B,UAAU,EAAE,IAAI,CAACvC,MAAM,CAACwC;UAC1B,CAAC,CAAC;QACJ;MACF;IACF;IAEA,OAAO,KAAK;EACd,CAAC;AACH","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ import { sentryLogger } from "../../../../helpers/utils/sentry-logger.js";
3
4
  import { LepuCommandBuilder } from "../lepu/lepu.command-builder.js";
4
5
  import { LepuIdentityGate } from "../lepu/lepu.identity-gate.js";
5
6
 
@@ -16,7 +17,24 @@ const DEFAULT_START_BYTE = "a5";
16
17
  * answers on the one it is addressed with, so the list matters for reading and its head for
17
18
  * writing.
18
19
  */
19
- export const createLepuSequencer = (lepu, report) => new LepuIdentityGate({
20
+ /**
21
+ * Records what the device said it was.
22
+ *
23
+ * The model number is logged because it is the only place one exists: the vendor's SDK
24
+ * never reads the field back, so a declaration written without it is completed by
25
+ * connecting once and reading this line.
26
+ */
27
+ const recordLepuIdentity = (deviceData, info) => {
28
+ deviceData.sn = info.serialNumber;
29
+ sentryLogger("info", "BT_MANAGER: Device identified itself", {
30
+ deviceId: deviceData.id,
31
+ deviceName: deviceData.name,
32
+ deviceType: info.deviceType,
33
+ branchCode: info.branchCode,
34
+ protocolMaxLength: info.protocolMaxLength
35
+ });
36
+ };
37
+ const createLepuSequencer = (lepu, report) => new LepuIdentityGate({
20
38
  write: {
21
39
  serviceUuid: lepu.write.serviceUuid,
22
40
  characteristicUuid: lepu.write.characteristicUuid
@@ -29,4 +47,5 @@ export const createLepuSequencer = (lepu, report) => new LepuIdentityGate({
29
47
  onIdentified: report.onIdentified,
30
48
  onRefused: report.onRefused
31
49
  });
50
+ export { createLepuSequencer, recordLepuIdentity };
32
51
  //# sourceMappingURL=custom-lepu-sequencer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["LepuCommandBuilder","LepuIdentityGate","DEFAULT_START_BYTE","createLepuSequencer","lepu","report","write","serviceUuid","characteristicUuid","builder","startBytes","expectedDeviceTypes","pollCommand","undefined","onIdentified","onRefused"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/custom/custom-lepu-sequencer.ts"],"mappings":";;AAEA,SAASA,kBAAkB,QAAQ,iCAA8B;AAEjE,SAASC,gBAAgB,QAAQ,+BAA4B;;AAE7D;AACA,MAAMC,kBAAkB,GAAG,IAAI;AAO/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAGA,CACjCC,IAAoB,EACpBC,MAAsB,KAEtB,IAAIJ,gBAAgB,CAAC;EACnBK,KAAK,EAAE;IACLC,WAAW,EAAEH,IAAI,CAACE,KAAK,CAACC,WAAW;IACnCC,kBAAkB,EAAEJ,IAAI,CAACE,KAAK,CAACE;EACjC,CAAC;EACDC,OAAO,EAAE,IAAIT,kBAAkB,CAACI,IAAI,CAACM,UAAU,CAAC,CAAC,CAAC,IAAIR,kBAAkB,CAAC;EACzES,mBAAmB,EAAEP,IAAI,CAACO,mBAAmB;EAC7C,IAAIP,IAAI,CAACQ,WAAW,KAAKC,SAAS,GAAG,CAAC,CAAC,GAAG;IAAED,WAAW,EAAER,IAAI,CAACQ;EAAY,CAAC,CAAC;EAC5EE,YAAY,EAAET,MAAM,CAACS,YAAY;EACjCC,SAAS,EAAEV,MAAM,CAACU;AACpB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["sentryLogger","LepuCommandBuilder","LepuIdentityGate","DEFAULT_START_BYTE","recordLepuIdentity","deviceData","info","sn","serialNumber","deviceId","id","deviceName","name","deviceType","branchCode","protocolMaxLength","createLepuSequencer","lepu","report","write","serviceUuid","characteristicUuid","builder","startBytes","expectedDeviceTypes","pollCommand","undefined","onIdentified","onRefused"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/custom/custom-lepu-sequencer.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4CAAyC;AAItE,SAASC,kBAAkB,QAAQ,iCAA8B;AAEjE,SAASC,gBAAgB,QAAQ,+BAA4B;;AAE7D;AACA,MAAMC,kBAAkB,GAAG,IAAI;AAO/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAGA,CACzBC,UAAsB,EACtBC,IAAoB,KACX;EACTD,UAAU,CAACE,EAAE,GAAGD,IAAI,CAACE,YAAY;EAEjCR,YAAY,CAAC,MAAM,EAAE,sCAAsC,EAAE;IAC3DS,QAAQ,EAAEJ,UAAU,CAACK,EAAE;IACvBC,UAAU,EAAEN,UAAU,CAACO,IAAI;IAC3BC,UAAU,EAAEP,IAAI,CAACO,UAAU;IAC3BC,UAAU,EAAER,IAAI,CAACQ,UAAU;IAC3BC,iBAAiB,EAAET,IAAI,CAACS;EAC1B,CAAC,CAAC;AACJ,CAAC;AAED,MAAMC,mBAAmB,GAAGA,CAC1BC,IAAoB,EACpBC,MAAsB,KAEtB,IAAIhB,gBAAgB,CAAC;EACnBiB,KAAK,EAAE;IACLC,WAAW,EAAEH,IAAI,CAACE,KAAK,CAACC,WAAW;IACnCC,kBAAkB,EAAEJ,IAAI,CAACE,KAAK,CAACE;EACjC,CAAC;EACDC,OAAO,EAAE,IAAIrB,kBAAkB,CAACgB,IAAI,CAACM,UAAU,CAAC,CAAC,CAAC,IAAIpB,kBAAkB,CAAC;EACzEqB,mBAAmB,EAAEP,IAAI,CAACO,mBAAmB;EAC7C,IAAIP,IAAI,CAACQ,WAAW,KAAKC,SAAS,GAAG,CAAC,CAAC,GAAG;IAAED,WAAW,EAAER,IAAI,CAACQ;EAAY,CAAC,CAAC;EAC5EE,YAAY,EAAET,MAAM,CAACS,YAAY;EACjCC,SAAS,EAAEV,MAAM,CAACU;AACpB,CAAC,CAAC;AAEJ,SAASZ,mBAAmB,EAAEZ,kBAAkB","ignoreList":[]}
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
 
3
- import { sentryLogger } from "../../../../helpers/utils/sentry-logger.js";
4
3
  import { CaseType } from "../../../types/case-type.js";
5
4
  import { createFrameValidator } from "../../../utils/create-frame-validator.js";
5
+ import { parseMeasurement } from "../../../utils/parse-measurement.js";
6
+ import { discardedReadingError, rejectCustomReading } from "../../../utils/reject-custom-reading.js";
6
7
  import { BTManagedDevice } from "../bt-managed-device.js";
7
8
  import { LepuFrameReader } from "../lepu/lepu.frame-reader.js";
8
- import { createLepuSequencer } from "./custom-lepu-sequencer.js";
9
+ import { createLepuSequencer, recordLepuIdentity } from "./custom-lepu-sequencer.js";
9
10
  /**
10
11
  * Runs a device registered with defineCustomDevice.
11
12
  *
@@ -49,29 +50,7 @@ export class CustomDevice extends BTManagedDevice {
49
50
  onRefused: this.onIdentityRefused
50
51
  });
51
52
  }
52
-
53
- /**
54
- * Records what the device said it was.
55
- *
56
- * The model number is logged because it is the only place one exists: the vendor's SDK
57
- * never reads the field back, so a declaration written without it is completed by
58
- * connecting once and reading this line.
59
- */
60
- onIdentified = info => {
61
- this.deviceData.sn = info.serialNumber;
62
- sentryLogger("info", "BT_MANAGER: Device identified itself", {
63
- deviceId: this.deviceData.id,
64
- deviceName: this.deviceData.name,
65
- deviceType: info.deviceType,
66
- branchCode: info.branchCode,
67
- protocolMaxLength: info.protocolMaxLength
68
- });
69
- };
70
-
71
- /**
72
- * Nothing is sent to a device that could not be identified, because the same opcode means
73
- * different things on different models in this family.
74
- */
53
+ onIdentified = info => recordLepuIdentity(this.deviceData, info);
75
54
  onIdentityRefused = reason => {
76
55
  this.onError?.(new Error(`Custom device "${this.definition.id}" was not addressed: ${reason}.`));
77
56
  };
@@ -90,7 +69,7 @@ export class CustomDevice extends BTManagedDevice {
90
69
  */
91
70
  handleDependentResult = data => {
92
71
  try {
93
- this.report(data.parsedData, data.parsingCase);
72
+ this.reportFrame(data);
94
73
  } catch (error) {
95
74
  this.onError?.(error);
96
75
  }
@@ -111,6 +90,26 @@ export class CustomDevice extends BTManagedDevice {
111
90
  return;
112
91
  }
113
92
 
93
+ /**
94
+ * Reports what the frame carried, which may be more than one reading.
95
+ *
96
+ * A device handing over its stored history answers one request with every record it
97
+ * holds, back to back. Those were taken at different times and are separate readings, so
98
+ * each record is decoded and reported on its own. A trailing part-record is ignored: half
99
+ * a record is not a reading.
100
+ */
101
+ reportFrame(data) {
102
+ const repeated = data.parsingCase.repeatedRecords;
103
+ if (!repeated || !data.frame) {
104
+ this.report(data.parsedData, data.parsingCase);
105
+ return;
106
+ }
107
+ const records = Math.floor((data.frame.length - repeated.from) / repeated.recordBytes);
108
+ for (let record = 0; record < records; record++) {
109
+ this.report(parseMeasurement(data.frame, data.parsingCase, repeated.from + record * repeated.recordBytes), data.parsingCase);
110
+ }
111
+ }
112
+
114
113
  /**
115
114
  * Reports every reading the frame carried.
116
115
  *
@@ -125,11 +124,14 @@ export class CustomDevice extends BTManagedDevice {
125
124
  report(parsedData, parsingCase) {
126
125
  const measurements = parsingCase.measurements ?? [];
127
126
  if (measurements.length === 0) {
128
- this.fail("a result frame carries no measurement type", parsedData);
127
+ this.discard("a result frame carries no measurement type", parsedData);
129
128
  return;
130
129
  }
131
130
  measurements.forEach(measurement => this.reportMeasurement(parsedData, measurement));
132
131
  }
132
+ discard(reason, parsedData) {
133
+ this.onError?.(discardedReadingError(this.definition.id, reason, parsedData));
134
+ }
133
135
  reportMeasurement(parsedData, measurement) {
134
136
  const reading = {
135
137
  caseType: parsedData.caseType,
@@ -138,28 +140,12 @@ export class CustomDevice extends BTManagedDevice {
138
140
  measurement.fieldNames.forEach(name => {
139
141
  reading[name] = parsedData[name];
140
142
  });
141
- const rejection = measurement.fieldNames.map(name => this.reject(measurement.measurementTypeKey, name, reading[name])).find(message => message !== undefined);
143
+ const rejection = measurement.fieldNames.map(name => rejectCustomReading(this.definition.fields, measurement.measurementTypeKey, name, reading[name])).find(message => message !== undefined);
142
144
  if (rejection) {
143
- this.fail(rejection, reading);
145
+ this.discard(rejection, reading);
144
146
  return;
145
147
  }
146
148
  this.onResult?.(reading);
147
149
  }
148
- reject(measurementTypeKey, name, value) {
149
- const field = this.definition.fields.get(`${measurementTypeKey}:${name}`);
150
- if (!field) {
151
- return `decoded "${name}", which is not declared for ${measurementTypeKey}`;
152
- }
153
- if (typeof value !== "number" || !Number.isFinite(value)) {
154
- return `could not decode ${name}; the frame was shorter than the declaration expects`;
155
- }
156
- if (value < field.min || value > field.max) {
157
- return `decoded ${name} = ${value} ${field.unit}, outside the accepted range ${field.min}-${field.max} ${field.unit}`;
158
- }
159
- return undefined;
160
- }
161
- fail(reason, parsedData) {
162
- this.onError?.(new Error(`Custom device "${this.definition.id}": ${reason}. The reading was discarded (decoded ${JSON.stringify(parsedData)}).`));
163
- }
164
150
  }
165
151
  //# sourceMappingURL=custom.device.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["sentryLogger","CaseType","createFrameValidator","BTManagedDevice","LepuFrameReader","createLepuSequencer","CustomDevice","validators","Map","constructor","device","params","definition","mainServices","stuckDataTimeout","preferredMtu","undefined","declareLepuProtocol","frames","forEach","frame","uuid","set","lepu","frameReader","startBytes","createCommandSequencer","onIdentified","onRefused","onIdentityRefused","info","deviceData","sn","serialNumber","deviceId","id","deviceName","name","deviceType","branchCode","protocolMaxLength","reason","onError","Error","validatePackage","pkg","validate","get","String","toLowerCase","handleDependentResult","data","report","parsedData","parsingCase","error","caseType","OTHER","handleSuccessResult","measurements","length","fail","measurement","reportMeasurement","reading","measurementTypeKey","fieldNames","rejection","map","reject","find","message","onResult","value","field","fields","Number","isFinite","min","max","unit","JSON","stringify"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/custom/custom.device.ts"],"mappings":";;AAEA,SAASA,YAAY,QAAQ,4CAAyC;AACtE,SAASC,QAAQ,QAAQ,6BAA0B;AAUnD,SAASC,oBAAoB,QAAQ,0CAAuC;AAC5E,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,eAAe,QAAQ,8BAA2B;AAE3D,SAASC,mBAAmB,QAAQ,4BAAyB;AAK7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,SAASH,eAAe,CAAiB;EAM/CI,UAAU,GAAG,IAAIC,GAAG,CAAqC,CAAC;EAE3EC,WAAWA,CACTC,MAAc,EACdC,MAA0C,EAC1CC,UAAkC,EAClC;IACA,KAAK,CAACF,MAAM,EAAEC,MAAM,CAAC;IAErB,IAAI,CAACC,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,YAAY,GAAGD,UAAU,CAACC,YAAY;IAC3C,IAAI,CAACC,gBAAgB,GAAGF,UAAU,CAACE,gBAAgB;IAEnD,IAAIF,UAAU,CAACG,YAAY,KAAKC,SAAS,EAAE;MACzC,IAAI,CAACD,YAAY,GAAGH,UAAU,CAACG,YAAY;IAC7C;IAEA,IAAI,CAACE,mBAAmB,CAACL,UAAU,CAAC;IAEpCA,UAAU,CAACM,MAAM,CAACC,OAAO,CAAC,CAACC,KAAK,EAAEC,IAAI,KAAK;MACzC,IAAI,CAACd,UAAU,CAACe,GAAG,CAACD,IAAI,EAAEnB,oBAAoB,CAACkB,KAAK,CAAC,CAAC;IACx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AAMM,MAAM,wCAAwCwC,IAAI,CAACC,SAAS,CAAC7B,UAAU,CAAC,IACpH,CACF,CAAC;EACH;AACF","ignoreList":[]}
1
+ {"version":3,"names":["CaseType","createFrameValidator","parseMeasurement","discardedReadingError","rejectCustomReading","BTManagedDevice","LepuFrameReader","createLepuSequencer","recordLepuIdentity","CustomDevice","validators","Map","constructor","device","params","definition","mainServices","stuckDataTimeout","preferredMtu","undefined","declareLepuProtocol","frames","forEach","frame","uuid","set","lepu","frameReader","startBytes","createCommandSequencer","onIdentified","onRefused","onIdentityRefused","info","deviceData","reason","onError","Error","id","validatePackage","pkg","validate","get","String","toLowerCase","handleDependentResult","data","reportFrame","error","parsingCase","caseType","OTHER","handleSuccessResult","repeated","repeatedRecords","report","parsedData","records","Math","floor","length","from","recordBytes","record","measurements","discard","measurement","reportMeasurement","reading","measurementTypeKey","fieldNames","name","rejection","map","fields","find","message","onResult"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/custom/custom.device.ts"],"mappings":";;AAEA,SAASA,QAAQ,QAAQ,6BAA0B;AAUnD,SAASC,oBAAoB,QAAQ,0CAAuC;AAC5E,SAASC,gBAAgB,QAAQ,qCAAkC;AACnE,SACEC,qBAAqB,EACrBC,mBAAmB,QACd,yCAAsC;AAC7C,SAASC,eAAe,QAAQ,yBAAsB;AAEtD,SAASC,eAAe,QAAQ,8BAA2B;AAE3D,SACEC,mBAAmB,EACnBC,kBAAkB,QACb,4BAAyB;AAKhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,SAASJ,eAAe,CAAiB;EAM/CK,UAAU,GAAG,IAAIC,GAAG,CAAqC,CAAC;EAE3EC,WAAWA,CACTC,MAAc,EACdC,MAA0C,EAC1CC,UAAkC,EAClC;IACA,KAAK,CAACF,MAAM,EAAEC,MAAM,CAAC;IAErB,IAAI,CAACC,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,YAAY,GAAGD,UAAU,CAAC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,SAAS,EAAEJ,OAAO,CAAC;MAEhC;IACF;IAEA,IAAI,CAACS,QAAQ,GAAGT,OAAO,CAAC;EAC1B;AAEF","ignoreList":[]}
@@ -31,7 +31,8 @@ export class FrameParser {
31
31
  return {
32
32
  parsingCase,
33
33
  measurementTypeKey: parsingCase.measurementTypeKey,
34
- parsedData: parsedData
34
+ parsedData: parsedData,
35
+ frame
35
36
  };
36
37
  }
37
38
  findParsingModel(uuid) {
@@ -1 +1 @@
1
- {"version":3,"names":["parseMeasurement","FrameParser","constructor","mainServices","parse","uuid","frame","parsingModel","findParsingModel","caseValue","readCaseValue","parsingCase","cases","find","declared","parsedData","measurementTypeKey","mainService","characteristic","monitorUuids","monitored","toLowerCase","undefined","caseValuePosition","map","index","join"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/frame-parser.ts"],"mappings":";;AAMA,SAASA,gBAAgB,QAAQ,kCAA+B;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,CAAwB;EAC9CC,WAAWA,CAAkBC,YAA2C,EAAE;IAAA,KAA7CA,YAA2C,GAA3CA,YAA2C;EAAG;EAEpEC,KAAKA,CACVC,IAAY,EACZC,KAAe,EAC8B;IAC7C,MAAMC,YAAY,GAAG,IAAI,CAACC,gBAAgB,CAACH,IAAI,CAAC;IAEhD,IAAI,CAACE,YAAY,EAAE;MACjB;IACF;IAEA,MAAME,SAAS,GAAG,IAAI,CAACC,aAAa,CAACH,YAAY,EAAED,KAAK,CAAC;IAEzD,MAAMK,WAAW,GAAGJ,YAAY,CAACK,KAAK,EAAEC,IAAI,CACzCC,QAAQ,IAAKA,QAAQ,CAACL,SAAS,KAAKA,SACvC,CAAC;IAED,IAAI,CAACE,WAAW,EAAE;MAChB;IACF;IAEA,MAAMI,UAAU,GAAGf,gBAAgB,CAACM,KAAK,EAAEK,WAAW,CAAC;IAEvD,IAAI,CAACI,UAAU,EAAE;MACf;IACF;IAEA,OAAO;MACLJ,WAAW;MACXK,kBAAkB,EAAEL,WAAW,CAACK,kBAAkB;MAClDD,UAAU,EAAEA;IACd,CAAC;EACH;EAEQP,gBAAgBA,CAACH,IAAY,EAA4B;IAC/D,KAAK,MAAMY,WAAW,IAAI,IAAI,CAACd,YAAY,EAAE;MAC3C,MAAMe,cAAc,GAAGD,WAAW,CAACE,YAAY,CAACN,IAAI,CACjDO,SAAS,IAAKA,SAAS,CAACf,IAAI,CAACgB,WAAW,CAAC,CAAC,KAAKhB,IAAI,CAACgB,WAAW,CAAC,CACnE,CAAC;MAED,IAAIH,cAAc,EAAE;QAClB,OAAOA,cAAc,CAACX,YAAY;MACpC;IACF;IAEA,OAAOe,SAAS;EAClB;EAEQZ,aAAaA,CAACH,YAA0B,EAAED,KAAe,EAAU;IACzE,OACEC,YAAY,CAACgB,iBAAiB,EAAEC,GAAG,CAAEC,KAAK,IAAKnB,KAAK,CAACmB,KAAK,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC,IACrE,EAAE;EAEN;AACF","ignoreList":[]}
1
+ {"version":3,"names":["parseMeasurement","FrameParser","constructor","mainServices","parse","uuid","frame","parsingModel","findParsingModel","caseValue","readCaseValue","parsingCase","cases","find","declared","parsedData","measurementTypeKey","mainService","characteristic","monitorUuids","monitored","toLowerCase","undefined","caseValuePosition","map","index","join"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/frame-parser.ts"],"mappings":";;AAMA,SAASA,gBAAgB,QAAQ,kCAA+B;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,CAAwB;EAC9CC,WAAWA,CAAkBC,YAA2C,EAAE;IAAA,KAA7CA,YAA2C,GAA3CA,YAA2C;EAAG;EAEpEC,KAAKA,CACVC,IAAY,EACZC,KAAe,EAC8B;IAC7C,MAAMC,YAAY,GAAG,IAAI,CAACC,gBAAgB,CAACH,IAAI,CAAC;IAEhD,IAAI,CAACE,YAAY,EAAE;MACjB;IACF;IAEA,MAAME,SAAS,GAAG,IAAI,CAACC,aAAa,CAACH,YAAY,EAAED,KAAK,CAAC;IAEzD,MAAMK,WAAW,GAAGJ,YAAY,CAACK,KAAK,EAAEC,IAAI,CACzCC,QAAQ,IAAKA,QAAQ,CAACL,SAAS,KAAKA,SACvC,CAAC;IAED,IAAI,CAACE,WAAW,EAAE;MAChB;IACF;IAEA,MAAMI,UAAU,GAAGf,gBAAgB,CAACM,KAAK,EAAEK,WAAW,CAAC;IAEvD,IAAI,CAACI,UAAU,EAAE;MACf;IACF;IAEA,OAAO;MACLJ,WAAW;MACXK,kBAAkB,EAAEL,WAAW,CAACK,kBAAkB;MAClDD,UAAU,EAAEA,UAAwC;MACpDT;IACF,CAAC;EACH;EAEQE,gBAAgBA,CAACH,IAAY,EAA4B;IAC/D,KAAK,MAAMY,WAAW,IAAI,IAAI,CAACd,YAAY,EAAE;MAC3C,MAAMe,cAAc,GAAGD,WAAW,CAACE,YAAY,CAACN,IAAI,CACjDO,SAAS,IAAKA,SAAS,CAACf,IAAI,CAACgB,WAAW,CAAC,CAAC,KAAKhB,IAAI,CAACgB,WAAW,CAAC,CACnE,CAAC;MAED,IAAIH,cAAc,EAAE;QAClB,OAAOA,cAAc,CAACX,YAAY;MACpC;IACF;IAEA,OAAOe,SAAS;EAClB;EAEQZ,aAAaA,CAACH,YAA0B,EAAED,KAAe,EAAU;IACzE,OACEC,YAAY,CAACgB,iBAAiB,EAAEC,GAAG,CAAEC,KAAK,IAAKnB,KAAK,CAACmB,KAAK,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC,IACrE,EAAE;EAEN;AACF","ignoreList":[]}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ import { FrameReadStatus } from "../../types/frame-read-status.js";
4
+ const lower = byte => (byte ?? "").toLowerCase();
5
+
6
+ /**
7
+ * Reads a reply that ends on a sentinel byte rather than declaring its length.
8
+ *
9
+ * The Veroval duo control answers this way, as serial protocols generally do: a request is
10
+ * answered across as many notifications as it takes and the end is marked, not counted. The
11
+ * reader therefore cannot know how much is coming and holds the buffer until the terminator
12
+ * lands - which is why the cap exists.
13
+ *
14
+ * There is no integrity check to make. A sentinel protocol carries no checksum, so a frame
15
+ * that reaches a parser here has been delimited, not verified, and whatever decodes it is
16
+ * the only thing standing between a corrupted reply and a reported reading. Declare a range
17
+ * for every field.
18
+ */
19
+ export class SentinelFrameReader {
20
+ constructor(spec) {
21
+ this.spec = spec;
22
+ }
23
+ readFrame(buffer) {
24
+ const first = lower(buffer[0]);
25
+ if (buffer.length > 0 && (this.spec.standaloneBytes ?? []).includes(first)) {
26
+ return {
27
+ status: FrameReadStatus.COMPLETE,
28
+ consumedBytes: 1,
29
+ frame: [first]
30
+ };
31
+ }
32
+ const start = this.frameStart(buffer);
33
+
34
+ /**
35
+ * A declared start byte is one byte, so there is no partial match to preserve: a buffer
36
+ * without it holds no frame start and is junk in its entirety.
37
+ */
38
+ if (start === undefined) {
39
+ return {
40
+ status: FrameReadStatus.INCOMPLETE,
41
+ consumedBytes: buffer.length
42
+ };
43
+ }
44
+ const end = buffer.findIndex((byte, index) => index >= start && lower(byte) === this.spec.terminator);
45
+ if (end === -1) {
46
+ return this.incompleteOrOverlong(buffer, start);
47
+ }
48
+ return {
49
+ status: FrameReadStatus.COMPLETE,
50
+ consumedBytes: end + 1,
51
+ frame: buffer.slice(start, end)
52
+ };
53
+ }
54
+
55
+ /**
56
+ * Where the payload begins: after the start byte when one is declared, and at zero when
57
+ * none is. A declared start byte that has not arrived means the reply has not begun.
58
+ */
59
+ frameStart(buffer) {
60
+ if (this.spec.start === undefined) {
61
+ return 0;
62
+ }
63
+ const index = buffer.findIndex(byte => lower(byte) === this.spec.start);
64
+ return index === -1 ? undefined : index + 1;
65
+ }
66
+ incompleteOrOverlong(buffer, start) {
67
+ if (buffer.length - start <= this.spec.maxFrameBytes) {
68
+ return {
69
+ status: FrameReadStatus.INCOMPLETE,
70
+ consumedBytes: 0
71
+ };
72
+ }
73
+ return {
74
+ status: FrameReadStatus.CORRUPT,
75
+ consumedBytes: buffer.length
76
+ };
77
+ }
78
+ }
79
+ //# sourceMappingURL=sentinel-frame-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FrameReadStatus","lower","byte","toLowerCase","SentinelFrameReader","constructor","spec","readFrame","buffer","first","length","standaloneBytes","includes","status","COMPLETE","consumedBytes","frame","start","frameStart","undefined","INCOMPLETE","end","findIndex","index","terminator","incompleteOrOverlong","slice","maxFrameBytes","CORRUPT"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/sentinel-frame-reader.ts"],"mappings":";;AACA,SAASA,eAAe,QAAQ,kCAA+B;AAgC/D,MAAMC,KAAK,GAAIC,IAAwB,IAAa,CAACA,IAAI,IAAI,EAAE,EAAEC,WAAW,CAAC,CAAC;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,CAAwB;EAC/CC,WAAWA,CAAkBC,IAAuB,EAAE;IAAA,KAAzBA,IAAuB,GAAvBA,IAAuB;EAAG;EAEvDC,SAASA,CAACC,MAAyB,EAAmB;IAC3D,MAAMC,KAAK,GAAGR,KAAK,CAACO,MAAM,CAAC,CAAC,CAAC,CAAC;IAE9B,IAAIA,MAAM,CAACE,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAACJ,IAAI,CAACK,eAAe,IAAI,EAAE,EAAEC,QAAQ,CAACH,KAAK,CAAC,EAAE;MAC1E,OAAO;QACLI,MAAM,EAAEb,eAAe,CAACc,QAAQ;QAChCC,aAAa,EAAE,CAAC;QAChBC,KAAK,EAAE,CAACP,KAAK;MACf,CAAC;IACH;IAEA,MAAMQ,KAAK,GAAG,IAAI,CAACC,UAAU,CAACV,MAAM,CAAC;;IAErC;AACJ;AACA;AACA;IACI,IAAIS,KAAK,KAAKE,SAAS,EAAE;MACvB,OAAO;QAAEN,MAAM,EAAEb,eAAe,CAACoB,UAAU;Q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