@ovok/native 0.4.1 → 0.4.3

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 (318) hide show
  1. package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  2. package/lib/commonjs/modules/bt-management/components/bt-provider.js.map +1 -1
  3. package/lib/commonjs/modules/bt-management/constants/custom-device-brand.js +12 -0
  4. package/lib/commonjs/modules/bt-management/constants/custom-device-brand.js.map +1 -0
  5. package/lib/commonjs/modules/bt-management/constants/measurement-field-catalog.js +111 -0
  6. package/lib/commonjs/modules/bt-management/constants/measurement-field-catalog.js.map +1 -0
  7. package/lib/commonjs/modules/bt-management/index.js +209 -0
  8. package/lib/commonjs/modules/bt-management/index.js.map +1 -1
  9. package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
  10. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-case.js +116 -0
  11. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-case.js.map +1 -0
  12. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-field.js +83 -0
  13. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-field.js.map +1 -0
  14. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-frame.js +64 -0
  15. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-frame.js.map +1 -0
  16. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-monitor.js +76 -0
  17. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-monitor.js.map +1 -0
  18. package/lib/commonjs/modules/bt-management/services/custom/custom-device-error.js +13 -0
  19. package/lib/commonjs/modules/bt-management/services/custom/custom-device-error.js.map +1 -0
  20. package/lib/commonjs/modules/bt-management/services/custom/define-custom-device.js +120 -0
  21. package/lib/commonjs/modules/bt-management/services/custom/define-custom-device.js.map +1 -0
  22. package/lib/commonjs/modules/bt-management/services/custom/normalize-ble-uuid.js +32 -0
  23. package/lib/commonjs/modules/bt-management/services/custom/normalize-ble-uuid.js.map +1 -0
  24. package/lib/commonjs/modules/bt-management/services/device-creator.js +52 -26
  25. package/lib/commonjs/modules/bt-management/services/device-creator.js.map +1 -1
  26. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js +22 -5
  27. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  28. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  29. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +103 -0
  30. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -0
  31. package/lib/commonjs/modules/bt-management/types/accepted-device.js +6 -0
  32. package/lib/commonjs/modules/bt-management/types/accepted-device.js.map +1 -0
  33. package/lib/commonjs/modules/bt-management/types/compiled-custom-field.js +6 -0
  34. package/lib/commonjs/modules/bt-management/types/compiled-custom-field.js.map +1 -0
  35. package/lib/commonjs/modules/bt-management/types/custom-byte-order.js +2 -0
  36. package/lib/commonjs/modules/bt-management/types/custom-byte-order.js.map +1 -0
  37. package/lib/commonjs/modules/bt-management/types/custom-case-kind.js +2 -0
  38. package/lib/commonjs/modules/bt-management/types/custom-case-kind.js.map +1 -0
  39. package/lib/commonjs/modules/bt-management/types/custom-case-spec.js +6 -0
  40. package/lib/commonjs/modules/bt-management/types/custom-case-spec.js.map +1 -0
  41. package/lib/commonjs/modules/bt-management/types/custom-device-definition.js +4 -0
  42. package/lib/commonjs/modules/bt-management/types/custom-device-definition.js.map +1 -0
  43. package/lib/commonjs/modules/bt-management/types/custom-device-id.js +2 -0
  44. package/lib/commonjs/modules/bt-management/types/custom-device-id.js.map +1 -0
  45. package/lib/commonjs/modules/bt-management/types/custom-device-spec.js +6 -0
  46. package/lib/commonjs/modules/bt-management/types/custom-device-spec.js.map +1 -0
  47. package/lib/commonjs/modules/bt-management/types/custom-field-encoding.js +2 -0
  48. package/lib/commonjs/modules/bt-management/types/custom-field-encoding.js.map +1 -0
  49. package/lib/commonjs/modules/bt-management/types/custom-field-spec.js +6 -0
  50. package/lib/commonjs/modules/bt-management/types/custom-field-spec.js.map +1 -0
  51. package/lib/commonjs/modules/bt-management/types/custom-frame-spec.js +6 -0
  52. package/lib/commonjs/modules/bt-management/types/custom-frame-spec.js.map +1 -0
  53. package/lib/commonjs/modules/bt-management/types/custom-measurement.js +6 -0
  54. package/lib/commonjs/modules/bt-management/types/custom-measurement.js.map +1 -0
  55. package/lib/commonjs/modules/bt-management/types/custom-monitor-spec.js +6 -0
  56. package/lib/commonjs/modules/bt-management/types/custom-monitor-spec.js.map +1 -0
  57. package/lib/commonjs/modules/bt-management/types/custom-service-spec.js +6 -0
  58. package/lib/commonjs/modules/bt-management/types/custom-service-spec.js.map +1 -0
  59. package/lib/commonjs/modules/bt-management/types/device-key-of.js +6 -0
  60. package/lib/commonjs/modules/bt-management/types/device-key-of.js.map +1 -0
  61. package/lib/commonjs/modules/bt-management/types/device-key.js +6 -0
  62. package/lib/commonjs/modules/bt-management/types/device-key.js.map +1 -0
  63. package/lib/commonjs/modules/bt-management/types/device-measurement-map.js.map +1 -1
  64. package/lib/commonjs/modules/bt-management/utils/create-custom-field-parser.js +54 -0
  65. package/lib/commonjs/modules/bt-management/utils/create-custom-field-parser.js.map +1 -0
  66. package/lib/commonjs/modules/bt-management/utils/create-frame-validator.js +40 -0
  67. package/lib/commonjs/modules/bt-management/utils/create-frame-validator.js.map +1 -0
  68. package/lib/commonjs/modules/bt-management/utils/decode-medical-float.js +38 -0
  69. package/lib/commonjs/modules/bt-management/utils/decode-medical-float.js.map +1 -0
  70. package/lib/commonjs/modules/bt-management/utils/is-custom-device-definition.js +15 -0
  71. package/lib/commonjs/modules/bt-management/utils/is-custom-device-definition.js.map +1 -0
  72. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  73. package/lib/module/modules/bt-management/components/bt-provider.js.map +1 -1
  74. package/lib/module/modules/bt-management/constants/custom-device-brand.js +8 -0
  75. package/lib/module/modules/bt-management/constants/custom-device-brand.js.map +1 -0
  76. package/lib/module/modules/bt-management/constants/measurement-field-catalog.js +108 -0
  77. package/lib/module/modules/bt-management/constants/measurement-field-catalog.js.map +1 -0
  78. package/lib/module/modules/bt-management/index.js +19 -0
  79. package/lib/module/modules/bt-management/index.js.map +1 -1
  80. package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
  81. package/lib/module/modules/bt-management/services/custom/compile-custom-case.js +112 -0
  82. package/lib/module/modules/bt-management/services/custom/compile-custom-case.js.map +1 -0
  83. package/lib/module/modules/bt-management/services/custom/compile-custom-field.js +78 -0
  84. package/lib/module/modules/bt-management/services/custom/compile-custom-field.js.map +1 -0
  85. package/lib/module/modules/bt-management/services/custom/compile-custom-frame.js +59 -0
  86. package/lib/module/modules/bt-management/services/custom/compile-custom-frame.js.map +1 -0
  87. package/lib/module/modules/bt-management/services/custom/compile-custom-monitor.js +71 -0
  88. package/lib/module/modules/bt-management/services/custom/compile-custom-monitor.js.map +1 -0
  89. package/lib/module/modules/bt-management/services/custom/custom-device-error.js +8 -0
  90. package/lib/module/modules/bt-management/services/custom/custom-device-error.js.map +1 -0
  91. package/lib/module/modules/bt-management/services/custom/define-custom-device.js +115 -0
  92. package/lib/module/modules/bt-management/services/custom/define-custom-device.js.map +1 -0
  93. package/lib/module/modules/bt-management/services/custom/normalize-ble-uuid.js +27 -0
  94. package/lib/module/modules/bt-management/services/custom/normalize-ble-uuid.js.map +1 -0
  95. package/lib/module/modules/bt-management/services/device-creator.js +52 -26
  96. package/lib/module/modules/bt-management/services/device-creator.js.map +1 -1
  97. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js +22 -5
  98. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  99. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  100. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +98 -0
  101. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -0
  102. package/lib/module/modules/bt-management/types/accepted-device.js +4 -0
  103. package/lib/module/modules/bt-management/types/accepted-device.js.map +1 -0
  104. package/lib/module/modules/bt-management/types/compiled-custom-field.js +4 -0
  105. package/lib/module/modules/bt-management/types/compiled-custom-field.js.map +1 -0
  106. package/lib/module/modules/bt-management/types/custom-byte-order.js +2 -0
  107. package/lib/module/modules/bt-management/types/custom-byte-order.js.map +1 -0
  108. package/lib/module/modules/bt-management/types/custom-case-kind.js +2 -0
  109. package/lib/module/modules/bt-management/types/custom-case-kind.js.map +1 -0
  110. package/lib/module/modules/bt-management/types/custom-case-spec.js +4 -0
  111. package/lib/module/modules/bt-management/types/custom-case-spec.js.map +1 -0
  112. package/lib/module/modules/bt-management/types/custom-device-definition.js +8 -0
  113. package/lib/module/modules/bt-management/types/custom-device-definition.js.map +1 -0
  114. package/lib/module/modules/bt-management/types/custom-device-id.js +2 -0
  115. package/lib/module/modules/bt-management/types/custom-device-id.js.map +1 -0
  116. package/lib/module/modules/bt-management/types/custom-device-spec.js +4 -0
  117. package/lib/module/modules/bt-management/types/custom-device-spec.js.map +1 -0
  118. package/lib/module/modules/bt-management/types/custom-field-encoding.js +2 -0
  119. package/lib/module/modules/bt-management/types/custom-field-encoding.js.map +1 -0
  120. package/lib/module/modules/bt-management/types/custom-field-spec.js +4 -0
  121. package/lib/module/modules/bt-management/types/custom-field-spec.js.map +1 -0
  122. package/lib/module/modules/bt-management/types/custom-frame-spec.js +4 -0
  123. package/lib/module/modules/bt-management/types/custom-frame-spec.js.map +1 -0
  124. package/lib/module/modules/bt-management/types/custom-measurement.js +4 -0
  125. package/lib/module/modules/bt-management/types/custom-measurement.js.map +1 -0
  126. package/lib/module/modules/bt-management/types/custom-monitor-spec.js +4 -0
  127. package/lib/module/modules/bt-management/types/custom-monitor-spec.js.map +1 -0
  128. package/lib/module/modules/bt-management/types/custom-service-spec.js +4 -0
  129. package/lib/module/modules/bt-management/types/custom-service-spec.js.map +1 -0
  130. package/lib/module/modules/bt-management/types/device-key-of.js +4 -0
  131. package/lib/module/modules/bt-management/types/device-key-of.js.map +1 -0
  132. package/lib/module/modules/bt-management/types/device-key.js +4 -0
  133. package/lib/module/modules/bt-management/types/device-key.js.map +1 -0
  134. package/lib/module/modules/bt-management/types/device-measurement-map.js +5 -0
  135. package/lib/module/modules/bt-management/types/device-measurement-map.js.map +1 -1
  136. package/lib/module/modules/bt-management/utils/create-custom-field-parser.js +49 -0
  137. package/lib/module/modules/bt-management/utils/create-custom-field-parser.js.map +1 -0
  138. package/lib/module/modules/bt-management/utils/create-frame-validator.js +35 -0
  139. package/lib/module/modules/bt-management/utils/create-frame-validator.js.map +1 -0
  140. package/lib/module/modules/bt-management/utils/decode-medical-float.js +33 -0
  141. package/lib/module/modules/bt-management/utils/decode-medical-float.js.map +1 -0
  142. package/lib/module/modules/bt-management/utils/is-custom-device-definition.js +10 -0
  143. package/lib/module/modules/bt-management/utils/is-custom-device-definition.js.map +1 -0
  144. package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts +2 -2
  145. package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  146. package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider.d.ts +2 -2
  147. package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider.d.ts.map +1 -1
  148. package/lib/typescript/commonjs/src/modules/bt-management/constants/custom-device-brand.d.ts +6 -0
  149. package/lib/typescript/commonjs/src/modules/bt-management/constants/custom-device-brand.d.ts.map +1 -0
  150. package/lib/typescript/commonjs/src/modules/bt-management/constants/measurement-field-catalog.d.ts +26 -0
  151. package/lib/typescript/commonjs/src/modules/bt-management/constants/measurement-field-catalog.d.ts.map +1 -0
  152. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +19 -0
  153. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
  154. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +5 -4
  155. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  156. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-case.d.ts +6 -0
  157. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-case.d.ts.map +1 -0
  158. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-field.d.ts +6 -0
  159. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-field.d.ts.map +1 -0
  160. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-frame.d.ts +13 -0
  161. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-frame.d.ts.map +1 -0
  162. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-monitor.d.ts +10 -0
  163. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-monitor.d.ts.map +1 -0
  164. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/custom-device-error.d.ts +6 -0
  165. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/custom-device-error.d.ts.map +1 -0
  166. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/define-custom-device.d.ts +12 -0
  167. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/define-custom-device.d.ts.map +1 -0
  168. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/normalize-ble-uuid.d.ts +7 -0
  169. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/normalize-ble-uuid.d.ts.map +1 -0
  170. package/lib/typescript/commonjs/src/modules/bt-management/services/device-creator.d.ts +12 -5
  171. package/lib/typescript/commonjs/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
  172. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts +12 -1
  173. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
  174. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +2 -1
  175. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  176. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +43 -0
  177. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -0
  178. package/lib/typescript/commonjs/src/modules/bt-management/types/accepted-device.d.ts +5 -0
  179. package/lib/typescript/commonjs/src/modules/bt-management/types/accepted-device.d.ts.map +1 -0
  180. package/lib/typescript/commonjs/src/modules/bt-management/types/btprovider-children-props.d.ts +5 -4
  181. package/lib/typescript/commonjs/src/modules/bt-management/types/btprovider-children-props.d.ts.map +1 -1
  182. package/lib/typescript/commonjs/src/modules/bt-management/types/btprovider-props.d.ts +2 -2
  183. package/lib/typescript/commonjs/src/modules/bt-management/types/btprovider-props.d.ts.map +1 -1
  184. package/lib/typescript/commonjs/src/modules/bt-management/types/compiled-custom-field.d.ts +16 -0
  185. package/lib/typescript/commonjs/src/modules/bt-management/types/compiled-custom-field.d.ts.map +1 -0
  186. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts +2 -2
  187. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  188. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-byte-order.d.ts +6 -0
  189. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-byte-order.d.ts.map +1 -0
  190. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-case-kind.d.ts +12 -0
  191. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-case-kind.d.ts.map +1 -0
  192. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-case-spec.d.ts +18 -0
  193. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-case-spec.d.ts.map +1 -0
  194. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-definition.d.ts +22 -0
  195. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-definition.d.ts.map +1 -0
  196. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-id.d.ts +10 -0
  197. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-id.d.ts.map +1 -0
  198. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-spec.d.ts +12 -0
  199. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-device-spec.d.ts.map +1 -0
  200. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-field-encoding.d.ts +10 -0
  201. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-field-encoding.d.ts.map +1 -0
  202. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-field-spec.d.ts +33 -0
  203. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-field-spec.d.ts.map +1 -0
  204. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-frame-spec.d.ts +27 -0
  205. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-frame-spec.d.ts.map +1 -0
  206. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-measurement.d.ts +10 -0
  207. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-measurement.d.ts.map +1 -0
  208. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-monitor-spec.d.ts +14 -0
  209. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-monitor-spec.d.ts.map +1 -0
  210. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-service-spec.d.ts +15 -0
  211. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-service-spec.d.ts.map +1 -0
  212. package/lib/typescript/commonjs/src/modules/bt-management/types/device-data.d.ts +2 -2
  213. package/lib/typescript/commonjs/src/modules/bt-management/types/device-data.d.ts.map +1 -1
  214. package/lib/typescript/commonjs/src/modules/bt-management/types/device-key-of.d.ts +8 -0
  215. package/lib/typescript/commonjs/src/modules/bt-management/types/device-key-of.d.ts.map +1 -0
  216. package/lib/typescript/commonjs/src/modules/bt-management/types/device-key.d.ts +5 -0
  217. package/lib/typescript/commonjs/src/modules/bt-management/types/device-key.d.ts.map +1 -0
  218. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts +10 -5
  219. package/lib/typescript/commonjs/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  220. package/lib/typescript/commonjs/src/modules/bt-management/types/result-callback.d.ts +2 -2
  221. package/lib/typescript/commonjs/src/modules/bt-management/types/result-callback.d.ts.map +1 -1
  222. package/lib/typescript/commonjs/src/modules/bt-management/utils/create-custom-field-parser.d.ts +12 -0
  223. package/lib/typescript/commonjs/src/modules/bt-management/utils/create-custom-field-parser.d.ts.map +1 -0
  224. package/lib/typescript/commonjs/src/modules/bt-management/utils/create-frame-validator.d.ts +10 -0
  225. package/lib/typescript/commonjs/src/modules/bt-management/utils/create-frame-validator.d.ts.map +1 -0
  226. package/lib/typescript/commonjs/src/modules/bt-management/utils/decode-medical-float.d.ts +9 -0
  227. package/lib/typescript/commonjs/src/modules/bt-management/utils/decode-medical-float.d.ts.map +1 -0
  228. package/lib/typescript/commonjs/src/modules/bt-management/utils/is-custom-device-definition.d.ts +9 -0
  229. package/lib/typescript/commonjs/src/modules/bt-management/utils/is-custom-device-definition.d.ts.map +1 -0
  230. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
  231. package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts +2 -2
  232. package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  233. package/lib/typescript/module/src/modules/bt-management/components/bt-provider.d.ts +2 -2
  234. package/lib/typescript/module/src/modules/bt-management/components/bt-provider.d.ts.map +1 -1
  235. package/lib/typescript/module/src/modules/bt-management/constants/custom-device-brand.d.ts +6 -0
  236. package/lib/typescript/module/src/modules/bt-management/constants/custom-device-brand.d.ts.map +1 -0
  237. package/lib/typescript/module/src/modules/bt-management/constants/measurement-field-catalog.d.ts +26 -0
  238. package/lib/typescript/module/src/modules/bt-management/constants/measurement-field-catalog.d.ts.map +1 -0
  239. package/lib/typescript/module/src/modules/bt-management/index.d.ts +19 -0
  240. package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
  241. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +5 -4
  242. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  243. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-case.d.ts +6 -0
  244. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-case.d.ts.map +1 -0
  245. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-field.d.ts +6 -0
  246. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-field.d.ts.map +1 -0
  247. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-frame.d.ts +13 -0
  248. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-frame.d.ts.map +1 -0
  249. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-monitor.d.ts +10 -0
  250. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-monitor.d.ts.map +1 -0
  251. package/lib/typescript/module/src/modules/bt-management/services/custom/custom-device-error.d.ts +6 -0
  252. package/lib/typescript/module/src/modules/bt-management/services/custom/custom-device-error.d.ts.map +1 -0
  253. package/lib/typescript/module/src/modules/bt-management/services/custom/define-custom-device.d.ts +12 -0
  254. package/lib/typescript/module/src/modules/bt-management/services/custom/define-custom-device.d.ts.map +1 -0
  255. package/lib/typescript/module/src/modules/bt-management/services/custom/normalize-ble-uuid.d.ts +7 -0
  256. package/lib/typescript/module/src/modules/bt-management/services/custom/normalize-ble-uuid.d.ts.map +1 -0
  257. package/lib/typescript/module/src/modules/bt-management/services/device-creator.d.ts +12 -5
  258. package/lib/typescript/module/src/modules/bt-management/services/device-creator.d.ts.map +1 -1
  259. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts +12 -1
  260. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
  261. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +2 -1
  262. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  263. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +43 -0
  264. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -0
  265. package/lib/typescript/module/src/modules/bt-management/types/accepted-device.d.ts +5 -0
  266. package/lib/typescript/module/src/modules/bt-management/types/accepted-device.d.ts.map +1 -0
  267. package/lib/typescript/module/src/modules/bt-management/types/btprovider-children-props.d.ts +5 -4
  268. package/lib/typescript/module/src/modules/bt-management/types/btprovider-children-props.d.ts.map +1 -1
  269. package/lib/typescript/module/src/modules/bt-management/types/btprovider-props.d.ts +2 -2
  270. package/lib/typescript/module/src/modules/bt-management/types/btprovider-props.d.ts.map +1 -1
  271. package/lib/typescript/module/src/modules/bt-management/types/compiled-custom-field.d.ts +16 -0
  272. package/lib/typescript/module/src/modules/bt-management/types/compiled-custom-field.d.ts.map +1 -0
  273. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts +2 -2
  274. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  275. package/lib/typescript/module/src/modules/bt-management/types/custom-byte-order.d.ts +6 -0
  276. package/lib/typescript/module/src/modules/bt-management/types/custom-byte-order.d.ts.map +1 -0
  277. package/lib/typescript/module/src/modules/bt-management/types/custom-case-kind.d.ts +12 -0
  278. package/lib/typescript/module/src/modules/bt-management/types/custom-case-kind.d.ts.map +1 -0
  279. package/lib/typescript/module/src/modules/bt-management/types/custom-case-spec.d.ts +18 -0
  280. package/lib/typescript/module/src/modules/bt-management/types/custom-case-spec.d.ts.map +1 -0
  281. package/lib/typescript/module/src/modules/bt-management/types/custom-device-definition.d.ts +22 -0
  282. package/lib/typescript/module/src/modules/bt-management/types/custom-device-definition.d.ts.map +1 -0
  283. package/lib/typescript/module/src/modules/bt-management/types/custom-device-id.d.ts +10 -0
  284. package/lib/typescript/module/src/modules/bt-management/types/custom-device-id.d.ts.map +1 -0
  285. package/lib/typescript/module/src/modules/bt-management/types/custom-device-spec.d.ts +12 -0
  286. package/lib/typescript/module/src/modules/bt-management/types/custom-device-spec.d.ts.map +1 -0
  287. package/lib/typescript/module/src/modules/bt-management/types/custom-field-encoding.d.ts +10 -0
  288. package/lib/typescript/module/src/modules/bt-management/types/custom-field-encoding.d.ts.map +1 -0
  289. package/lib/typescript/module/src/modules/bt-management/types/custom-field-spec.d.ts +33 -0
  290. package/lib/typescript/module/src/modules/bt-management/types/custom-field-spec.d.ts.map +1 -0
  291. package/lib/typescript/module/src/modules/bt-management/types/custom-frame-spec.d.ts +27 -0
  292. package/lib/typescript/module/src/modules/bt-management/types/custom-frame-spec.d.ts.map +1 -0
  293. package/lib/typescript/module/src/modules/bt-management/types/custom-measurement.d.ts +10 -0
  294. package/lib/typescript/module/src/modules/bt-management/types/custom-measurement.d.ts.map +1 -0
  295. package/lib/typescript/module/src/modules/bt-management/types/custom-monitor-spec.d.ts +14 -0
  296. package/lib/typescript/module/src/modules/bt-management/types/custom-monitor-spec.d.ts.map +1 -0
  297. package/lib/typescript/module/src/modules/bt-management/types/custom-service-spec.d.ts +15 -0
  298. package/lib/typescript/module/src/modules/bt-management/types/custom-service-spec.d.ts.map +1 -0
  299. package/lib/typescript/module/src/modules/bt-management/types/device-data.d.ts +2 -2
  300. package/lib/typescript/module/src/modules/bt-management/types/device-data.d.ts.map +1 -1
  301. package/lib/typescript/module/src/modules/bt-management/types/device-key-of.d.ts +8 -0
  302. package/lib/typescript/module/src/modules/bt-management/types/device-key-of.d.ts.map +1 -0
  303. package/lib/typescript/module/src/modules/bt-management/types/device-key.d.ts +5 -0
  304. package/lib/typescript/module/src/modules/bt-management/types/device-key.d.ts.map +1 -0
  305. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts +10 -5
  306. package/lib/typescript/module/src/modules/bt-management/types/device-measurement-map.d.ts.map +1 -1
  307. package/lib/typescript/module/src/modules/bt-management/types/result-callback.d.ts +2 -2
  308. package/lib/typescript/module/src/modules/bt-management/types/result-callback.d.ts.map +1 -1
  309. package/lib/typescript/module/src/modules/bt-management/utils/create-custom-field-parser.d.ts +12 -0
  310. package/lib/typescript/module/src/modules/bt-management/utils/create-custom-field-parser.d.ts.map +1 -0
  311. package/lib/typescript/module/src/modules/bt-management/utils/create-frame-validator.d.ts +10 -0
  312. package/lib/typescript/module/src/modules/bt-management/utils/create-frame-validator.d.ts.map +1 -0
  313. package/lib/typescript/module/src/modules/bt-management/utils/decode-medical-float.d.ts +9 -0
  314. package/lib/typescript/module/src/modules/bt-management/utils/decode-medical-float.d.ts.map +1 -0
  315. package/lib/typescript/module/src/modules/bt-management/utils/is-custom-device-definition.d.ts +9 -0
  316. package/lib/typescript/module/src/modules/bt-management/utils/is-custom-device-definition.d.ts.map +1 -0
  317. package/lib/typescript/module/src/modules/data-sync/services/managers/sync-progress-manager.d.ts +1 -1
  318. package/package.json +2 -2
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.compileCustomField = void 0;
7
+ var _measurementFieldCatalog = require("../../constants/measurement-field-catalog.js");
8
+ var _customDeviceError = require("./custom-device-error.js");
9
+ const MAX_INTEGER_BYTES = 6;
10
+ const WIDTHS = {
11
+ sfloat: 2,
12
+ float: 4
13
+ };
14
+ const assertByteIndexes = (id, path, field, minLengthBytes) => {
15
+ const indexes = field.byteIndexes;
16
+ if (!Array.isArray(indexes) || indexes.length === 0 || indexes.some(i => !Number.isInteger(i) || i < 0)) {
17
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.byteIndexes`, "must be a non-empty list of byte offsets that are integers of at least 0");
18
+ }
19
+ if (new Set(indexes).size !== indexes.length) {
20
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.byteIndexes`, "reads the same byte twice");
21
+ }
22
+ const encoding = field.encoding ?? "uint";
23
+ const required = WIDTHS[encoding];
24
+ if (required !== undefined && indexes.length !== required) {
25
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.encoding`, `"${encoding}" needs exactly ${required} bytes, but ${indexes.length} byte index(es) are declared`);
26
+ }
27
+ if (required === undefined && indexes.length > MAX_INTEGER_BYTES) {
28
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.byteIndexes`, `reads ${indexes.length} bytes; an integer field may read at most ${MAX_INTEGER_BYTES} bytes so the value stays exact in a JavaScript number`);
29
+ }
30
+ const outOfFrame = indexes.filter(i => i >= minLengthBytes);
31
+ if (outOfFrame.length > 0) {
32
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.byteIndexes`, `reads byte ${outOfFrame[0]}, which frame.minLengthBytes (${minLengthBytes}) does not guarantee is present`);
33
+ }
34
+ };
35
+ const assertArithmetic = (id, path, field) => {
36
+ const scale = field.scale ?? 1;
37
+ if (!Number.isFinite(scale) || scale === 0) {
38
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.scale`, "must be a finite, non-zero number");
39
+ }
40
+ if (!Number.isFinite(field.offset ?? 0)) {
41
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.offset`, "must be a finite number");
42
+ }
43
+ const decimals = field.decimals;
44
+ if (decimals !== undefined && (!Number.isInteger(decimals) || decimals < 0 || decimals > 6)) {
45
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.decimals`, "must be a whole number between 0 and 6");
46
+ }
47
+ };
48
+
49
+ /** Validates one declared field against the measurement catalog and resolves its defaults. */
50
+ const compileCustomField = (id, path, field, measurementTypeKey, minLengthBytes) => {
51
+ const catalog = _measurementFieldCatalog.measurementFieldCatalog[measurementTypeKey];
52
+ const known = catalog?.[field.name];
53
+ if (!catalog || !known) {
54
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.name`, `"${field.name}" is not a property of ${measurementTypeKey}; expected one of ${Object.keys(catalog ?? {}).join(", ")}`);
55
+ }
56
+ if (field.unit !== known.unit) {
57
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.unit`, `is "${field.unit}"; expected "${known.unit}", the canonical unit of ${field.name}. Convert with scale instead of changing the unit`);
58
+ }
59
+ assertByteIndexes(id, path, field, minLengthBytes);
60
+ assertArithmetic(id, path, field);
61
+ const min = field.min ?? known.min;
62
+ const max = field.max ?? known.max;
63
+ if (!Number.isFinite(min) || !Number.isFinite(max) || min >= max) {
64
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}`, `declares min ${min} and max ${max}; min must be below max`);
65
+ }
66
+ if (min < known.min || max > known.max) {
67
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}`, `declares ${min}-${max} ${known.unit}, which is outside the accepted range for ${field.name} (${known.min}-${known.max} ${known.unit})`);
68
+ }
69
+ const indexes = [...field.byteIndexes];
70
+ return {
71
+ name: field.name,
72
+ byteIndexes: field.byteOrder === "little" ? indexes.reverse() : indexes,
73
+ encoding: field.encoding ?? "uint",
74
+ scale: field.scale ?? 1,
75
+ offset: field.offset ?? 0,
76
+ decimals: field.decimals,
77
+ unit: known.unit,
78
+ min,
79
+ max
80
+ };
81
+ };
82
+ exports.compileCustomField = compileCustomField;
83
+ //# sourceMappingURL=compile-custom-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_measurementFieldCatalog","require","_customDeviceError","MAX_INTEGER_BYTES","WIDTHS","sfloat","float","assertByteIndexes","id","path","field","minLengthBytes","indexes","byteIndexes","Array","isArray","length","some","i","Number","isInteger","customDeviceError","Set","size","encoding","required","undefined","outOfFrame","filter","assertArithmetic","scale","isFinite","offset","decimals","compileCustomField","measurementTypeKey","catalog","measurementFieldCatalog","known","name","Object","keys","join","unit","min","max","byteOrder","reverse","exports"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/custom/compile-custom-field.ts"],"mappings":";;;;;;AAEA,IAAAA,wBAAA,GAAAC,OAAA;AAIA,IAAAC,kBAAA,GAAAD,OAAA;AAEA,MAAME,iBAAiB,GAAG,CAAC;AAE3B,MAAMC,MAAgE,GAAG;EACvEC,MAAM,EAAE,CAAC;EACTC,KAA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C,IAAI,EAAE,EACT,YAAYmC,GAAG,IAAIC,GAAG,IAAIP,KAAK,CAACK,IAAI,6CAA6CjC,KAAK,CAAC6B,IAAI,KAAKD,KAAK,CAACM,GAAG,IAAIN,KAAK,CAACO,GAAG,IAAIP,KAAK,CAACK,IAAI,GACtI,CAAC;EACH;EAEA,MAAM/B,OAAO,GAAG,CAAC,GAAGF,KAAK,CAACG,WAAW,CAAC;EAEtC,OAAO;IACL0B,IAAI,EAAE7B,KAAK,CAAC6B,IAAI;IAChB1B,WAAW,EAAEH,KAAK,CAACoC,SAAS,KAAK,QAAQ,GAAGlC,OAAO,CAACmC,OAAO,CAAC,CAAC,GAAGnC,OAAO;IACvEY,QAAQ,EAAEd,KAAK,CAACc,QAAQ,IAAI,MAAM;IAClCM,KAAK,EAAEpB,KAAK,CAACoB,KAAK,IAAI,CAAC;IACvBE,MAAM,EAAEtB,KAAK,CAACsB,MAAM,IAAI,CAAC;IACzBC,QAAQ,EAAEvB,KAAK,CAACuB,QAAQ;IACxBU,IAAI,EAAEL,KAAK,CAACK,IAAI;IAChBC,GAAG;IACHC;EACF,CAAC;AACH,CAAC;AAACG,OAAA,CAAAd,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.compileCustomFrame = void 0;
7
+ var _customDeviceError = require("./custom-device-error.js");
8
+ const HEX_BYTE = /^[0-9a-f]{2}$/;
9
+
10
+ /**
11
+ * Checks that a frame declaration can actually recognise a complete package, and returns a
12
+ * frozen, lower-cased copy of it.
13
+ *
14
+ * The copy matters twice. The received buffer is always lower-case hex, so a header declared
15
+ * as ["AA","55"] would never match and the device would silently produce nothing until the
16
+ * stuck-data timeout. And the runtime must not read an object the caller still holds a
17
+ * reference to: mutating the declaration after registration would otherwise move byte offsets
18
+ * that were bounds-checked at registration.
19
+ */
20
+ const compileCustomFrame = (id, path, frame) => {
21
+ const minLengthBytes = frame?.minLengthBytes;
22
+ if (!Number.isInteger(minLengthBytes) || minLengthBytes < 1) {
23
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.minLengthBytes`, "must be a whole number of at least 1");
24
+ }
25
+ const declaredHeader = frame.header ?? [];
26
+ if (!Array.isArray(declaredHeader)) {
27
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.header`, "must be a list of hex bytes");
28
+ }
29
+ const header = declaredHeader.map(byte => String(byte).toLowerCase());
30
+ if (header.some(byte => !HEX_BYTE.test(byte))) {
31
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.header`, 'must be a list of single hex bytes, e.g. ["aa", "55"]');
32
+ }
33
+ if (header.length > minLengthBytes) {
34
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.header`, `is ${header.length} bytes, which does not fit inside minLengthBytes (${minLengthBytes})`);
35
+ }
36
+ const length = frame.length;
37
+ if (!length) {
38
+ return Object.freeze({
39
+ header: Object.freeze(header),
40
+ minLengthBytes
41
+ });
42
+ }
43
+ if (!Number.isInteger(length.index) || length.index < 0) {
44
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.length.index`, "must be a byte offset of at least 0");
45
+ }
46
+ if (length.widthBytes !== 1 && length.widthBytes !== 2) {
47
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.length.widthBytes`, "must be 1 or 2");
48
+ }
49
+ if (!Number.isInteger(length.overheadBytes) || length.overheadBytes < 0) {
50
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.length.overheadBytes`, "must be a whole number of at least 0");
51
+ }
52
+ if (length.index + length.widthBytes > minLengthBytes) {
53
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.length`, `reads bytes ${length.index}-${length.index + length.widthBytes - 1}, which frame.minLengthBytes (${minLengthBytes}) does not guarantee are present`);
54
+ }
55
+ return Object.freeze({
56
+ header: Object.freeze(header),
57
+ minLengthBytes,
58
+ length: Object.freeze({
59
+ ...length
60
+ })
61
+ });
62
+ };
63
+ exports.compileCustomFrame = compileCustomFrame;
64
+ //# sourceMappingURL=compile-custom-frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_customDeviceError","require","HEX_BYTE","compileCustomFrame","id","path","frame","minLengthBytes","Number","isInteger","customDeviceError","declaredHeader","header","Array","isArray","map","byte","String","toLowerCase","some","test","length","Object","freeze","index","widthBytes","overheadBytes","exports"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/custom/compile-custom-frame.ts"],"mappings":";;;;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AAEA,MAAMC,QAAQ,GAAG,eAAe;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,kBAAkB,GAAGA,CAChCC,EAAU,EACVC,IAAY,EACZC,KAAsB,KACF;EACpB,MAAMC,cAAc,GAAGD,KAAK,EAAEC,cAAc;EAE5C,IAAI,CAACC,MAAM,CAACC,SAAS,CAACF,cAAc,CAAC,IAAIA,cAAc,GAAG,CAAC,EAAE;IAC3D,MAAM,IAAAG,oCAAiB,EACrBN,EAAE,EACF,GAAGC,IAAI,iBAAiB,EACxB,sCACF,CAAC;EACH;EAEA,MAAMM,cAAc,GAAGL,KAAK,CAACM,MAAM,IAAI,EAAE;EAEzC,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,cAAc,CAAC,EAAE;IAClC,MAAM,IAAAD,oCAAiB,EAACN,EAAE,EAAE,GAAGC,IAAI,SAAS,EAAE,6BAA6B,CAAC;EAC9E;EAEA,MAAMO,MAAM,GAAGD,cAAc,CAACI,GAAG,CAAEC,IAAI,IAAKC,MAAM,CAACD,IAAI,CAAC,CAACE,WAAW,CAAC,CAAC,CAAC;EAEvE,IAAIN,MAAM,CAACO,IAAI,CAAEH,IAAI,IAAK,CAACd,QAAQ,CAACkB,IAAI,CAACJ,IAAI,CAAC,CAAC,EAAE;IAC/C,MAAM,IAAAN,oCAAiB,EACrBN,EAAE,EACF,GAAGC,IAAI,SAAS,EA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c,kCACpH,CAAC;EACH;EAEA,OAAOe,MAAM,CAACC,MAAM,CAAC;IACnBX,MAAM,EAAEU,MAAM,CAACC,MAAM,CAACX,MAAM,CAAa;IACzCL,cAAc;IACdc,MAAM,EAAEC,MAAM,CAACC,MAAM,CAAC;MAAE,GAAGF;IAAO,CAAC;EACrC,CAAC,CAAC;AACJ,CAAC;AAACM,OAAA,CAAAxB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.compileCustomMonitor = void 0;
7
+ var _compileCustomCase = require("./compile-custom-case.js");
8
+ var _compileCustomFrame = require("./compile-custom-frame.js");
9
+ var _customDeviceError = require("./custom-device-error.js");
10
+ var _normalizeBleUuid = require("./normalize-ble-uuid.js");
11
+ const HEX = /^[0-9a-f]*$/;
12
+ const assertSelectorBytes = (id, path, monitor, frame) => {
13
+ const selectorBytes = monitor.caseSelectorBytes;
14
+ if (selectorBytes === undefined) {
15
+ if (monitor.cases.length !== 1 || monitor.cases[0]?.selector !== "") {
16
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.caseSelectorBytes`, "is required unless the characteristic has exactly one case with an empty selector");
17
+ }
18
+ return [];
19
+ }
20
+ if (!Array.isArray(selectorBytes) || selectorBytes.length === 0 || selectorBytes.some(i => !Number.isInteger(i) || i < 0)) {
21
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.caseSelectorBytes`, "must be a non-empty list of byte offsets that are integers of at least 0");
22
+ }
23
+ const outOfFrame = selectorBytes.filter(i => i >= frame.minLengthBytes);
24
+ if (outOfFrame.length > 0) {
25
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.caseSelectorBytes`, `reads byte ${outOfFrame[0]}, which frame.minLengthBytes (${frame.minLengthBytes}) does not guarantee is present`);
26
+ }
27
+ return selectorBytes;
28
+ };
29
+ const assertSelector = (id, path, selector, selectorBytes, seen) => {
30
+ const value = String(selector ?? "").toLowerCase();
31
+ const expected = selectorBytes.length * 2;
32
+ if (!HEX.test(value)) {
33
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.selector`, `is "${selector}", which is not hex`);
34
+ }
35
+ if (value.length !== expected) {
36
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.selector`, `is ${value.length} hex digits but caseSelectorBytes declares ${selectorBytes.length} byte(s), so it must be ${expected}`);
37
+ }
38
+ if (seen.has(value)) {
39
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.selector`, `has the same selector "${value}" as an earlier case, which would silently shadow it`);
40
+ }
41
+ seen.add(value);
42
+ };
43
+
44
+ /** Validates one notify characteristic and turns it into a parsing model and a frame. */
45
+ const compileCustomMonitor = (id, path, monitor, fields) => {
46
+ if (typeof monitor !== "object" || monitor === null) {
47
+ throw (0, _customDeviceError.customDeviceError)(id, path, "must be a monitor characteristic object");
48
+ }
49
+ const uuid = (0, _normalizeBleUuid.normalizeBleUuid)(id, `${path}.uuid`, monitor.uuid);
50
+ const frame = (0, _compileCustomFrame.compileCustomFrame)(id, `${path}.frame`, monitor.frame);
51
+ if (!Array.isArray(monitor.cases) || monitor.cases.length === 0) {
52
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.cases`, "must declare at least one case");
53
+ }
54
+ const selectorBytes = assertSelectorBytes(id, path, monitor, frame);
55
+ const seen = new Set();
56
+ const cases = monitor.cases.map((caseSpec, index) => {
57
+ const casePath = `${path}.cases[${index}]`;
58
+ if (typeof caseSpec !== "object" || caseSpec === null) {
59
+ throw (0, _customDeviceError.customDeviceError)(id, casePath, "must be a case object");
60
+ }
61
+ assertSelector(id, casePath, caseSpec.selector, selectorBytes, seen);
62
+ return (0, _compileCustomCase.compileCustomCase)(id, casePath, caseSpec, frame.minLengthBytes, fields);
63
+ });
64
+ return {
65
+ characteristic: {
66
+ uuid,
67
+ parsingModel: {
68
+ caseValuePosition: selectorBytes.length > 0 ? selectorBytes : undefined,
69
+ cases
70
+ }
71
+ },
72
+ frame
73
+ };
74
+ };
75
+ exports.compileCustomMonitor = compileCustomMonitor;
76
+ //# sourceMappingURL=compile-custom-monitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_compileCustomCase","require","_compileCustomFrame","_customDeviceError","_normalizeBleUuid","HEX","assertSelectorBytes","id","path","monitor","frame","selectorBytes","caseSelectorBytes","undefined","cases","length","selector","customDeviceError","Array","isArray","some","i","Number","isInteger","outOfFrame","filter","minLengthBytes","assertSelector","seen","value","String","toLowerCase","expected","test","has","add","compileCustomMonitor","fields","uuid","normalizeBleUuid","compileCustomFrame","Set","map","caseSpec","index","casePath","compileCustomCase","characteristic","parsingModel","caseValuePosition","exports"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/custom/compile-custom-monitor.ts"],"mappings":";;;;;;AAKA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAEA,MAAMI,GAAG,GAAG,aAAa;AAEzB,MAAMC,mBAAmB,GAAGA,CAC1BC,EAAU,EACVC,IAAY,EACZC,OAA0B,EAC1BC,KAAsB,KACT;EACb,MAAMC,aAAa,GAAGF,OAAO,CAACG,iBAAiB;EAE/C,IAAID,aAAa,KAAKE,SAAS,EAAE;IAC/B,IAAIJ,OAAO,CAACK,KAAK,CAACC,MAAM,KAAK,CAAC,IAAIN,OAAO,CAACK,KAAK,CAAC,CAAC,CAAC,EAAEE,QAAQ,KAAK,EAAE,EAAE;MACnE,MAAM,IAAAC,oCAAiB,EACrBV,EAAE,EACF,GAAGC,IAAI,oBAAoB,EAC3B,mFACF,CAAC;IACH;IAEA,OAAO,EAAE;EACX;EAEA,IACE,CAACU,KAAK,CAACC,OAAO,CAACR,aAAa,CAAC,IAC7BA,aAAa,CAACI,MAAM,KAAK,CAAC,IAC1BJ,aAAa,CAACS,IAAI,CAAEC,CAAC,IAAK,C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,EAACV,EAAE,EAAEsC,QAAQ,EAAE,uBAAuB,CAAC;IAChE;IAEAlB,cAAc,CAACpB,EAAE,EAAEsC,QAAQ,EAAEF,QAAQ,CAAC3B,QAAQ,EAAEL,aAAa,EAAEiB,IAAI,CAAC;IAEpE,OAAO,IAAAkB,oCAAiB,EACtBvC,EAAE,EACFsC,QAAQ,EACRF,QAAQ,EACRjC,KAAK,CAACgB,cAAc,EACpBW,MACF,CAAC;EACH,CAAC,CAAC;EAEF,OAAO;IACLU,cAAc,EAAE;MACdT,IAAI;MACJU,YAAY,EAAE;QACZC,iBAAiB,EAAEtC,aAAa,CAACI,MAAM,GAAG,CAAC,GAAGJ,aAAa,GAAGE,SAAS;QACvEC;MACF;IACF,CAAC;IACDJ;EACF,CAAC;AACH,CAAC;AAACwC,OAAA,CAAAd,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.customDeviceError = void 0;
7
+ /**
8
+ * Every registration failure names the exact position in the declaration, because the
9
+ * author is looking at a datasheet and needs to know which line of it is wrong.
10
+ */
11
+ const customDeviceError = (id, path, message) => new Error(`Custom device "${id}": ${path} ${message}`);
12
+ exports.customDeviceError = customDeviceError;
13
+ //# sourceMappingURL=custom-device-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["customDeviceError","id","path","message","Error","exports"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/custom/custom-device-error.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,GAAGA,CAC/BC,EAAU,EACVC,IAAY,EACZC,OAAe,KACL,IAAIC,KAAK,CAAC,kBAAkBH,EAAE,MAAMC,IAAI,IAAIC,OAAO,EAAE,CAAC;AAACE,OAAA,CAAAL,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.defineCustomDevice = void 0;
7
+ var _customDeviceBrand = require("../../constants/custom-device-brand.js");
8
+ var _integratedDevices = require("../../types/integrated-devices.js");
9
+ var _compileCustomMonitor = require("./compile-custom-monitor.js");
10
+ var _customDeviceError = require("./custom-device-error.js");
11
+ var _normalizeBleUuid = require("./normalize-ble-uuid.js");
12
+ const MIN_STUCK_TIMEOUT_MS = 1_000;
13
+
14
+ // The SDK's own F4 scale waits this long, because it sleeps while still connected.
15
+ const MAX_STUCK_TIMEOUT_MS = 6_000_000;
16
+ const HEX_BYTES = /^([0-9a-f]{2})+$/;
17
+ const assertIdentity = spec => {
18
+ const id = typeof spec?.id === "string" ? spec.id.trim() : "";
19
+ if (!id) {
20
+ throw (0, _customDeviceError.customDeviceError)(String(spec?.id), "id", "must not be empty");
21
+ }
22
+ const builtIn = Object.values(_integratedDevices.IntegratedDevices).find(name => name.toLowerCase() === id.toLowerCase());
23
+ if (builtIn) {
24
+ throw (0, _customDeviceError.customDeviceError)(id, "id", `collides with the built-in device "${builtIn}"`);
25
+ }
26
+ return id;
27
+ };
28
+ const compileNameMatch = (id, spec) => {
29
+ const nameMatch = spec.nameMatch;
30
+ if (nameMatch instanceof RegExp) {
31
+ if (nameMatch.global || nameMatch.sticky) {
32
+ throw (0, _customDeviceError.customDeviceError)(id, "nameMatch", `must not use the ${nameMatch.global ? "global" : "sticky"} flag, because it makes RegExp.test advance lastIndex and alternate between true and false across scan results`);
33
+ }
34
+ return nameMatch;
35
+ }
36
+ const exact = typeof nameMatch === "string" ? nameMatch.trim() : "";
37
+ if (!exact) {
38
+ throw (0, _customDeviceError.customDeviceError)(id, "nameMatch", "must not be empty");
39
+ }
40
+ return new RegExp(`^${exact.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`);
41
+ };
42
+ const assertStuckTimeout = (id, spec) => {
43
+ const timeout = spec.stuckDataTimeoutMs;
44
+ if (!Number.isInteger(timeout) || timeout < MIN_STUCK_TIMEOUT_MS || timeout > MAX_STUCK_TIMEOUT_MS) {
45
+ throw (0, _customDeviceError.customDeviceError)(id, "stuckDataTimeoutMs", `must be a whole number of milliseconds between ${MIN_STUCK_TIMEOUT_MS} and ${MAX_STUCK_TIMEOUT_MS}`);
46
+ }
47
+ return timeout;
48
+ };
49
+ const compileWrite = (id, path, write) => {
50
+ if (!write) {
51
+ return undefined;
52
+ }
53
+ const commandHex = String(write.commandHex ?? "").toLowerCase();
54
+ if (!HEX_BYTES.test(commandHex)) {
55
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.write.commandHex`, `is "${write.commandHex}"; it must be an even number of hex digits`);
56
+ }
57
+ return {
58
+ uuid: (0, _normalizeBleUuid.normalizeBleUuid)(id, `${path}.write.uuid`, write.uuid),
59
+ mainCommandUuid: commandHex
60
+ };
61
+ };
62
+
63
+ /**
64
+ * Validates a declaration and compiles it into a runnable device.
65
+ *
66
+ * Every rule the declarative decoder relies on is checked here, at registration, because the
67
+ * alternative is a plausible wrong number at read time. Registration fails loudly - it
68
+ * throws, naming the exact position in the declaration - and a device that fails to compile
69
+ * is never scanned for.
70
+ */
71
+ const defineCustomDevice = spec => {
72
+ const id = assertIdentity(spec);
73
+ const nameMatch = compileNameMatch(id, spec);
74
+ const stuckDataTimeout = assertStuckTimeout(id, spec);
75
+ if (!Array.isArray(spec.services) || spec.services.length === 0) {
76
+ throw (0, _customDeviceError.customDeviceError)(id, "services", "must declare at least one service");
77
+ }
78
+ const fields = new Map();
79
+ const frames = new Map();
80
+ const seenCharacteristics = new Set();
81
+ const mainServices = spec.services.map((service, serviceIndex) => {
82
+ const path = `services[${serviceIndex}]`;
83
+ if (typeof service !== "object" || service === null) {
84
+ throw (0, _customDeviceError.customDeviceError)(id, path, "must be a service object");
85
+ }
86
+ if (!Array.isArray(service.monitor) || service.monitor.length === 0) {
87
+ throw (0, _customDeviceError.customDeviceError)(id, `${path}.monitor`, "must declare at least one monitor characteristic");
88
+ }
89
+ const monitorUuids = service.monitor.map((monitor, monitorIndex) => {
90
+ const monitorPath = `${path}.monitor[${monitorIndex}]`;
91
+ const {
92
+ characteristic,
93
+ frame
94
+ } = (0, _compileCustomMonitor.compileCustomMonitor)(id, monitorPath, monitor, fields);
95
+ if (seenCharacteristics.has(characteristic.uuid)) {
96
+ throw (0, _customDeviceError.customDeviceError)(id, `${monitorPath}.uuid`, `is declared twice; a characteristic may appear only once`);
97
+ }
98
+ seenCharacteristics.add(characteristic.uuid);
99
+ frames.set(characteristic.uuid, frame);
100
+ return characteristic;
101
+ });
102
+ return {
103
+ uuid: (0, _normalizeBleUuid.normalizeBleUuid)(id, `${path}.uuid`, service.uuid),
104
+ monitorUuids,
105
+ writeUuid: compileWrite(id, path, service.write)
106
+ };
107
+ });
108
+ return {
109
+ [_customDeviceBrand.CUSTOM_DEVICE_BRAND]: true,
110
+ id: id,
111
+ spec,
112
+ nameMatch,
113
+ mainServices,
114
+ stuckDataTimeout,
115
+ fields,
116
+ frames
117
+ };
118
+ };
119
+ exports.defineCustomDevice = defineCustomDevice;
120
+ //# sourceMappingURL=define-custom-device.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_customDeviceBrand","require","_integratedDevices","_compileCustomMonitor","_customDeviceError","_normalizeBleUuid","MIN_STUCK_TIMEOUT_MS","MAX_STUCK_TIMEOUT_MS","HEX_BYTES","assertIdentity","spec","id","trim","customDeviceError","String","builtIn","Object","values","IntegratedDevices","find","name","toLowerCase","compileNameMatch","nameMatch","RegExp","global","sticky","exact","replace","assertStuckTimeout","timeout","stuckDataTimeoutMs","Number","isInteger","compileWrite","path","write","undefined","commandHex","test","uuid","normalizeBleUuid","mainCommandUuid","defineCustomDevice","stuckDataTimeout","Array","isArray","services","length","fields","Map","frames","seenCharacteristics","Set","mainServices","map","service","serviceIndex","monitor","monitorUuids","monitorIndex","monitorPath","characteristic","frame","compileCustomMonitor","has","add","set","writeUuid","CUSTOM_DEVICE_BRAND","exports"],"sourceRoot":"../../../../../../src","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AAGwB,IAAI,UAAU,EACjB,kDACF,CAAC;IACH;IAEA,MAAMwB,YAAY,GAAGH,OAAO,CAACE,OAAO,CAACH,GAAG,CAAC,CAACG,OAAO,EAAEE,YAAY,KAAK;MAClE,MAAMC,WAAW,GAAG,GAAG1B,IAAI,YAAYyB,YAAY,GAAG;MAEtD,MAAM;QAAEE,cAAc;QAAEC;MAAM,CAAC,GAAG,IAAAC,0CAAoB,EACpDrD,EAAE,EACFkD,WAAW,EACXH,OAAO,EACPT,MACF,CAAC;MAED,IAAIG,mBAAmB,CAACa,GAAG,CAACH,cAAc,CAACtB,IAAI,CAAC,EAAE;QAChD,MAAM,IAAA3B,oCAAiB,EACrBF,EAAE,EACF,GAAGkD,WAAW,OAAO,EACrB,0DACF,CAAC;MACH;MAEAT,mBAAmB,CAACc,GAAG,CAACJ,cAAc,CAACtB,IAAI,CAAC;MAC5CW,MAAM,CAACgB,GAAG,CAACL,cAAc,CAACtB,IAAI,EAAEuB,KAAK,CAAC;MAEtC,OAAOD,cAAc;IACvB,CAAC,CAAC;IAEF,OAAO;MACLtB,IAAI,EAAE,IAAAC,kCAAgB,EAAC9B,EAAE,EAAE,GAAGwB,IAAI,OAAO,EAAEqB,OAAO,CAAChB,IAAI,CAAC;MACxDmB,YAAY;MACZS,SAAS,EAAElC,YAAY,CAACvB,EAAE,EAAEwB,IAAI,EAAEqB,OAAO,CAACpB,KAAK;IACjD,CAAC;EACH,CAAC,CAAC;EAEF,OAAO;IACL,CAACiC,sCAAmB,GAAG,IAAI;IAC3B1D,EAAE,EAAEA,EAAoB;IACxBD,IAAI;IACJa,SAAS;IACT+B,YAAY;IACZV,gBAAgB;IAChBK,MAAM;IACNE;EACF,CAAC;AACH,CAAC;AAACmB,OAAA,CAAA3B,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.normalizeBleUuid = void 0;
7
+ var _customDeviceError = require("./custom-device-error.js");
8
+ const BASE_UUID_SUFFIX = "-0000-1000-8000-00805f9b34fb";
9
+ const SHORT = /^[0-9a-f]{4}$/;
10
+ const MEDIUM = /^[0-9a-f]{8}$/;
11
+ const FULL = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
12
+
13
+ /**
14
+ * Accepts a 16-bit, 32-bit or 128-bit UUID and returns the 128-bit form, because that is
15
+ * what react-native-ble-plx reports back on a notification and what the parsing model is
16
+ * matched against.
17
+ */
18
+ const normalizeBleUuid = (id, path, value) => {
19
+ const raw = typeof value === "string" ? value.trim().toLowerCase() : "";
20
+ if (SHORT.test(raw)) {
21
+ return `0000${raw}${BASE_UUID_SUFFIX}`;
22
+ }
23
+ if (MEDIUM.test(raw)) {
24
+ return `${raw}${BASE_UUID_SUFFIX}`;
25
+ }
26
+ if (FULL.test(raw)) {
27
+ return raw;
28
+ }
29
+ throw (0, _customDeviceError.customDeviceError)(id, path, `is "${String(value)}", which is not a 16-bit, 32-bit or 128-bit Bluetooth UUID`);
30
+ };
31
+ exports.normalizeBleUuid = normalizeBleUuid;
32
+ //# sourceMappingURL=normalize-ble-uuid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_customDeviceError","require","BASE_UUID_SUFFIX","SHORT","MEDIUM","FULL","normalizeBleUuid","id","path","value","raw","trim","toLowerCase","test","customDeviceError","String","exports"],"sourceRoot":"../../../../../../src","sources":["modules/bt-management/services/custom/normalize-ble-uuid.ts"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAEA,MAAMC,gBAAgB,GAAG,8BAA8B;AACvD,MAAMC,KAAK,GAAG,eAAe;AAC7B,MAAMC,MAAM,GAAG,eAAe;AAE9B,MAAMC,IAAI,GACR,gEAAgE;;AAElE;AACA;AACA;AACA;AACA;AACO,MAAMC,gBAAgB,GAAGA,CAC9BC,EAAU,EACVC,IAAY,EACZC,KAAc,KACH;EACX,MAAMC,GAAG,GAAG,OAAOD,KAAK,KAAK,QAAQ,GAAGA,KAAK,CAACE,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAG,EAAE;EAEvE,IAAIT,KAAK,CAACU,IAAI,CAACH,GAAG,CAAC,EAAE;IACnB,OAAO,OAAOA,GAAG,GAAGR,gBAAgB,EAAE;EACxC;EAEA,IAAIE,MAAM,CAACS,IAAI,CAACH,GAAG,CAAC,EAAE;IACpB,OAAO,GAAGA,GAAG,GAAGR,gBAAgB,EAAE;EACpC;EAEA,IAAIG,IAAI,CAACQ,IAAI,CAACH,GAAG,CAAC,EAAE;IAClB,OAAOA,GAAG;EACZ;EAEA,MAAM,IAAAI,oCAAiB,EACrBP,EAAE,EACFC,IAAI,EACJ,OAAOO,MAAM,CAACN,KAAK,CAAC,4DACtB,CAAC;AACH,CAAC;AAACO,OAAA,CAAAV,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -6,28 +6,55 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.DeviceCreator = void 0;
7
7
  var _integratedDevicesMap = require("../constants/integrated-devices-map.js");
