@ovok/native 0.4.6 → 0.4.7

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 (380) hide show
  1. package/lib/commonjs/modules/bt-management/index.js +176 -0
  2. package/lib/commonjs/modules/bt-management/index.js.map +1 -1
  3. package/lib/commonjs/modules/bt-management/services/custom/compile-case-fields.js +49 -0
  4. package/lib/commonjs/modules/bt-management/services/custom/compile-case-fields.js.map +1 -0
  5. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-case.js +47 -41
  6. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-case.js.map +1 -1
  7. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-frame.js +48 -2
  8. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-frame.js.map +1 -1
  9. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js +98 -0
  10. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -0
  11. package/lib/commonjs/modules/bt-management/services/custom/define-custom-device.js +24 -1
  12. package/lib/commonjs/modules/bt-management/services/custom/define-custom-device.js.map +1 -1
  13. package/lib/commonjs/modules/bt-management/services/device-creator.js +15 -8
  14. package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
  15. package/lib/commonjs/modules/bt-management/services/devices/aoj/aoj.thermometers.js +85 -0
  16. package/lib/commonjs/modules/bt-management/services/devices/aoj/aoj.thermometers.js.map +1 -0
  17. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +8 -74
  18. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
  19. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js +141 -0
  20. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -0
  21. package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js +9 -49
  22. package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
  23. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js +17 -6
  24. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  25. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +21 -14
  26. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  27. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +36 -0
  28. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -0
  29. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +81 -14
  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/lepu/lepu.command-builder.js +48 -0
  32. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.command-builder.js.map +1 -0
  33. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.commands.js +37 -0
  34. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.commands.js.map +1 -0
  35. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.device-info.js +83 -0
  36. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.device-info.js.map +1 -0
  37. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.device-names.js +26 -0
  38. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.device-names.js.map +1 -0
  39. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-names.js +36 -0
  40. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-names.js.map +1 -0
  41. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +155 -0
  42. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -0
  43. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +98 -0
  44. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -0
  45. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame.js +29 -0
  46. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame.js.map +1 -0
  47. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +103 -0
  48. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -0
  49. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.name-match.js +32 -0
  50. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.name-match.js.map +1 -0
  51. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.response-type.js +64 -0
  52. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.response-type.js.map +1 -0
  53. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js +143 -0
  54. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -0
  55. package/lib/commonjs/modules/bt-management/services/devices/polling-command-sequencer.js +38 -0
  56. package/lib/commonjs/modules/bt-management/services/devices/polling-command-sequencer.js.map +1 -0
  57. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +156 -0
  58. package/lib/commonjs/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -0
  59. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +124 -0
  60. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -0
  61. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +113 -0
  62. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -0
  63. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.lepod.js +117 -0
  64. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.lepod.js.map +1 -0
  65. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js +82 -0
  66. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -0
  67. package/lib/commonjs/modules/bt-management/types/command-sequencer.js +6 -0
  68. package/lib/commonjs/modules/bt-management/types/command-sequencer.js.map +1 -0
  69. package/lib/commonjs/modules/bt-management/types/custom-checksum-algorithm.js +2 -0
  70. package/lib/commonjs/modules/bt-management/types/custom-checksum-algorithm.js.map +1 -0
  71. package/lib/commonjs/modules/bt-management/types/custom-checksum-spec.js +6 -0
  72. package/lib/commonjs/modules/bt-management/types/custom-checksum-spec.js.map +1 -0
  73. package/lib/commonjs/modules/bt-management/types/custom-lepu-spec.js +2 -0
  74. package/lib/commonjs/modules/bt-management/types/custom-lepu-spec.js.map +1 -0
  75. package/lib/commonjs/modules/bt-management/types/custom-measurement-spec.js +6 -0
  76. package/lib/commonjs/modules/bt-management/types/custom-measurement-spec.js.map +1 -0
  77. package/lib/commonjs/modules/bt-management/types/device-command.js +2 -0
  78. package/lib/commonjs/modules/bt-management/types/device-command.js.map +1 -0
  79. package/lib/commonjs/modules/bt-management/types/measurement-group.js +6 -0
  80. package/lib/commonjs/modules/bt-management/types/measurement-group.js.map +1 -0
  81. package/lib/commonjs/modules/bt-management/utils/calculate-checksum.js +49 -0
  82. package/lib/commonjs/modules/bt-management/utils/calculate-checksum.js.map +1 -0
  83. package/lib/commonjs/modules/bt-management/utils/create-frame-validator.js +9 -0
  84. package/lib/commonjs/modules/bt-management/utils/create-frame-validator.js.map +1 -1
  85. package/lib/commonjs/modules/bt-management/utils/hex-to-bytes.js +19 -0
  86. package/lib/commonjs/modules/bt-management/utils/hex-to-bytes.js.map +1 -0
  87. package/lib/commonjs/modules/bt-management/utils/le-32-to-bytes.js +13 -0
  88. package/lib/commonjs/modules/bt-management/utils/le-32-to-bytes.js.map +1 -0
  89. package/lib/commonjs/modules/bt-management/utils/summarise-measurement-for-log.js +22 -0
  90. package/lib/commonjs/modules/bt-management/utils/summarise-measurement-for-log.js.map +1 -0
  91. package/lib/commonjs/modules/bt-management/utils/supported-measurement-type-keys.js +18 -0
  92. package/lib/commonjs/modules/bt-management/utils/supported-measurement-type-keys.js.map +1 -0
  93. package/lib/module/modules/bt-management/index.js +16 -0
  94. package/lib/module/modules/bt-management/index.js.map +1 -1
  95. package/lib/module/modules/bt-management/services/custom/compile-case-fields.js +44 -0
  96. package/lib/module/modules/bt-management/services/custom/compile-case-fields.js.map +1 -0
  97. package/lib/module/modules/bt-management/services/custom/compile-custom-case.js +47 -41
  98. package/lib/module/modules/bt-management/services/custom/compile-custom-case.js.map +1 -1
  99. package/lib/module/modules/bt-management/services/custom/compile-custom-frame.js +48 -2
  100. package/lib/module/modules/bt-management/services/custom/compile-custom-frame.js.map +1 -1
  101. package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js +93 -0
  102. package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -0
  103. package/lib/module/modules/bt-management/services/custom/define-custom-device.js +24 -1
  104. package/lib/module/modules/bt-management/services/custom/define-custom-device.js.map +1 -1
  105. package/lib/module/modules/bt-management/services/device-creator.js +16 -8
  106. package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
  107. package/lib/module/modules/bt-management/services/devices/aoj/aoj.thermometers.js +81 -0
  108. package/lib/module/modules/bt-management/services/devices/aoj/aoj.thermometers.js.map +1 -0
  109. package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +8 -73
  110. package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
  111. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js +136 -0
  112. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -0
  113. package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js +9 -49
  114. package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
  115. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js +17 -6
  116. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  117. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +21 -14
  118. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  119. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +32 -0
  120. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -0
  121. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +81 -14
  122. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  123. package/lib/module/modules/bt-management/services/devices/lepu/lepu.command-builder.js +43 -0
  124. package/lib/module/modules/bt-management/services/devices/lepu/lepu.command-builder.js.map +1 -0
  125. package/lib/module/modules/bt-management/services/devices/lepu/lepu.commands.js +33 -0
  126. package/lib/module/modules/bt-management/services/devices/lepu/lepu.commands.js.map +1 -0
  127. package/lib/module/modules/bt-management/services/devices/lepu/lepu.device-info.js +79 -0
  128. package/lib/module/modules/bt-management/services/devices/lepu/lepu.device-info.js.map +1 -0
  129. package/lib/module/modules/bt-management/services/devices/lepu/lepu.device-names.js +22 -0
  130. package/lib/module/modules/bt-management/services/devices/lepu/lepu.device-names.js.map +1 -0
  131. package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-names.js +32 -0
  132. package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-names.js.map +1 -0
  133. package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +150 -0
  134. package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -0
  135. package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +93 -0
  136. package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -0
  137. package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame.js +24 -0
  138. package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame.js.map +1 -0
  139. package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +98 -0
  140. package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -0
  141. package/lib/module/modules/bt-management/services/devices/lepu/lepu.name-match.js +27 -0
  142. package/lib/module/modules/bt-management/services/devices/lepu/lepu.name-match.js.map +1 -0
  143. package/lib/module/modules/bt-management/services/devices/lepu/lepu.response-type.js +59 -0
  144. package/lib/module/modules/bt-management/services/devices/lepu/lepu.response-type.js.map +1 -0
  145. package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js +140 -0
  146. package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -0
  147. package/lib/module/modules/bt-management/services/devices/polling-command-sequencer.js +34 -0
  148. package/lib/module/modules/bt-management/services/devices/polling-command-sequencer.js.map +1 -0
  149. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js +149 -0
  150. package/lib/module/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.js.map +1 -0
  151. package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +118 -0
  152. package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -0
  153. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +108 -0
  154. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -0
  155. package/lib/module/modules/bt-management/services/devices/viatom/viatom.lepod.js +114 -0
  156. package/lib/module/modules/bt-management/services/devices/viatom/viatom.lepod.js.map +1 -0
  157. package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js +79 -0
  158. package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -0
  159. package/lib/module/modules/bt-management/types/command-sequencer.js +4 -0
  160. package/lib/module/modules/bt-management/types/command-sequencer.js.map +1 -0
  161. package/lib/module/modules/bt-management/types/custom-checksum-algorithm.js +2 -0
  162. package/lib/module/modules/bt-management/types/custom-checksum-algorithm.js.map +1 -0
  163. package/lib/module/modules/bt-management/types/custom-checksum-spec.js +4 -0
  164. package/lib/module/modules/bt-management/types/custom-checksum-spec.js.map +1 -0
  165. package/lib/module/modules/bt-management/types/custom-device-definition.js.map +1 -1
  166. package/lib/module/modules/bt-management/types/custom-lepu-spec.js +2 -0
  167. package/lib/module/modules/bt-management/types/custom-lepu-spec.js.map +1 -0
  168. package/lib/module/modules/bt-management/types/custom-measurement-spec.js +4 -0
  169. package/lib/module/modules/bt-management/types/custom-measurement-spec.js.map +1 -0
  170. package/lib/module/modules/bt-management/types/device-command.js +2 -0
  171. package/lib/module/modules/bt-management/types/device-command.js.map +1 -0
  172. package/lib/module/modules/bt-management/types/measurement-group.js +4 -0
  173. package/lib/module/modules/bt-management/types/measurement-group.js.map +1 -0
  174. package/lib/module/modules/bt-management/utils/calculate-checksum.js +44 -0
  175. package/lib/module/modules/bt-management/utils/calculate-checksum.js.map +1 -0
  176. package/lib/module/modules/bt-management/utils/create-frame-validator.js +9 -0
  177. package/lib/module/modules/bt-management/utils/create-frame-validator.js.map +1 -1
  178. package/lib/module/modules/bt-management/utils/hex-to-bytes.js +14 -0
  179. package/lib/module/modules/bt-management/utils/hex-to-bytes.js.map +1 -0
  180. package/lib/module/modules/bt-management/utils/le-32-to-bytes.js +8 -0
  181. package/lib/module/modules/bt-management/utils/le-32-to-bytes.js.map +1 -0
  182. package/lib/module/modules/bt-management/utils/summarise-measurement-for-log.js +17 -0
  183. package/lib/module/modules/bt-management/utils/summarise-measurement-for-log.js.map +1 -0
  184. package/lib/module/modules/bt-management/utils/supported-measurement-type-keys.js +13 -0
  185. package/lib/module/modules/bt-management/utils/supported-measurement-type-keys.js.map +1 -0
  186. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +16 -0
  187. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
  188. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-case-fields.d.ts +13 -0
  189. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-case-fields.d.ts.map +1 -0
  190. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-case.d.ts.map +1 -1
  191. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-frame.d.ts.map +1 -1
  192. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts +11 -0
  193. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -0
  194. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/define-custom-device.d.ts.map +1 -1
  195. package/lib/typescript/commonjs/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
  196. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/aoj/aoj.thermometers.d.ts +24 -0
  197. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/aoj/aoj.thermometers.d.ts.map +1 -0
  198. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +5 -8
  199. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
  200. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts +67 -0
  201. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -0
  202. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +6 -4
  203. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
  204. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts +20 -1
  205. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
  206. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +12 -1
  207. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  208. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +21 -0
  209. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -0
  210. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +33 -0
  211. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  212. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.command-builder.d.ts +24 -0
  213. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.command-builder.d.ts.map +1 -0
  214. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.commands.d.ts +32 -0
  215. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.commands.d.ts.map +1 -0
  216. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.device-info.d.ts +27 -0
  217. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.device-info.d.ts.map +1 -0
  218. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.device-names.d.ts +20 -0
  219. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.device-names.d.ts.map +1 -0
  220. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-names.d.ts +14 -0
  221. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-names.d.ts.map +1 -0
  222. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +75 -0
  223. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -0
  224. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +28 -0
  225. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -0
  226. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame.d.ts +12 -0
  227. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame.d.ts.map +1 -0
  228. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +81 -0
  229. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -0
  230. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.name-match.d.ts +17 -0
  231. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.name-match.d.ts.map +1 -0
  232. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.response-type.d.ts +33 -0
  233. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.response-type.d.ts.map +1 -0
  234. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +85 -0
  235. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -0
  236. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/polling-command-sequencer.d.ts +27 -0
  237. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/polling-command-sequencer.d.ts.map +1 -0
  238. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +44 -0
  239. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -0
  240. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts +44 -0
  241. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -0
  242. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts +32 -0
  243. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -0
  244. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts +25 -0
  245. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts.map +1 -0
  246. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts +39 -0
  247. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -0
  248. package/lib/typescript/commonjs/src/modules/bt-management/types/command-sequencer.d.ts +26 -0
  249. package/lib/typescript/commonjs/src/modules/bt-management/types/command-sequencer.d.ts.map +1 -0
  250. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-case-spec.d.ts +13 -0
  251. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-case-spec.d.ts.map +1 -1
  252. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-checksum-algorithm.d.ts +10 -0
  253. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-checksum-algorithm.d.ts.map +1 -0
  254. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-checksum-spec.d.ts +23 -0
  255. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-checksum-spec.d.ts.map +1 -0
  256. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-definition.d.ts +5 -0
  257. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-definition.d.ts.map +1 -1
  258. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-spec.d.ts +12 -0
  259. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-spec.d.ts.map +1 -1
  260. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-frame-spec.d.ts +8 -0
  261. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-frame-spec.d.ts.map +1 -1
  262. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts +44 -0
  263. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -0
  264. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-measurement-spec.d.ts +9 -0
  265. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-measurement-spec.d.ts.map +1 -0
  266. package/lib/typescript/commonjs/src/modules/bt-management/types/device-command.d.ts +18 -0
  267. package/lib/typescript/commonjs/src/modules/bt-management/types/device-command.d.ts.map +1 -0
  268. package/lib/typescript/commonjs/src/modules/bt-management/types/measurement-group.d.ts +14 -0
  269. package/lib/typescript/commonjs/src/modules/bt-management/types/measurement-group.d.ts.map +1 -0
  270. package/lib/typescript/commonjs/src/modules/bt-management/types/parsing-case.d.ts +9 -0
  271. package/lib/typescript/commonjs/src/modules/bt-management/types/parsing-case.d.ts.map +1 -1
  272. package/lib/typescript/commonjs/src/modules/bt-management/utils/calculate-checksum.d.ts +13 -0
  273. package/lib/typescript/commonjs/src/modules/bt-management/utils/calculate-checksum.d.ts.map +1 -0
  274. package/lib/typescript/commonjs/src/modules/bt-management/utils/create-frame-validator.d.ts.map +1 -1
  275. package/lib/typescript/commonjs/src/modules/bt-management/utils/hex-to-bytes.d.ts +10 -0
  276. package/lib/typescript/commonjs/src/modules/bt-management/utils/hex-to-bytes.d.ts.map +1 -0
  277. package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-to-bytes.d.ts +3 -0
  278. package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-to-bytes.d.ts.map +1 -0
  279. package/lib/typescript/commonjs/src/modules/bt-management/utils/summarise-measurement-for-log.d.ts +9 -0
  280. package/lib/typescript/commonjs/src/modules/bt-management/utils/summarise-measurement-for-log.d.ts.map +1 -0
  281. package/lib/typescript/commonjs/src/modules/bt-management/utils/supported-measurement-type-keys.d.ts +10 -0
  282. package/lib/typescript/commonjs/src/modules/bt-management/utils/supported-measurement-type-keys.d.ts.map +1 -0
  283. package/lib/typescript/module/src/modules/bt-management/index.d.ts +16 -0
  284. package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
  285. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-case-fields.d.ts +13 -0
  286. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-case-fields.d.ts.map +1 -0
  287. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-case.d.ts.map +1 -1
  288. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-frame.d.ts.map +1 -1
  289. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts +11 -0
  290. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -0
  291. package/lib/typescript/module/src/modules/bt-management/services/custom/define-custom-device.d.ts.map +1 -1
  292. package/lib/typescript/module/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
  293. package/lib/typescript/module/src/modules/bt-management/services/devices/aoj/aoj.thermometers.d.ts +24 -0
  294. package/lib/typescript/module/src/modules/bt-management/services/devices/aoj/aoj.thermometers.d.ts.map +1 -0
  295. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +5 -8
  296. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
  297. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts +67 -0
  298. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -0
  299. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +6 -4
  300. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
  301. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts +20 -1
  302. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
  303. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +12 -1
  304. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  305. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +21 -0
  306. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -0
  307. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +33 -0
  308. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  309. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.command-builder.d.ts +24 -0
  310. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.command-builder.d.ts.map +1 -0
  311. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.commands.d.ts +32 -0
  312. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.commands.d.ts.map +1 -0
  313. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.device-info.d.ts +27 -0
  314. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.device-info.d.ts.map +1 -0
  315. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.device-names.d.ts +20 -0
  316. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.device-names.d.ts.map +1 -0
  317. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-names.d.ts +14 -0
  318. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-names.d.ts.map +1 -0
  319. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +75 -0
  320. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -0
  321. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +28 -0
  322. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -0
  323. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame.d.ts +12 -0
  324. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame.d.ts.map +1 -0
  325. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +81 -0
  326. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -0
  327. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.name-match.d.ts +17 -0
  328. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.name-match.d.ts.map +1 -0
  329. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.response-type.d.ts +33 -0
  330. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.response-type.d.ts.map +1 -0
  331. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +85 -0
  332. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -0
  333. package/lib/typescript/module/src/modules/bt-management/services/devices/polling-command-sequencer.d.ts +27 -0
  334. package/lib/typescript/module/src/modules/bt-management/services/devices/polling-command-sequencer.d.ts.map +1 -0
  335. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts +44 -0
  336. package/lib/typescript/module/src/modules/bt-management/services/devices/standard-gatt/standard-gatt.devices.d.ts.map +1 -0
  337. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts +44 -0
  338. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -0
  339. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts +32 -0
  340. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -0
  341. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts +25 -0
  342. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.lepod.d.ts.map +1 -0
  343. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts +39 -0
  344. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -0
  345. package/lib/typescript/module/src/modules/bt-management/types/command-sequencer.d.ts +26 -0
  346. package/lib/typescript/module/src/modules/bt-management/types/command-sequencer.d.ts.map +1 -0
  347. package/lib/typescript/module/src/modules/bt-management/types/custom-case-spec.d.ts +13 -0
  348. package/lib/typescript/module/src/modules/bt-management/types/custom-case-spec.d.ts.map +1 -1
  349. package/lib/typescript/module/src/modules/bt-management/types/custom-checksum-algorithm.d.ts +10 -0
  350. package/lib/typescript/module/src/modules/bt-management/types/custom-checksum-algorithm.d.ts.map +1 -0
  351. package/lib/typescript/module/src/modules/bt-management/types/custom-checksum-spec.d.ts +23 -0
  352. package/lib/typescript/module/src/modules/bt-management/types/custom-checksum-spec.d.ts.map +1 -0
  353. package/lib/typescript/module/src/modules/bt-management/types/custom-device-definition.d.ts +5 -0
  354. package/lib/typescript/module/src/modules/bt-management/types/custom-device-definition.d.ts.map +1 -1
  355. package/lib/typescript/module/src/modules/bt-management/types/custom-device-spec.d.ts +12 -0
  356. package/lib/typescript/module/src/modules/bt-management/types/custom-device-spec.d.ts.map +1 -1
  357. package/lib/typescript/module/src/modules/bt-management/types/custom-frame-spec.d.ts +8 -0
  358. package/lib/typescript/module/src/modules/bt-management/types/custom-frame-spec.d.ts.map +1 -1
  359. package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts +44 -0
  360. package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -0
  361. package/lib/typescript/module/src/modules/bt-management/types/custom-measurement-spec.d.ts +9 -0
  362. package/lib/typescript/module/src/modules/bt-management/types/custom-measurement-spec.d.ts.map +1 -0
  363. package/lib/typescript/module/src/modules/bt-management/types/device-command.d.ts +18 -0
  364. package/lib/typescript/module/src/modules/bt-management/types/device-command.d.ts.map +1 -0
  365. package/lib/typescript/module/src/modules/bt-management/types/measurement-group.d.ts +14 -0
  366. package/lib/typescript/module/src/modules/bt-management/types/measurement-group.d.ts.map +1 -0
  367. package/lib/typescript/module/src/modules/bt-management/types/parsing-case.d.ts +9 -0
  368. package/lib/typescript/module/src/modules/bt-management/types/parsing-case.d.ts.map +1 -1
  369. package/lib/typescript/module/src/modules/bt-management/utils/calculate-checksum.d.ts +13 -0
  370. package/lib/typescript/module/src/modules/bt-management/utils/calculate-checksum.d.ts.map +1 -0
  371. package/lib/typescript/module/src/modules/bt-management/utils/create-frame-validator.d.ts.map +1 -1
  372. package/lib/typescript/module/src/modules/bt-management/utils/hex-to-bytes.d.ts +10 -0
  373. package/lib/typescript/module/src/modules/bt-management/utils/hex-to-bytes.d.ts.map +1 -0
  374. package/lib/typescript/module/src/modules/bt-management/utils/le-32-to-bytes.d.ts +3 -0
  375. package/lib/typescript/module/src/modules/bt-management/utils/le-32-to-bytes.d.ts.map +1 -0
  376. package/lib/typescript/module/src/modules/bt-management/utils/summarise-measurement-for-log.d.ts +9 -0
  377. package/lib/typescript/module/src/modules/bt-management/utils/summarise-measurement-for-log.d.ts.map +1 -0
  378. package/lib/typescript/module/src/modules/bt-management/utils/supported-measurement-type-keys.d.ts +10 -0
  379. package/lib/typescript/module/src/modules/bt-management/utils/supported-measurement-type-keys.d.ts.map +1 -0
  380. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"names":["le32FromHex","le32ToBytes","LepuCommand","lepuNameBytes","lepuNamesFrom","lepuCommandOf","lepuPayloadOf","describeLepuResponseType","isLepuSuccess","FILE_SIZE_OFFSET","MAX_FILE_BYTES","TRANSFER_COMMANDS","GET_FILE_LIST","READ_FILE_START","READ_FILE_DATA","READ_FILE_END","LepuFileTransfer","files","fileIndex","name","totalBytes","content","isSessionOpen","isDone","constructor","params","initialCommands","commandFor","nextCommand","frame","command","includes","undefined","fail","openNextFile","openedFile","appendChunk","closedFile","payload","limit","maxFileBytes","closeFile","length","push","onProgress","receivedBytes","onFile","reason","onError","write","builder","build"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.file-transfer.ts"],"mappings":";;AAEA,SAASA,WAAW,QAAQ,kCAA+B;AAC3D,SAASC,WAAW,QAAQ,kCAA+B;AAG3D,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,SAASC,aAAa,EAAEC,aAAa,QAAQ,sBAAmB;AAChE,SAASC,aAAa,EAAEC,aAAa,QAAQ,iBAAc;AAC3D,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,yBAAsB;AAE9E,MAAMC,gBAAgB,GAAG,CAAC;;AAE1B;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG,OAAO;AA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,IAAI,IAAI,CAACA,UAAU,GAAG,CAAC,EAAE;MACvB,IAAI,CAACK,MAAM,CAACqB,MAAM,CAAC;QAAE3B,IAAI,EAAE,IAAI,CAACA,IAAI;QAAEE,OAAO,EAAE,IAAI,CAACA;MAAQ,CAAC,CAAC;IAChE;IAEA,IAAI,CAACH,SAAS,EAAE;IAEhB,OAAO,IAAI,CAACgB,YAAY,CAAC,CAAC;EAC5B,CAAC;EAEOO,SAAS,GAAGA,CAAA,KAAgC,CAClD,IAAI,CAACd,UAAU,CAACzB,WAAW,CAACa,aAAa,CAAC,CAC3C;;EAED;AACF;AACA;AACA;AACA;AACA;EACUkB,IAAI,GAAIc,MAAc,IAA2C;IACvE,IAAI,CAACtB,MAAM,CAACuB,OAAO,CAACD,MAAM,CAAC;IAC3B,IAAI,CAACxB,MAAM,GAAG,IAAI;IAElB,IAAI,CAAC,IAAI,CAACD,aAAa,EAAE;MACvB,OAAOU,SAAS;IAClB;IAEA,IAAI,CAACV,aAAa,GAAG,KAAK;IAE1B,OAAO,IAAI,CAACmB,SAAS,CAAC,CAAC;EACzB,CAAC;EAEOd,UAAU,GAAGA,CACnBG,OAAe,EACfQ,OAA0B,GAAG,EAAE,MACZ;IACnB,GAAG,IAAI,CAACb,MAAM,CAACwB,KAAK;IACpBpB,KAAK,EAAE,IAAI,CAACJ,MAAM,CAACyB,OAAO,CAACC,KAAK,CAACrB,OAAO,EAAEQ,OAAO;EACnD,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ import { FrameReadStatus } from "../../../types/frame-read-status.js";
4
+ import { calculateCrc8 } from "../../../utils/calculate-crc-8.js";
5
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
6
+ import { le16FromHex } from "../../../utils/le-16-from-hex.js";
7
+ const COMMAND_INDEX = 1;
8
+ const COMMAND_COMPLEMENT_INDEX = 2;
9
+ const PAYLOAD_LENGTH_INDEX = 5;
10
+ const HEADER_BYTES = 7;
11
+ const CHECKSUM_BYTES = 1;
12
+ const BYTE_MASK = 0xff;
13
+
14
+ /** Start byte, command and its complement: the shortest run that can identify a start. */
15
+ const START_PATTERN_BYTES = 3;
16
+
17
+ /**
18
+ * Reads the frame every Lepu device shares.
19
+ *
20
+ * Layout: `start | cmd | ~cmd | type | seq | lenLow lenHigh | payload | crc8`, where the
21
+ * checksum covers every byte before it. The complement of the command byte only narrows the
22
+ * search for a start; the checksum is what actually decides a frame is trustworthy.
23
+ *
24
+ * The start byte is the only part that varies across the family. Most devices use `a5`, a
25
+ * smaller group uses `55`, and a few accept either and settle on one at runtime - so it is a
26
+ * list rather than a single value. Everything else is identical on every device speaking this
27
+ * protocol, which is why it is worth having once rather than once per device.
28
+ */
29
+ export class LepuFrameReader {
30
+ constructor(startBytes) {
31
+ this.startBytes = startBytes;
32
+ }
33
+ readFrame(buffer) {
34
+ const start = this.findFrameStart(buffer);
35
+ if (start === -1) {
36
+ return {
37
+ status: FrameReadStatus.INCOMPLETE,
38
+ consumedBytes: this.droppableLeadingBytes(buffer)
39
+ };
40
+ }
41
+ const payloadLength = le16FromHex(buffer, start + PAYLOAD_LENGTH_INDEX);
42
+ const frameLength = HEADER_BYTES + payloadLength + CHECKSUM_BYTES;
43
+ if (start + frameLength > buffer.length) {
44
+ return {
45
+ status: FrameReadStatus.INCOMPLETE,
46
+ consumedBytes: start
47
+ };
48
+ }
49
+ const frame = buffer.slice(start, start + frameLength);
50
+ if (!this.hasValidChecksum(frame)) {
51
+ return {
52
+ status: FrameReadStatus.CORRUPT,
53
+ consumedBytes: start + START_PATTERN_BYTES
54
+ };
55
+ }
56
+ return {
57
+ status: FrameReadStatus.COMPLETE,
58
+ consumedBytes: start + frameLength,
59
+ frame
60
+ };
61
+ }
62
+ isFrameStart(buffer, index) {
63
+ if (!this.startBytes.includes((buffer[index] || "").toLowerCase())) {
64
+ return false;
65
+ }
66
+ const command = hexToByte(buffer[index + COMMAND_INDEX] || "0");
67
+ const complement = hexToByte(buffer[index + COMMAND_COMPLEMENT_INDEX] || "0");
68
+ return command === (~complement & BYTE_MASK);
69
+ }
70
+ findFrameStart(buffer) {
71
+ const lastCandidate = buffer.length - START_PATTERN_BYTES;
72
+ for (let index = 0; index <= lastCandidate; index++) {
73
+ if (this.isFrameStart(buffer, index)) {
74
+ return index;
75
+ }
76
+ }
77
+ return -1;
78
+ }
79
+
80
+ /**
81
+ * Bytes that cannot begin a frame start, and are therefore safe to drop when no start was
82
+ * found. The trailing bytes are kept because a start pattern may still be arriving.
83
+ */
84
+ droppableLeadingBytes(buffer) {
85
+ return Math.max(0, buffer.length - (START_PATTERN_BYTES - 1));
86
+ }
87
+ hasValidChecksum(frame) {
88
+ const checksummedBytes = frame.length - CHECKSUM_BYTES;
89
+ const declared = hexToByte(frame[checksummedBytes] || "0");
90
+ return declared === calculateCrc8(frame, checksummedBytes);
91
+ }
92
+ }
93
+ //# sourceMappingURL=lepu.frame-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FrameReadStatus","calculateCrc8","hexToByte","le16FromHex","COMMAND_INDEX","COMMAND_COMPLEMENT_INDEX","PAYLOAD_LENGTH_INDEX","HEADER_BYTES","CHECKSUM_BYTES","BYTE_MASK","START_PATTERN_BYTES","LepuFrameReader","constructor","startBytes","readFrame","buffer","start","findFrameStart","status","INCOMPLETE","consumedBytes","droppableLeadingBytes","payloadLength","frameLength","length","frame","slice","hasValidChecksum","CORRUPT","COMPLETE","isFrameStart","index","includes","toLowerCase","command","complement","lastCandidate","Math","max","checksummedBytes","declared"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.frame-reader.ts"],"mappings":";;AACA,SAASA,eAAe,QAAQ,qCAAkC;AAElE,SAASC,aAAa,QAAQ,mCAAgC;AAC9D,SAASC,SAAS,QAAQ,+BAA4B;AACtD,SAASC,WAAW,QAAQ,kCAA+B;AAE3D,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,wBAAwB,GAAG,CAAC;AACl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a,CAACwB,KAAK,EAAEc,gBAAgB,CAAC;EAC5D;AACF","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
4
+ import { le16FromHex } from "../../../utils/le-16-from-hex.js";
5
+ const COMMAND_INDEX = 1;
6
+ const PAYLOAD_LENGTH_INDEX = 5;
7
+ const HEADER_BYTES = 7;
8
+
9
+ /** The opcode a frame answers, which is what correlates a reply to its request. */
10
+ const lepuCommandOf = frame => hexToByte(frame[COMMAND_INDEX] ?? "0");
11
+
12
+ /**
13
+ * The bytes a frame carries, from its own declared length.
14
+ *
15
+ * Declared rather than derived from what arrived: the frame reader has already checked that
16
+ * the buffer holds the whole frame, so the length field is the payload's end, and trusting
17
+ * the array instead would fold the checksum byte into the data.
18
+ */
19
+ const lepuPayloadOf = frame => {
20
+ const length = le16FromHex(frame, PAYLOAD_LENGTH_INDEX);
21
+ return frame.slice(HEADER_BYTES, HEADER_BYTES + length);
22
+ };
23
+ export { lepuCommandOf, lepuPayloadOf };
24
+ //# sourceMappingURL=lepu.frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["hexToByte","le16FromHex","COMMAND_INDEX","PAYLOAD_LENGTH_INDEX","HEADER_BYTES","lepuCommandOf","frame","lepuPayloadOf","length","slice"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.frame.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,+BAA4B;AACtD,SAASC,WAAW,QAAQ,kCAA+B;AAE3D,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,oBAAoB,GAAG,CAAC;AAC9B,MAAMC,YAAY,GAAG,CAAC;;AAEtB;AACA,MAAMC,aAAa,GAAIC,KAAwB,IAC7CN,SAAS,CAACM,KAAK,CAACJ,aAAa,CAAC,IAAI,GAAG,CAAC;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMK,aAAa,GAAID,KAAwB,IAAe;EAC5D,MAAME,MAAM,GAAGP,WAAW,CAACK,KAAK,EAAEH,oBAAoB,CAAC;EAEvD,OAAOG,KAAK,CAACG,KAAK,CAACL,YAAY,EAAEA,YAAY,GAAGI,MAAM,CAAC;AACzD,CAAC;AAED,SAASH,aAAa,EAAEE,aAAa","ignoreList":[]}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
4
+ import { LepuCommand } from "./lepu.commands.js";
5
+ import { parseLepuDeviceInfo } from "./lepu.device-info.js";
6
+ import { describeLepuResponseType, isLepuSuccess } from "./lepu.response-type.js";
7
+ const COMMAND_INDEX = 1;
8
+
9
+ /**
10
+ * Asks a Lepu device what it is before sending it anything that acts.
11
+ *
12
+ * The family shares one frame format, one checksum and one opcode space, but not one
13
+ * meaning: `0x08` polls realtime data on a BP2, starts a blood-pressure measurement on an
14
+ * AirBp and starts an ECG on a Lepod. A frame built for the wrong device is therefore
15
+ * perfectly well-formed - the CRC is computed the same way on every one of them - so
16
+ * nothing in the protocol catches a driver bound to the wrong hardware. What comes back is
17
+ * a cuff inflating on someone's arm because a name matched during a scan.
18
+ *
19
+ * `GET_INFO` is the one command that cannot cause that: it is generic, inert, and answered
20
+ * identically family-wide. So it goes first, and everything else waits on its reply.
21
+ *
22
+ * A declaration that names the models it was written for is refused permanently when the
23
+ * device answers with a different one. A declaration that names none is identified by the
24
+ * advertised name it already matched, which is the basis the vendor's own SDK binds every
25
+ * one of its products on; it is asked what it is anyway, and the answer reported, because
26
+ * that is the only place these model numbers exist - the vendor never reads the field back,
27
+ * so there is no table of them to copy.
28
+ *
29
+ * A reply that never arrives leaves the gate closed and nothing sent, which the data
30
+ * processor's stuck-data timeout reports and disconnects on. That is the watchdog for this
31
+ * too - the protocol has no retry of its own, so a dropped reply is recovered by
32
+ * reconnecting rather than by asking again.
33
+ */
34
+ export class LepuIdentityGate {
35
+ isIdentified = false;
36
+ isRefused = false;
37
+ constructor(params) {
38
+ this.params = params;
39
+ }
40
+ initialCommands = () => [this.commandFor(LepuCommand.GET_INFO)];
41
+ nextCommand = frame => {
42
+ if (this.isRefused) {
43
+ return undefined;
44
+ }
45
+ if (this.isIdentified) {
46
+ return this.poll();
47
+ }
48
+ return this.admit(frame);
49
+ };
50
+
51
+ /**
52
+ * Decides on the reply to `GET_INFO`.
53
+ *
54
+ * A frame that is not that reply leaves the gate as it was rather than provoking another
55
+ * command, because the only command outstanding is the one still being waited on.
56
+ *
57
+ * A reply that is that command but carries an error type is refused rather than parsed.
58
+ * The payload of an error is the reason for it, so reading a model number out of it would
59
+ * identify the hardware from an error code.
60
+ */
61
+ admit = frame => {
62
+ if (hexToByte(frame[COMMAND_INDEX] ?? "0") !== LepuCommand.GET_INFO) {
63
+ return undefined;
64
+ }
65
+ if (!isLepuSuccess(frame)) {
66
+ return this.refuse(`the device would not say what it is: ${describeLepuResponseType(frame)}`);
67
+ }
68
+ const info = parseLepuDeviceInfo(frame);
69
+ if (!info) {
70
+ return this.refuse("the device answered with a frame too short to hold its own model number");
71
+ }
72
+ this.params.onIdentified?.(info);
73
+ if (this.params.pollCommand === undefined) {
74
+ return undefined;
75
+ }
76
+ const isNarrowed = this.params.expectedDeviceTypes.length > 0;
77
+ if (isNarrowed && !this.params.expectedDeviceTypes.includes(info.deviceType)) {
78
+ return this.refuse(`the hardware reported model ${info.deviceType} (branch "${info.branchCode}"), which this declaration was not written for`);
79
+ }
80
+ this.isIdentified = true;
81
+ return this.poll();
82
+ };
83
+
84
+ /** Closes the gate for good. There is no state a refused device can be talked back from. */
85
+ refuse = reason => {
86
+ this.isRefused = true;
87
+ this.params.onRefused(reason);
88
+ return undefined;
89
+ };
90
+
91
+ /** Nothing, for a declaration that asks what the device is and stops there. */
92
+ poll = () => this.params.pollCommand === undefined ? undefined : [this.commandFor(this.params.pollCommand)];
93
+ commandFor = command => ({
94
+ ...this.params.write,
95
+ frame: this.params.builder.build(command)
96
+ });
97
+ }
98
+ //# sourceMappingURL=lepu.identity-gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["hexToByte","LepuCommand","parseLepuDeviceInfo","describeLepuResponseType","isLepuSuccess","COMMAND_INDEX","LepuIdentityGate","isIdentified","isRefused","constructor","params","initialCommands","commandFor","GET_INFO","nextCommand","frame","undefined","poll","admit","refuse","info","onIdentified","pollCommand","isNarrowed","expectedDeviceTypes","length","includes","deviceType","branchCode","reason","onRefused","command","write","builder","build"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.identity-gate.ts"],"mappings":";;AAEA,SAASA,SAAS,QAAQ,+BAA4B;AAGtD,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,SAAyBC,mBAAmB,QAAQ,uBAAoB;AACxE,SACEC,wBAAwB,EACxBC,aAAa,QACR,yBAAsB;AAmC7B,MAAMC,aAAa,GAAG,CAAC;;AAEvB;AACA;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,gBAAgB,CAA6B;EAChDC,YAAY,GAAG,KAAK;EACpBC,SAAS,GAAG,KAAK;EAElBC,WAAWA,CAAkBC,MAA8B,EAAE;IAAA,KAAhCA,MAA8B,GAA9BA,MAA8B;EAAG;EAE9DC,eAAe,GAAGA,CAAA,KAAgC,CACvD,IAAI,CAACC,UAAU,CAACX,WAAW,CAACY,QAAQ,CAAC,CACtC;EAEMC,WAAW,GAChBC,KAAwB,IACiB;IACzC,IAAI,IAAI,CAACP,SAAS,EAAE;MAClB,OAAOQ,SAAS;IAClB;IAEA,IAAI,IAAI,CAACT,YAAY,EAAE;MACrB,OAAO,IAAI,CAACU,IAAI,CAAC,CAAC;IACpB;IAEA,OAAO,IAAI,CAACC,KAAK,CAACH,KAAK,CAAC;EAC1B,CAAC;;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACUG,KAAK,GACXH,KAAw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,UAAU,CAAC,IAAI,CAACF,MAAM,CAACY,WAAW,CAAC,CAAC;EAExCV,UAAU,GAAImB,OAAe,KAAqB;IACxD,GAAG,IAAI,CAACrB,MAAM,CAACsB,KAAK;IACpBjB,KAAK,EAAE,IAAI,CAACL,MAAM,CAACuB,OAAO,CAACC,KAAK,CAACH,OAAO;EAC1C,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ import { LEPU_DEVICE_NAMES } from "./lepu.device-names.js";
4
+ const REGEXP_SPECIAL = /[.*+?^${}()|[\]\\]/g;
5
+ const escapeRegExp = value => value.replace(REGEXP_SPECIAL, "\\$&");
6
+
7
+ /**
8
+ * Builds a matcher for one advertised name that cannot also match a longer one.
9
+ *
10
+ * The vendor tests these names with a substring check in a hand-ordered cascade, so `BP2`
11
+ * only fails to match a BP2W because `BP2W` happens to be checked first. Order is a fragile
12
+ * place to keep a safety property: it lives in whoever wrote the list, is invisible at the
13
+ * point of use, and an insertion in the wrong place silently binds the wrong driver.
14
+ *
15
+ * Here the exclusions are derived instead. Every name in the vocabulary that extends this
16
+ * one becomes a negative lookahead, so the matcher is correct wherever it is used and in
17
+ * whatever order it is tried.
18
+ *
19
+ * The match is deliberately open at the end, because these devices advertise a serial after
20
+ * the model - `BP2 1234` - and the serial's shape varies across the family.
21
+ */
22
+ export const lepuNameMatch = (name, vocabulary = LEPU_DEVICE_NAMES) => {
23
+ const extensions = vocabulary.filter(other => other !== name && other.startsWith(name)).map(other => escapeRegExp(other.slice(name.length)));
24
+ const exclusion = extensions.length > 0 ? `(?!${extensions.join("|")})` : "";
25
+ return new RegExp(`^${escapeRegExp(name)}${exclusion}`);
26
+ };
27
+ //# sourceMappingURL=lepu.name-match.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LEPU_DEVICE_NAMES","REGEXP_SPECIAL","escapeRegExp","value","replace","lepuNameMatch","name","vocabulary","extensions","filter","other","startsWith","map","slice","length","exclusion","join","RegExp"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.name-match.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,wBAAqB;AAEvD,MAAMC,cAAc,GAAG,qBAAqB;AAE5C,MAAMC,YAAY,GAAIC,KAAa,IACjCA,KAAK,CAACC,OAAO,CAACH,cAAc,EAAE,MAAM,CAAC;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,aAAa,GAAGA,CAC3BC,IAAY,EACZC,UAA6B,GAAGP,iBAAiB,KACtC;EACX,MAAMQ,UAAU,GAAGD,UAAU,CAC1BE,MAAM,CAAEC,KAAK,IAAKA,KAAK,KAAKJ,IAAI,IAAII,KAAK,CAACC,UAAU,CAACL,IAAI,CAAC,CAAC,CAC3DM,GAAG,CAAEF,KAAK,IAAKR,YAAY,CAACQ,KAAK,CAACG,KAAK,CAACP,IAAI,CAACQ,MAAM,CAAC,CAAC,CAAC;EAEzD,MAAMC,SAAS,GACbP,UAAU,CAACM,MAAM,GAAG,CAAC,GAAG,MAAMN,UAAU,CAACQ,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE;EAE5D,OAAO,IAAIC,MAAM,CAAC,IAAIf,YAAY,CAACI,IAAI,CAAC,GAAGS,SAAS,EAAE,CAAC;AACzD,CAAC","ignoreList":[]}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
4
+
5
+ /** Byte 3 of every frame: the direction on a request, the outcome on a reply. */
6
+ const RESPONSE_TYPE_INDEX = 3;
7
+
8
+ /**
9
+ * What a Lepu device says about the request it just answered.
10
+ *
11
+ * Only `SUCCESS` means the payload holds what was asked for. Every other value is an error
12
+ * whose payload is not the requested data, so a reply has to be checked before it is
13
+ * decoded - otherwise a refusal is read as a reading, out of whatever bytes happen to
14
+ * follow the header.
15
+ */
16
+ const LepuResponseType = {
17
+ /** A request, phone to device. Never seen on a reply. */
18
+ REQUEST: 0x00,
19
+ SUCCESS: 0x01,
20
+ /** The device rejected our checksum. */
21
+ CRC_ERROR: 0x02,
22
+ FILE_NOT_FOUND: 0xe0,
23
+ FILE_READ_FAILED: 0xe1,
24
+ FILE_WRITE_FAILED: 0xe2,
25
+ PARAMETER_ILLEGAL: 0xf1,
26
+ PERMISSION_DENIED: 0xf2,
27
+ DECRYPT_FAILED: 0xf3,
28
+ /** Mid-measurement or otherwise occupied. Worth backing off rather than giving up. */
29
+ DEVICE_BUSY: 0xfb,
30
+ COMMAND_FORMAT_ERROR: 0xfc,
31
+ /** The opcode is unknown to this firmware, which is how a feature is detected. */
32
+ COMMAND_NOT_SUPPORTED: 0xfd,
33
+ ERROR: 0xff
34
+ };
35
+ const RESPONSE_TYPE_NAMES = {
36
+ [LepuResponseType.CRC_ERROR]: "it rejected our checksum",
37
+ [LepuResponseType.FILE_NOT_FOUND]: "the file does not exist",
38
+ [LepuResponseType.FILE_READ_FAILED]: "the file could not be read",
39
+ [LepuResponseType.FILE_WRITE_FAILED]: "the file could not be written",
40
+ [LepuResponseType.PARAMETER_ILLEGAL]: "the parameter was rejected",
41
+ [LepuResponseType.PERMISSION_DENIED]: "permission was denied",
42
+ [LepuResponseType.DECRYPT_FAILED]: "it could not decrypt the request",
43
+ [LepuResponseType.DEVICE_BUSY]: "it is busy",
44
+ [LepuResponseType.COMMAND_FORMAT_ERROR]: "the command was malformed",
45
+ [LepuResponseType.COMMAND_NOT_SUPPORTED]: "the opcode is unknown to this firmware",
46
+ [LepuResponseType.ERROR]: "it reported a generic error"
47
+ };
48
+ const lepuResponseType = frame => hexToByte(frame[RESPONSE_TYPE_INDEX] ?? "0");
49
+ const isLepuSuccess = frame => lepuResponseType(frame) === LepuResponseType.SUCCESS;
50
+
51
+ /** Why a device refused, in words, for an error a person will read. */
52
+ const describeLepuResponseType = frame => {
53
+ const type = lepuResponseType(frame);
54
+ const known = RESPONSE_TYPE_NAMES[type];
55
+ const code = `0x${type.toString(16).padStart(2, "0")}`;
56
+ return known ? `${known} (${code})` : `it answered with ${code}`;
57
+ };
58
+ export { describeLepuResponseType, isLepuSuccess, LepuResponseType, lepuResponseType };
59
+ //# sourceMappingURL=lepu.response-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["hexToByte","RESPONSE_TYPE_INDEX","LepuResponseType","REQUEST","SUCCESS","CRC_ERROR","FILE_NOT_FOUND","FILE_READ_FAILED","FILE_WRITE_FAILED","PARAMETER_ILLEGAL","PERMISSION_DENIED","DECRYPT_FAILED","DEVICE_BUSY","COMMAND_FORMAT_ERROR","COMMAND_NOT_SUPPORTED","ERROR","RESPONSE_TYPE_NAMES","lepuResponseType","frame","isLepuSuccess","describeLepuResponseType","type","known","code","toString","padStart"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.response-type.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,+BAA4B;;AAEtD;AACA,MAAMC,mBAAmB,GAAG,CAAC;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG;EACvB;EACAC,OAAO,EAAE,IAAI;EAEbC,OAAO,EAAE,IAAI;EAEb;EACAC,SAAS,EAAE,IAAI;EAEfC,cAAc,EAAE,IAAI;EACpBC,gBAAgB,EAAE,IAAI;EACtBC,iBAAiB,EAAE,IAAI;EACvBC,iBAAiB,EAAE,IAAI;EACvBC,iBAAiB,EAAE,IAAI;EACvBC,cAAc,EAAE,IAAI;EAEpB;EACAC,WAAW,EAAE,IAAI;EAEjBC,oBAAoB,EAAE,IAAI;EAE1B;EACAC,qBAAqB,EAAE,IAAI;EAE3BC,KAAK,EAAE;AACT,CAAU;AAEV,MAAMC,mBAAqD,GAAG;EAC5D,CAACd,gBAAgB,CAACG,SAAS,GAAG,0BAA0B;EACxD,CAACH,gBAAgB,CAACI,cAAc,GAAG,yBAAyB;EAC5D,CAACJ,gBAAgB,CAACK,gBAAgB,GAAG,4BAA4B;EACjE,CAACL,gBAAgB,CAACM,iBAAiB,GAAG,+BAA+B;EACrE,CAACN,gBAAgB,CAACO,iBAAiB,GAAG,4BAA4B;EAClE,CAACP,gBAAgB,CAACQ,iBAAiB,GAAG,uBAAuB;EAC7D,CAACR,gBAAgB,CAACS,cAAc,GAAG,kCAAkC;EACrE,CAACT,gBAAgB,CAACU,WAAW,GAAG,YAAY;EAC5C,CAACV,gBAAgB,CAACW,oBAAoB,GAAG,2BAA2B;EACpE,CAACX,gBAAgB,CAACY,qBAAqB,GACrC,wCAAwC;EAC1C,CAACZ,gBAAgB,CAACa,KAAK,GAAG;AAC5B,CAAC;AAED,MAAME,gBAAgB,GAAIC,KAAwB,IAChDlB,SAAS,CAACkB,KAAK,CAACjB,mBAAmB,CAAC,IAAI,GAAG,CAAC;AAE9C,MAAMkB,aAAa,GAAID,KAAwB,IAC7CD,gBAAgB,CAACC,KAAK,CAAC,KAAKhB,gBAAgB,CAACE,OAAO;;AAEtD;AACA,MAAMgB,wBAAwB,GAAIF,KAAwB,IAAa;EACrE,MAAMG,IAAI,GAAGJ,gBAAgB,CAACC,KAAK,CAAC;EACpC,MAAMI,KAAK,GAAGN,mBAAmB,CAACK,IAAI,CAAC;EACvC,MAAME,IAAI,GAAG,KAAKF,IAAI,CAACG,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;EAEtD,OAAOH,KAAK,GAAG,GAAGA,KAAK,KAAKC,IAAI,GAAG,GAAG,oBAAoBA,IAAI,EAAE;AAClE,CAAC;AAED,SACEH,wBAAwB,EACxBD,aAAa,EACbjB,gBAAgB,EAChBe,gBAAgB","ignoreList":[]}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+
3
+ import { defineCustomDevice } from "../../custom/define-custom-device.js";
4
+
5
+ /**
6
+ * Declares a device from the Lepu/Viatom family.
7
+ *
8
+ * Thirty products in that family share one frame format, one CRC and one generic opcode
9
+ * space, and they differ in only three things: which characteristics they expose, what
10
+ * their payload means, and what they call themselves. The first of those is the same for
11
+ * almost all of them and is recorded here; the other two belong to the product and are
12
+ * asked of the caller.
13
+ *
14
+ * Two things a declaration cannot supply, and where they come from:
15
+ *
16
+ * - **The model numbers.** A device reports one in its information reply, but the vendor's
17
+ * own SDK never reads that field back - it binds a driver from the advertised name - so
18
+ * no table of them exists to copy. Declare the device without a `pollCommand`, connect
19
+ * once, and it reports what it is without sending anything that acts.
20
+ * - **The payload layout.** Every product decodes differently, and a guessed offset yields
21
+ * a plausible wrong reading rather than an error. Declared cases are the caller's.
22
+ *
23
+ * Some of these products negotiate encryption in the vendor app (`Bp2`, `Er2` and the
24
+ * oximeters do; `Er1`, `Er3`, `Bp3` and `Lepod` do not). The SDK speaks the cleartext
25
+ * protocol, which is what the BP2 already runs on in production, so a product that turns out
26
+ * to require the handshake will identify itself and then stop rather than mis-report.
27
+ */
28
+
29
+ /**
30
+ * Most of the family. The vendor's own SDK reference lists 71 products on these three
31
+ * characteristics - the BP2 and BP3 monitors, Er1/Er2/Er3, Lepod, the whole O2Ring and
32
+ * Oxyfit range, Checkme, AirBp - and the SDK's own BP2 driver has run against them on real
33
+ * hardware.
34
+ */
35
+ const STANDARD_SERVICE = "14839ac4-7d7e-415c-9a42-167340cf2339";
36
+ const STANDARD_WRITE = "8b00ace7-eb0b-49b0-bbe9-9aee0a26e1a3";
37
+ const STANDARD_NOTIFY = "0734594a-a8e7-4b1a-a6b1-cd5243059a57";
38
+
39
+ /** Nine products in the vendor's reference: O2Ring S, the PF-10 wearables and the BBSM bands. */
40
+ const AW1_SERVICE = "e8fb0001-a14b-98f9-831b-4e2941d01248";
41
+ const AW1_WRITE = "e8fb0002-a14b-98f9-831b-4e2941d01248";
42
+ const AW1_NOTIFY = "e8fb0003-a14b-98f9-831b-4e2941d01248";
43
+
44
+ /**
45
+ * Read from an OEM build rather than from the vendor's published reference, which documents
46
+ * no product on these characteristics. Real, but unconfirmed by the vendor and untried here.
47
+ */
48
+ const DING_SERVICE = "0000fe60-0000-1000-8000-00805f9b34fb";
49
+ const DING_WRITE = "0000fe61-0000-1000-8000-00805f9b34fb";
50
+ const DING_NOTIFY = "0000fe62-0000-1000-8000-00805f9b34fb";
51
+
52
+ /** Also from an OEM build only, and likewise absent from the vendor's published reference. */
53
+ const AI_TELE_SERVICE = "00002760-08c2-11e1-9073-0e8ac72e5450";
54
+ const AI_TELE_WRITE = "00002760-08c2-11e1-9073-0e8ac72e5401";
55
+ const AI_TELE_NOTIFY = "00002760-08c2-11e1-9073-0e8ac72e5402";
56
+
57
+ /** What the vendor app asks for on every one of these links but the Er2's. */
58
+ const PREFERRED_MTU = 247;
59
+
60
+ /** The Er2 negotiates the link minimum, which is why commands are split to fit. */
61
+ const MINIMUM_MTU = 23;
62
+
63
+ /** Long enough for a device that waits on a person to start a measurement. */
64
+ const DEFAULT_STUCK_TIMEOUT_MS = 60_000;
65
+ const START_BYTE = "a5";
66
+ /**
67
+ * The characteristics each group of products exposes, read from the vendor's own managers.
68
+ *
69
+ * `standard` and `aw1` match the vendor's published SDK reference exactly, and `standard`
70
+ * also matches the SDK's existing BP2 driver, which has run against hardware on precisely
71
+ * these UUIDs. `ding` and `aiTele` were read from an OEM build and the vendor documents no
72
+ * product on them, so they are the two entries here that nothing independent confirms.
73
+ */
74
+ const lepuTransports = {
75
+ standard: {
76
+ serviceUuid: STANDARD_SERVICE,
77
+ notifyUuid: STANDARD_NOTIFY,
78
+ writeUuid: STANDARD_WRITE,
79
+ preferredMtu: PREFERRED_MTU
80
+ },
81
+ /** The same characteristics on a link that will not grow past the minimum. */
82
+ standardSmallMtu: {
83
+ serviceUuid: STANDARD_SERVICE,
84
+ notifyUuid: STANDARD_NOTIFY,
85
+ writeUuid: STANDARD_WRITE,
86
+ preferredMtu: MINIMUM_MTU
87
+ },
88
+ aw1: {
89
+ serviceUuid: AW1_SERVICE,
90
+ notifyUuid: AW1_NOTIFY,
91
+ writeUuid: AW1_WRITE,
92
+ preferredMtu: PREFERRED_MTU
93
+ },
94
+ ding: {
95
+ serviceUuid: DING_SERVICE,
96
+ notifyUuid: DING_NOTIFY,
97
+ writeUuid: DING_WRITE,
98
+ preferredMtu: PREFERRED_MTU
99
+ },
100
+ aiTele: {
101
+ serviceUuid: AI_TELE_SERVICE,
102
+ notifyUuid: AI_TELE_NOTIFY,
103
+ writeUuid: AI_TELE_WRITE,
104
+ preferredMtu: PREFERRED_MTU
105
+ }
106
+ };
107
+ const COMMAND_BYTE = 1;
108
+ const lepuDevice = params => {
109
+ const transport = lepuTransports[params.transport ?? "standard"];
110
+ return defineCustomDevice({
111
+ id: params.id,
112
+ nameMatch: params.nameMatch,
113
+ stuckDataTimeoutMs: params.stuckDataTimeoutMs ?? DEFAULT_STUCK_TIMEOUT_MS,
114
+ preferredMtu: transport.preferredMtu,
115
+ lepu: {
116
+ startBytes: [START_BYTE],
117
+ write: {
118
+ serviceUuid: transport.serviceUuid,
119
+ characteristicUuid: transport.writeUuid
120
+ },
121
+ expectedDeviceTypes: [...(params.expectedDeviceTypes ?? [])],
122
+ ...(params.pollCommand === undefined ? {} : {
123
+ pollCommand: params.pollCommand
124
+ })
125
+ },
126
+ services: [{
127
+ uuid: transport.serviceUuid,
128
+ monitor: [{
129
+ uuid: transport.notifyUuid,
130
+ frame: {
131
+ minLengthBytes: params.minLengthBytes
132
+ },
133
+ caseSelectorBytes: params.caseSelectorBytes ?? [COMMAND_BYTE],
134
+ cases: params.cases
135
+ }]
136
+ }]
137
+ });
138
+ };
139
+ export { lepuDevice, lepuTransports };
140
+ //# sourceMappingURL=lepu.transports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["defineCustomDevice","STANDARD_SERVICE","STANDARD_WRITE","STANDARD_NOTIFY","AW1_SERVICE","AW1_WRITE","AW1_NOTIFY","DING_SERVICE","DING_WRITE","DING_NOTIFY","AI_TELE_SERVICE","AI_TELE_WRITE","AI_TELE_NOTIFY","PREFERRED_MTU","MINIMUM_MTU","DEFAULT_STUCK_TIMEOUT_MS","START_BYTE","lepuTransports","standard","serviceUuid","notifyUuid","writeUuid","preferredMtu","standardSmallMtu","aw1","ding","aiTele","COMMAND_BYTE","lepuDevice","params","transport","id","nameMatch","stuckDataTimeoutMs","lepu","startBytes","write","characteristicUuid","expectedDeviceTypes","pollCommand","undefined","services","uuid","monitor","frame","minLengthBytes","caseSelectorBytes","cases"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.transports.ts"],"mappings":";;AAEA,SAASA,kBAAkB,QAAQ,sCAAmC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG,sCAAsC;AAC/D,MAAMC,cAAc,GAAG,sCAAsC;AAC7D,MAAMC,eAAe,GAAG,sCAAsC;;AAE9D;AACA,MAAMC,WAAW,GAAG,sCAAsC;AAC1D,MAAMC,SAAS,GAAG,sCAAsC;AACxD,MAAMC,UAAU,GAAG,sCAAsC;;AAEzD;AACA;AACA;AACA;AACA,MAAMC,YAAY,GAAG,sCAAsC;AAC3D,MAAMC,UAAU,GAAG,sCAAsC;AACzD,MAAMC,WAAW,GAAG,sCAAsC;;AAE1D;AACA,MAAMC,eAAe,GAAG,sCAAsC;AAC9D,MAAMC,aAAa,GAAG,sCAAsC;AAC5D,MAAMC,cAAc,GAAG,sCAAsC;;AAE7D;AACA,MAAMC,aAAa,GAAG,GAAG;;AAEzB;AACA,MAAMC,WAAW,GAAG,EAAE;;AAEtB;AACA,MAAMC,wBAAwB,GAAG,MAAM;AAEvC,MAAMC,UAAU,GAAG,IAAI;AASvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG;EACrBC,QAAQ,EAAE;IACRC,WAAW,EAAElB,gBAAgB;IAC7BmB,UAAU,EAA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IT,MAAM,CAACU,WAAW,KAAKC,SAAS,GAChC,CAAC,CAAC,GACF;QAAED,WAAW,EAAEV,MAAM,CAACU;MAAY,CAAC;IACzC,CAAC;IACDE,QAAQ,EAAE,CACR;MACEC,IAAI,EAAEZ,SAAS,CAACX,WAAW;MAC3BwB,OAAO,EAAE,CACP;QACED,IAAI,EAAEZ,SAAS,CAACV,UAAU;QAC1BwB,KAAK,EAAE;UAAEC,cAAc,EAAEhB,MAAM,CAACgB;QAAe,CAAC;QAChDC,iBAAiB,EAAEjB,MAAM,CAACiB,iBAAiB,IAAI,CAACnB,YAAY,CAAC;QAC7DoB,KAAK,EAAElB,MAAM,CAACkB;MAChB,CAAC;IAEL,CAAC;EAEL,CAAC,CAAC;AACJ,CAAC;AAED,SAASnB,UAAU,EAAEX,cAAc","ignoreList":[]}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ import { hexToBytes } from "../../utils/hex-to-bytes.js";
4
+
5
+ /**
6
+ * Sends the same commands on connect and after every frame.
7
+ *
8
+ * This is what the SDK did before a device could express anything else, and it remains
9
+ * right for the devices that only ever ask one question: a poll goes out, a reading comes
10
+ * back, and the answer is another poll. Keeping it as a named policy rather than as
11
+ * behaviour built into the transport is what lets a device replace it without every other
12
+ * device changing.
13
+ */
14
+ class PollingCommandSequencer {
15
+ constructor(commands) {
16
+ this.commands = commands;
17
+ }
18
+ initialCommands = () => this.commands;
19
+ nextCommand = () => this.commands;
20
+ }
21
+
22
+ /**
23
+ * Builds the polling policy a device's declared services already describe.
24
+ *
25
+ * A service without a write characteristic contributes nothing, so a listen-only device
26
+ * gets an empty policy and is never written to.
27
+ */
28
+ const pollingSequencerFor = services => new PollingCommandSequencer(services.flatMap(service => service.writeUuid ? [{
29
+ serviceUuid: service.uuid,
30
+ characteristicUuid: service.writeUuid.uuid,
31
+ frame: hexToBytes(service.writeUuid.mainCommandUuid)
32
+ }] : []));
33
+ export { PollingCommandSequencer, pollingSequencerFor };
34
+ //# sourceMappingURL=polling-command-sequencer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["hexToBytes","PollingCommandSequencer","constructor","commands","initialCommands","nextCommand","pollingSequencerFor","services","flatMap","service","writeUuid","serviceUuid","uuid","characteristicUuid","frame","mainCommandUuid"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/devices/polling-command-sequencer.ts"],"mappings":";;AAGA,SAASA,UAAU,QAAQ,6BAA0B;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,CAA6B;EACjDC,WAAWA,CAAkBC,QAAkC,EAAE;IAAA,KAApCA,QAAkC,GAAlCA,QAAkC;EAAG;EAElEC,eAAe,GAAGA,CAAA,KAAgC,IAAI,CAACD,QAAQ;EAE/DE,WAAW,GAAGA,CAAA,KAAgC,IAAI,CAACF,QAAQ;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,mBAAmB,GACvBC,QAAuC,IAEvC,IAAIN,uBAAuB,CACzBM,QAAQ,CAACC,OAAO,CAAEC,OAAO,IACvBA,OAAO,CAACC,SAAS,GACb,CACE;EACEC,WAAW,EAAEF,OAAO,CAACG,IAAI;EACzBC,kBAAkB,EAAEJ,OAAO,CAACC,SAAS,CAACE,IAAI;EAC1CE,KAAK,EAAEd,UAAU,CAACS,OAAO,CAACC,SAAS,CAACK,eAAe;AACrD,CAAC,CACF,GACD,EACN,CACF,CAAC;AAEH,SAASd,uBAAuB,EAAEK,mBAAmB","ignoreList":[]}