@tempivo/sensor-beacon 0.3.3 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +159 -9
- package/android/build.gradle +2 -2
- package/android/src/main/AndroidManifest.xml +2 -1
- package/android/src/main/java/expo/modules/tempivosensorbeacon/SensorBeaconNative.java +18 -5
- package/android/src/main/java/expo/modules/tempivosensorbeacon/TempivoSensorBeaconModule.kt +11 -2
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/BleConnectCredentials.kt +25 -0
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/SdkMeasurementFormat.kt +111 -0
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/SensorBleRuntime.kt +39 -87
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/SensorBleVendor.kt +28 -0
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/SensorModelHint.kt +20 -0
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/SensorSdkScanTelemetry.kt +112 -0
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorBeaconDecoder.kt +54 -1
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorBeaconScanner.kt +160 -74
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorBeaconTypes.kt +2 -0
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorQr.kt +27 -9
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorSession.kt +20 -16
- package/dist/connect-helpers.d.ts +52 -0
- package/dist/connect-helpers.js +153 -0
- package/dist/decoder.d.ts +1 -2
- package/dist/decoder.js +7 -18
- package/dist/index.d.ts +7 -3
- package/dist/index.js +5 -3
- package/dist/model.d.ts +5 -0
- package/dist/model.js +25 -0
- package/dist/native-helpers.js +5 -2
- package/dist/native-module.js +7 -3
- package/dist/native-types.d.ts +2 -0
- package/dist/profile.d.ts +8 -1
- package/dist/profile.js +42 -19
- package/dist/qr.d.ts +3 -2
- package/dist/qr.js +8 -6
- package/dist/react-native.d.ts +28 -1
- package/dist/react-native.js +24 -1
- package/dist/session-types.d.ts +6 -3
- package/dist/tempivo-sensor-beacon.aar +0 -0
- package/ios/Frameworks/TempivoSensorBridge.xcframework/ios-arm64/TempivoSensorBridge.framework/Headers/TempivoSensorBridge.h +28 -1
- package/ios/Frameworks/TempivoSensorBridge.xcframework/ios-arm64/TempivoSensorBridge.framework/TempivoSensorBridge +0 -0
- package/ios/Frameworks/TempivoSensorBridge.xcframework/ios-arm64-simulator/TempivoSensorBridge.framework/Headers/TempivoSensorBridge.h +28 -1
- package/ios/Frameworks/TempivoSensorBridge.xcframework/ios-arm64-simulator/TempivoSensorBridge.framework/TempivoSensorBridge +0 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorBeaconDecoder.swift +8 -1
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorBeaconScanner.swift +10 -1
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorModelHint.swift +29 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorProfile.swift +37 -13
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorQr.swift +48 -8
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorSession.swift +24 -10
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorSessionTypes.swift +1 -4
- package/ios/TempivoSensorBeaconModule.swift +214 -24
- package/package.json +3 -2
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { sensorModelFromFirmware } from './model.js';
|
|
2
|
+
import { DEFAULT_SENSOR_MODEL, normalizeSensorSerial, parseSensorQrJson } from './qr.js';
|
|
3
|
+
/** PIN / reset code from sticker JSON (`pin` or `resetCode`, string or number). */
|
|
4
|
+
export function pinFromSensorQrRecord(rec) {
|
|
5
|
+
const raw = rec.pin ?? rec.resetCode;
|
|
6
|
+
if (typeof raw === 'string') {
|
|
7
|
+
const t = raw.trim();
|
|
8
|
+
return t.length > 0 ? t : undefined;
|
|
9
|
+
}
|
|
10
|
+
if (typeof raw === 'number' && Number.isFinite(raw)) {
|
|
11
|
+
return String(Math.trunc(raw));
|
|
12
|
+
}
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
function serialFromQrRecord(rec) {
|
|
16
|
+
if (typeof rec.sn === 'string')
|
|
17
|
+
return rec.sn;
|
|
18
|
+
if (typeof rec.sn === 'number' && Number.isFinite(rec.sn))
|
|
19
|
+
return String(Math.trunc(rec.sn));
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
/** Parse sticker QR JSON without throwing (invalid → null). */
|
|
23
|
+
export function tryParseSensorQrJson(text) {
|
|
24
|
+
try {
|
|
25
|
+
const o = JSON.parse(text.trim());
|
|
26
|
+
if (o === null || typeof o !== 'object' || Array.isArray(o))
|
|
27
|
+
return null;
|
|
28
|
+
const rec = o;
|
|
29
|
+
return {
|
|
30
|
+
sn: serialFromQrRecord(rec),
|
|
31
|
+
pin: pinFromSensorQrRecord(rec),
|
|
32
|
+
model: typeof rec.model === 'string' ? rec.model : undefined,
|
|
33
|
+
iccid: typeof rec.iccid === 'string' ? rec.iccid : undefined,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Serial from QR scan payload (structured or raw JSON). 12 hex chars or null. */
|
|
41
|
+
export function serialHexFromSensorQrScan(data) {
|
|
42
|
+
if (data == null)
|
|
43
|
+
return null;
|
|
44
|
+
let sn;
|
|
45
|
+
if (typeof data === 'string') {
|
|
46
|
+
sn = tryParseSensorQrJson(data)?.sn;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
sn = data.sn?.trim() || (typeof data.raw === 'string' ? tryParseSensorQrJson(data.raw)?.sn : undefined);
|
|
50
|
+
}
|
|
51
|
+
if (!sn)
|
|
52
|
+
return null;
|
|
53
|
+
const hex = normalizeSensorSerial(sn);
|
|
54
|
+
return hex.length === 12 ? hex : null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* True when QR serial is missing/incomplete, or matches selected BLE serial.
|
|
58
|
+
* False when both are 12-hex and differ (wrong sticker for selected device).
|
|
59
|
+
*/
|
|
60
|
+
export function sensorQrSerialMatchesSelected(qrSerialHex, selectedSerial) {
|
|
61
|
+
const qr = normalizeSensorSerial(qrSerialHex ?? '');
|
|
62
|
+
const sel = normalizeSensorSerial(selectedSerial ?? '');
|
|
63
|
+
if (qr.length !== 12 || sel.length !== 12)
|
|
64
|
+
return true;
|
|
65
|
+
return qr === sel;
|
|
66
|
+
}
|
|
67
|
+
/** Normalize sticker `model` to HC5/HC7, or null if missing/unknown. */
|
|
68
|
+
export function normalizeSensorStickerModel(model) {
|
|
69
|
+
if (model == null || model.trim() === '')
|
|
70
|
+
return null;
|
|
71
|
+
const m = model.trim().toUpperCase().replace(/-/g, '');
|
|
72
|
+
if (m === 'HC5')
|
|
73
|
+
return 'HC5';
|
|
74
|
+
if (m === 'HC7')
|
|
75
|
+
return 'HC7';
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Map label PIN to native connect credentials (resetCode + encryptionKey for 5–6 digit codes).
|
|
80
|
+
* Same rules as Tempivo app `resolveEfentoBleConnectCredentialsFromPin`.
|
|
81
|
+
*/
|
|
82
|
+
export function resolveSensorBleConnectCredentialsFromPin(pinOrCode) {
|
|
83
|
+
const pin = pinOrCode?.trim() ?? '';
|
|
84
|
+
if (!pin)
|
|
85
|
+
return {};
|
|
86
|
+
if (!/^\d+$/.test(pin)) {
|
|
87
|
+
return { encryptionKey: pin };
|
|
88
|
+
}
|
|
89
|
+
const parsed = Number.parseInt(pin, 10);
|
|
90
|
+
if (Number.isNaN(parsed) || parsed < 0) {
|
|
91
|
+
return { encryptionKey: pin };
|
|
92
|
+
}
|
|
93
|
+
const cred = { resetCode: parsed };
|
|
94
|
+
if (pin.length > 4 || pin.startsWith('0')) {
|
|
95
|
+
cred.encryptionKey = pin;
|
|
96
|
+
}
|
|
97
|
+
return cred;
|
|
98
|
+
}
|
|
99
|
+
export function buildSensorQrConnectJson(parts) {
|
|
100
|
+
const body = {
|
|
101
|
+
sn: parts.serial,
|
|
102
|
+
pin: parts.pin,
|
|
103
|
+
model: parts.model ?? DEFAULT_SENSOR_MODEL,
|
|
104
|
+
};
|
|
105
|
+
if (parts.deviceId?.trim())
|
|
106
|
+
body.deviceId = parts.deviceId.trim();
|
|
107
|
+
return JSON.stringify(body);
|
|
108
|
+
}
|
|
109
|
+
/** Build connect JSON from a parsed QR (strict) or loose scan result. */
|
|
110
|
+
export function sensorQrConnectJsonFromLoose(loose, deviceId) {
|
|
111
|
+
if (!loose.sn?.trim() || !loose.pin?.trim())
|
|
112
|
+
return null;
|
|
113
|
+
return buildSensorQrConnectJson({
|
|
114
|
+
serial: loose.sn.trim(),
|
|
115
|
+
pin: loose.pin.trim(),
|
|
116
|
+
model: loose.model,
|
|
117
|
+
deviceId,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/** Draft QR JSON from a scan row (uses device model / FW hint, keeps existing PIN if provided). */
|
|
121
|
+
export function draftSensorQrConnectJsonFromScanDevice(device, pin = '111111') {
|
|
122
|
+
const serial = device.serialNumber?.trim();
|
|
123
|
+
if (!serial)
|
|
124
|
+
return null;
|
|
125
|
+
const fw = device.telemetry?.firmware ?? null;
|
|
126
|
+
const model = normalizeSensorStickerModel(device.model ?? undefined) ??
|
|
127
|
+
sensorModelFromFirmware(fw);
|
|
128
|
+
return buildSensorQrConnectJson({
|
|
129
|
+
serial,
|
|
130
|
+
pin,
|
|
131
|
+
model,
|
|
132
|
+
deviceId: device.deviceId,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/** Merge scan `deviceId` / MAC from a selected row into a parsed QR for connect. */
|
|
136
|
+
export function mergeScanTargetIntoSensorQr(qr, device) {
|
|
137
|
+
if (!device)
|
|
138
|
+
return qr;
|
|
139
|
+
const mac = device.bluetoothMacAddress?.includes(':') ? device.bluetoothMacAddress : qr.bluetoothMac;
|
|
140
|
+
return {
|
|
141
|
+
...qr,
|
|
142
|
+
deviceId: device.deviceId || qr.deviceId,
|
|
143
|
+
bluetoothMac: mac ?? qr.bluetoothMac,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
/** Parse QR text and attach scan target (deviceId, MAC) when a row is selected. */
|
|
147
|
+
export function parseSensorQrForConnect(qrText, selectedDevice) {
|
|
148
|
+
const qr = parseSensorQrJson(qrText);
|
|
149
|
+
return mergeScanTargetIntoSensorQr(qr, selectedDevice);
|
|
150
|
+
}
|
|
151
|
+
export function formatSensorReadingLine(reading) {
|
|
152
|
+
return `${reading.typeHex}: ${reading.text}`;
|
|
153
|
+
}
|
package/dist/decoder.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { SensorBeaconReading } from './types.js';
|
|
|
2
2
|
export declare const TEMPVO_SENSOR_MANUFACTURER_ID = 620;
|
|
3
3
|
/** FW6 `0x03` advertisement frame length (bytes after company id). */
|
|
4
4
|
export declare const ADV_FRAME_03_LEN = 22;
|
|
5
|
+
export declare function measurementTypeLabel(mtype: number): string;
|
|
5
6
|
export declare function decodeMeasurementSlot(mtype: number, raw24: number): string;
|
|
6
7
|
export declare function serialKeyFromAdv03Frame(frame: Uint8Array): string | null;
|
|
7
8
|
export declare function macKeyFromAddress(macWithColons: string): string;
|
|
@@ -11,5 +12,3 @@ export declare function splitSensorBeaconFrames(payload: Uint8Array): Uint8Array
|
|
|
11
12
|
export declare function buildSensorBeaconReading(adv03: Uint8Array | null | undefined, adv04: Uint8Array | null | undefined, rawHex?: string): SensorBeaconReading | null;
|
|
12
13
|
/** One-shot decode of manufacturer payload (after company id strip). */
|
|
13
14
|
export declare function decodeSensorBeaconPayload(data: Uint8Array): SensorBeaconReading | null;
|
|
14
|
-
/** FW 7+ → modern (`false`); FW 6-/5.x → legacy (`true`). */
|
|
15
|
-
export declare function legacyHintFromFirmware(firmware: string | null | undefined): boolean | null;
|
package/dist/decoder.js
CHANGED
|
@@ -44,6 +44,12 @@ function unitForType(mtype) {
|
|
|
44
44
|
return '';
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
export function measurementTypeLabel(mtype) {
|
|
48
|
+
const spec = MEASURE_SPECS.get(mtype);
|
|
49
|
+
if (spec)
|
|
50
|
+
return spec.name.toLowerCase();
|
|
51
|
+
return `type_${mtype.toString(16).padStart(2, '0')}`;
|
|
52
|
+
}
|
|
47
53
|
export function decodeMeasurementSlot(mtype, raw24) {
|
|
48
54
|
const spec = MEASURE_SPECS.get(mtype);
|
|
49
55
|
if (!spec) {
|
|
@@ -200,7 +206,7 @@ function parseScan04(frame) {
|
|
|
200
206
|
summaryParts.push(text);
|
|
201
207
|
measurements.push({
|
|
202
208
|
typeId: mtype,
|
|
203
|
-
typeHex:
|
|
209
|
+
typeHex: measurementTypeLabel(mtype),
|
|
204
210
|
raw24: raw24 & 0xffffff,
|
|
205
211
|
text,
|
|
206
212
|
...parsedValuesFromSlot(mtype, raw24),
|
|
@@ -306,20 +312,3 @@ export function decodeSensorBeaconPayload(data) {
|
|
|
306
312
|
const merged03 = adv03 ?? adv02;
|
|
307
313
|
return buildSensorBeaconReading(merged03, adv04, bufferToHex(data));
|
|
308
314
|
}
|
|
309
|
-
/** FW 7+ → modern (`false`); FW 6-/5.x → legacy (`true`). */
|
|
310
|
-
export function legacyHintFromFirmware(firmware) {
|
|
311
|
-
if (!firmware?.trim())
|
|
312
|
-
return null;
|
|
313
|
-
const t = firmware.trim();
|
|
314
|
-
if (/^FW 5/i.test(t))
|
|
315
|
-
return true;
|
|
316
|
-
const m = /^(\d+)\.\d+/.exec(t);
|
|
317
|
-
if (!m)
|
|
318
|
-
return null;
|
|
319
|
-
const major = parseInt(m[1], 10);
|
|
320
|
-
if (major >= 7)
|
|
321
|
-
return false;
|
|
322
|
-
if (major >= 1)
|
|
323
|
-
return true;
|
|
324
|
-
return null;
|
|
325
|
-
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
export { ADV_FRAME_03_LEN, TEMPVO_SENSOR_MANUFACTURER_ID, buildSensorBeaconReading, decodeMeasurementSlot, decodeSensorBeaconPayload, lookupDeviceKeys, macKeyFromAddress, serialKeyFromAdv03Frame, splitSensorBeaconFrames, } from './decoder.js';
|
|
1
|
+
export { ADV_FRAME_03_LEN, TEMPVO_SENSOR_MANUFACTURER_ID, buildSensorBeaconReading, decodeMeasurementSlot, decodeSensorBeaconPayload, lookupDeviceKeys, macKeyFromAddress, measurementTypeLabel, serialKeyFromAdv03Frame, splitSensorBeaconFrames, } from './decoder.js';
|
|
2
2
|
export { ingestManufacturerPayload } from './ingest.js';
|
|
3
3
|
export { dataViewToUint8Array, manufacturerPayloadsFromScanRecordBytes, normalizeManufacturerBytes } from './normalize.js';
|
|
4
4
|
export { MEASURE_SPECS, type MeasureSpec } from './measure-specs.js';
|
|
5
5
|
export { createSensorBeaconFrameCache, type SensorBeaconFrameCache, type SensorBeaconMeasurement, type SensorBeaconReading, } from './types.js';
|
|
6
6
|
export { TempivoSensorError, type TempivoSensorErrorCode } from './errors.js';
|
|
7
|
-
export { DEFAULT_SENSOR_MODEL, bluetoothMacFromSerial, normalizeSensorSerial, encodeSensorPinPayload, parseSensorQrJson, sessionTypeFromModel, } from './qr.js';
|
|
7
|
+
export { DEFAULT_SENSOR_MODEL, assertSupportedSensorModel, bluetoothMacFromSerial, normalizeSensorSerial, encodeSensorPinPayload, parseSensorQrJson, sessionTypeFromModel, } from './qr.js';
|
|
8
|
+
export { isMissingAdvertisementFirmware, sensorModelFromFirmware, } from './model.js';
|
|
9
|
+
export type { SensorStickerModel } from './model.js';
|
|
10
|
+
export { buildSensorQrConnectJson, draftSensorQrConnectJsonFromScanDevice, formatSensorReadingLine, mergeScanTargetIntoSensorQr, normalizeSensorStickerModel, parseSensorQrForConnect, pinFromSensorQrRecord, resolveSensorBleConnectCredentialsFromPin, sensorQrConnectJsonFromLoose, sensorQrSerialMatchesSelected, serialHexFromSensorQrScan, tryParseSensorQrJson, } from './connect-helpers.js';
|
|
11
|
+
export type { ParsedSensorQrLoose, SensorBleConnectCredentials, } from './connect-helpers.js';
|
|
8
12
|
export { calibrationFromExtendedJson, decodeLaboratoryCalibrationTimestamp, } from './calibration.js';
|
|
9
|
-
export { BLE_MAX_MEASUREMENT_INTERVAL_MINUTES, BLE_MAX_TRANSMISSION_INTERVAL_SECONDS, BLE_MIN_MEASUREMENT_INTERVAL_MINUTES, BLE_MIN_TRANSMISSION_INTERVAL_SECONDS, DEFAULT_ALERT_HYSTERESIS_C, compileSensorProfileToBleJson, configurationFromApiProfile, parseSensorConfiguration, parseSensorConfigurationJson, pickPartnerConfigurationJson, } from './profile.js';
|
|
13
|
+
export { BLE_MAX_MEASUREMENT_INTERVAL_MINUTES, BLE_MAX_TRANSMISSION_INTERVAL_SECONDS, BLE_MIN_MEASUREMENT_INTERVAL_MINUTES, BLE_MIN_TRANSMISSION_INTERVAL_SECONDS, DEFAULT_ALERT_HYSTERESIS_C, compileSensorProfileToBleJson, configurationFromApiProfile, parseSensorConfiguration, parseSensorConfigurationFromDevice, parseSensorConfigurationFromDeviceJson, parseSensorConfigurationJson, pickPartnerConfigurationJson, } from './profile.js';
|
|
10
14
|
export type { TempivoSchedule, TempivoScheduleAlways, TempivoScheduleWeek, TempivoSensorCalibration, TempivoSensorConfiguration, TempivoSensorQr, TempivoSensorSessionType, TempivoTemperatureAlert, TempivoTemperatureChannel, TempivoTemperatureMaxAlert, TempivoTemperatureMinAlert, TempivoTemperatureRangeAlert, TempivoTriggerTransmissionResult, } from './session-types.js';
|
|
11
15
|
export { addDeviceFoundListener, connect, disconnect, getCalibration, getConfiguration, isNativeSensorBeaconAvailable, isScanning, requestPermissions, setConfigurationJson, startScan, stopScan, triggerTransmission, } from './native-bridge.js';
|
|
12
16
|
export type { TempivoDeviceFoundSubscription, TempivoNativeCalibration, TempivoNativeMeasurement, TempivoNativePermissionResponse, TempivoNativePermissionStatus, TempivoNativeQr, TempivoNativeTelemetry, TempivoSensorBeaconDevice, } from './native-types.js';
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export { ADV_FRAME_03_LEN, TEMPVO_SENSOR_MANUFACTURER_ID, buildSensorBeaconReading, decodeMeasurementSlot, decodeSensorBeaconPayload, lookupDeviceKeys, macKeyFromAddress, serialKeyFromAdv03Frame, splitSensorBeaconFrames, } from './decoder.js';
|
|
1
|
+
export { ADV_FRAME_03_LEN, TEMPVO_SENSOR_MANUFACTURER_ID, buildSensorBeaconReading, decodeMeasurementSlot, decodeSensorBeaconPayload, lookupDeviceKeys, macKeyFromAddress, measurementTypeLabel, serialKeyFromAdv03Frame, splitSensorBeaconFrames, } from './decoder.js';
|
|
2
2
|
export { ingestManufacturerPayload } from './ingest.js';
|
|
3
3
|
export { dataViewToUint8Array, manufacturerPayloadsFromScanRecordBytes, normalizeManufacturerBytes } from './normalize.js';
|
|
4
4
|
export { MEASURE_SPECS } from './measure-specs.js';
|
|
5
5
|
export { createSensorBeaconFrameCache, } from './types.js';
|
|
6
6
|
export { TempivoSensorError } from './errors.js';
|
|
7
|
-
export { DEFAULT_SENSOR_MODEL, bluetoothMacFromSerial, normalizeSensorSerial, encodeSensorPinPayload, parseSensorQrJson, sessionTypeFromModel, } from './qr.js';
|
|
7
|
+
export { DEFAULT_SENSOR_MODEL, assertSupportedSensorModel, bluetoothMacFromSerial, normalizeSensorSerial, encodeSensorPinPayload, parseSensorQrJson, sessionTypeFromModel, } from './qr.js';
|
|
8
|
+
export { isMissingAdvertisementFirmware, sensorModelFromFirmware, } from './model.js';
|
|
9
|
+
export { buildSensorQrConnectJson, draftSensorQrConnectJsonFromScanDevice, formatSensorReadingLine, mergeScanTargetIntoSensorQr, normalizeSensorStickerModel, parseSensorQrForConnect, pinFromSensorQrRecord, resolveSensorBleConnectCredentialsFromPin, sensorQrConnectJsonFromLoose, sensorQrSerialMatchesSelected, serialHexFromSensorQrScan, tryParseSensorQrJson, } from './connect-helpers.js';
|
|
8
10
|
export { calibrationFromExtendedJson, decodeLaboratoryCalibrationTimestamp, } from './calibration.js';
|
|
9
|
-
export { BLE_MAX_MEASUREMENT_INTERVAL_MINUTES, BLE_MAX_TRANSMISSION_INTERVAL_SECONDS, BLE_MIN_MEASUREMENT_INTERVAL_MINUTES, BLE_MIN_TRANSMISSION_INTERVAL_SECONDS, DEFAULT_ALERT_HYSTERESIS_C, compileSensorProfileToBleJson, configurationFromApiProfile, parseSensorConfiguration, parseSensorConfigurationJson, pickPartnerConfigurationJson, } from './profile.js';
|
|
11
|
+
export { BLE_MAX_MEASUREMENT_INTERVAL_MINUTES, BLE_MAX_TRANSMISSION_INTERVAL_SECONDS, BLE_MIN_MEASUREMENT_INTERVAL_MINUTES, BLE_MIN_TRANSMISSION_INTERVAL_SECONDS, DEFAULT_ALERT_HYSTERESIS_C, compileSensorProfileToBleJson, configurationFromApiProfile, parseSensorConfiguration, parseSensorConfigurationFromDevice, parseSensorConfigurationFromDeviceJson, parseSensorConfigurationJson, pickPartnerConfigurationJson, } from './profile.js';
|
|
10
12
|
export { addDeviceFoundListener, connect, disconnect, getCalibration, getConfiguration, isNativeSensorBeaconAvailable, isScanning, requestPermissions, setConfigurationJson, startScan, stopScan, triggerTransmission, } from './native-bridge.js';
|
package/dist/model.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type SensorStickerModel = 'HC5' | 'HC7';
|
|
2
|
+
/** True when advertisement has no usable firmware semver (incl. SDK placeholder `0.0.0`). */
|
|
3
|
+
export declare function isMissingAdvertisementFirmware(firmware: string | null | undefined): boolean;
|
|
4
|
+
/** Product hint from firmware only. Missing FW → HC7. */
|
|
5
|
+
export declare function sensorModelFromFirmware(firmware: string | null | undefined): SensorStickerModel;
|
package/dist/model.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DEFAULT_SENSOR_MODEL } from './qr.js';
|
|
2
|
+
/** True when advertisement has no usable firmware semver (incl. SDK placeholder `0.0.0`). */
|
|
3
|
+
export function isMissingAdvertisementFirmware(firmware) {
|
|
4
|
+
const t = firmware?.trim() ?? '';
|
|
5
|
+
return t.length === 0 || t === '0.0.0';
|
|
6
|
+
}
|
|
7
|
+
/** Product hint from firmware only. Missing FW → HC7. */
|
|
8
|
+
export function sensorModelFromFirmware(firmware) {
|
|
9
|
+
if (isMissingAdvertisementFirmware(firmware))
|
|
10
|
+
return DEFAULT_SENSOR_MODEL;
|
|
11
|
+
const t = firmware.trim();
|
|
12
|
+
if (/^FW\s*5/i.test(t))
|
|
13
|
+
return 'HC5';
|
|
14
|
+
const m = /(?:^FW\s*)?(\d+)\.\d+/i.exec(t);
|
|
15
|
+
if (!m)
|
|
16
|
+
return DEFAULT_SENSOR_MODEL;
|
|
17
|
+
const major = Number(m[1]);
|
|
18
|
+
if (!Number.isFinite(major))
|
|
19
|
+
return DEFAULT_SENSOR_MODEL;
|
|
20
|
+
if (major >= 7)
|
|
21
|
+
return 'HC7';
|
|
22
|
+
if (major >= 1)
|
|
23
|
+
return 'HC5';
|
|
24
|
+
return DEFAULT_SENSOR_MODEL;
|
|
25
|
+
}
|
package/dist/native-helpers.js
CHANGED
|
@@ -12,11 +12,14 @@ const SENSOR_CODES = [
|
|
|
12
12
|
export function qrToConnectJson(qr) {
|
|
13
13
|
if (typeof qr === 'string')
|
|
14
14
|
return qr;
|
|
15
|
-
|
|
15
|
+
const body = {
|
|
16
16
|
sn: qr.serial,
|
|
17
17
|
pin: qr.pin,
|
|
18
18
|
model: qr.model ?? 'HC7',
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
|
+
if (qr.deviceId)
|
|
21
|
+
body.deviceId = qr.deviceId;
|
|
22
|
+
return JSON.stringify(body);
|
|
20
23
|
}
|
|
21
24
|
export function configToJson(config) {
|
|
22
25
|
return typeof config === 'string' ? config : JSON.stringify(config);
|
package/dist/native-module.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { requireOptionalNativeModule } from 'expo-modules-core';
|
|
2
2
|
import { TempivoSensorError } from './errors.js';
|
|
3
3
|
import { configToJson, mapNativeError, qrToConnectJson } from './native-helpers.js';
|
|
4
|
-
import {
|
|
4
|
+
import { parseSensorConfigurationFromDeviceJson } from './profile.js';
|
|
5
5
|
function getNative() {
|
|
6
6
|
const native = requireOptionalNativeModule('TempivoSensorBeacon');
|
|
7
7
|
if (!native) {
|
|
@@ -50,7 +50,11 @@ export function isScanning() {
|
|
|
50
50
|
return getNative().isScanning();
|
|
51
51
|
}
|
|
52
52
|
export function addDeviceFoundListener(listener) {
|
|
53
|
-
|
|
53
|
+
const native = getNative();
|
|
54
|
+
if (typeof native.addListener !== 'function') {
|
|
55
|
+
throw new TempivoSensorError('runtimeUnavailable', 'Native scan events are unavailable in this build.');
|
|
56
|
+
}
|
|
57
|
+
return native.addListener('onDeviceFound', listener);
|
|
54
58
|
}
|
|
55
59
|
export async function connect(qr) {
|
|
56
60
|
await ensureBlePermission();
|
|
@@ -72,7 +76,7 @@ export async function disconnect() {
|
|
|
72
76
|
export async function getConfiguration() {
|
|
73
77
|
try {
|
|
74
78
|
const json = await getNative().getConfigurationJson();
|
|
75
|
-
return
|
|
79
|
+
return parseSensorConfigurationFromDeviceJson(json);
|
|
76
80
|
}
|
|
77
81
|
catch (error) {
|
|
78
82
|
throw mapNativeError(error);
|
package/dist/native-types.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export type TempivoNativeTelemetry = {
|
|
|
27
27
|
export type TempivoSensorBeaconDevice = {
|
|
28
28
|
deviceId: string;
|
|
29
29
|
rssi: number;
|
|
30
|
+
/** HC7 when advertisement firmware is missing; else inferred from FW major. */
|
|
31
|
+
model?: string;
|
|
30
32
|
bluetoothMacAddress?: string | null;
|
|
31
33
|
serialNumber?: string | null;
|
|
32
34
|
summary?: string | null;
|
package/dist/profile.d.ts
CHANGED
|
@@ -6,10 +6,17 @@ export declare const BLE_MIN_MEASUREMENT_INTERVAL_MINUTES = 60;
|
|
|
6
6
|
export declare const BLE_MAX_MEASUREMENT_INTERVAL_MINUTES = 600;
|
|
7
7
|
export declare const BLE_MIN_TRANSMISSION_INTERVAL_SECONDS = 3600;
|
|
8
8
|
export declare const BLE_MAX_TRANSMISSION_INTERVAL_SECONDS = 604800;
|
|
9
|
+
export type ParseSensorConfigurationOptions = {
|
|
10
|
+
/** When true, accept intervals outside partner API limits (device readback). Default false. */
|
|
11
|
+
fromDevice?: boolean;
|
|
12
|
+
};
|
|
9
13
|
/** Validate Cellular API config-profile JSON for BLE setConfiguration. */
|
|
10
|
-
export declare function parseSensorConfiguration(input: unknown): TempivoSensorConfiguration;
|
|
14
|
+
export declare function parseSensorConfiguration(input: unknown, options?: ParseSensorConfigurationOptions): TempivoSensorConfiguration;
|
|
15
|
+
/** Parse configuration read from the device (intervals may be below partner API minimums). */
|
|
16
|
+
export declare function parseSensorConfigurationFromDevice(input: unknown): TempivoSensorConfiguration;
|
|
11
17
|
/** Same as {@link parseSensorConfiguration}: GET `{ profile }` or the profile object. */
|
|
12
18
|
export declare const configurationFromApiProfile: typeof parseSensorConfiguration;
|
|
13
19
|
export declare function parseSensorConfigurationJson(json: string): TempivoSensorConfiguration;
|
|
20
|
+
export declare function parseSensorConfigurationFromDeviceJson(json: string): TempivoSensorConfiguration;
|
|
14
21
|
export declare function compileSensorProfileToBleJson(input: unknown): string;
|
|
15
22
|
export declare function pickPartnerConfigurationJson(json: string): string;
|
package/dist/profile.js
CHANGED
|
@@ -195,18 +195,21 @@ export const BLE_MIN_MEASUREMENT_INTERVAL_MINUTES = 60;
|
|
|
195
195
|
export const BLE_MAX_MEASUREMENT_INTERVAL_MINUTES = 600;
|
|
196
196
|
export const BLE_MIN_TRANSMISSION_INTERVAL_SECONDS = 3600;
|
|
197
197
|
export const BLE_MAX_TRANSMISSION_INTERVAL_SECONDS = 604_800;
|
|
198
|
-
function parseOptionalIntervals(body) {
|
|
198
|
+
function parseOptionalIntervals(body, options = {}) {
|
|
199
|
+
const validatePartnerLimits = !options.fromDevice;
|
|
199
200
|
const out = {};
|
|
200
201
|
if (body.measurementIntervalMinutes !== undefined) {
|
|
201
202
|
const n = parseFiniteNumber(body.measurementIntervalMinutes);
|
|
202
203
|
if (n === undefined || !Number.isFinite(n) || n <= 0) {
|
|
203
204
|
throw new TempivoSensorError('invalidConfig', 'measurementIntervalMinutes must be a positive number.');
|
|
204
205
|
}
|
|
205
|
-
if (
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
206
|
+
if (validatePartnerLimits) {
|
|
207
|
+
if (n < BLE_MIN_MEASUREMENT_INTERVAL_MINUTES) {
|
|
208
|
+
throw new TempivoSensorError('invalidConfig', `measurementIntervalMinutes must be at least ${BLE_MIN_MEASUREMENT_INTERVAL_MINUTES} (1 hour).`);
|
|
209
|
+
}
|
|
210
|
+
if (n > BLE_MAX_MEASUREMENT_INTERVAL_MINUTES) {
|
|
211
|
+
throw new TempivoSensorError('invalidConfig', `measurementIntervalMinutes must be at most ${BLE_MAX_MEASUREMENT_INTERVAL_MINUTES}.`);
|
|
212
|
+
}
|
|
210
213
|
}
|
|
211
214
|
out.measurementIntervalMinutes = n;
|
|
212
215
|
}
|
|
@@ -215,15 +218,18 @@ function parseOptionalIntervals(body) {
|
|
|
215
218
|
if (n === undefined || !Number.isInteger(n) || n <= 0) {
|
|
216
219
|
throw new TempivoSensorError('invalidConfig', 'transmissionIntervalSeconds must be a positive integer.');
|
|
217
220
|
}
|
|
218
|
-
if (
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
if (validatePartnerLimits) {
|
|
222
|
+
if (n < BLE_MIN_TRANSMISSION_INTERVAL_SECONDS) {
|
|
223
|
+
throw new TempivoSensorError('invalidConfig', `transmissionIntervalSeconds must be at least ${BLE_MIN_TRANSMISSION_INTERVAL_SECONDS} (1 hour).`);
|
|
224
|
+
}
|
|
225
|
+
if (n > BLE_MAX_TRANSMISSION_INTERVAL_SECONDS) {
|
|
226
|
+
throw new TempivoSensorError('invalidConfig', `transmissionIntervalSeconds must be at most ${BLE_MAX_TRANSMISSION_INTERVAL_SECONDS}.`);
|
|
227
|
+
}
|
|
223
228
|
}
|
|
224
229
|
out.transmissionIntervalSeconds = n;
|
|
225
230
|
}
|
|
226
|
-
if (
|
|
231
|
+
if (validatePartnerLimits &&
|
|
232
|
+
out.measurementIntervalMinutes != null &&
|
|
227
233
|
out.transmissionIntervalSeconds != null) {
|
|
228
234
|
const maxTx = out.measurementIntervalMinutes * 60 * 60;
|
|
229
235
|
if (out.transmissionIntervalSeconds > maxTx) {
|
|
@@ -232,12 +238,7 @@ function parseOptionalIntervals(body) {
|
|
|
232
238
|
}
|
|
233
239
|
return out;
|
|
234
240
|
}
|
|
235
|
-
|
|
236
|
-
export function parseSensorConfiguration(input) {
|
|
237
|
-
if (!isRecord(input)) {
|
|
238
|
-
throw new TempivoSensorError('invalidConfig', 'Configuration must be a JSON object.');
|
|
239
|
-
}
|
|
240
|
-
const body = unwrapApiProfile(input);
|
|
241
|
+
function parseSensorConfigurationBody(body, options = {}) {
|
|
241
242
|
rejectWireAlarmRules(body);
|
|
242
243
|
const alertsRaw = body.temperatureAlerts;
|
|
243
244
|
if (alertsRaw !== undefined && !Array.isArray(alertsRaw)) {
|
|
@@ -245,13 +246,25 @@ export function parseSensorConfiguration(input) {
|
|
|
245
246
|
}
|
|
246
247
|
const temperatureAlerts = (alertsRaw ?? []).map((item, i) => parseAlert(item, i));
|
|
247
248
|
assertAlertSlotBudget(temperatureAlerts);
|
|
248
|
-
const intervals = parseOptionalIntervals(body);
|
|
249
|
+
const intervals = parseOptionalIntervals(body, options);
|
|
249
250
|
return {
|
|
250
251
|
temperatureAlerts,
|
|
251
252
|
schedule: parseSchedule(body.schedule),
|
|
252
253
|
...intervals,
|
|
253
254
|
};
|
|
254
255
|
}
|
|
256
|
+
/** Validate Cellular API config-profile JSON for BLE setConfiguration. */
|
|
257
|
+
export function parseSensorConfiguration(input, options = {}) {
|
|
258
|
+
if (!isRecord(input)) {
|
|
259
|
+
throw new TempivoSensorError('invalidConfig', 'Configuration must be a JSON object.');
|
|
260
|
+
}
|
|
261
|
+
const body = unwrapApiProfile(input);
|
|
262
|
+
return parseSensorConfigurationBody(body, options);
|
|
263
|
+
}
|
|
264
|
+
/** Parse configuration read from the device (intervals may be below partner API minimums). */
|
|
265
|
+
export function parseSensorConfigurationFromDevice(input) {
|
|
266
|
+
return parseSensorConfiguration(input, { fromDevice: true });
|
|
267
|
+
}
|
|
255
268
|
/** Same as {@link parseSensorConfiguration}: GET `{ profile }` or the profile object. */
|
|
256
269
|
export const configurationFromApiProfile = parseSensorConfiguration;
|
|
257
270
|
export function parseSensorConfigurationJson(json) {
|
|
@@ -264,6 +277,16 @@ export function parseSensorConfigurationJson(json) {
|
|
|
264
277
|
}
|
|
265
278
|
return parseSensorConfiguration(parsed);
|
|
266
279
|
}
|
|
280
|
+
export function parseSensorConfigurationFromDeviceJson(json) {
|
|
281
|
+
let parsed;
|
|
282
|
+
try {
|
|
283
|
+
parsed = JSON.parse(json);
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
throw new TempivoSensorError('invalidConfig', 'Configuration is not valid JSON.');
|
|
287
|
+
}
|
|
288
|
+
return parseSensorConfigurationFromDevice(parsed);
|
|
289
|
+
}
|
|
267
290
|
export function compileSensorProfileToBleJson(input) {
|
|
268
291
|
return JSON.stringify(parseSensorConfiguration(input));
|
|
269
292
|
}
|
package/dist/qr.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import type { TempivoSensorQr, TempivoSensorSessionType } from './session-types.
|
|
|
2
2
|
export declare function normalizeSensorSerial(value: string): string;
|
|
3
3
|
/** `282C024F0012` → `28:2C:02:4F:00:12`. */
|
|
4
4
|
export declare function bluetoothMacFromSerial(serial: string): string;
|
|
5
|
-
/** BLE default when QR omits `model`.
|
|
5
|
+
/** BLE default when QR omits `model`. */
|
|
6
6
|
export declare const DEFAULT_SENSOR_MODEL = "HC7";
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function assertSupportedSensorModel(model: string): void;
|
|
8
|
+
export declare function sessionTypeFromModel(_model: string | undefined | null): TempivoSensorSessionType;
|
|
8
9
|
/**
|
|
9
10
|
* 3-byte big-endian numeric PIN for GATT command payloads that check a reset code
|
|
10
11
|
* (`setConfiguration`, trigger, and many other privileged writes).
|
package/dist/qr.js
CHANGED
|
@@ -13,14 +13,15 @@ export function bluetoothMacFromSerial(serial) {
|
|
|
13
13
|
parts.push(key.slice(i, i + 2));
|
|
14
14
|
return parts.join(':');
|
|
15
15
|
}
|
|
16
|
-
/** BLE default when QR omits `model`.
|
|
16
|
+
/** BLE default when QR omits `model`. */
|
|
17
17
|
export const DEFAULT_SENSOR_MODEL = 'HC7';
|
|
18
|
-
export function
|
|
19
|
-
if (model == null || model.trim() === '')
|
|
20
|
-
return 'modern';
|
|
18
|
+
export function assertSupportedSensorModel(model) {
|
|
21
19
|
const m = model.trim().toUpperCase().replace(/-/g, '');
|
|
22
|
-
if (m === 'HC5'
|
|
23
|
-
|
|
20
|
+
if (m === 'HC5') {
|
|
21
|
+
throw new TempivoSensorError('invalidQr', 'HC5 is not supported by the partner SDK. Use HC7 sensors.');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export function sessionTypeFromModel(_model) {
|
|
24
25
|
return 'modern';
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
@@ -80,6 +81,7 @@ export function parseSensorQrJson(text) {
|
|
|
80
81
|
}
|
|
81
82
|
const rawModel = typeof rec.model === 'string' ? rec.model.trim() : '';
|
|
82
83
|
const model = rawModel || DEFAULT_SENSOR_MODEL;
|
|
84
|
+
assertSupportedSensorModel(model);
|
|
83
85
|
return {
|
|
84
86
|
serial,
|
|
85
87
|
pin,
|
package/dist/react-native.d.ts
CHANGED
|
@@ -1 +1,28 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { ADV_FRAME_03_LEN, TEMPVO_SENSOR_MANUFACTURER_ID, buildSensorBeaconReading, decodeMeasurementSlot, decodeSensorBeaconPayload, lookupDeviceKeys, macKeyFromAddress, serialKeyFromAdv03Frame, splitSensorBeaconFrames, } from './decoder.js';
|
|
2
|
+
export { ingestManufacturerPayload } from './ingest.js';
|
|
3
|
+
export { dataViewToUint8Array, manufacturerPayloadsFromScanRecordBytes, normalizeManufacturerBytes } from './normalize.js';
|
|
4
|
+
export { MEASURE_SPECS, type MeasureSpec } from './measure-specs.js';
|
|
5
|
+
export { createSensorBeaconFrameCache, type SensorBeaconFrameCache, type SensorBeaconMeasurement, type SensorBeaconReading, } from './types.js';
|
|
6
|
+
export { TempivoSensorError, type TempivoSensorErrorCode } from './errors.js';
|
|
7
|
+
export { DEFAULT_SENSOR_MODEL, bluetoothMacFromSerial, normalizeSensorSerial, encodeSensorPinPayload, parseSensorQrJson, sessionTypeFromModel, } from './qr.js';
|
|
8
|
+
export { isMissingAdvertisementFirmware, sensorModelFromFirmware } from './model.js';
|
|
9
|
+
export type { SensorStickerModel } from './model.js';
|
|
10
|
+
export { buildSensorQrConnectJson, draftSensorQrConnectJsonFromScanDevice, formatSensorReadingLine, mergeScanTargetIntoSensorQr, normalizeSensorStickerModel, parseSensorQrForConnect, pinFromSensorQrRecord, resolveSensorBleConnectCredentialsFromPin, sensorQrConnectJsonFromLoose, sensorQrSerialMatchesSelected, serialHexFromSensorQrScan, tryParseSensorQrJson, } from './connect-helpers.js';
|
|
11
|
+
export type { ParsedSensorQrLoose, SensorBleConnectCredentials } from './connect-helpers.js';
|
|
12
|
+
export { calibrationFromExtendedJson, decodeLaboratoryCalibrationTimestamp, } from './calibration.js';
|
|
13
|
+
export { BLE_MAX_MEASUREMENT_INTERVAL_MINUTES, BLE_MAX_TRANSMISSION_INTERVAL_SECONDS, BLE_MIN_MEASUREMENT_INTERVAL_MINUTES, BLE_MIN_TRANSMISSION_INTERVAL_SECONDS, DEFAULT_ALERT_HYSTERESIS_C, compileSensorProfileToBleJson, configurationFromApiProfile, parseSensorConfiguration, parseSensorConfigurationFromDevice, parseSensorConfigurationFromDeviceJson, parseSensorConfigurationJson, pickPartnerConfigurationJson, } from './profile.js';
|
|
14
|
+
export type { TempivoSchedule, TempivoScheduleAlways, TempivoScheduleWeek, TempivoSensorCalibration, TempivoSensorConfiguration, TempivoSensorQr, TempivoSensorSessionType, TempivoTemperatureAlert, TempivoTemperatureChannel, TempivoTemperatureMaxAlert, TempivoTemperatureMinAlert, TempivoTemperatureRangeAlert, TempivoTriggerTransmissionResult, } from './session-types.js';
|
|
15
|
+
export type { TempivoDeviceFoundSubscription, TempivoNativeCalibration, TempivoNativeMeasurement, TempivoNativePermissionResponse, TempivoNativePermissionStatus, TempivoNativeQr, TempivoNativeTelemetry, TempivoSensorBeaconDevice, } from './native-types.js';
|
|
16
|
+
import * as native from './native-module.js';
|
|
17
|
+
export declare const isNativeSensorBeaconAvailable: typeof native.isNativeSensorBeaconAvailable;
|
|
18
|
+
export declare const requestPermissions: typeof native.requestPermissions;
|
|
19
|
+
export declare const startScan: typeof native.startScan;
|
|
20
|
+
export declare const stopScan: typeof native.stopScan;
|
|
21
|
+
export declare const isScanning: typeof native.isScanning;
|
|
22
|
+
export declare const addDeviceFoundListener: typeof native.addDeviceFoundListener;
|
|
23
|
+
export declare const connect: typeof native.connect;
|
|
24
|
+
export declare const disconnect: typeof native.disconnect;
|
|
25
|
+
export declare const getConfiguration: typeof native.getConfiguration;
|
|
26
|
+
export declare const setConfigurationJson: typeof native.setConfigurationJson;
|
|
27
|
+
export declare const triggerTransmission: typeof native.triggerTransmission;
|
|
28
|
+
export declare const getCalibration: typeof native.getCalibration;
|
package/dist/react-native.js
CHANGED
|
@@ -1 +1,24 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { ADV_FRAME_03_LEN, TEMPVO_SENSOR_MANUFACTURER_ID, buildSensorBeaconReading, decodeMeasurementSlot, decodeSensorBeaconPayload, lookupDeviceKeys, macKeyFromAddress, serialKeyFromAdv03Frame, splitSensorBeaconFrames, } from './decoder.js';
|
|
2
|
+
export { ingestManufacturerPayload } from './ingest.js';
|
|
3
|
+
export { dataViewToUint8Array, manufacturerPayloadsFromScanRecordBytes, normalizeManufacturerBytes } from './normalize.js';
|
|
4
|
+
export { MEASURE_SPECS } from './measure-specs.js';
|
|
5
|
+
export { createSensorBeaconFrameCache, } from './types.js';
|
|
6
|
+
export { TempivoSensorError } from './errors.js';
|
|
7
|
+
export { DEFAULT_SENSOR_MODEL, bluetoothMacFromSerial, normalizeSensorSerial, encodeSensorPinPayload, parseSensorQrJson, sessionTypeFromModel, } from './qr.js';
|
|
8
|
+
export { isMissingAdvertisementFirmware, sensorModelFromFirmware } from './model.js';
|
|
9
|
+
export { buildSensorQrConnectJson, draftSensorQrConnectJsonFromScanDevice, formatSensorReadingLine, mergeScanTargetIntoSensorQr, normalizeSensorStickerModel, parseSensorQrForConnect, pinFromSensorQrRecord, resolveSensorBleConnectCredentialsFromPin, sensorQrConnectJsonFromLoose, sensorQrSerialMatchesSelected, serialHexFromSensorQrScan, tryParseSensorQrJson, } from './connect-helpers.js';
|
|
10
|
+
export { calibrationFromExtendedJson, decodeLaboratoryCalibrationTimestamp, } from './calibration.js';
|
|
11
|
+
export { BLE_MAX_MEASUREMENT_INTERVAL_MINUTES, BLE_MAX_TRANSMISSION_INTERVAL_SECONDS, BLE_MIN_MEASUREMENT_INTERVAL_MINUTES, BLE_MIN_TRANSMISSION_INTERVAL_SECONDS, DEFAULT_ALERT_HYSTERESIS_C, compileSensorProfileToBleJson, configurationFromApiProfile, parseSensorConfiguration, parseSensorConfigurationFromDevice, parseSensorConfigurationFromDeviceJson, parseSensorConfigurationJson, pickPartnerConfigurationJson, } from './profile.js';
|
|
12
|
+
import * as native from './native-module.js';
|
|
13
|
+
export const isNativeSensorBeaconAvailable = native.isNativeSensorBeaconAvailable;
|
|
14
|
+
export const requestPermissions = native.requestPermissions;
|
|
15
|
+
export const startScan = native.startScan;
|
|
16
|
+
export const stopScan = native.stopScan;
|
|
17
|
+
export const isScanning = native.isScanning;
|
|
18
|
+
export const addDeviceFoundListener = native.addDeviceFoundListener;
|
|
19
|
+
export const connect = native.connect;
|
|
20
|
+
export const disconnect = native.disconnect;
|
|
21
|
+
export const getConfiguration = native.getConfiguration;
|
|
22
|
+
export const setConfigurationJson = native.setConfigurationJson;
|
|
23
|
+
export const triggerTransmission = native.triggerTransmission;
|
|
24
|
+
export const getCalibration = native.getCalibration;
|
package/dist/session-types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** Partner SDK: modern GATT only (HC7 / firmware 7+). */
|
|
2
|
+
export type TempivoSensorSessionType = 'modern';
|
|
2
3
|
export type TempivoTemperatureChannel = 'ambient' | 'probe';
|
|
3
4
|
export type TempivoTemperatureRangeAlert = {
|
|
4
5
|
type: 'range';
|
|
@@ -54,10 +55,13 @@ export type TempivoSensorConfiguration = {
|
|
|
54
55
|
export type TempivoSensorQr = {
|
|
55
56
|
serial: string;
|
|
56
57
|
pin: string;
|
|
57
|
-
/** Optional sticker field.
|
|
58
|
+
/** Optional sticker field. Defaults to HC7. HC5 is rejected. */
|
|
58
59
|
model?: string;
|
|
60
|
+
/** Always `modern` (HC7 GATT). */
|
|
59
61
|
sessionType: TempivoSensorSessionType;
|
|
60
62
|
bluetoothMac: string;
|
|
63
|
+
/** SDK scan `deviceId` when it differs from sticker serial. */
|
|
64
|
+
deviceId?: string;
|
|
61
65
|
};
|
|
62
66
|
export type TempivoSensorCalibration = {
|
|
63
67
|
laboratoryCalibrationDate: string | null;
|
|
@@ -65,5 +69,4 @@ export type TempivoSensorCalibration = {
|
|
|
65
69
|
};
|
|
66
70
|
export type TempivoTriggerTransmissionResult = {
|
|
67
71
|
ok: boolean;
|
|
68
|
-
supported: boolean;
|
|
69
72
|
};
|
|
Binary file
|