8
8
  var _integratedDevices = require("../types/integrated-devices.js");
9
+ var _isCustomDeviceDefinition = require("../utils/is-custom-device-definition.js");
9
10
  var _bc01Device = require("./devices/bc01/bc01.device.js");
10
11
  var _bp2Device = require("./devices/bp2/bp2.device.js");
12
+ var _customDevice = require("./devices/custom/custom.device.js");
11
13
  var _f4Device = require("./devices/f4/f4.device.js");
12
14
  var _spo2Device = require("./devices/spo/spo2.device.js");
15
+ const collectCustomDevices = acceptedDevices => {
16
+ const customDevices = new Map();
17
+ const matchers = new Set();
18
+ acceptedDevices.forEach((entry, index) => {
19
+ if (typeof entry === "string") {
20
+ return;
21
+ }
22
+ if (!(0, _isCustomDeviceDefinition.isCustomDeviceDefinition)(entry)) {
23
+ throw new Error(`acceptedDevices[${index}] is not a device registered with defineCustomDevice`);
24
+ }
25
+ if (customDevices.has(entry.id)) {
26
+ throw new Error(`acceptedDevices[${index}] registers the custom device "${entry.id}" twice`);
27
+ }
28
+ if (matchers.has(entry.nameMatch.source)) {
29
+ throw new Error(`acceptedDevices[${index}] ("${entry.id}") matches the same advertised name as an earlier custom device, so one would silently shadow the other`);
30
+ }
31
+ customDevices.set(entry.id, entry);
32
+ matchers.add(entry.nameMatch.source);
33
+ });
34
+ return customDevices;
35
+ };
13
36
  class DeviceCreator {
14
37
  deviceNameCache = new Map();
15
38
  CACHE_MAX_SIZE = 100;
16
39
  constructor(acceptedDeviceNames) {
17
40
  this.acceptedDeviceNames = acceptedDeviceNames;
41
+ this.customDevices = collectCustomDevices(acceptedDeviceNames);
18
42
  }
19
43
  getDeviceName = foundName => {
20
- const deviceName = this.getIntegratedDeviceName(foundName);
21
- if (!deviceName) {
22
- return;
44
+ if (!foundName) {
45
+ return undefined;
23
46
  }
24
- if (!this.acceptedDeviceNames.some(name => name === deviceName)) {
25
- return;
47
+ if (this.deviceNameCache.has(foundName)) {
48
+ return this.deviceNameCache.get(foundName) ?? undefined;
26
49
  }
27
- return deviceName;
50
+ const matched = this.matchDeviceName(foundName);
51
+
52
+ // Cache the result (store null for non-matches to avoid repeated tests)
53
+ this.cacheDeviceName(foundName, matched ?? null);
54
+ return matched;
28
55
  };
29
56
  createDevice(params) {
30
- if (!params.deviceName.trim()) {
57
+ if (!String(params.deviceName ?? "").trim()) {
31
58
  throw new Error("Device name is required");
32
59
  }
33
60
  if (!params.device) {
@@ -39,6 +66,11 @@ class DeviceCreator {
39
66
  if (!params.device.id) {
40
67
  throw new Error("Device ID is required");
41
68
  }
69
+ const custom = this.customDevices.get(params.deviceName);
70
+ if (custom) {
71
+ // @ts-expect-error - the caller asked for this custom device by its own id
72
+ return new _customDevice.CustomDevice(params.device, params, custom);
73
+ }
42
74
  const deviceMap = {
43
75
  [_integratedDevices.IntegratedDevices.BP2]: _bp2Device.BP2Device,
44
76
  [_integratedDevices.IntegratedDevices.F4]: _f4Device.F4Device,
@@ -56,29 +88,23 @@ class DeviceCreator {
56
88
  destroy = () => {
57
89
  this.deviceNameCache.clear();
58
90
  };
59
- getIntegratedDeviceName = deviceName => {
60
- if (!deviceName) {
61
- return undefined;
62
- }
63
-
64
- // Check cache first
65
- if (this.deviceNameCache.has(deviceName)) {
66
- const cached = this.deviceNameCache.get(deviceName);
67
- return cached ?? undefined;
68
- }
69
91
 
70
- // Not in cache - test regexes with early return
71
- let matchedDevice;
92
+ /**
93
+ * A built-in device always wins over a declaration: its decoder is compiled and tested,
94
+ * and a declaration that happens to match the same advertised name must not displace it.
95
+ */
96
+ matchDeviceName = deviceName => {
72
97
  for (const [regex, deviceType] of _integratedDevicesMap.integratedDevicesMap) {
73
- if (regex.test(deviceName)) {
74
- matchedDevice = deviceType;
75
- break; // Early return!
98
+ if (regex.test(deviceName) && this.acceptedDeviceNames.some(name => name === deviceType)) {
99
+ return deviceType;
76
100
  }
77
101
  }
78
-
79
- // Cache result (store null for non-matches to avoid repeated tests)
80
- this.cacheDeviceName(deviceName, matchedDevice ?? null);
81
- return matchedDevice;
102
+ for (const custom of this.customDevices.values()) {
103
+ if (custom.nameMatch.test(deviceName)) {
104
+ return custom.id;
105
+ }
106
+ }
107
+ return undefined;
82
108
  };
83
109
  cacheDeviceName(deviceName, deviceType) {
84
110
  // Implement simple LRU by clearing oldest entries when cache is full
@@ -1 +1 @@
1
- {"version":3,"names":["_integratedDevicesMap","require","_integratedDevices","_bc01Device","_bp2Device","_f4Device","_spo2Device","DeviceCreator","deviceNameCache","Map","CACHE_MAX_SIZE","constructor","acceptedDeviceNames","getDeviceName","foundName","deviceName","getIntegratedDeviceName","some","name","createDevice","params","trim","Error","device","id","deviceMap","IntegratedDevices","BP2","BP2Device","F4","F4Device","PC60WF","SPO2Device","BC01","BC01Device","deviceClass","destroy","clear","undefined","has","cached","get","matchedDevice","regex","deviceType","integratedDevicesMap","test","cacheDeviceName","size","firstKey","keys","next","value","delete","set","exports"],"sourceRoot":"../../../../../src","sources":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AACpC,eAAe,CAACwC,IAAI,IAAI,IAAI,CAACtC,cAAc,EAAE;MACpD,MAAMuC,QAAQ,GAAG,IAAI,CAACzC,eAAe,CAAC0C,IAAI,CAAC,CAAC,CAACC,IAAI,CAAC,CAAC,CAACC,KAAK;MAEzD,IAAIH,QAAQ,KAAKX,SAAS,EAAE;QAC1B,IAAI,CAAC9B,eAAe,CAAC6C,MAAM,CAACJ,QAAQ,CAAC;MACvC;IACF;IAEA,IAAI,CAACzC,eAAe,CAAC8C,GAAG,CAACvC,UAAU,EAAE6B,UAAU,CAAC;EAClD;AACF;AAACW,OAAA,CAAAhD,aAAA,GAAAA,aAAA","ignoreList":[]}
1
+ {"version":3,"names":["_integratedDevicesMap","require","_integratedDevices","_isCustomDeviceDefinition","_bc01Device","_bp2Device","_customDevice","_f4Device","_spo2Device","collectCustomDevices","acceptedDevices","customDevices","Map","matchers","Set","forEach","entry","index","isCustomDeviceDefinition","Error","has","id","nameMatch","source","set","add","DeviceCreator","deviceNameCache","CACHE_MAX_SIZE","constructor","acceptedDeviceNames","getDeviceName","foundName","undefined","get","matched","matchDeviceName","cacheDeviceName","createDevice","params","String","deviceName","trim","device","name","custom","CustomDevice","deviceMap","IntegratedDevices","BP2","BP2Device","F4","F4Device","PC60WF","SPO2Device","BC01","BC01Device","deviceClass","destroy","clear","regex","deviceType","integratedDevicesMap","test","some","values","size","firstKey","keys","next","value","delete","exports"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/services/device-creator.ts"],"mappings":";;;;;;AAAA,IAAAA,qBAAA,GAAAC,OAAA;AAMA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA;AAEA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAEA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAEA,MAAMQ,oBAAoB,GACxBC,eAA0C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