@ovok/native 1.16.1-dev.2141 → 1.16.1-dev.2145

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 (127) hide show
  1. package/lib/commonjs/modules/next/background-sync/index.js +11 -0
  2. package/lib/commonjs/modules/next/background-sync/index.js.map +1 -1
  3. package/lib/commonjs/modules/next/background-sync/offline-measurement-background-sync.js +63 -0
  4. package/lib/commonjs/modules/next/background-sync/offline-measurement-background-sync.js.map +1 -0
  5. package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-peripheral.js +35 -0
  6. package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-peripheral.js.map +1 -0
  7. package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-scanner.js +3 -30
  8. package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-scanner.js.map +1 -1
  9. package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js +2 -2
  10. package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
  11. package/lib/commonjs/modules/next/bluetooth/react-native/ovok-sink.js.map +1 -1
  12. package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth-runtime.js +28 -0
  13. package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth-runtime.js.map +1 -0
  14. package/lib/commonjs/modules/next/bluetooth/web/index.js +208 -0
  15. package/lib/commonjs/modules/next/bluetooth/web/index.js.map +1 -0
  16. package/lib/commonjs/modules/next/bluetooth/web/web-ble-device.js +143 -0
  17. package/lib/commonjs/modules/next/bluetooth/web/web-ble-device.js.map +1 -0
  18. package/lib/commonjs/modules/next/bluetooth/web/web-ble-shapes.js +43 -0
  19. package/lib/commonjs/modules/next/bluetooth/web/web-ble-shapes.js.map +1 -0
  20. package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-permissions.js +21 -0
  21. package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-permissions.js.map +1 -0
  22. package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-scanner.js +133 -0
  23. package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-scanner.js.map +1 -0
  24. package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-services.js +28 -0
  25. package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-services.js.map +1 -0
  26. package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-values.js +37 -0
  27. package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-values.js.map +1 -0
  28. package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth.types.js +2 -0
  29. package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth.types.js.map +1 -0
  30. package/lib/commonjs/modules/next/bluetooth/web/web-gatt.js +83 -0
  31. package/lib/commonjs/modules/next/bluetooth/web/web-gatt.js.map +1 -0
  32. package/lib/module/modules/next/background-sync/index.js +1 -0
  33. package/lib/module/modules/next/background-sync/index.js.map +1 -1
  34. package/lib/module/modules/next/background-sync/offline-measurement-background-sync.js +55 -0
  35. package/lib/module/modules/next/background-sync/offline-measurement-background-sync.js.map +1 -0
  36. package/lib/module/modules/next/bluetooth/ble-plx/ble-peripheral.js +30 -0
  37. package/lib/module/modules/next/bluetooth/ble-plx/ble-peripheral.js.map +1 -0
  38. package/lib/module/modules/next/bluetooth/ble-plx/ble-scanner.js +2 -27
  39. package/lib/module/modules/next/bluetooth/ble-plx/ble-scanner.js.map +1 -1
  40. package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js +1 -1
  41. package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
  42. package/lib/module/modules/next/bluetooth/react-native/ovok-sink.js.map +1 -1
  43. package/lib/module/modules/next/bluetooth/web/create-web-bluetooth-runtime.js +25 -0
  44. package/lib/module/modules/next/bluetooth/web/create-web-bluetooth-runtime.js.map +1 -0
  45. package/lib/module/modules/next/bluetooth/web/index.js +28 -0
  46. package/lib/module/modules/next/bluetooth/web/index.js.map +1 -0
  47. package/lib/module/modules/next/bluetooth/web/web-ble-device.js +140 -0
  48. package/lib/module/modules/next/bluetooth/web/web-ble-device.js.map +1 -0
  49. package/lib/module/modules/next/bluetooth/web/web-ble-shapes.js +39 -0
  50. package/lib/module/modules/next/bluetooth/web/web-ble-shapes.js.map +1 -0
  51. package/lib/module/modules/next/bluetooth/web/web-bluetooth-permissions.js +18 -0
  52. package/lib/module/modules/next/bluetooth/web/web-bluetooth-permissions.js.map +1 -0
  53. package/lib/module/modules/next/bluetooth/web/web-bluetooth-scanner.js +128 -0
  54. package/lib/module/modules/next/bluetooth/web/web-bluetooth-scanner.js.map +1 -0
  55. package/lib/module/modules/next/bluetooth/web/web-bluetooth-services.js +25 -0
  56. package/lib/module/modules/next/bluetooth/web/web-bluetooth-services.js.map +1 -0
  57. package/lib/module/modules/next/bluetooth/web/web-bluetooth-values.js +29 -0
  58. package/lib/module/modules/next/bluetooth/web/web-bluetooth-values.js.map +1 -0
  59. package/lib/module/modules/next/bluetooth/web/web-bluetooth.types.js +2 -0
  60. package/lib/module/modules/next/bluetooth/web/web-bluetooth.types.js.map +1 -0
  61. package/lib/module/modules/next/bluetooth/web/web-gatt.js +79 -0
  62. package/lib/module/modules/next/bluetooth/web/web-gatt.js.map +1 -0
  63. package/lib/typescript/commonjs/src/modules/next/background-sync/index.d.ts +1 -0
  64. package/lib/typescript/commonjs/src/modules/next/background-sync/index.d.ts.map +1 -1
  65. package/lib/typescript/commonjs/src/modules/next/background-sync/offline-measurement-background-sync.d.ts +22 -0
  66. package/lib/typescript/commonjs/src/modules/next/background-sync/offline-measurement-background-sync.d.ts.map +1 -0
  67. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-link.d.ts +1 -1
  68. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-link.d.ts.map +1 -1
  69. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-peripheral.d.ts +8 -0
  70. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-peripheral.d.ts.map +1 -0
  71. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts +3 -7
  72. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts.map +1 -1
  73. package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/ovok-sink.d.ts +2 -2
  74. package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/ovok-sink.d.ts.map +1 -1
  75. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth-runtime.d.ts +23 -0
  76. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth-runtime.d.ts.map +1 -0
  77. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts +41 -0
  78. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts.map +1 -0
  79. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-ble-device.d.ts +53 -0
  80. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-ble-device.d.ts.map +1 -0
  81. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-ble-shapes.d.ts +27 -0
  82. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-ble-shapes.d.ts.map +1 -0
  83. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-permissions.d.ts +8 -0
  84. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-permissions.d.ts.map +1 -0
  85. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-scanner.d.ts +29 -0
  86. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-scanner.d.ts.map +1 -0
  87. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-services.d.ts +10 -0
  88. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-services.d.ts.map +1 -0
  89. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-values.d.ts +9 -0
  90. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-values.d.ts.map +1 -0
  91. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth.types.d.ts +56 -0
  92. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth.types.d.ts.map +1 -0
  93. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-gatt.d.ts +27 -0
  94. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-gatt.d.ts.map +1 -0
  95. package/lib/typescript/module/src/modules/next/background-sync/index.d.ts +1 -0
  96. package/lib/typescript/module/src/modules/next/background-sync/index.d.ts.map +1 -1
  97. package/lib/typescript/module/src/modules/next/background-sync/offline-measurement-background-sync.d.ts +22 -0
  98. package/lib/typescript/module/src/modules/next/background-sync/offline-measurement-background-sync.d.ts.map +1 -0
  99. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-link.d.ts +1 -1
  100. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-link.d.ts.map +1 -1
  101. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-peripheral.d.ts +8 -0
  102. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-peripheral.d.ts.map +1 -0
  103. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts +3 -7
  104. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts.map +1 -1
  105. package/lib/typescript/module/src/modules/next/bluetooth/react-native/ovok-sink.d.ts +2 -2
  106. package/lib/typescript/module/src/modules/next/bluetooth/react-native/ovok-sink.d.ts.map +1 -1
  107. package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth-runtime.d.ts +23 -0
  108. package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth-runtime.d.ts.map +1 -0
  109. package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts +41 -0
  110. package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts.map +1 -0
  111. package/lib/typescript/module/src/modules/next/bluetooth/web/web-ble-device.d.ts +53 -0
  112. package/lib/typescript/module/src/modules/next/bluetooth/web/web-ble-device.d.ts.map +1 -0
  113. package/lib/typescript/module/src/modules/next/bluetooth/web/web-ble-shapes.d.ts +27 -0
  114. package/lib/typescript/module/src/modules/next/bluetooth/web/web-ble-shapes.d.ts.map +1 -0
  115. package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-permissions.d.ts +8 -0
  116. package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-permissions.d.ts.map +1 -0
  117. package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-scanner.d.ts +29 -0
  118. package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-scanner.d.ts.map +1 -0
  119. package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-services.d.ts +10 -0
  120. package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-services.d.ts.map +1 -0
  121. package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-values.d.ts +9 -0
  122. package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-values.d.ts.map +1 -0
  123. package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth.types.d.ts +56 -0
  124. package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth.types.d.ts.map +1 -0
  125. package/lib/typescript/module/src/modules/next/bluetooth/web/web-gatt.d.ts +27 -0
  126. package/lib/typescript/module/src/modules/next/bluetooth/web/web-gatt.d.ts.map +1 -0
  127. package/package.json +11 -1
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_webBleShapes","require","_webBluetoothValues","_webGatt","DEFAULT_MTU","VALUE_CHANGED","DISCONNECTED","WebBleDevice","mtu","rssi","monitors","Set","disconnectListeners","constructor","device","advertisement","id","name","trim","localName","manufacturerData","serviceUUIDs","gatt","WebGatt","addEventListener","onDisconnect","connect","server","isConnected","connected","cancelConnection","disconnect","requestMTU","discoverAllServicesAndCharacteristics","uuids","queued","forget","serviceUuids","length","services","map","uuid","deviceID","isPrimary","characteristicsForService","serviceUuid","characteristicsOf","characteristic","toBleCharacteristic","canonicalUuid","readCharacteristicForService","characteristicUuid","value","readValue","toBase64","bytesOf","writeCharacteristicWithResponseForService","base64","write","writeCharacteristicWithoutResponseForService","monitorCharacteristicForService","listener","active","onValue","event","target","stop","started","removeEventListener","stopNotifications","catch","undefined","add","startNotifications","then","error","errorOf","remove","delete","onDisconnected","WebBleError","DEVICE_DISCONNECTED","forEach","clear","withResponse","writeValue","writeValueWithResponse","writeValueWithoutResponse","call","fromBase64","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/web-ble-device.ts"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAEA;AACA,MAAMG,WAAW,GAAG,EAAE;AACtB,MAAMC,aAAa,GAAG,4BAA4B;AAClD,MAAMC,YAAY,GAAG,wBAAwB;;AAM7C;;AAGA;AACA;AACA;AACA;AACA;AACA,MAAMC,YAAY,CAAC;EAKDC,GAAG,GAAGJ,WAAW;EACjBK,IAAI,GAAG,IAAI;EAGVC,QAAQ,GAAG,IAAIC,GAAG,CAAkB,CAAC;EACrCC,mBAAmB,GAAG,IAAID,GAAG,CAAqB,CAAC;EAE7DE,WAAWA,CAACC,MAA0B,EAAEC,aAAmC,EAAE;IAClF,IAAI,CAACC,EAAE,GAAGF,MAAM,CAACE,EAAE;IACnB,IAAI,CAACC,IAAI,GAAGH,MAAM,CAACG,IAAI,EAAEC,IAAI,CAAC,CAAC,IAAI,IAAI;IACvC,IAAI,CAACC,SAAS,GAAG,IAAI,CAACF,IAAI;IAC1B,IAAI,CAACG,gBAAgB,GAAGL,aAAa,EAAEK,gBAAgB,IAAI,IAAI;IAC/D,IAAI,CAACC,YAAY,GAAGN,aAAa,EAAEM,YAAY,IAAI,IAAI;IACvD,IAAI,CAACC,IA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,MAAM,CAACF,UAAU,IAAItC,cAAc,CAACsC,UAAU,EAAEG,IAAI,CAACzC,cAAc,EAAE,IAAA0C,8BAAU,EAAChC,MAAM,CAAC,CAAC;MAExF,OAAO,IAAAT,iCAAmB,EAAC,IAAI,CAAChC,EAAE,EAAE,IAAAiC,iCAAa,EAACJ,WAAW,CAAC,EAAEE,cAAc,EAAEU,MAAM,CAAC;IACzF,CAAC,CAAC;EACJ;AACF;AAACiC,OAAA,CAAAnF,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.toBleCharacteristic = exports.WebBleError = exports.UNKNOWN_ERROR = exports.DEVICE_DISCONNECTED = void 0;
7
+ var _webBluetoothValues = require("./web-bluetooth-values.js");
8
+ /** `react-native-ble-plx`'s BleErrorCode.DeviceDisconnected, which ends a link instead of failing it. */
9
+ const DEVICE_DISCONNECTED = exports.DEVICE_DISCONNECTED = 201;
10
+ const UNKNOWN_ERROR = exports.UNKNOWN_ERROR = 0;
11
+
12
+ /** A failed Web Bluetooth operation in the shape `react-native-ble-plx` reports errors. */
13
+ class WebBleError extends Error {
14
+ constructor(errorCode, message, reason) {
15
+ super(message);
16
+ this.errorCode = errorCode;
17
+ this.reason = reason;
18
+ this.name = "BleError";
19
+ }
20
+ }
21
+
22
+ /** A characteristic in the shape `react-native-ble-plx` returns one, with its value as base64. */
23
+ exports.WebBleError = WebBleError;
24
+ const toBleCharacteristic = (deviceID, serviceUUID, characteristic, value) => {
25
+ const {
26
+ properties
27
+ } = characteristic;
28
+ const uuid = (0, _webBluetoothValues.canonicalUuid)(characteristic.uuid);
29
+ return {
30
+ id: `${serviceUUID}/${uuid}`,
31
+ uuid,
32
+ serviceUUID,
33
+ deviceID,
34
+ value,
35
+ isReadable: properties.read,
36
+ isWritableWithResponse: properties.write,
37
+ isWritableWithoutResponse: properties.writeWithoutResponse,
38
+ isNotifiable: properties.notify,
39
+ isIndicatable: properties.indicate
40
+ };
41
+ };
42
+ exports.toBleCharacteristic = toBleCharacteristic;
43
+ //# sourceMappingURL=web-ble-shapes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_webBluetoothValues","require","DEVICE_DISCONNECTED","exports","UNKNOWN_ERROR","WebBleError","Error","constructor","errorCode","message","reason","name","toBleCharacteristic","deviceID","serviceUUID","characteristic","value","properties","uuid","canonicalUuid","id","isReadable","read","isWritableWithResponse","write","isWritableWithoutResponse","writeWithoutResponse","isNotifiable","notify","isIndicatable","indicate"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/web-ble-shapes.ts"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAGA;AACA,MAAMC,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,GAAG;AAC/B,MAAME,aAAa,GAAAD,OAAA,CAAAC,aAAA,GAAG,CAAC;;AAEvB;AACA,MAAMC,WAAW,SAASC,KAAK,CAAC;EACvBC,WAAWA,CAAiBC,SAAiB,EAAEC,OAAe,EAAkBC,MAAgB,EAAE;IACvG,KAAK,CAACD,OAAO,CAAC;IAAC,KADkBD,SAAiB,GAAjBA,SAAiB;IAAA,KAAmCE,MAAgB,GAAhBA,MAAgB;IAErG,IAAI,CAACC,IAAI,GAAG,UAAU;EACxB;AACF;;AAEA;AAAAR,OAAA,CAAAE,WAAA,GAAAA,WAAA;AAcA,MAAMO,mBAAmB,GAAGA,CAC1BC,QAAgB,EAChBC,WAAmB,EACnBC,cAA0C,EAC1CC,KAAoB,KACE;EACtB,MAAM;IAAEC;EAAW,CAAC,GAAGF,cAAc;EACrC,MAAMG,IAAI,GAAG,IAAAC,iCAAa,EAACJ,cAAc,CAACG,IAAI,CAAC;EAE/C,OAAO;IACLE,EAAE,EAAE,GAAGN,WAAW,IAAII,IAAI,EAAE;IAC5BA,IAAI;IACJJ,WAAW;IACXD,QAAQ;IACRG,KAAK;IACLK,UAAU,EAAEJ,UAAU,CAACK,IAAI;IAC3BC,sBAAsB,EAAEN,UAAU,CAACO,KAAK;IACxCC,yBAAyB,EAAER,UAAU,CAACS,oBAAoB;IAC1DC,YAAY,EAAEV,UAAU,CAACW,MAAM;IAC/BC,aAAa,EAAEZ,UAAU,CAACa;EAC5B,CAAC;AACH,CAAC;AAAC3B,OAAA,CAAAS,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.webBluetoothPermissions = void 0;
7
+ var _webBluetoothScanner = require("./web-bluetooth-scanner.js");
8
+ /**
9
+ * Browser permissions: the browser asks per device in its chooser, so there is no prompt to show first. Granted where
10
+ * the browser has Web Bluetooth, denied where it has none; no settings page can change that.
11
+ */
12
+ const webBluetoothPermissions = () => {
13
+ const permission = async () => (0, _webBluetoothScanner.isWebBluetoothAvailable)() ? "granted" : "denied";
14
+ return {
15
+ check: permission,
16
+ request: permission,
17
+ openSettings: async () => undefined
18
+ };
19
+ };
20
+ exports.webBluetoothPermissions = webBluetoothPermissions;
21
+ //# sourceMappingURL=web-bluetooth-permissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_webBluetoothScanner","require","webBluetoothPermissions","permission","isWebBluetoothAvailable","check","request","openSettings","undefined","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/web-bluetooth-permissions.ts"],"mappings":";;;;;;AAEA,IAAAA,oBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAAGA,CAAA,KAA4B;EAC1D,MAAMC,UAAU,GAAG,MAAAA,CAAA,KAA2C,IAAAC,4CAAuB,EAAC,CAAC,GAAG,SAAS,GAAG,QAAS;EAE/G,OAAO;IAAEC,KAAK,EAAEF,UAAU;IAAEG,OAAO,EAAEH,UAAU;IAAEI,YAAY,EAAE,MAAAA,CAAA,KAAYC;EAAU,CAAC;AACxF,CAAC;AAACC,OAAA,CAAAP,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.webBluetoothScanner = exports.isWebBluetoothAvailable = void 0;
7
+ var _bleErrors = require("../ble-plx/ble-errors.js");
8
+ var _blePeripheral = require("../ble-plx/ble-peripheral.js");
9
+ var _errors = require("../errors.js");
10
+ var _webBleDevice = require("./web-ble-device.js");
11
+ var _webBluetoothServices = require("./web-bluetooth-services.js");
12
+ var _webBluetoothValues = require("./web-bluetooth-values.js");
13
+ /** How long a device gets to advertise, where the browser lets the page watch, before it is reported without. */
14
+ const ADVERTISEMENT_WAIT_MS = 1500;
15
+ const CHOOSER_CLOSED = "NotFoundError";
16
+
17
+ /** What `webBluetoothScanner` needs. */
18
+
19
+ /** A `BluetoothScanner` for browsers, where a page only reaches the devices the user picks in the browser's chooser. */
20
+
21
+ const navigatorBluetooth = () => globalThis.navigator?.bluetooth;
22
+
23
+ /** Whether this browser has Web Bluetooth, such as Chrome and Edge on desktop and Android, or Bluefy on iOS. */
24
+ const isWebBluetoothAvailable = () => navigatorBluetooth() !== undefined;
25
+ exports.isWebBluetoothAvailable = isWebBluetoothAvailable;
26
+ const unsupported = () => new _errors.BluetoothError("unsupported", "This browser has no Web Bluetooth");
27
+
28
+ /** The first advertisement the browser reports, when it lets the page watch them, so names alone need not match. */
29
+ const advertisementOf = device => {
30
+ if (typeof device.watchAdvertisements !== "function") {
31
+ return Promise.resolve(undefined);
32
+ }
33
+ return new Promise(resolve => {
34
+ const watching = new AbortController();
35
+ const done = advertisement => {
36
+ clearTimeout(timer);
37
+ device.removeEventListener("advertisementreceived", received);
38
+ watching.abort();
39
+ resolve(advertisement);
40
+ };
41
+ const received = event => {
42
+ const {
43
+ uuids,
44
+ manufacturerData
45
+ } = event;
46
+ done({
47
+ serviceUUIDs: uuids?.map(_webBluetoothValues.canonicalUuid) ?? null,
48
+ manufacturerData: (0, _webBluetoothValues.manufacturerDataOf)(manufacturerData)
49
+ });
50
+ };
51
+ const timer = setTimeout(() => done(), ADVERTISEMENT_WAIT_MS);
52
+ device.addEventListener("advertisementreceived", received);
53
+ device.watchAdvertisements?.({
54
+ signal: watching.signal
55
+ }).catch(() => done());
56
+ });
57
+ };
58
+
59
+ /**
60
+ * Finds devices through Web Bluetooth. A scan reports the devices this site may already use (`getDevices`, where the
61
+ * browser has it) and every device picked with `chooseDevice`; browsers can't scan in the background or without the
62
+ * user picking.
63
+ */
64
+ const webBluetoothScanner = ({
65
+ acceptedDevices,
66
+ bluetooth = navigatorBluetooth()
67
+ } = {}) => {
68
+ const optionalServices = (0, _webBluetoothServices.webBluetoothServicesFor)(acceptedDevices);
69
+ const scans = new Set();
70
+ const devices = new Map();
71
+ const peripheralOf = async device => {
72
+ let bleDevice = devices.get(device.id);
73
+ if (!bleDevice) {
74
+ bleDevice = new _webBleDevice.WebBleDevice(device, await advertisementOf(device));
75
+ devices.set(device.id, bleDevice);
76
+ }
77
+ if (!bleDevice.serviceUUIDs?.length) {
78
+ // Devices told apart by their services alone (the SIG profiles) need them, and only a connection reveals them.
79
+ await bleDevice.connect().then(connected => connected.discoverAllServicesAndCharacteristics()).catch(() => undefined);
80
+ }
81
+ return (0, _blePeripheral.blePeripheral)(bleDevice);
82
+ };
83
+ const report = async device => {
84
+ const peripheral = await peripheralOf(device);
85
+ scans.forEach(onFound => onFound(peripheral));
86
+ return peripheral;
87
+ };
88
+ return {
89
+ watchState: listener => {
90
+ if (!bluetooth) {
91
+ listener("unsupported");
92
+ return () => undefined;
93
+ }
94
+ let watching = true;
95
+ const changed = event => watching && listener(event.value ? "on" : "off");
96
+ bluetooth.addEventListener("availabilitychanged", changed);
97
+ bluetooth.getAvailability().then(available => watching && listener(available ? "on" : "off"), () => watching && listener("unknown"));
98
+ return () => {
99
+ watching = false;
100
+ bluetooth.removeEventListener("availabilitychanged", changed);
101
+ };
102
+ },
103
+ scan: (onFound, onError) => {
104
+ if (!bluetooth) {
105
+ onError(unsupported());
106
+ return () => undefined;
107
+ }
108
+ scans.add(onFound);
109
+ bluetooth.getDevices?.().then(allowed => allowed.forEach(device => void report(device)), error => onError((0, _bleErrors.fromBleError)(error)));
110
+ return () => {
111
+ scans.delete(onFound);
112
+ };
113
+ },
114
+ chooseDevice: async () => {
115
+ if (!bluetooth) {
116
+ throw unsupported();
117
+ }
118
+ try {
119
+ return await report(await bluetooth.requestDevice({
120
+ acceptAllDevices: true,
121
+ optionalServices
122
+ }));
123
+ } catch (error) {
124
+ if (error?.name === CHOOSER_CLOSED) {
125
+ return undefined;
126
+ }
127
+ throw (0, _bleErrors.fromBleError)(error);
128
+ }
129
+ }
130
+ };
131
+ };
132
+ exports.webBluetoothScanner = webBluetoothScanner;
133
+ //# sourceMappingURL=web-bluetooth-scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_bleErrors","require","_blePeripheral","_errors","_webBleDevice","_webBluetoothServices","_webBluetoothValues","ADVERTISEMENT_WAIT_MS","CHOOSER_CLOSED","navigatorBluetooth","globalThis","navigator","bluetooth","isWebBluetoothAvailable","undefined","exports","unsupported","BluetoothError","advertisementOf","device","watchAdvertisements","Promise","resolve","watching","AbortController","done","advertisement","clearTimeout","timer","removeEventListener","received","abort","event","uuids","manufacturerData","serviceUUIDs","map","canonicalUuid","manufacturerDataOf","setTimeout","addEventListener","signal","catch","webBluetoothScanner","acceptedDevices","optionalServices","webBluetoothServicesFor","scans","Set","devices","Map","peripheralOf","bleDevice","get","id","WebBleDevice","set","length","connect","then","connected","discoverAllServicesAndCharacteristics","blePeripheral","report","peripheral","forEach","onFound","watchState","listener","changed","value","getAvailability","available","scan","onError","add","getDevices","allowed","error","fromBleError","delete","chooseDevice","requestDevice","acceptAllDevices","name"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/web-bluetooth-scanner.ts"],"mappings":";;;;;;AAGA,IAAAA,UAAA,GAAAC,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CAAC,CAACjB,IAAI,CAC1BkB,OAAO,IAAKA,OAAO,CAACZ,OAAO,CAAE9C,MAAM,IAAK,KAAK4C,MAAM,CAAC5C,MAAM,CAAC,CAAC,EAC5D2D,KAAc,IAAKJ,OAAO,CAAC,IAAAK,uBAAY,EAACD,KAAK,CAAC,CACjD,CAAC;MAED,OAAO,MAAM;QACX/B,KAAK,CAACiC,MAAM,CAACd,OAAO,CAAC;MACvB,CAAC;IACH,CAAC;IACDe,YAAY,EAAE,MAAAA,CAAA,KAAY;MACxB,IAAI,CAACrE,SAAS,EAAE;QACd,MAAMI,WAAW,CAAC,CAAC;MACrB;MAEA,IAAI;QACF,OAAO,MAAM+C,MAAM,CAAC,MAAMnD,SAAS,CAACsE,aAAa,CAAC;UAAEC,gBAAgB,EAAE,IAAI;UAAEtC;QAAiB,CAAC,CAAC,CAAC;MAClG,CAAC,CAAC,OAAOiC,KAAK,EAAE;QACd,IAAKA,KAAK,EAAoCM,IAAI,KAAK5E,cAAc,EAAE;UACrE,OAAOM,SAAS;QAClB;QACA,MAAM,IAAAiE,uBAAY,EAACD,KAAK,CAAC;MAC3B;IACF;EACF,CAAC;AACH,CAAC;AAAC/D,OAAA,CAAA4B,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.webBluetoothServicesFor = exports.WEB_BLUETOOTH_SERVICES = void 0;
7
+ var _backgroundServiceUuids = require("../../../bt-management/services/background-sync/background-service-uuids.js");
8
+ var _integratedDevices = require("../../../bt-management/types/integrated-devices.js");
9
+ var _webBluetoothValues = require("./web-bluetooth-values.js");
10
+ /** Services read on every connection, whatever the device. */
11
+ const SHARED_SERVICES = ["1800", "180a", "180f", "1805", "1804"];
12
+
13
+ /** Bluetooth SIG profiles: glucose, thermometer, heart rate, blood pressure, weight scale, pulse oximeter. */
14
+ const SIG_SERVICES = ["1808", "1809", "180d", "1810", "181d", "1822"];
15
+
16
+ /** Services the integrated devices' protocols use beyond their background-scan services. */
17
+ const PROTOCOL_SERVICES = ["1000", "18f0", "7801", "7802", "7809", "7889", "7892", "a000", "a500", "a602", "a610", "ae30", "f018", "fe60", "fee0", "ff00", "ff12", "ffb0", "ffe0", "ffe5", "fff0", "ffff", "14839ac4-7d7e-415c-9a42-167340cf2339", "e8fb0001-a14b-98f9-831b-4e2941d01248", "00002760-08c2-11e1-9073-0e8ac72e5450", "6e400001-b5a3-f393-e0a9-e50e24dcca9e", "cdeacb80-5235-4c07-8846-93a37ee6b86d", "cdeacd80-5235-4c07-8846-93a37ee6b86d", "49535343-fe7d-4ae5-8fa9-9fafd205e455", "81eea003-e735-49ec-8a11-7e32cae1e14e", "5d4b8aa6-a26a-4a1b-99f5-cd4473c786e3", "2610fc00-494d-494c-4544-55544954414c", "233bf000-5a34-1b6d-975c-000d5690abe4", "23434100-1fe4-1eff-80cb-00ff78297d8b", "00001523-1212-efde-1523-785feabcd123", "0003cdd0-0000-1000-8000-00805f9b0131", "00010203-0405-0607-0809-0a0b0c0d1910", "fb349b5f-8000-0080-0010-0000f0180000"];
18
+
19
+ /**
20
+ * Every GATT service an integrated device uses, as a browser must be told when the user picks a device: a page can
21
+ * only reach the services it named in `navigator.bluetooth.requestDevice`'s `optionalServices`.
22
+ */
23
+ const WEB_BLUETOOTH_SERVICES = exports.WEB_BLUETOOTH_SERVICES = [...new Set([...SHARED_SERVICES, ...SIG_SERVICES, ...PROTOCOL_SERVICES, ...(0, _backgroundServiceUuids.getBackgroundServiceUUIDs)(Object.values(_integratedDevices.IntegratedDevices))].map(_webBluetoothValues.canonicalUuid))];
24
+
25
+ /** `WEB_BLUETOOTH_SERVICES` and the services of the `defineCustomDevice` declarations among `acceptedDevices`. */
26
+ const webBluetoothServicesFor = (acceptedDevices = []) => [...new Set([...WEB_BLUETOOTH_SERVICES, ...(0, _backgroundServiceUuids.getBackgroundServiceUUIDs)(acceptedDevices).map(_webBluetoothValues.canonicalUuid)])];
27
+ exports.webBluetoothServicesFor = webBluetoothServicesFor;
28
+ //# sourceMappingURL=web-bluetooth-services.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_backgroundServiceUuids","require","_integratedDevices","_webBluetoothValues","SHARED_SERVICES","SIG_SERVICES","PROTOCOL_SERVICES","WEB_BLUETOOTH_SERVICES","exports","Set","getBackgroundServiceUUIDs","Object","values","IntegratedDevices","map","canonicalUuid","webBluetoothServicesFor","acceptedDevices"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/web-bluetooth-services.ts"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,OAAA;AAEA,IAAAC,kBAAA,GAAAD,OAAA;AAEA,IAAAE,mBAAA,GAAAF,OAAA;AAEA;AACA,MAAMG,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;;AAEhE;AACA,MAAMC,YAAY,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;;AAErE;AACA,MAAMC,iBAAiB,GAAG,CACxB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAC9G,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAC9D,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,EACtC,sCAAsC,CACvC;;AAED;AACA;AACA;AACA;AACA,MAAMC,sBAAyC,GAAAC,OAAA,CAAAD,sBAAA,GAAG,CAChD,GAAG,IAAIE,GAAG,CACR,CACE,GAAGL,eAAe,EAClB,GAAGC,YAAY,EACf,GAAGC,iBAAiB,EACpB,GAAG,IAAAI,iDAAyB,EAACC,MAAM,CAACC,MAAM,CAACC,oCAAiB,CAAC,CAAC,CAC/D,CAACC,GAAG,CAACC,iCAAa,CACrB,CAAC,CACF;;AAED;AACA,MAAMC,uBAAuB,GAAGA,CAACC,eAA0C,GAAG,EAAE,KAAe,CAC7F,GAAG,IAAIR,GAAG,CAAC,CAAC,GAAGF,sBAAsB,EAAE,GAAG,IAAAG,iDAAyB,EAACO,eAAe,CAAC,CAACH,GAAG,CAACC,iCAAa,CAAC,CAAC,CAAC,CAC1G;AAACP,OAAA,CAAAQ,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.toBase64 = exports.manufacturerDataOf = exports.fromBase64 = exports.canonicalUuid = exports.bytesOf = void 0;
7
+ const BASE_UUID_SUFFIX = "-0000-1000-8000-00805f9b34fb";
8
+ const SHORT_UUID = /^[0-9a-f]{4}$/;
9
+ const MEDIUM_UUID = /^[0-9a-f]{8}$/;
10
+
11
+ /** A UUID as Web Bluetooth accepts it: lower case, with a 16- or 32-bit alias expanded on the Bluetooth base UUID. */
12
+ const canonicalUuid = uuid => {
13
+ const lower = uuid.trim().toLowerCase();
14
+ if (SHORT_UUID.test(lower)) {
15
+ return `0000${lower}${BASE_UUID_SUFFIX}`;
16
+ }
17
+ return MEDIUM_UUID.test(lower) ? `${lower}${BASE_UUID_SUFFIX}` : lower;
18
+ };
19
+ exports.canonicalUuid = canonicalUuid;
20
+ const bytesOf = view => new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
21
+ exports.bytesOf = bytesOf;
22
+ const toBase64 = bytes => btoa(Array.from(bytes, byte => String.fromCharCode(byte)).join(""));
23
+ exports.toBase64 = toBase64;
24
+ const fromBase64 = base64 => Uint8Array.from(atob(base64), char => char.charCodeAt(0));
25
+
26
+ /** Manufacturer data the way `react-native-ble-plx` reports it: the company ID, little endian, then the payload. */
27
+ exports.fromBase64 = fromBase64;
28
+ const manufacturerDataOf = data => {
29
+ const [entry] = data ?? [];
30
+ if (!entry) {
31
+ return null;
32
+ }
33
+ const [companyId, payload] = entry;
34
+ return toBase64(Uint8Array.from([companyId & 0xff, companyId >> 8, ...bytesOf(payload)]));
35
+ };
36
+ exports.manufacturerDataOf = manufacturerDataOf;
37
+ //# sourceMappingURL=web-bluetooth-values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BASE_UUID_SUFFIX","SHORT_UUID","MEDIUM_UUID","canonicalUuid","uuid","lower","trim","toLowerCase","test","exports","bytesOf","view","Uint8Array","buffer","byteOffset","byteLength","toBase64","bytes","btoa","Array","from","byte","String","fromCharCode","join","fromBase64","base64","atob","char","charCodeAt","manufacturerDataOf","data","entry","companyId","payload"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/web-bluetooth-values.ts"],"mappings":";;;;;;AAAA,MAAMA,gBAAgB,GAAG,8BAA8B;AACvD,MAAMC,UAAU,GAAG,eAAe;AAClC,MAAMC,WAAW,GAAG,eAAe;;AAEnC;AACA,MAAMC,aAAa,GAAIC,IAAY,IAAa;EAC9C,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC;EAEvC,IAAIN,UAAU,CAACO,IAAI,CAACH,KAAK,CAAC,EAAE;IAC1B,OAAO,OAAOA,KAAK,GAAGL,gBAAgB,EAAE;EAC1C;EAEA,OAAOE,WAAW,CAACM,IAAI,CAACH,KAAK,CAAC,GAAG,GAAGA,KAAK,GAAGL,gBAAgB,EAAE,GAAGK,KAAK;AACxE,CAAC;AAACI,OAAA,CAAAN,aAAA,GAAAA,aAAA;AAEF,MAAMO,OAAO,GAAIC,IAAc,IAAiB,IAAIC,UAAU,CAACD,IAAI,CAACE,MAAM,EAAEF,IAAI,CAACG,UAAU,EAAEH,IAAI,CAACI,UAAU,CAAC;AAACN,OAAA,CAAAC,OAAA,GAAAA,OAAA;AAE9G,MAAMM,QAAQ,GAAIC,KAAiB,IAAaC,IAAI,CAACC,KAAK,CAACC,IAAI,CAACH,KAAK,EAAGI,IAAI,IAAKC,MAAM,CAACC,YAAY,CAACF,IAAI,CAAC,CAAC,CAACG,IAAI,CAAC,EAAE,CAAC,CAAC;AAACf,OAAA,CAAAO,QAAA,GAAAA,QAAA;AAEtH,MAAMS,UAAU,GAAIC,MAAc,IAAiBd,UAAU,CAACQ,IAAI,CAACO,IAAI,CAACD,MAAM,CAAC,EAAGE,IAAI,IAAKA,IAAI,CAACC,UAAU,CAAC,CAAC,CAAC,CAAC;;AAE9G;AAAApB,OAAA,CAAAgB,UAAA,GAAAA,UAAA;AACA,MAAMK,kBAAkB,GAAIC,IAA+C,IAAoB;EAC7F,MAAM,CAACC,KAAK,CAAC,GAAGD,IAAI,IAAI,EAAE;EAE1B,IAAI,CAACC,KAAK,EAAE;IACV,OAAO,IAAI;EACb;EAEA,MAAM,CAACC,SAAS,EAAEC,OAAO,CAAC,GAAGF,KAAK;EAElC,OAAOhB,QAAQ,CAACJ,UAAU,CAACQ,IAAI,CAAC,CAACa,SAAS,GAAG,IAAI,EAAEA,SAAS,IAAI,CAAC,EAAE,GAAGvB,OAAO,CAACwB,OAAO,CAAC,CAAC,CAAC,CAAC;AAC3F,CAAC;AAACzB,OAAA,CAAAqB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=web-bluetooth.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/web-bluetooth.types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WebGatt = void 0;
7
+ var _webBleShapes = require("./web-ble-shapes.js");
8
+ var _webBluetoothValues = require("./web-bluetooth-values.js");
9
+ const messageOf = error => error instanceof Error ? error.message : String(error);
10
+
11
+ /**
12
+ * A device's GATT server as one queue: browsers allow one GATT operation at a time, so each runs after the previous one
13
+ * settles, and its services are discovered once per connection.
14
+ */
15
+ class WebGatt {
16
+ characteristics = new Map();
17
+ operations = Promise.resolve();
18
+ constructor(device) {
19
+ this.device = device;
20
+ }
21
+ get connected() {
22
+ return this.device.gatt?.connected ?? false;
23
+ }
24
+ server() {
25
+ if (!this.device.gatt) {
26
+ throw new _webBleShapes.WebBleError(_webBleShapes.UNKNOWN_ERROR, `Device ${this.device.id} is unsupported: it has no GATT server`);
27
+ }
28
+ return this.device.gatt;
29
+ }
30
+
31
+ /** Runs `operation` after the previous one settles; a failure comes back as a `react-native-ble-plx` error. */
32
+ queued(operation) {
33
+ const result = this.operations.then(operation, operation).catch(error => {
34
+ throw this.errorOf(error);
35
+ });
36
+ this.operations = result.catch(() => undefined);
37
+ return result;
38
+ }
39
+
40
+ /** The discovered services' UUIDs; call it inside a queued operation, so discovery never queues behind itself. */
41
+ async serviceUuids() {
42
+ await this.discover();
43
+ return [...this.characteristics.keys()];
44
+ }
45
+ async characteristicsOf(serviceUuid) {
46
+ await this.discover();
47
+ return [...(this.characteristics.get((0, _webBluetoothValues.canonicalUuid)(serviceUuid))?.values() ?? [])];
48
+ }
49
+ async characteristic(serviceUuid, characteristicUuid) {
50
+ await this.discover();
51
+ const characteristic = this.characteristics.get((0, _webBluetoothValues.canonicalUuid)(serviceUuid))?.get((0, _webBluetoothValues.canonicalUuid)(characteristicUuid));
52
+ if (!characteristic) {
53
+ throw new _webBleShapes.WebBleError(_webBleShapes.UNKNOWN_ERROR, `Characteristic ${characteristicUuid} of service ${serviceUuid} was not found on device ${this.device.id}`);
54
+ }
55
+ return characteristic;
56
+ }
57
+
58
+ /** Forgets the discovered services, as a new connection must discover them again. */
59
+ forget() {
60
+ this.discovered = undefined;
61
+ }
62
+ errorOf(error) {
63
+ if (error instanceof _webBleShapes.WebBleError) {
64
+ return error;
65
+ }
66
+ return new _webBleShapes.WebBleError(this.connected ? _webBleShapes.UNKNOWN_ERROR : _webBleShapes.DEVICE_DISCONNECTED, messageOf(error), error);
67
+ }
68
+ discover() {
69
+ this.discovered ??= (async () => {
70
+ this.characteristics.clear();
71
+ for (const service of await this.server().getPrimaryServices()) {
72
+ const characteristics = await service.getCharacteristics().catch(() => []);
73
+ this.characteristics.set((0, _webBluetoothValues.canonicalUuid)(service.uuid), new Map(characteristics.map(characteristic => [(0, _webBluetoothValues.canonicalUuid)(characteristic.uuid), characteristic])));
74
+ }
75
+ })().catch(error => {
76
+ this.discovered = undefined;
77
+ throw error;
78
+ });
79
+ return this.discovered;
80
+ }
81
+ }
82
+ exports.WebGatt = WebGatt;
83
+ //# sourceMappingURL=web-gatt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_webBleShapes","require","_webBluetoothValues","messageOf","error","Error","message","String","WebGatt","characteristics","Map","operations","Promise","resolve","constructor","device","connected","gatt","server","WebBleError","UNKNOWN_ERROR","id","queued","operation","result","then","catch","errorOf","undefined","serviceUuids","discover","keys","characteristicsOf","serviceUuid","get","canonicalUuid","values","characteristic","characteristicUuid","forget","discovered","DEVICE_DISCONNECTED","clear","service","getPrimaryServices","getCharacteristics","set","uuid","map","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/web-gatt.ts"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAGA,MAAME,SAAS,GAAIC,KAAc,IAAcA,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAACE,OAAO,GAAGC,MAAM,CAACH,KAAK,CAAE;;AAEtG;AACA;AACA;AACA;AACA,MAAMI,OAAO,C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C3B,IAAIrC,GAAG,CAACD,eAAe,CAACuC,GAAG,CAAEX,cAAc,IAAK,CAAC,IAAAF,iCAAa,EAACE,cAAc,CAACU,IAAI,CAAC,EAAEV,cAAc,CAAC,CAAC,CACvG,CAAC;MACH;IACF,CAAC,EAAE,CAAC,CAACX,KAAK,CAAEtB,KAAc,IAAK;MAC7B,IAAI,CAACoC,UAAU,GAAGZ,SAAS;MAC3B,MAAMxB,KAAK;IACb,CAAC,CAAC;IAEF,OAAO,IAAI,CAACoC,UAAU;EACxB;AACF;AAACS,OAAA,CAAAzC,OAAA,GAAAA,OAAA","ignoreList":[]}
@@ -8,4 +8,5 @@
8
8
  * @module next/background-sync
