@tempivo/sensor-beacon 1.1.2 → 1.1.4
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 +35 -22
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/tempivosensorbeacon/SensorBeaconNative.java +8 -0
- package/android/src/main/java/expo/modules/tempivosensorbeacon/TempivoSensorBeaconModule.kt +8 -0
- package/android-aar/library/build.gradle +5 -0
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/EfentoRawConfigTransfer.kt +672 -0
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/PartnerBleRules.kt +124 -10
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/SensorBleRuntime.kt +19 -8
- package/android-aar/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorSession.kt +142 -11
- package/android-aar/library/src/test/java/com/tempivo/sensor/beacon/PartnerBleRulesTest.kt +209 -0
- package/dist/native-module.d.ts +10 -0
- package/dist/native-module.js +46 -3
- package/dist/partner-dual-range-fixture.d.ts +28 -0
- package/dist/partner-dual-range-fixture.js +29 -0
- package/dist/profile.js +33 -19
- package/dist/proto/decode-proto-config.d.ts +3 -0
- package/dist/proto/decode-proto-config.js +46 -0
- package/dist/proto/efento-protobuf-descriptor.d.ts +964 -0
- package/dist/proto/efento-protobuf-descriptor.js +727 -0
- package/dist/proto/partner-from-proto.d.ts +9 -0
- package/dist/proto/partner-from-proto.js +187 -0
- package/dist/proto/partner-to-proto.d.ts +12 -0
- package/dist/proto/partner-to-proto.js +211 -0
- package/dist/tempivo-sensor-beacon.aar +0 -0
- package/ios/Frameworks/TempivoSensorBridge.xcframework/ios-arm64/TempivoSensorBridge.framework/TempivoSensorBridge +0 -0
- package/ios/Sources/TempivoSensorBeacon/EfentoRawConfigTransfer.swift +601 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorSession.swift +99 -29
- package/ios/TempivoSensorBeaconModule.swift +9 -0
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,35 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
<!-- Publish trigger: 1.1.4 not on npm until CI Trusted Publisher (ci.yml) runs. -->
|
|
10
|
+
|
|
11
|
+
## [1.1.4] - 2026-09-07
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Android BLE get/set for alarm rules uses the same raw ProtoConfig GATT path as iOS (0x0C / 0x0D), with a persistent GATT link and `writeProtoConfigBase64`.
|
|
16
|
+
- Partner `getConfiguration` return value is only partner fields (no `configSource` / `protoBase64`).
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- `setConfigurationJson` (JS): on iOS and Android, read baseline proto → patch partner alerts → raw GATT write.
|
|
21
|
+
- Vendor SDK remains for connect, scan, trigger, and calibration.
|
|
22
|
+
|
|
23
|
+
## [1.1.3] - 2026-09-07
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- BLE set: if the device already has the same alarm rules, treat it as success (info), not a reject. Fail only when on-device rules actually differ after write.
|
|
28
|
+
- iOS BLE get/set for alarm rules uses raw ProtoConfig GATT (0x0C / 0x0D), not the vendor SDK rule APIs (HC7 SDK get returns empty rules; SDK set often fails with Invalid PIN).
|
|
29
|
+
- iOS: back-to-back config reads and writes no longer time out. The raw config link is now one persistent central/peripheral reused across commands, with one retry on failure.
|
|
30
|
+
- iOS BLE set only writes rules-related fields. Echoing the whole device read back exceeded the single-write BLE limit and would have rewritten server, APN, and token settings.
|
|
31
|
+
- BLE get: device intervals reported as `0` or `null` are omitted instead of failing the whole read.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- Partner `getConfiguration` / `setConfigurationJson` signatures unchanged.
|
|
36
|
+
- Vendor SDK is still used for connect, scan, trigger, and calibration.
|
|
37
|
+
|
|
9
38
|
## [1.1.2] - 2026-09-05
|
|
10
39
|
|
|
11
40
|
### Fixed
|
package/README.md
CHANGED
|
@@ -59,36 +59,40 @@ const sub = await addDeviceFoundListener((device) => {
|
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
await startScan();
|
|
62
|
+
// Stop scan before GATT connect. While connected, the sensor does not advertise.
|
|
62
63
|
|
|
63
64
|
const qr = parseSensorQrJson(stickerQrText);
|
|
64
65
|
await connect(qr);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
await
|
|
66
|
+
try {
|
|
67
|
+
await setConfigurationJson({
|
|
68
|
+
schedule: { always: true },
|
|
69
|
+
temperatureAlerts: [
|
|
70
|
+
{
|
|
71
|
+
type: 'range',
|
|
72
|
+
channel: 'probe',
|
|
73
|
+
lowC: -30,
|
|
74
|
+
highC: -10,
|
|
75
|
+
hysteresisC: 0.5,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
});
|
|
79
|
+
// BLE write is on-device only. Cloud pending / last report update after a cellular uplink:
|
|
80
|
+
await triggerTransmission();
|
|
81
|
+
// Tempivo then drops from the cloud queue only fields the device already matches;
|
|
82
|
+
// other queued Cellular fields can still downlink. To cancel the whole queue:
|
|
83
|
+
// DELETE /api/v1/devices/{serial}/config (see docs/cellular-api.md).
|
|
84
|
+
const applied = await getConfiguration();
|
|
85
|
+
const cal = await getCalibration();
|
|
86
|
+
} finally {
|
|
87
|
+
await disconnect(); // required so advertising / startScan can see the sensor again
|
|
88
|
+
}
|
|
85
89
|
stopScan();
|
|
86
90
|
sub.remove();
|
|
87
91
|
```
|
|
88
92
|
|
|
89
93
|
`startScan` and `connect` request Bluetooth permission. Sticker PIN is required on `connect`. Wrong PIN is `invalidPin`.
|
|
90
94
|
|
|
91
|
-
**Connect tips:** stop scan before GATT connect. Pass the scan row’s `deviceId` and MAC when they differ from the sticker serial (`parseSensorQrForConnect`). 5–6 digit PINs map to an encryption key internally; numeric `resetCode` alone is not enough on all devices.
|
|
95
|
+
**Connect tips:** stop scan before GATT connect. Pass the scan row’s `deviceId` and MAC when they differ from the sticker serial (`parseSensorQrForConnect`). 5–6 digit PINs map to an encryption key internally; numeric `resetCode` alone is not enough on all devices. Call `disconnect()` when finished. **While any device holds a GATT connection, the sensor does not advertise**, so `startScan` will not show beacon / live readings for that sensor until everyone disconnects (including other apps).
|
|
92
96
|
|
|
93
97
|
If a bundler misses native BLE, import `@tempivo/sensor-beacon/react-native`.
|
|
94
98
|
|
|
@@ -129,6 +133,12 @@ const draft = draftSensorQrConnectJsonFromScanDevice(device);
|
|
|
129
133
|
// Connect: parse sticker + merge selected row deviceId / MAC
|
|
130
134
|
const qr = parseSensorQrForConnect(stickerJson, selectedDevice);
|
|
131
135
|
await connect(qr);
|
|
136
|
+
try {
|
|
137
|
+
await setConfigurationJson(profileJson);
|
|
138
|
+
await getConfiguration();
|
|
139
|
+
} finally {
|
|
140
|
+
await disconnect();
|
|
141
|
+
}
|
|
132
142
|
|
|
133
143
|
// Scan list: same reading line as in-app
|
|
134
144
|
formatSensorReadingLine({ typeHex: 'temperature', text: '23.5 °C' });
|
|
@@ -311,6 +321,8 @@ Sticker QR is JSON. Parse with `parseSensorQrJson`.
|
|
|
311
321
|
|
|
312
322
|
Filter manufacturer data on company id **0x026C**. Active scanning is on so scan-response packets arrive.
|
|
313
323
|
|
|
324
|
+
**Advertising vs GATT:** beacon packets (manufacturer `0x026C`, frames `0x03` / `0x04`) are only sent while the sensor is **not** in a GATT session. If your app, another phone, or another tool is connected, scan results for that sensor disappear or freeze until `disconnect()` (or the link drops). Do not expect live `telemetry.readings` during `connect`.
|
|
325
|
+
|
|
314
326
|
| Field | Meaning |
|
|
315
327
|
|------|---------|
|
|
316
328
|
| `deviceId` | Platform BLE id. Often randomized. Not the sticker serial. |
|
|
@@ -393,6 +405,7 @@ try {
|
|
|
393
405
|
val applied = session.getConfiguration()
|
|
394
406
|
val cal = session.getCalibration()
|
|
395
407
|
} finally {
|
|
408
|
+
// Without disconnect, the sensor will not advertise for startScan.
|
|
396
409
|
session.disconnect()
|
|
397
410
|
}
|
|
398
411
|
```
|
|
@@ -412,7 +425,7 @@ Needs a physical device for GATT. Simulator can scan advertisements only. Set **
|
|
|
412
425
|
let qr = try TempivoSensorQrParser.parse(stickerQrText)
|
|
413
426
|
let session = TempivoSensorSession()
|
|
414
427
|
try session.connect(qr: qr)
|
|
415
|
-
defer { session.disconnect() }
|
|
428
|
+
defer { session.disconnect() } // advertising resumes after disconnect
|
|
416
429
|
try session.setConfigurationJson(profileJson)
|
|
417
430
|
_ = try session.triggerTransmission()
|
|
418
431
|
let applied = try session.getConfiguration()
|
package/android/build.gradle
CHANGED
|
@@ -4,14 +4,14 @@ plugins {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
group = 'com.tempivo.sensor.beacon'
|
|
7
|
-
version = '0.4.
|
|
7
|
+
version = '0.4.4'
|
|
8
8
|
|
|
9
9
|
android {
|
|
10
10
|
namespace "expo.modules.tempivosensorbeacon"
|
|
11
11
|
defaultConfig {
|
|
12
12
|
minSdk 26
|
|
13
13
|
versionCode 1
|
|
14
|
-
versionName "0.4.
|
|
14
|
+
versionName "0.4.4"
|
|
15
15
|
}
|
|
16
16
|
compileOptions {
|
|
17
17
|
sourceCompatibility JavaVersion.VERSION_17
|
|
@@ -95,6 +95,14 @@ final class SensorBeaconNative {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
void writeProtoConfigBase64(String base64) {
|
|
99
|
+
try {
|
|
100
|
+
requireSessionConnected().writeProtoConfigBase64Blocking(base64);
|
|
101
|
+
} catch (Throwable error) {
|
|
102
|
+
throw wrap(error);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
98
106
|
void setConfigurationJson(String json) {
|
|
99
107
|
try {
|
|
100
108
|
requireSessionConnected().setConfigurationJsonBlocking(json);
|
|
@@ -68,6 +68,14 @@ class TempivoSensorBeaconModule : Module() {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
AsyncFunction("writeProtoConfigBase64") { base64: String ->
|
|
72
|
+
try {
|
|
73
|
+
native.writeProtoConfigBase64(base64)
|
|
74
|
+
} catch (error: Throwable) {
|
|
75
|
+
throw error.toSensorException()
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
71
79
|
AsyncFunction("setConfigurationJson") { json: String ->
|
|
72
80
|
try {
|
|
73
81
|
native.setConfigurationJson(json)
|
|
@@ -20,6 +20,10 @@ android {
|
|
|
20
20
|
kotlinOptions {
|
|
21
21
|
jvmTarget = "17"
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
testOptions {
|
|
25
|
+
unitTests.returnDefaultValues = true
|
|
26
|
+
}
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
dependencies {
|
|
@@ -27,4 +31,5 @@ dependencies {
|
|
|
27
31
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2"
|
|
28
32
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2"
|
|
29
33
|
implementation "pl.efento.mobile:bluetooth:2.3.0"
|
|
34
|
+
testImplementation "junit:junit:4.13.2"
|
|
30
35
|
}
|