@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.
- package/lib/commonjs/modules/next/background-sync/index.js +11 -0
- package/lib/commonjs/modules/next/background-sync/index.js.map +1 -1
- package/lib/commonjs/modules/next/background-sync/offline-measurement-background-sync.js +63 -0
- package/lib/commonjs/modules/next/background-sync/offline-measurement-background-sync.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-peripheral.js +35 -0
- package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-peripheral.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-scanner.js +3 -30
- package/lib/commonjs/modules/next/bluetooth/ble-plx/ble-scanner.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js +2 -2
- package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/react-native/ovok-sink.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth-runtime.js +28 -0
- package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth-runtime.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/web/index.js +208 -0
- package/lib/commonjs/modules/next/bluetooth/web/index.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-ble-device.js +143 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-ble-device.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-ble-shapes.js +43 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-ble-shapes.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-permissions.js +21 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-permissions.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-scanner.js +133 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-scanner.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-services.js +28 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-services.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-values.js +37 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth-values.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth.types.js +2 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-bluetooth.types.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-gatt.js +83 -0
- package/lib/commonjs/modules/next/bluetooth/web/web-gatt.js.map +1 -0
- package/lib/module/modules/next/background-sync/index.js +1 -0
- package/lib/module/modules/next/background-sync/index.js.map +1 -1
- package/lib/module/modules/next/background-sync/offline-measurement-background-sync.js +55 -0
- package/lib/module/modules/next/background-sync/offline-measurement-background-sync.js.map +1 -0
- package/lib/module/modules/next/bluetooth/ble-plx/ble-peripheral.js +30 -0
- package/lib/module/modules/next/bluetooth/ble-plx/ble-peripheral.js.map +1 -0
- package/lib/module/modules/next/bluetooth/ble-plx/ble-scanner.js +2 -27
- package/lib/module/modules/next/bluetooth/ble-plx/ble-scanner.js.map +1 -1
- package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js +1 -1
- package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
- package/lib/module/modules/next/bluetooth/react-native/ovok-sink.js.map +1 -1
- package/lib/module/modules/next/bluetooth/web/create-web-bluetooth-runtime.js +25 -0
- package/lib/module/modules/next/bluetooth/web/create-web-bluetooth-runtime.js.map +1 -0
- package/lib/module/modules/next/bluetooth/web/index.js +28 -0
- package/lib/module/modules/next/bluetooth/web/index.js.map +1 -0
- package/lib/module/modules/next/bluetooth/web/web-ble-device.js +140 -0
- package/lib/module/modules/next/bluetooth/web/web-ble-device.js.map +1 -0
- package/lib/module/modules/next/bluetooth/web/web-ble-shapes.js +39 -0
- package/lib/module/modules/next/bluetooth/web/web-ble-shapes.js.map +1 -0
- package/lib/module/modules/next/bluetooth/web/web-bluetooth-permissions.js +18 -0
- package/lib/module/modules/next/bluetooth/web/web-bluetooth-permissions.js.map +1 -0
- package/lib/module/modules/next/bluetooth/web/web-bluetooth-scanner.js +128 -0
- package/lib/module/modules/next/bluetooth/web/web-bluetooth-scanner.js.map +1 -0
- package/lib/module/modules/next/bluetooth/web/web-bluetooth-services.js +25 -0
- package/lib/module/modules/next/bluetooth/web/web-bluetooth-services.js.map +1 -0
- package/lib/module/modules/next/bluetooth/web/web-bluetooth-values.js +29 -0
- package/lib/module/modules/next/bluetooth/web/web-bluetooth-values.js.map +1 -0
- package/lib/module/modules/next/bluetooth/web/web-bluetooth.types.js +2 -0
- package/lib/module/modules/next/bluetooth/web/web-bluetooth.types.js.map +1 -0
- package/lib/module/modules/next/bluetooth/web/web-gatt.js +79 -0
- package/lib/module/modules/next/bluetooth/web/web-gatt.js.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/background-sync/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/next/background-sync/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/background-sync/offline-measurement-background-sync.d.ts +22 -0
- package/lib/typescript/commonjs/src/modules/next/background-sync/offline-measurement-background-sync.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-link.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-link.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-peripheral.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-peripheral.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts +3 -7
- package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/ovok-sink.d.ts +2 -2
- package/lib/typescript/commonjs/src/modules/next/bluetooth/react-native/ovok-sink.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth-runtime.d.ts +23 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth-runtime.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts +41 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-ble-device.d.ts +53 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-ble-device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-ble-shapes.d.ts +27 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-ble-shapes.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-permissions.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-permissions.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-scanner.d.ts +29 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-scanner.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-services.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-services.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-values.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth-values.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth.types.d.ts +56 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-bluetooth.types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-gatt.d.ts +27 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/web-gatt.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/background-sync/index.d.ts +1 -0
- package/lib/typescript/module/src/modules/next/background-sync/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/background-sync/offline-measurement-background-sync.d.ts +22 -0
- package/lib/typescript/module/src/modules/next/background-sync/offline-measurement-background-sync.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-link.d.ts +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-link.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-peripheral.d.ts +8 -0
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-peripheral.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts +3 -7
- package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/ble-scanner.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/react-native/ovok-sink.d.ts +2 -2
- package/lib/typescript/module/src/modules/next/bluetooth/react-native/ovok-sink.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth-runtime.d.ts +23 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth-runtime.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts +41 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-ble-device.d.ts +53 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-ble-device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-ble-shapes.d.ts +27 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-ble-shapes.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-permissions.d.ts +8 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-permissions.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-scanner.d.ts +29 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-scanner.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-services.d.ts +10 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-services.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-values.d.ts +9 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth-values.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth.types.d.ts +56 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-bluetooth.types.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-gatt.d.ts +27 -0
- package/lib/typescript/module/src/modules/next/bluetooth/web/web-gatt.d.ts.map +1 -0
- package/package.json +11 -1
|
@@ -14,4 +14,15 @@ Object.keys(_index).forEach(function (key) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
+
var _offlineMeasurementBackgroundSync = require("./offline-measurement-background-sync.js");
|
|
18
|
+
Object.keys(_offlineMeasurementBackgroundSync).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _offlineMeasurementBackgroundSync[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _offlineMeasurementBackgroundSync[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
17
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_index","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sourceRoot":"../../../../../src","sources":["modules/next/background-sync/index.ts"],"mappings":";;;;;AAOA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_index","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_offlineMeasurementBackgroundSync"],"sourceRoot":"../../../../../src","sources":["modules/next/background-sync/index.ts"],"mappings":";;;;;AAOA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,iCAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,iCAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,iCAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,iCAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.scheduleOfflineMeasurementBackgroundSync = exports.runOfflineMeasurementBackgroundSync = exports.registerOfflineMeasurementBackgroundTask = exports.cancelOfflineMeasurementBackgroundSync = void 0;
|
|
7
|
+
var BackgroundTask = _interopRequireWildcard(require("expo-background-task"));
|
|
8
|
+
var TaskManager = _interopRequireWildcard(require("expo-task-manager"));
|
|
9
|
+
var _sentryLogger = require("../../helpers/utils/sentry-logger.js");
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
const OFFLINE_MEASUREMENT_BACKGROUND_TASK_NAME = "OvokOfflineMeasurementBackgroundSync";
|
|
12
|
+
const MINIMUM_INTERVAL_MINUTES = 15;
|
|
13
|
+
|
|
14
|
+
/** Core client surface used by the background queue flush. */
|
|
15
|
+
|
|
16
|
+
/** Options for recurring offline measurement sync. */
|
|
17
|
+
|
|
18
|
+
/** Flushes the Core offline measurement queue for a restored client. */
|
|
19
|
+
const runOfflineMeasurementBackgroundSync = client => client.measurements.offlineQueue.flush();
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Defines the task at app entry-point load so it exists after process restart.
|
|
23
|
+
* The callback must restore the app-owned client and its secure session.
|
|
24
|
+
*/
|
|
25
|
+
exports.runOfflineMeasurementBackgroundSync = runOfflineMeasurementBackgroundSync;
|
|
26
|
+
const registerOfflineMeasurementBackgroundTask = restoreClient => {
|
|
27
|
+
TaskManager.defineTask(OFFLINE_MEASUREMENT_BACKGROUND_TASK_NAME, async () => {
|
|
28
|
+
try {
|
|
29
|
+
const client = await restoreClient();
|
|
30
|
+
const result = await runOfflineMeasurementBackgroundSync(client);
|
|
31
|
+
if (Object.keys(result.failures).length > 0) {
|
|
32
|
+
throw new Error("Offline measurement queue contains failed items.");
|
|
33
|
+
}
|
|
34
|
+
return BackgroundTask.BackgroundTaskResult.Success;
|
|
35
|
+
} catch {
|
|
36
|
+
(0, _sentryLogger.sentryLogger)("error", "Background measurement sync failed", {
|
|
37
|
+
errorCode: "offline_measurement_background_sync_failed"
|
|
38
|
+
});
|
|
39
|
+
return BackgroundTask.BackgroundTaskResult.Failed;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** Schedules recurring offline measurement sync through WorkManager or BGTaskScheduler. */
|
|
45
|
+
exports.registerOfflineMeasurementBackgroundTask = registerOfflineMeasurementBackgroundTask;
|
|
46
|
+
const scheduleOfflineMeasurementBackgroundSync = async (options = {}) => {
|
|
47
|
+
const minimumIntervalMinutes = options.minimumIntervalMinutes ?? MINIMUM_INTERVAL_MINUTES;
|
|
48
|
+
if (!Number.isFinite(minimumIntervalMinutes) || minimumIntervalMinutes < MINIMUM_INTERVAL_MINUTES) {
|
|
49
|
+
throw new RangeError(`minimumIntervalMinutes must be at least ${MINIMUM_INTERVAL_MINUTES}.`);
|
|
50
|
+
}
|
|
51
|
+
if (!TaskManager.isTaskDefined(OFFLINE_MEASUREMENT_BACKGROUND_TASK_NAME)) {
|
|
52
|
+
throw new Error("Register the offline measurement background task from the app entry point before scheduling it.");
|
|
53
|
+
}
|
|
54
|
+
await BackgroundTask.registerTaskAsync(OFFLINE_MEASUREMENT_BACKGROUND_TASK_NAME, {
|
|
55
|
+
minimumInterval: minimumIntervalMinutes
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/** Cancels recurring offline measurement sync. */
|
|
60
|
+
exports.scheduleOfflineMeasurementBackgroundSync = scheduleOfflineMeasurementBackgroundSync;
|
|
61
|
+
const cancelOfflineMeasurementBackgroundSync = () => BackgroundTask.unregisterTaskAsync(OFFLINE_MEASUREMENT_BACKGROUND_TASK_NAME);
|
|
62
|
+
exports.cancelOfflineMeasurementBackgroundSync = cancelOfflineMeasurementBackgroundSync;
|
|
63
|
+
//# sourceMappingURL=offline-measurement-background-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BackgroundTask","_interopRequireWildcard","require","TaskManager","_sentryLogger","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","OFFLINE_MEASUREMENT_BACKGROUND_TASK_NAME","MINIMUM_INTERVAL_MINUTES","runOfflineMeasurementBackgroundSync","client","measurements","offlineQueue","flush","exports","registerOfflineMeasurementBackgroundTask","restoreClient","defineTask","result","keys","failures","length","Error","BackgroundTaskResult","Success","sentryLogger","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":"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","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.blePeripheral = exports.bleDeviceOf = void 0;
|
|
7
|
+
var _bleLink = require("./ble-link.js");
|
|
8
|
+
const bleDevices = new WeakMap();
|
|
9
|
+
|
|
10
|
+
/** The `react-native-ble-plx` device behind a peripheral that `blePeripheral` made. */
|
|
11
|
+
const bleDeviceOf = peripheral => {
|
|
12
|
+
const device = bleDevices.get(peripheral);
|
|
13
|
+
if (!device) {
|
|
14
|
+
throw new Error("The peripheral was not made by blePeripheral");
|
|
15
|
+
}
|
|
16
|
+
return device;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** A `react-native-ble-plx` device, or a device with the same API such as a Web Bluetooth one, as a peripheral. */
|
|
20
|
+
exports.bleDeviceOf = bleDeviceOf;
|
|
21
|
+
const blePeripheral = device => {
|
|
22
|
+
const peripheral = {
|
|
23
|
+
id: device.id,
|
|
24
|
+
advertisement: {
|
|
25
|
+
name: device.name?.trim() || device.localName?.trim() || "",
|
|
26
|
+
serviceUUIDs: device.serviceUUIDs ?? [],
|
|
27
|
+
manufacturerData: device.manufacturerData ?? null
|
|
28
|
+
},
|
|
29
|
+
openLink: signal => (0, _bleLink.openBleLink)(device, signal)
|
|
30
|
+
};
|
|
31
|
+
bleDevices.set(peripheral, device);
|
|
32
|
+
return peripheral;
|
|
33
|
+
};
|
|
34
|
+
exports.blePeripheral = blePeripheral;
|
|
35
|
+
//# sourceMappingURL=ble-peripheral.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_bleLink","require","bleDevices","WeakMap","bleDeviceOf","peripheral","device","get","Error","exports","blePeripheral","id","advertisement","name","trim","localName","serviceUUIDs","manufacturerData","openLink","signal","openBleLink","set"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/ble-peripheral.ts"],"mappings":";;;;;;AAIA,IAAAA,QAAA,GAAAC,OAAA;AAEA,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;AAAAG,OAAA,CAAAL,WAAA,GAAAA,WAAA;AACA,MAAMM,aAAa,GAAIJ,MAAc,IAAiB;EACpD,MAAMD,UAAsB,GAAG;IAC7BM,EAAE,EAAEL,MAAM,CAACK,EAAE;IACbC,aAAa,EAAE;MACbC,IAAI,EAAEP,MAAM,CAACO,IAAI,EAAEC,IAAI,CAAC,CAAC,IAAIR,MAAM,CAACS,SAAS,EAAED,IAAI,CAAC,CAAC,IAAI,EAAE;MAC3DE,YAAY,EAAEV,MAAM,CAACU,YAAY,IAAI,EAAE;MACvCC,gBAAgB,EAAEX,MAAM,CAACW,gBAAgB,IAAI;IAC/C,CAAC;IACDC,QAAQ,EAAGC,MAAM,IAAK,IAAAC,oBAAW,EAACd,MAAM,EAAEa,MAAM;EAClD,CAAC;EAEDjB,UAAU,CAACmB,GAAG,CAAChB,UAAU,EAAEC,MAAM,CAAC;EAElC,OAAOD,UAAU;AACnB,CAAC;AAACI,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -3,45 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.bleManagerScanner = void 0;
|
|
7
7
|
var _reactNativeBlePlx = require("react-native-ble-plx");
|
|
8
8
|
var _bleErrors = require("./ble-errors.js");
|
|
9
|
-
var
|
|
9
|
+
var _blePeripheral = require("./ble-peripheral.js");
|
|
10
10
|
const ADAPTER_STATES = {
|
|
11
11
|
[_reactNativeBlePlx.State.PoweredOn]: "on",
|
|
12
12
|
[_reactNativeBlePlx.State.PoweredOff]: "off",
|
|
13
13
|
[_reactNativeBlePlx.State.Unauthorized]: "unauthorized",
|
|
14
14
|
[_reactNativeBlePlx.State.Unsupported]: "unsupported"
|
|
15
15
|
};
|
|
16
|
-
const bleDevices = new WeakMap();
|
|
17
|
-
|
|
18
|
-
/** The `react-native-ble-plx` device behind a peripheral this adapter reported. */
|
|
19
|
-
const bleDeviceOf = peripheral => {
|
|
20
|
-
const device = bleDevices.get(peripheral);
|
|
21
|
-
if (!device) {
|
|
22
|
-
throw new Error("The peripheral was not found by bleManagerScanner");
|
|
23
|
-
}
|
|
24
|
-
return device;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/** A `react-native-ble-plx` device as a peripheral. */
|
|
28
|
-
exports.bleDeviceOf = bleDeviceOf;
|
|
29
|
-
const blePeripheral = device => {
|
|
30
|
-
const peripheral = {
|
|
31
|
-
id: device.id,
|
|
32
|
-
advertisement: {
|
|
33
|
-
name: device.name?.trim() || device.localName?.trim() || "",
|
|
34
|
-
serviceUUIDs: device.serviceUUIDs ?? [],
|
|
35
|
-
manufacturerData: device.manufacturerData ?? null
|
|
36
|
-
},
|
|
37
|
-
openLink: signal => (0, _bleLink.openBleLink)(device, signal)
|
|
38
|
-
};
|
|
39
|
-
bleDevices.set(peripheral, device);
|
|
40
|
-
return peripheral;
|
|
41
|
-
};
|
|
42
16
|
|
|
43
17
|
/** A scanner over a `react-native-ble-plx` `BleManager`. */
|
|
44
|
-
exports.blePeripheral = blePeripheral;
|
|
45
18
|
const bleManagerScanner = bleManager => ({
|
|
46
19
|
watchState: listener => {
|
|
47
20
|
const subscription = bleManager.onStateChange(state => listener(ADAPTER_STATES[state] ?? "unknown"), true);
|
|
@@ -59,7 +32,7 @@ const bleManagerScanner = bleManager => ({
|
|
|
59
32
|
if (error) {
|
|
60
33
|
onError((0, _bleErrors.fromBleError)(error));
|
|
61
34
|
} else if (device) {
|
|
62
|
-
onFound(blePeripheral(device));
|
|
35
|
+
onFound((0, _blePeripheral.blePeripheral)(device));
|
|
63
36
|
}
|
|
64
37
|
});
|
|
65
38
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeBlePlx","require","_bleErrors","
|
|
1
|
+
{"version":3,"names":["_reactNativeBlePlx","require","_bleErrors","_blePeripheral","ADAPTER_STATES","State","PoweredOn","PoweredOff","Unauthorized","Unsupported","bleManagerScanner","bleManager","watchState","listener","subscription","onStateChange","state","remove","scan","onFound","onError","active","startDeviceScan","scanMode","ScanMode","Balanced","error","device","fromBleError","blePeripheral","stopDeviceScan","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/ble-scanner.ts"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAIA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEA,MAAMG,cAAoD,GAAG;EAC3D,CAACC,wBAAK,CAACC,SAAS,GAAG,IAAI;EACvB,CAACD,wBAAK,CAACE,UAAU,GAAG,KAAK;EACzB,CAACF,wBAAK,CAACG,YAAY,GAAG,cAAc;EACpC,CAACH,wBAAK,CAACI,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,CAACT,cAAc,CAACY,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,EAAEC,2BAAQ,CAACC;MAAS,CAAC,EAAE,CAACC,KAAK,EAAEC,MAAM,KAAK;QACnF,IAAI,CAACN,MAAM,EAAE;UACX;QACF;QACA,IAAIK,KAAK,EAAE;UACTN,OAAO,CAAC,IAAAQ,uBAAY,EAACF,KAAK,CAAC,CAAC;QAC9B,CAAC,MAAM,IAAIC,MAAM,EAAE;UACjBR,OAAO,CAAC,IAAAU,4BAAa,EAACF,MAAM,CAAC,CAAC;QAChC;MACF,CAAC,CAAC;IACJ,CAAC,CAAC,OAAOD,KAAK,EAAE;MACdN,OAAO,CAAC,IAAAQ,uBAAY,EAACF,KAAK,CAAC,CAAC;IAC9B;IAEA,OAAO,MAAM;MACXL,MAAM,GAAG,KAAK;MACdV,UAAU,CAACmB,cAAc,CAAC,CAAC;IAC7B,CAAC;EACH;AACF,CAAC,CAAC;AAACC,OAAA,CAAArB,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -8,7 +8,7 @@ var _deviceStatus = require("../../../bt-management/types/device-status.js");
|
|
|
8
8
|
var _channel = require("../channel.js");
|
|
9
9
|
var _driver = require("../driver.js");
|
|
10
10
|
var _bleErrors = require("./ble-errors.js");
|
|
11
|
-
var
|
|
11
|
+
var _blePeripheral = require("./ble-peripheral.js");
|
|
12
12
|
const STATUSES = {
|
|
13
13
|
[_deviceStatus.DeviceStatus.CONNECTED]: "connected",
|
|
14
14
|
[_deviceStatus.DeviceStatus.MEASURING]: "measuring",
|
|
@@ -23,7 +23,7 @@ const legacyDriver = (creator, deviceName) => (peripheral, signal) => {
|
|
|
23
23
|
void managed.disconnect();
|
|
24
24
|
});
|
|
25
25
|
const managed = creator.createDevice({
|
|
26
|
-
device: (0,
|
|
26
|
+
device: (0, _blePeripheral.bleDeviceOf)(peripheral),
|
|
27
27
|
deviceName,
|
|
28
28
|
onResult: ({
|
|
29
29
|
id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_deviceStatus","require","_channel","_driver","_bleErrors","
|
|
1
|
+
{"version":3,"names":["_deviceStatus","require","_channel","_driver","_bleErrors","_blePeripheral","STATUSES","DeviceStatus","CONNECTED","MEASURING","DISCONNECTED","legacyDriver","creator","deviceName","peripheral","signal","stop","events","end","Channel","removeEventListener","managed","disconnect","createDevice","device","bleDeviceOf","onResult","id","data","reading","push","kind","isTimestamped","onDeviceStatusChanged","status","mapped","onError","error","fromBleError","addEventListener","once","connect","catch","fail","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/ble-plx/legacy-driver.ts"],"mappings":";;;;;;AAKA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AAEA,MAAMK,QAAmF,GAAG;EAC1F,CAACC,0BAAY,CAACC,SAAS,GAAG,WAAW;EACrC,CAACD,0BAAY,CAACE,SAAS,GAAG,WAAW;EACrC,CAACF,0BAAY,CAACG,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,IAAIE,gBAAO,CAAc,MAAM;IAC5CJ,MAAM,CAACK,mBAAmB,CAAC,OAAO,EAAEJ,IAAI,CAAC;IACzC,KAAKK,OAAO,CAACC,UAAU,CAAC,CAAC;EAC3B,CAAC,CAAC;EAEF,MAAMD,OAAO,GAAGT,OAAO,CAACW,YAAY,CAAC;IACnCC,MAAM,EAAE,IAAAC,0BAAW,EAACX,UAAU,CAAC;IAC/BD,UAAU;IACVa,QAAQ,EAAEA,CAAC;MAAEC,EAAE;MAAEC;IAAK,CAAC,KAAK;MAC1B,MAAMC,OAAO,GAAGD,IAAmB;MAEnCX,MAAM,CAACa,IAAI,CAAC;QAAEC,IAAI,EAAE,SAAS;QAAEJ,EAAE,EAAE,IAAAK,qBAAa,EAACH,OAAO,CAAC,GAAGF,EAAE,GAAG,IAAI;QAAEE;MAAQ,CAAC,CAAC;IACnF,CAAC;IACDI,qBAAqB,EAAEA,CAAC;MAAEC;IAAO,CAAC,KAAK;MACrC,MAAMC,MAAM,GAAG7B,QAAQ,CAAC4B,MAAM,CAAC;MAE/B,IAAIC,MAAM,EAAE;QACVlB,MAAM,CAACa,IAAI,CAAC;UAAEC,IAAI,EAAE,QAAQ;UAAEG,MAAM,EAAEC;QAAO,CAAC,CAAC;MACjD;MACA,IAAID,MAAM,KAAK3B,0BAAY,CAACG,YAAY,EAAE;QACxCO,MAAM,CAACC,GAAG,CAAC,CAAC;MACd;IACF,CAAC;IACDkB,OAAO,EAAEA,CAAC;MAAEC;IAAM,CAAC,KAAKpB,MAAM,CAACa,IAAI,CAAC;MAAEC,IAAI,EAAE,OAAO;MAAEM,KAAK,EAAE,IAAAC,uBAAY,EAACD,KAAK;IAAE,CAAC;EACnF,CAAC,CAAC;EAEFtB,MAAM,CAACwB,gBAAgB,CAAC,OAAO,EAAEvB,IAAI,EAAE;IAAEwB,IAAI,EAAE;EAAK,CAAC,CAAC;EACtDnB,OAAO,CAACoB,OAAO,CAAC,CAAC,CAACC,KAAK,CAAEL,KAAc,IAAKpB,MAAM,CAAC0B,IAAI,CAAC,IAAAL,uBAAY,EAACD,KAAK,CAAC,CAAC,CAAC;EAE7E,OAAOpB,MAAM;AACf,CAAC;AAAC2B,OAAA,CAAAjC,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["recordedAtOf","measurement","recordedAt","Date","Number","isNaN","getTime","undefined","ovokReadingSink","client","save","id","device","result","measurements","sourceId","effectiveDateTime","name","key","localName","manufacturerData","manufacturerName","information","model","sn","serialNumber","status","flushQueued","Object","keys","offlineQueue","flush","responses","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/react-native/ovok-sink.ts"],"mappings":";;;;;;AAIA;AACA,MAAMA,YAAY,GAAIC,WAAmB,IAAuB;EAC9D,MAAM;IAAEC;EAAW,CAAC,GAAGD,WAAuC;EAE9D,OAAOC,UAAU,YAAYC,IAAI,IAAI,CAACC,MAAM,CAACC,KAAK,CAACH,UAAU,CAACI,OAAO,CAAC,CAAC,CAAC,GAAGJ,UAAU,GAAGK,SAAS;AACnG,CAAC;;AAED;AACA,MAAMC,eAAe,GAAIC,
|
|
1
|
+
{"version":3,"names":["recordedAtOf","measurement","recordedAt","Date","Number","isNaN","getTime","undefined","ovokReadingSink","client","save","id","device","result","measurements","sourceId","effectiveDateTime","name","key","localName","manufacturerData","manufacturerName","information","model","sn","serialNumber","status","flushQueued","Object","keys","offlineQueue","flush","responses","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/react-native/ovok-sink.ts"],"mappings":";;;;;;AAIA;AACA,MAAMA,YAAY,GAAIC,WAAmB,IAAuB;EAC9D,MAAM;IAAEC;EAAW,CAAC,GAAGD,WAAuC;EAE9D,OAAOC,UAAU,YAAYC,IAAI,IAAI,CAACC,MAAM,CAACC,KAAK,CAACH,UAAU,CAACI,OAAO,CAAC,CAAC,CAAC,GAAGJ,UAAU,GAAGK,SAAS;AACnG,CAAC;;AAED;AACA,MAAMC,eAAe,GAAIC,MAAkC,KAAmB;EAC5EC,IAAI,EAAE,MAAAA,CAAO;IAAEC,EAAE;IAAEC,MAAM;IAAEX;EAAY,CAAC,KAAK;IAC3C,MAAMY,MAAM,GAAG,MAAMJ,MAAM,CAACK,YAAY,CAACJ,IAAI,CAAC;MAC5CT,WAAW;MACXc,QAAQ,EAAEJ,EAAE;MACZK,iBAAiB,EAAEhB,YAAY,CAACC,WAAW,CAAC;MAC5CW,MAAM,EAAE;QACND,EAAE,EAAEC,MAAM,CAACD,EAAE;QACbM,IAAI,EAAEL,MAAM,CAACM,GAAG;QAChBC,SAAS,EAAEP,MAAM,CAACK,IAAI;QACtBG,gBAAgB,EAAE,EAAE;QACpBC,gBAAgB,EAAET,MAAM,CAACU,WAAW,EAAED,gBAAgB;QACtDE,KAAK,EAAEX,MAAM,CAACU,WAAW,EAAEC,KAAK;QAChCC,EAAE,EAAEZ,MAAM,CAACU,WAAW,EAAEG,YAAY,IAAI;MAC1C;IACF,CAAC,CAAC;IAEF,OAAOZ,MAAM,CAACa,MAAM,KAAK,OAAO,GAAG;MAAEA,MAAM,EAAE;IAAQ,CAAC,GAAGb,MAAM;EACjE,CAAC;EACDc,WAAW,EAAE,MAAAA,CAAA,KAAYC,MAAM,CAACC,IAAI,CAAC,CAAC,MAAMpB,MAAM,CAACK,YAAY,CAACgB,YAAY,CAACC,KAAK,CAAC,CAAC,EAAEC,SAAS;AACjG,CAAC,CAAC;AAACC,OAAA,CAAAzB,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createWebBluetoothRuntime = void 0;
|
|
7
|
+
var _ovokSink = require("../react-native/ovok-sink.js");
|
|
8
|
+
var _runtime = require("../runtime.js");
|
|
9
|
+
var _webBluetoothPermissions = require("./web-bluetooth-permissions.js");
|
|
10
|
+
/** What `createWebBluetoothRuntime` needs. */
|
|
11
|
+
|
|
12
|
+
/** A `BluetoothRuntime` wired for browsers: Web Bluetooth through `scanner`, saving through `client`. */
|
|
13
|
+
const createWebBluetoothRuntime = ({
|
|
14
|
+
client,
|
|
15
|
+
scanner,
|
|
16
|
+
devices,
|
|
17
|
+
resultPolicy,
|
|
18
|
+
pairedStorage
|
|
19
|
+
}) => new _runtime.BluetoothRuntime({
|
|
20
|
+
scanner,
|
|
21
|
+
permissions: (0, _webBluetoothPermissions.webBluetoothPermissions)(),
|
|
22
|
+
sink: (0, _ovokSink.ovokReadingSink)(client),
|
|
23
|
+
devices,
|
|
24
|
+
resultPolicy,
|
|
25
|
+
pairedStorage
|
|
26
|
+
});
|
|
27
|
+
exports.createWebBluetoothRuntime = createWebBluetoothRuntime;
|
|
28
|
+
//# sourceMappingURL=create-web-bluetooth-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ovokSink","require","_runtime","_webBluetoothPermissions","createWebBluetoothRuntime","client","scanner","devices","resultPolicy","pairedStorage","BluetoothRuntime","permissions","webBluetoothPermissions","sink","ovokReadingSink","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/create-web-bluetooth-runtime.ts"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,wBAAA,GAAAF,OAAA;AAGA;;AAmBA;AACA,MAAMG,yBAAyB,GAAGA,CAAC;EACjCC,MAAM;EACNC,OAAO;EACPC,OAAO;EACPC,YAAY;EACZC;AACgC,CAAC,KACjC,IAAIC,yBAAgB,CAAC;EACnBJ,OAAO;EACPK,WAAW,EAAE,IAAAC,gDAAuB,EAAC,CAAC;EACtCC,IAAI,EAAE,IAAAC,yBAAe,EAACT,MAAM,CAAC;EAC7BE,OAAO;EACPC,YAAY;EACZC;AACF,CAAC,CAAC;AAACM,OAAA,CAAAX,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "BluetoothError", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _errors.BluetoothError;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "BluetoothProvider", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _context.BluetoothProvider;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "BluetoothRuntime", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _runtime.BluetoothRuntime;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "Devices", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _supportedDevices.Devices;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "IntegratedDevices", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _integratedDevices.IntegratedDevices;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "SIG_PROTOCOLS", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _sigProfiles.SIG_PROTOCOLS;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "SUPPORTED_DEVICES", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _supportedDevices.SUPPORTED_DEVICES;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "WEB_BLUETOOTH_SERVICES", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _webBluetoothServices.WEB_BLUETOOTH_SERVICES;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "acceptedMemorySlots", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _resultPolicy.acceptedMemorySlots;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "builtInDevices", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _builtInDevices.builtInDevices;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "createWebBluetoothRuntime", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _createWebBluetoothRuntime.createWebBluetoothRuntime;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "dailyTotalsOnly", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _resultPolicy.dailyTotalsOnly;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "defineDevice", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return _devices.defineDevice;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "everyReading", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _resultPolicy.everyReading;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "firstReadingPerKind", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _resultPolicy.firstReadingPerKind;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "isWebBluetoothAvailable", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () {
|
|
99
|
+
return _webBluetoothScanner.isWebBluetoothAvailable;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, "keepReadings", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () {
|
|
105
|
+
return _resultPolicy.keepReadings;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "ovokReadingSink", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return _ovokSink.ovokReadingSink;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "policyByKind", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function () {
|
|
117
|
+
return _resultPolicy.policyByKind;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "resultPoliciesFor", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () {
|
|
123
|
+
return _deviceQuery.resultPoliciesFor;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "useBluetooth", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function () {
|
|
129
|
+
return _context.useBluetooth;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "useBluetoothPermission", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function () {
|
|
135
|
+
return _hooks.useBluetoothPermission;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "useBluetoothState", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function () {
|
|
141
|
+
return _hooks.useBluetoothState;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(exports, "useMeasurements", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function () {
|
|
147
|
+
return _hooks.useMeasurements;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "useNearbyDevice", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () {
|
|
153
|
+
return _hooks.useNearbyDevice;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "useNearbyDevices", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () {
|
|
159
|
+
return _hooks.useNearbyDevices;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "usePairedDevices", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function () {
|
|
165
|
+
return _hooks.usePairedDevices;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(exports, "useScanning", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function () {
|
|
171
|
+
return _hooks.useScanning;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "webBluetoothPermissions", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function () {
|
|
177
|
+
return _webBluetoothPermissions.webBluetoothPermissions;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
Object.defineProperty(exports, "webBluetoothScanner", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: function () {
|
|
183
|
+
return _webBluetoothScanner.webBluetoothScanner;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
Object.defineProperty(exports, "webBluetoothServicesFor", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function () {
|
|
189
|
+
return _webBluetoothServices.webBluetoothServicesFor;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
var _createWebBluetoothRuntime = require("./create-web-bluetooth-runtime.js");
|
|
193
|
+
var _webBluetoothScanner = require("./web-bluetooth-scanner.js");
|
|
194
|
+
var _webBluetoothPermissions = require("./web-bluetooth-permissions.js");
|
|
195
|
+
var _webBluetoothServices = require("./web-bluetooth-services.js");
|
|
196
|
+
var _runtime = require("../runtime.js");
|
|
197
|
+
var _errors = require("../errors.js");
|
|
198
|
+
var _devices = require("../devices.js");
|
|
199
|
+
var _resultPolicy = require("../result-policy.js");
|
|
200
|
+
var _sigProfiles = require("../sig-profiles.js");
|
|
201
|
+
var _builtInDevices = require("../ble-plx/built-in-devices.js");
|
|
202
|
+
var _integratedDevices = require("../../../bt-management/types/integrated-devices.js");
|
|
203
|
+
var _supportedDevices = require("../../../bt-device/constants/supported-devices.js");
|
|
204
|
+
var _deviceQuery = require("../../../bt-device/utils/device-query.js");
|
|
205
|
+
var _ovokSink = require("../react-native/ovok-sink.js");
|
|
206
|
+
var _context = require("../react/context.js");
|
|
207
|
+
var _hooks = require("../react/hooks.js");
|
|
208
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_createWebBluetoothRuntime","require","_webBluetoothScanner","_webBluetoothPermissions","_webBluetoothServices","_runtime","_errors","_devices","_resultPolicy","_sigProfiles","_builtInDevices","_integratedDevices","_supportedDevices","_deviceQuery","_ovokSink","_context","_hooks"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/web/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAAA,0BAAA,GAAAC,OAAA;AAEA,IAAAC,oBAAA,GAAAD,OAAA;AAEA,IAAAE,wBAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AAMA,IAAAM,QAAA,GAAAN,OAAA;AAIA,IAAAO,aAAA,GAAAP,OAAA;AASA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAT,OAAA;AACA,IAAAU,kBAAA,GAAAV,OAAA;AAEA,IAAAW,iBAAA,GAAAX,OAAA;AAEA,IAAAY,YAAA,GAAAZ,OAAA;AACA,IAAAa,SAAA,GAAAb,OAAA;AACA,IAAAc,QAAA,GAAAd,OAAA;AAEA,IAAAe,MAAA,GAAAf,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WebBleDevice = void 0;
|
|
7
|
+
var _webBleShapes = require("./web-ble-shapes.js");
|
|
8
|
+
var _webBluetoothValues = require("./web-bluetooth-values.js");
|
|
9
|
+
var _webGatt = require("./web-gatt.js");
|
|
10
|
+
/** The ATT default; browsers negotiate a larger MTU themselves and expose no way to ask for one. */
|
|
11
|
+
const DEFAULT_MTU = 23;
|
|
12
|
+
const VALUE_CHANGED = "characteristicvaluechanged";
|
|
13
|
+
const DISCONNECTED = "gattserverdisconnected";
|
|
14
|
+
|
|
15
|
+
/** Advertising data a browser saw for the device, when it let the page watch advertisements. */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A Web Bluetooth device behind the part of the `react-native-ble-plx` `Device` API the SDK's device classes use, so
|
|
19
|
+
* every integrated device and `defineCustomDevice` declaration runs unchanged in a browser. Operations queue (see
|
|
20
|
+
* `WebGatt`), so a write also waits for notifications still being started.
|
|
21
|
+
*/
|
|
22
|
+
class WebBleDevice {
|
|
23
|
+
mtu = DEFAULT_MTU;
|
|
24
|
+
rssi = null;
|
|
25
|
+
monitors = new Set();
|
|
26
|
+
disconnectListeners = new Set();
|
|
27
|
+
constructor(device, advertisement) {
|
|
28
|
+
this.id = device.id;
|
|
29
|
+
this.name = device.name?.trim() || null;
|
|
30
|
+
this.localName = this.name;
|
|
31
|
+
this.manufacturerData = advertisement?.manufacturerData ?? null;
|
|
32
|
+
this.serviceUUIDs = advertisement?.serviceUUIDs ?? null;
|
|
33
|
+
this.gatt = new _webGatt.WebGatt(device);
|
|
34
|
+
device.addEventListener(DISCONNECTED, this.onDisconnect);
|
|
35
|
+
}
|
|
36
|
+
async connect() {
|
|
37
|
+
await this.gatt.server().connect();
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
async isConnected() {
|
|
41
|
+
return this.gatt.connected;
|
|
42
|
+
}
|
|
43
|
+
async cancelConnection() {
|
|
44
|
+
if (this.gatt.connected) {
|
|
45
|
+
this.gatt.server().disconnect();
|
|
46
|
+
}
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
async requestMTU() {
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Discovers the services, and reports them as advertised when the browser showed none. */
|
|
54
|
+
async discoverAllServicesAndCharacteristics() {
|
|
55
|
+
const uuids = await this.gatt.queued(() => {
|
|
56
|
+
this.gatt.forget();
|
|
57
|
+
return this.gatt.serviceUuids();
|
|
58
|
+
});
|
|
59
|
+
if (!this.serviceUUIDs?.length) {
|
|
60
|
+
this.serviceUUIDs = uuids;
|
|
61
|
+
}
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
services() {
|
|
65
|
+
return this.gatt.queued(async () => (await this.gatt.serviceUuids()).map(uuid => ({
|
|
66
|
+
uuid,
|
|
67
|
+
deviceID: this.id,
|
|
68
|
+
isPrimary: true
|
|
69
|
+
})));
|
|
70
|
+
}
|
|
71
|
+
characteristicsForService(serviceUuid) {
|
|
72
|
+
return this.gatt.queued(async () => (await this.gatt.characteristicsOf(serviceUuid)).map(characteristic => (0, _webBleShapes.toBleCharacteristic)(this.id, (0, _webBluetoothValues.canonicalUuid)(serviceUuid), characteristic, null)));
|
|
73
|
+
}
|
|
74
|
+
readCharacteristicForService(serviceUuid, characteristicUuid) {
|
|
75
|
+
return this.gatt.queued(async () => {
|
|
76
|
+
const characteristic = await this.gatt.characteristic(serviceUuid, characteristicUuid);
|
|
77
|
+
const value = await characteristic.readValue();
|
|
78
|
+
return (0, _webBleShapes.toBleCharacteristic)(this.id, (0, _webBluetoothValues.canonicalUuid)(serviceUuid), characteristic, (0, _webBluetoothValues.toBase64)((0, _webBluetoothValues.bytesOf)(value)));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
writeCharacteristicWithResponseForService(serviceUuid, characteristicUuid, base64) {
|
|
82
|
+
return this.write(serviceUuid, characteristicUuid, base64, true);
|
|
83
|
+
}
|
|
84
|
+
writeCharacteristicWithoutResponseForService(serviceUuid, characteristicUuid, base64) {
|
|
85
|
+
return this.write(serviceUuid, characteristicUuid, base64, false);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Starts notifications in the GATT queue; `listener` gets each value, then `DeviceDisconnected` if the link drops. */
|
|
89
|
+
monitorCharacteristicForService(serviceUuid, characteristicUuid, listener) {
|
|
90
|
+
let characteristic;
|
|
91
|
+
let active = true;
|
|
92
|
+
const onValue = event => {
|
|
93
|
+
const value = event.target?.value;
|
|
94
|
+
if (active && characteristic && value) {
|
|
95
|
+
const base64 = (0, _webBluetoothValues.toBase64)((0, _webBluetoothValues.bytesOf)(value));
|
|
96
|
+
listener(null, (0, _webBleShapes.toBleCharacteristic)(this.id, (0, _webBluetoothValues.canonicalUuid)(serviceUuid), characteristic, base64));
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const stop = () => {
|
|
100
|
+
const started = characteristic;
|
|
101
|
+
started?.removeEventListener(VALUE_CHANGED, onValue);
|
|
102
|
+
void this.gatt.queued(async () => started?.stopNotifications()).catch(() => undefined);
|
|
103
|
+
};
|
|
104
|
+
this.monitors.add(listener);
|
|
105
|
+
this.gatt.queued(async () => {
|
|
106
|
+
characteristic = await this.gatt.characteristic(serviceUuid, characteristicUuid);
|
|
107
|
+
characteristic.addEventListener(VALUE_CHANGED, onValue);
|
|
108
|
+
await characteristic.startNotifications();
|
|
109
|
+
}).then(() => !active && stop(), error => active && listener(this.gatt.errorOf(error), null));
|
|
110
|
+
return {
|
|
111
|
+
remove: () => {
|
|
112
|
+
if (active) {
|
|
113
|
+
active = false;
|
|
114
|
+
this.monitors.delete(listener);
|
|
115
|
+
stop();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
onDisconnected(listener) {
|
|
121
|
+
this.disconnectListeners.add(listener);
|
|
122
|
+
return {
|
|
123
|
+
remove: () => this.disconnectListeners.delete(listener)
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
onDisconnect = () => {
|
|
127
|
+
const error = new _webBleShapes.WebBleError(_webBleShapes.DEVICE_DISCONNECTED, `Device ${this.id} was disconnected`);
|
|
128
|
+
[...this.monitors].forEach(listener => listener(error, null));
|
|
129
|
+
this.monitors.clear();
|
|
130
|
+
this.gatt.forget();
|
|
131
|
+
[...this.disconnectListeners].forEach(listener => listener(null, this));
|
|
132
|
+
};
|
|
133
|
+
write(serviceUuid, characteristicUuid, base64, withResponse) {
|
|
134
|
+
return this.gatt.queued(async () => {
|
|
135
|
+
const characteristic = await this.gatt.characteristic(serviceUuid, characteristicUuid);
|
|
136
|
+
const writeValue = withResponse ? characteristic.writeValueWithResponse : characteristic.writeValueWithoutResponse;
|
|
137
|
+
await (writeValue ?? characteristic.writeValue).call(characteristic, (0, _webBluetoothValues.fromBase64)(base64));
|
|
138
|
+
return (0, _webBleShapes.toBleCharacteristic)(this.id, (0, _webBluetoothValues.canonicalUuid)(serviceUuid), characteristic, base64);
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.WebBleDevice = WebBleDevice;
|
|
143
|
+
//# sourceMappingURL=web-ble-device.js.map
|