9
9
  */
10
10
  export * from "../../background-sync/index.js";
11
+ export * from "./offline-measurement-background-sync.js";
11
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["modules/next/background-sync/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gCAAuB","ignoreList":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["modules/next/background-sync/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gCAAuB;AACrC,cAAc,0CAAuC","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ import * as BackgroundTask from "expo-background-task";
4
+ import * as TaskManager from "expo-task-manager";
5
+ import { sentryLogger } from "../../helpers/utils/sentry-logger.js";
6
+ const OFFLINE_MEASUREMENT_BACKGROUND_TASK_NAME = "OvokOfflineMeasurementBackgroundSync";
7
+ const MINIMUM_INTERVAL_MINUTES = 15;
8
+
9
+ /** Core client surface used by the background queue flush. */
10
+
11
+ /** Options for recurring offline measurement sync. */
12
+
13
+ /** Flushes the Core offline measurement queue for a restored client. */
14
+ const runOfflineMeasurementBackgroundSync = client => client.measurements.offlineQueue.flush();
15
+
16
+ /**
17
+ * Defines the task at app entry-point load so it exists after process restart.
18
+ * The callback must restore the app-owned client and its secure session.
19
+ */
20
+ const registerOfflineMeasurementBackgroundTask = restoreClient => {
21
+ TaskManager.defineTask(OFFLINE_MEASUREMENT_BACKGROUND_TASK_NAME, async () => {
22
+ try {
23
+ const client = await restoreClient();
24
+ const result = await runOfflineMeasurementBackgroundSync(client);
25
+ if (Object.keys(result.failures).length > 0) {
26
+ throw new Error("Offline measurement queue contains failed items.");
27
+ }
28
+ return BackgroundTask.BackgroundTaskResult.Success;
29
+ } catch {
30
+ sentryLogger("error", "Background measurement sync failed", {
31
+ errorCode: "offline_measurement_background_sync_failed"
32
+ });
33
+ return BackgroundTask.BackgroundTaskResult.Failed;
34
+ }
35
+ });
36
+ };
37
+
38
+ /** Schedules recurring offline measurement sync through WorkManager or BGTaskScheduler. */
39
+ const scheduleOfflineMeasurementBackgroundSync = async (options = {}) => {
40
+ const minimumIntervalMinutes = options.minimumIntervalMinutes ?? MINIMUM_INTERVAL_MINUTES;
41
+ if (!Number.isFinite(minimumIntervalMinutes) || minimumIntervalMinutes < MINIMUM_INTERVAL_MINUTES) {
42
+ throw new RangeError(`minimumIntervalMinutes must be at least ${MINIMUM_INTERVAL_MINUTES}.`);
43
+ }
44
+ if (!TaskManager.isTaskDefined(OFFLINE_MEASUREMENT_BACKGROUND_TASK_NAME)) {
45
+ throw new Error("Register the offline measurement background task from the app entry point before scheduling it.");
46
+ }
47
+ await BackgroundTask.registerTaskAsync(OFFLINE_MEASUREMENT_BACKGROUND_TASK_NAME, {
48
+ minimumInterval: minimumIntervalMinutes
49
+ });
50
+ };
51
+
52
+ /** Cancels recurring offline measurement sync. */
53
+ const cancelOfflineMeasurementBackgroundSync = () => BackgroundTask.unregisterTaskAsync(OFFLINE_MEASUREMENT_BACKGROUND_TASK_NAME);
54
+ export { cancelOfflineMeasurementBackgroundSync, registerOfflineMeasurementBackgroundTask, runOfflineMeasurementBackgroundSync, scheduleOfflineMeasurementBackgroundSync };
55
+ //# sourceMappingURL=offline-measurement-background-sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BackgroundTask","TaskManager","sentryLogger","OFFLINE_MEASUREMENT_BACKGROUND_TASK_NAME","MINIMUM_INTERVAL_MINUTES","runOfflineMeasurementBackgroundSync","client","measurements","offlineQueue","flush","registerOfflineMeasurementBackgroundTask","restoreClient","defineTask","result","Object","keys","failures","length","Error","BackgroundTaskResult","Success","errorCode","Failed","scheduleOfflineMeasurementBackgroundSync","options","minimumIntervalMinutes","Number","isFinite","RangeError","isTaskDefined","registerTaskAsync","minimumInterval","cancelOfflineMeasurementBackgroundSync","unregisterTaskAsync"],"sourceRoot":"../../../../../src","sources":["modules/next/background-sync/offline-measurement-background-sync.ts"],"mappings":";;AAAA,OAAO,KAAKA,cAAc,MAAM,sBAAsB;AACtD,OAAO,KAAKC,WAAW,MAAM,mBAAmB;AAIhD,SAASC,YAAY,QAAQ,sCAAmC;AAEhE,MAAMC,wCAAwC,GAC5C,sCAAsC;AAExC,MAAMC,wBAAwB,GAAG,EAAE;;AAEnC;;AAMA;;AAOA;AACA,MAAMC,mCAAmC,GACvCC,MAA8C,IAC3CA,MAAM,CAACC,YAAY,CAACC,YAAY,CAACC,KAAK,CAAC,CAAC;;AAE7C;AACA;AACA;AACA;AACA,MAAMC,wCAAwC,GAC5CC,aAAoE,IAC3D;EACTV,WAAW,CAACW,UAAU,CACpBT,wCAAwC,EACxC,YAAY;IACV,IAAI;MACF,MAAMG,MAAM,GAAG,MAAMK,aAAa,CAAC,CAAC;MAEpC,MAAME,MAAM,GAAG,MAAMR,mCAAmC,CAACC,MAAM,CAAC;MAEhE,IAAIQ,MAAM,CAACC,IAAI,CAACF,MAAM,CAACG,QAAQ,CAAC,CAACC,MAAM,GAAG,CAAC,EAAE;QAC3C,MAAM,IAAIC,KAAK,CAAC,kDAAkD,CAAC;MACrE;MAEA,OAAOlB,cAAc,CAACmB,oBAAoB,CAACC,OAAO;IACpD,CAAC,CAAC,MAAM;MACNlB,YAAY,CAAC,OAAO,EAAE,oCAAoC,EAAE;QAC1DmB,SAAS,EAAE;MACb,CAAC,CAAC;MAEF,OAAOrB,cAAc,CAACmB,oBAAoB,CAACG,MAAM;IACnD;EACF,CACF,CAAC;AACH,CAAC;;AAED;AACA,MAAMC,wCAAwC,GAAG,MAAAA,CAC/CC,OAAgD,GAAG,CAAC,CAAC,KACnC;EAClB,MAAMC,sBAAsB,GAC1BD,OAAO,CAACC,sBAAsB,IAAIrB,wBAAwB;EAE5D,IACE,CAACsB,MAAM,CAACC,QAAQ,CAACF,sBAAsB,CAAC,IACxCA,sBAAsB,GAAGrB,wBAAwB,EACjD;IACA,MAAM,IAAIwB,UAAU,CAClB,2CAA2CxB,wBAAwB,GACrE,CAAC;EACH;EAEA,IAAI,CAACH,WAAW,CAAC4B,aAAa,CAAC1B,wCAAwC,CAAC,EAAE;IACxE,MAAM,IAAIe,KAAK,CACb,iGACF,CAAC;EACH;EAEA,MAAMlB,cAAc,CAAC8B,iBAAiB,CACpC3B,wCAAwC,EACxC;IAAE4B,eAAe,EAAEN;EAAuB,CAC5C,CAAC;AACH,CAAC;;AAED;AACA,MAAMO,sCAAsC,GAAGA,CAAA,KAC7ChC,cAAc,CAACiC,mBAAmB,CAChC9B,wCACF,CAAC;AAEH,SACE6B,sCAAsC,EACtCtB,wCAAwC,EACxCL,mCAAmC,EACnCkB,wCAAwC","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ import { openBleLink } from "./ble-link.js";
4
+ const bleDevices = new WeakMap();
5
+
6
+ /** The `react-native-ble-plx` device behind a peripheral that `blePeripheral` made. */
7
+ const bleDeviceOf = peripheral => {
8
+ const device = bleDevices.get(peripheral);
9
+ if (!device) {
10
+ throw new Error("The peripheral was not made by blePeripheral");
11
+ }
12
+ return device;
13
+ };
14
+
15
+ /** A `react-native-ble-plx` device, or a device with the same API such as a Web Bluetooth one, as a peripheral. */
16
+ const blePeripheral = device => {
17
+ const peripheral = {
18
+ id: device.id,
19
+ advertisement: {
20
+ name: device.name?.trim() || device.localName?.trim() || "",
21
+ serviceUUIDs: device.serviceUUIDs ?? [],
22
+ manufacturerData: device.manufacturerData ?? null
23
+ },
24
+ openLink: signal => openBleLink(device, signal)
25
+ };
26
+ bleDevices.set(peripheral, device);
27
+ return peripheral;
28
+ };
29
+ export { bleDeviceOf, blePeripheral };
30
+ //# sourceMappingURL=ble-peripheral.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["openBleLink","bleDevices","WeakMap","bleDeviceOf","peripheral","device","get","Error","blePeripheral","id","advertisement","name","trim","localName","serviceUUIDs","manufacturerData","openLink","signal","set"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/ble-peripheral.ts"],"mappings":";;AAIA,SAASA,WAAW,QAAQ,eAAY;AAExC,MAAMC,UAAU,GAAG,IAAIC,OAAO,CAAqB,CAAC;;AAEpD;AACA,MAAMC,WAAW,GAAIC,UAAsB,IAAa;EACtD,MAAMC,MAAM,GAAGJ,UAAU,CAACK,GAAG,CAACF,UAAU,CAAC;EAEzC,IAAI,CAACC,MAAM,EAAE;IACX,MAAM,IAAIE,KAAK,CAAC,8CAA8C,CAAC;EACjE;EAEA,OAAOF,MAAM;AACf,CAAC;;AAED;AACA,MAAMG,aAAa,GAAIH,MAAc,IAAiB;EACpD,MAAMD,UAAsB,GAAG;IAC7BK,EAAE,EAAEJ,MAAM,CAACI,EAAE;IACbC,aAAa,EAAE;MACbC,IAAI,EAAEN,MAAM,CAACM,IAAI,EAAEC,IAAI,CAAC,CAAC,IAAIP,MAAM,CAACQ,SAAS,EAAED,IAAI,CAAC,CAAC,IAAI,EAAE;MAC3DE,YAAY,EAAET,MAAM,CAACS,YAAY,IAAI,EAAE;MACvCC,gBAAgB,EAAEV,MAAM,CAACU,gBAAgB,IAAI;IAC/C,CAAC;IACDC,QAAQ,EAAGC,MAAM,IAAKjB,WAAW,CAACK,MAAM,EAAEY,MAAM;EAClD,CAAC;EAEDhB,UAAU,CAACiB,GAAG,CAACd,UAAU,EAAEC,MAAM,CAAC;EAElC,OAAOD,UAAU;AACnB,CAAC;AAED,SAASD,WAAW,EAAEK,aAAa","ignoreList":[]}
@@ -2,38 +2,13 @@
2
2
 
3
3
  import { ScanMode, State } from "react-native-ble-plx";
4
4
  import { fromBleError } from "./ble-errors.js";
5
- import { openBleLink } from "./ble-link.js";
5
+ import { blePeripheral } from "./ble-peripheral.js";
6
6
  const ADAPTER_STATES = {
7
7
  [State.PoweredOn]: "on",
8
8
  [State.PoweredOff]: "off",
9
9
  [State.Unauthorized]: "unauthorized",
10
10
  [State.Unsupported]: "unsupported"
11
11
  };
12
- const bleDevices = new WeakMap();
13
-
14
- /** The `react-native-ble-plx` device behind a peripheral this adapter reported. */
15
- const bleDeviceOf = peripheral => {
16
- const device = bleDevices.get(peripheral);
17
- if (!device) {
18
- throw new Error("The peripheral was not found by bleManagerScanner");
19
- }
20
- return device;
21
- };
22
-
23
- /** A `react-native-ble-plx` device as a peripheral. */
24
- const blePeripheral = device => {
25
- const peripheral = {
26
- id: device.id,
27
- advertisement: {
28
- name: device.name?.trim() || device.localName?.trim() || "",
29
- serviceUUIDs: device.serviceUUIDs ?? [],
30
- manufacturerData: device.manufacturerData ?? null
31
- },
32
- openLink: signal => openBleLink(device, signal)
33
- };
34
- bleDevices.set(peripheral, device);
35
- return peripheral;
36
- };
37
12
 
38
13
  /** A scanner over a `react-native-ble-plx` `BleManager`. */
39
14
  const bleManagerScanner = bleManager => ({
@@ -65,5 +40,5 @@ const bleManagerScanner = bleManager => ({
65
40
  };
66
41
  }
67
42
  });
68
- export { bleDeviceOf, bleManagerScanner, blePeripheral };
43
+ export { bleManagerScanner };
69
44
  //# sourceMappingURL=ble-scanner.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ScanMode","State","fromBleError","openBleLink","ADAPTER_STATES","PoweredOn","PoweredOff","Unauthorized","Unsupported","bleDevices","WeakMap","bleDeviceOf","peripheral","device","get","Error","blePeripheral","id","advertisement","name","trim","localName","serviceUUIDs","manufacturerData","openLink","signal","set","bleManagerScanner","bleManager","watchState","listener","subscription","onStateChange","state","remove","scan","onFound","onError","active","startDeviceScan","scanMode","Balanced","error","stopDeviceScan"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/ble-scanner.ts"],"mappings":";;AAAA,SAA6BA,QAAQ,EAAEC,KAAK,QAAQ,sBAAsB;AAI1E,SAASC,YAAY,QAAQ,iBAAc;AAC3C,SAASC,WAAW,QAAQ,eAAY;AAExC,MAAMC,cAAoD,GAAG;EAC3D,CAACH,KAAK,CAACI,SAAS,GAAG,IAAI;EACvB,CAACJ,KAAK,CAACK,UAAU,GAAG,KAAK;EACzB,CAACL,KAAK,CAACM,YAAY,GAAG,cAAc;EACpC,CAACN,KAAK,CAACO,WAAW,GAAG;AACvB,CAAC;AAED,MAAMC,UAAU,GAAG,IAAIC,OAAO,CAAqB,CAAC;;AAEpD;AACA,MAAMC,WAAW,GAAIC,UAAsB,IAAa;EACtD,MAAMC,MAAM,GAAGJ,UAAU,CAACK,GAAG,CAACF,UAAU,CAAC;EAEzC,IAAI,CAACC,MAAM,EAAE;IACX,MAAM,IAAIE,KAAK,CAAC,mDAAmD,CAAC;EACtE;EAEA,OAAOF,MAAM;AACf,CAAC;;AAED;AACA,MAAMG,aAAa,GAAIH,MAAc,IAAiB;EACpD,MAAMD,UAAsB,GAAG;IAC7BK,EAAE,EAAEJ,MAAM,CAACI,EAAE;IACbC,aAAa,EAAE;MACbC,IAAI,EAAEN,MAAM,CAACM,IAAI,EAAEC,IAAI,CAAC,CAAC,IAAIP,MAAM,CAACQ,SAAS,EAAED,IAAI,CAAC,CAAC,IAAI,EAAE;MAC3DE,YAAY,EAAET,MAAM,CAACS,YAAY,IAAI,EAAE;MACvCC,gBAAgB,EAAEV,MAAM,CAACU,gBAAgB,IAAI;IAC/C,CAAC;IACDC,QAAQ,EAAGC,MAAM,IAAKtB,WAAW,CAACU,MAAM,EAAEY,MAAM;EAClD,CAAC;EAEDhB,UAAU,CAACiB,GAAG,CAACd,UAAU,EAAEC,MAAM,CAAC;EAElC,OAAOD,UAAU;AACnB,CAAC;;AAED;AACA,MAAMe,iBAAiB,GAAIC,UAAsB,KAAwB;EACvEC,UAAU,EAAGC,QAAQ,IAAK;IACxB,MAAMC,YAAY,GAAGH,UAAU,CAACI,aAAa,CAAEC,KAAK,IAAKH,QAAQ,CAAC1B,cAAc,CAAC6B,KAAK,CAAC,IAAI,SAAS,CAAC,EAAE,IAAI,CAAC;IAE5G,OAAO,MAAMF,YAAY,CAACG,MAAM,CAAC,CAAC;EACpC,CAAC;EACDC,IAAI,EAAEA,CAACC,OAAO,EAAEC,OAAO,KAAK;IAC1B,IAAIC,MAAM,GAAG,IAAI;IAEjB,IAAI;MACFV,UAAU,CAACW,eAAe,CAAC,IAAI,EAAE;QAAEC,QAAQ,EAAExC,QAAQ,CAACyC;MAAS,CAAC,EAAE,CAACC,KAAK,EAAE7B,MAAM,KAAK;QACnF,IAAI,CAACyB,MAAM,EAAE;UACX;QACF;QACA,IAAII,KAAK,EAAE;UACTL,OAAO,CAACnC,YAAY,CAACwC,KAAK,CAAC,CAAC;QAC9B,CAAC,MAAM,IAAI7B,MAAM,EAAE;UACjBuB,OAAO,CAACpB,aAAa,CAACH,MAAM,CAAC,CAAC;QAChC;MACF,CAAC,CAAC;IACJ,CAAC,CAAC,OAAO6B,KAAK,EAAE;MACdL,OAAO,CAACnC,YAAY,CAACwC,KAAK,CAAC,CAAC;IAC9B;IAEA,OAAO,MAAM;MACXJ,MAAM,GAAG,KAAK;MACdV,UAAU,CAACe,cAAc,CAAC,CAAC;IAC7B,CAAC;EACH;AACF,CAAC,CAAC;AAEF,SAAShC,WAAW,EAAEgB,iBAAiB,EAAEX,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["ScanMode","State","fromBleError","blePeripheral","ADAPTER_STATES","PoweredOn","PoweredOff","Unauthorized","Unsupported","bleManagerScanner","bleManager","watchState","listener","subscription","onStateChange","state","remove","scan","onFound","onError","active","startDeviceScan","scanMode","Balanced","error","device","stopDeviceScan"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/ble-scanner.ts"],"mappings":";;AAAA,SAAqBA,QAAQ,EAAEC,KAAK,QAAQ,sBAAsB;AAIlE,SAASC,YAAY,QAAQ,iBAAc;AAC3C,SAASC,aAAa,QAAQ,qBAAkB;AAEhD,MAAMC,cAAoD,GAAG;EAC3D,CAACH,KAAK,CAACI,SAAS,GAAG,IAAI;EACvB,CAACJ,KAAK,CAACK,UAAU,GAAG,KAAK;EACzB,CAACL,KAAK,CAACM,YAAY,GAAG,cAAc;EACpC,CAACN,KAAK,CAACO,WAAW,GAAG;AACvB,CAAC;;AAED;AACA,MAAMC,iBAAiB,GAAIC,UAAsB,KAAwB;EACvEC,UAAU,EAAGC,QAAQ,IAAK;IACxB,MAAMC,YAAY,GAAGH,UAAU,CAACI,aAAa,CAAEC,KAAK,IAAKH,QAAQ,CAACR,cAAc,CAACW,KAAK,CAAC,IAAI,SAAS,CAAC,EAAE,IAAI,CAAC;IAE5G,OAAO,MAAMF,YAAY,CAACG,MAAM,CAAC,CAAC;EACpC,CAAC;EACDC,IAAI,EAAEA,CAACC,OAAO,EAAEC,OAAO,KAAK;IAC1B,IAAIC,MAAM,GAAG,IAAI;IAEjB,IAAI;MACFV,UAAU,CAACW,eAAe,CAAC,IAAI,EAAE;QAAEC,QAAQ,EAAEtB,QAAQ,CAACuB;MAAS,CAAC,EAAE,CAACC,KAAK,EAAEC,MAAM,KAAK;QACnF,IAAI,CAACL,MAAM,EAAE;UACX;QACF;QACA,IAAII,KAAK,EAAE;UACTL,OAAO,CAACjB,YAAY,CAACsB,KAAK,CAAC,CAAC;QAC9B,CAAC,MAAM,IAAIC,MAAM,EAAE;UACjBP,OAAO,CAACf,aAAa,CAACsB,MAAM,CAAC,CAAC;QAChC;MACF,CAAC,CAAC;IACJ,CAAC,CAAC,OAAOD,KAAK,EAAE;MACdL,OAAO,CAACjB,YAAY,CAACsB,KAAK,CAAC,CAAC;IAC9B;IAEA,OAAO,MAAM;MACXJ,MAAM,GAAG,KAAK;MACdV,UAAU,CAACgB,cAAc,CAAC,CAAC;IAC7B,CAAC;EACH;AACF,CAAC,CAAC;AAEF,SAASjB,iBAAiB","ignoreList":[]}
@@ -4,7 +4,7 @@ import { DeviceStatus } from "../../../bt-management/types/device-status.js";
4
4
  import { Channel } from "../channel.js";
5
5
  import { isTimestamped } from "../driver.js";
6
6
  import { fromBleError } from "./ble-errors.js";
7
- import { bleDeviceOf } from "./ble-scanner.js";
7
+ import { bleDeviceOf } from "./ble-peripheral.js";
8
8
  const STATUSES = {
9
9
  [DeviceStatus.CONNECTED]: "connected",
10
10
  [DeviceStatus.MEASURING]: "measuring",
@@ -1 +1 @@
1
- {"version":3,"names":["DeviceStatus","Channel","isTimestamped","fromBleError","bleDeviceOf","STATUSES","CONNECTED","MEASURING","DISCONNECTED","legacyDriver","creator","deviceName","peripheral","signal","stop","events","end","removeEventListener","managed","disconnect","createDevice","device","onResult","id","data","reading","push","kind","onDeviceStatusChanged","status","mapped","onError","error","addEventListener","once","connect","catch","fail"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/legacy-driver.ts"],"mappings":";;AAKA,SAASA,YAAY,QAAQ,+CAA4C;AACzE,SAASC,OAAO,QAAQ,eAAY;AACpC,SAA8BC,aAAa,QAAQ,cAAW;AAE9D,SAASC,YAAY,QAAQ,iBAAc;AAC3C,SAASC,WAAW,QAAQ,kBAAe;AAE3C,MAAMC,QAAmF,GAAG;EAC1F,CAACL,YAAY,CAACM,SAAS,GAAG,WAAW;EACrC,CAACN,YAAY,CAACO,SAAS,GAAG,WAAW;EACrC,CAACP,YAAY,CAACQ,YAAY,GAAG;AAC/B,CAAC;;AAED;AACA,MAAMC,YAAY,GAAGA,CAACC,OAAiD,EAAEC,UAAqB,KAC5F,CAACC,UAAU,EAAEC,MAAM,KAAK;EACtB,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ACtDhB,OAAO,CAACiB,OAAO,CAAC,CAAC,CAACC,KAAK,CAAEJ,KAAc,IAAKjB,MAAM,CAACsB,IAAI,CAAClC,YAAY,CAAC6B,KAAK,CAAC,CAAC,CAAC;EAE7E,OAAOjB,MAAM;AACf,CAAC;AAEH,SAASN,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["DeviceStatus","Channel","isTimestamped","fromBleError","bleDeviceOf","STATUSES","CONNECTED","MEASURING","DISCONNECTED","legacyDriver","creator","deviceName","peripheral","signal","stop","events","end","removeEventListener","managed","disconnect","createDevice","device","onResult","id","data","reading","push","kind","onDeviceStatusChanged","status","mapped","onError","error","addEventListener","once","connect","catch","fail"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/legacy-driver.ts"],"mappings":";;AAKA,SAASA,YAAY,QAAQ,+CAA4C;AACzE,SAASC,OAAO,QAAQ,eAAY;AACpC,SAA8BC,aAAa,QAAQ,cAAW;AAE9D,SAASC,YAAY,QAAQ,iBAAc;AAC3C,SAASC,WAAW,QAAQ,qBAAkB;AAE9C,MAAMC,QAAmF,GAAG;EAC1F,CAACL,YAAY,CAACM,SAAS,GAAG,WAAW;EACrC,CAACN,YAAY,CAACO,SAAS,GAAG,WAAW;EACrC,CAACP,YAAY,CAACQ,YAAY,GAAG;AAC/B,CAAC;;AAED;AACA,MAAMC,YAAY,GAAGA,CAACC,OAAiD,EAAEC,UAAqB,KAC5F,CAACC,UAAU,EAAEC,MAAM,KAAK;EACtB,MAAMC,IAAI,GAAGA,CAAA,KAAMC,MAAM,CAACC,GAAG,CAAC,CAAC;EAE/B,MAAMD,MAAM,GAAG,IAAId,OAAO,CAAc,MAAM;IAC5CY,MAAM,CAACI,mBAAmB,CAAC,OAAO,EAAEH,IAAI,CAAC;IACzC,KAAKI,OAAO,CAACC,UAAU,CAAC,CAAC;EAC3B,CAAC,CAAC;EAEF,MAAMD,OAAO,GAAGR,OAAO,CAACU,YAAY,CAAC;IACnCC,MAAM,EAAEj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