@tempivo/sensor-beacon 0.1.0 → 0.2.0
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/README.md +209 -50
- package/android/build.gradle +4 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/gradle.properties +3 -0
- package/android/gradlew +251 -0
- package/android/library/build.gradle +30 -0
- package/android/library/consumer-rules.pro +1 -0
- package/android/library/src/main/AndroidManifest.xml +2 -0
- package/android/library/src/main/java/com/tempivo/sensor/beacon/PartnerBleRules.kt +279 -0
- package/android/library/src/main/java/com/tempivo/sensor/beacon/SensorBleRuntime.kt +168 -0
- package/android/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorBeaconDecoder.kt +389 -0
- package/android/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorBeaconScanner.kt +158 -0
- package/android/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorBeaconTypes.kt +40 -0
- package/android/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorCalibration.kt +36 -0
- package/android/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorError.kt +18 -0
- package/android/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorProfile.kt +171 -0
- package/android/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorQr.kt +82 -0
- package/android/library/src/main/java/com/tempivo/sensor/beacon/TempivoSensorSession.kt +114 -0
- package/android/settings.gradle +19 -0
- package/dist/calibration.d.ts +7 -0
- package/dist/calibration.js +42 -0
- package/dist/decoder.js +10 -18
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +8 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +5 -1
- package/dist/profile.d.ts +10 -0
- package/dist/profile.js +226 -0
- package/dist/qr.d.ts +16 -0
- package/dist/qr.js +90 -0
- package/dist/session-types.d.ts +64 -0
- package/dist/session-types.js +1 -0
- package/dist/tempivo-sensor-beacon.aar +0 -0
- package/dist/types.d.ts +3 -3
- package/ios/Package.swift +22 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorBeaconDecoder.swift +409 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorBeaconScanner.swift +159 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorBeaconTypes.swift +103 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorCalibration.swift +22 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorError.swift +24 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorProfile.swift +123 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorQr.swift +78 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorSession.swift +161 -0
- package/ios/Sources/TempivoSensorBeacon/TempivoSensorSessionTypes.swift +93 -0
- package/package.json +20 -6
package/README.md
CHANGED
|
@@ -1,87 +1,246 @@
|
|
|
1
1
|
# @tempivo/sensor-beacon
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Install
|
|
3
|
+
Tempivo partner SDK for sensors over BLE. Advertisement decode (manufacturer id **0x026C**) plus GATT session for alert rules, an immediate uplink, and laboratory calibration date.
|
|
6
4
|
|
|
7
5
|
```bash
|
|
8
6
|
npm install @tempivo/sensor-beacon
|
|
9
7
|
```
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
| Path | Use |
|
|
10
|
+
|------|-----|
|
|
11
|
+
| `dist/` | Node / TypeScript: advertising decode, QR parse, config JSON |
|
|
12
|
+
| `android/` + `dist/tempivo-sensor-beacon.aar` | Android scan + GATT |
|
|
13
|
+
| `ios/` | iOS Swift Package (scan + session) |
|
|
14
|
+
|
|
15
|
+
GATT runs on a phone (Android / iOS), not in Node. Always pass the sticker PIN to `connect`. Wrong PIN maps to `invalidPin`.
|
|
16
|
+
|
|
17
|
+
## QR object
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
Sticker QR is JSON. Parse with `parseSensorQrJson` (Node) or `TempivoSensorQrParser.parse` (Android / iOS).
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
```json
|
|
22
|
+
{ "sn": "282C024F0012", "pin": "111111", "model": "HC7" }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const qr = parseSensorQrJson(stickerQrText);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
| Field | Type | Meaning |
|
|
30
|
+
|-------|------|---------|
|
|
31
|
+
| `serial` | string | Device serial, 12 hex chars, no colons. From QR `sn`. |
|
|
32
|
+
| `pin` | string | Sticker PIN. Required on `connect`. Also accepted as QR `resetCode`. |
|
|
33
|
+
| `model` | string | Sticker model. Omitted QR `model` becomes **HC7**. `HC5` selects legacy GATT. |
|
|
34
|
+
| `sessionType` | `modern` \| `legacy` | GATT path. HC7 / firmware 7+ is `modern`. HC5 / firmware 6.x is `legacy`. |
|
|
35
|
+
| `bluetoothMac` | string | BLE MAC with colons, derived from `serial`. |
|
|
36
|
+
|
|
37
|
+
## Config JSON (same as Cellular API)
|
|
38
|
+
|
|
39
|
+
`setConfiguration` / `getConfiguration` use the same `temperatureAlerts` + `schedule` shape as `POST /api/v1/devices/config-profiles`.
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"schedule": { "always": true },
|
|
44
|
+
"temperatureAlerts": [
|
|
45
|
+
{
|
|
46
|
+
"type": "range",
|
|
47
|
+
"channel": "probe",
|
|
48
|
+
"lowC": -30,
|
|
49
|
+
"highC": -10,
|
|
50
|
+
"hysteresisC": 0.5,
|
|
51
|
+
"transmitOnBreach": true,
|
|
52
|
+
"transmitOnReturn": true
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Root**
|
|
59
|
+
|
|
60
|
+
| Field | Meaning |
|
|
61
|
+
|-------|---------|
|
|
62
|
+
| `temperatureAlerts` | Alert list. Empty array is valid (no temperature alerts). |
|
|
63
|
+
| `schedule` | When alerts are active. `{ "always": true }` is 24/7. |
|
|
64
|
+
|
|
65
|
+
Ignored over BLE: `slug`, `name`, `measurementIntervalMinutes`, `transmissionIntervalSeconds`. Do not pass `GET /devices/{serial}/config` (`alarmRules`).
|
|
66
|
+
|
|
67
|
+
**Each `temperatureAlerts[]` item**
|
|
68
|
+
|
|
69
|
+
| Field | Meaning |
|
|
70
|
+
|-------|---------|
|
|
71
|
+
| `type` | `range` (band), `min` (below), or `max` (above). |
|
|
72
|
+
| `channel` | `ambient` or `probe`. |
|
|
73
|
+
| `lowC` / `highC` | Inclusive band for `type: "range"`. |
|
|
74
|
+
| `minC` | Threshold for `type: "min"`. |
|
|
75
|
+
| `maxC` | Threshold for `type: "max"`. |
|
|
76
|
+
| `hysteresisC` | Degrees of hysteresis. Omitted: **1**. |
|
|
77
|
+
| `transmitOnBreach` | Uplink when the alert trips. Omitted: **true**. |
|
|
78
|
+
| `transmitOnReturn` | Extra uplink when temp returns inside a `range`. Omitted: **true**. Range only. |
|
|
79
|
+
|
|
80
|
+
**`schedule` weekday window** (instead of `always`)
|
|
81
|
+
|
|
82
|
+
| Field | Meaning |
|
|
83
|
+
|-------|---------|
|
|
84
|
+
| `weekdays` | **0 = Monday** … **6 = Sunday**. |
|
|
85
|
+
| `from` / `to` | 24h `HH:MM`. |
|
|
86
|
+
| `utcOffsetMinutes` | Offset from UTC for `from` / `to`. |
|
|
87
|
+
|
|
88
|
+
## Fetch a profile, apply over BLE
|
|
89
|
+
|
|
90
|
+
`GET /api/v1/devices/config-profiles/{slug}` returns `{ "profile": { … } }`. Pass the GET body or `profile` to `setConfigurationJson`.
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import { parseSensorQrJson, configurationFromApiProfile } from '@tempivo/sensor-beacon';
|
|
94
|
+
|
|
95
|
+
const qr = parseSensorQrJson(stickerQrText);
|
|
96
|
+
const res = await fetch(
|
|
97
|
+
`https://app.tempivo.com/api/v1/devices/config-profiles/${slug}`,
|
|
98
|
+
{ headers: { Authorization: `Bearer ${apiKey}` } }
|
|
99
|
+
);
|
|
100
|
+
const body = await res.json();
|
|
101
|
+
const cfg = configurationFromApiProfile(body); // or body.profile
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
On the phone, after `connect(qr)`:
|
|
105
|
+
|
|
106
|
+
```kotlin
|
|
107
|
+
session.setConfigurationJson(profileJson) // GET body or profile object
|
|
108
|
+
session.triggerTransmission()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
BLE does not write measurement interval, transmission interval, server, APN, name, or token.
|
|
112
|
+
|
|
113
|
+
## Node / TypeScript helpers
|
|
16
114
|
|
|
17
115
|
```ts
|
|
18
116
|
import {
|
|
19
|
-
TEMPVO_SENSOR_MANUFACTURER_ID,
|
|
20
117
|
normalizeManufacturerBytes,
|
|
21
118
|
decodeSensorBeaconPayload,
|
|
119
|
+
parseSensorQrJson,
|
|
120
|
+
parseSensorConfigurationJson,
|
|
22
121
|
} from '@tempivo/sensor-beacon';
|
|
23
122
|
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
123
|
+
const qr = parseSensorQrJson('{"sn":"282C024F0012","pin":"111111","model":"HC7"}');
|
|
124
|
+
const reading = decodeSensorBeaconPayload(normalizeManufacturerBytes(advertisementBytes));
|
|
125
|
+
const cfg = parseSensorConfigurationJson(/* config JSON above */);
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Invalid QR or config throws `TempivoSensorError` (`invalidQr`, `invalidPin`, `invalidConfig`).
|
|
129
|
+
|
|
130
|
+
## Android (GATT)
|
|
131
|
+
|
|
132
|
+
`connect` / `setConfigurationJson` / `triggerTransmission` are `suspend`. Request `BLUETOOTH_SCAN` and `BLUETOOTH_CONNECT` (API 31+) or location on older APIs.
|
|
133
|
+
|
|
134
|
+
```kotlin
|
|
135
|
+
val qr = TempivoSensorQrParser.parse(stickerQrText)
|
|
136
|
+
val session = TempivoSensorSession(context)
|
|
137
|
+
|
|
138
|
+
session.connect(qr)
|
|
139
|
+
try {
|
|
140
|
+
session.setConfigurationJson(profileJson)
|
|
141
|
+
val trigger = session.triggerTransmission()
|
|
142
|
+
val applied = session.getConfiguration()
|
|
143
|
+
val cal = session.getCalibration()
|
|
144
|
+
} finally {
|
|
145
|
+
session.disconnect()
|
|
29
146
|
}
|
|
30
147
|
```
|
|
31
148
|
|
|
32
|
-
|
|
149
|
+
**`triggerTransmission()`**
|
|
33
150
|
|
|
34
|
-
|
|
151
|
+
| Field | Meaning |
|
|
152
|
+
|-------|---------|
|
|
153
|
+
| `ok` | Device accepted the uplink request. |
|
|
154
|
+
| `supported` | Firmware implements the command. `false` is not an error. |
|
|
35
155
|
|
|
36
|
-
|
|
37
|
-
2. Read manufacturer specific data for **0x026C**.
|
|
38
|
-
3. Call `normalizeManufacturerBytes` then `decodeSensorBeaconPayload`, or cache frames with `ingestManufacturerPayload` and merge with `buildSensorBeaconReading`.
|
|
156
|
+
**`getCalibration()`**
|
|
39
157
|
|
|
40
|
-
|
|
158
|
+
| Field | Meaning |
|
|
159
|
+
|-------|---------|
|
|
160
|
+
| `laboratoryCalibrationDate` | ISO date (`YYYY-MM-DD`), or null if unset. |
|
|
161
|
+
| `laboratoryCalibrationTimestamp` | Same instant as unix seconds, or null. No expiry field on the device. |
|
|
41
162
|
|
|
42
|
-
|
|
43
|
-
- **`0x04` frame** (scan response): measurement slots (temperature, humidity, CO₂, etc.).
|
|
163
|
+
## iOS (GATT)
|
|
44
164
|
|
|
45
|
-
|
|
165
|
+
Needs a physical device and the native `TempivoSensorBridge` XCFramework (`scripts/build-ios-bridge.sh`). Set **`NSBluetoothAlwaysUsageDescription`** in Info.plist. Simulator can scan advertisements only.
|
|
46
166
|
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
167
|
+
```swift
|
|
168
|
+
let qr = try TempivoSensorQrParser.parse(stickerQrText)
|
|
169
|
+
let session = TempivoSensorSession()
|
|
170
|
+
try session.connect(qr: qr)
|
|
171
|
+
defer { session.disconnect() }
|
|
172
|
+
try session.setConfigurationJson(profileJson)
|
|
173
|
+
_ = try session.triggerTransmission()
|
|
174
|
+
let applied = try session.getConfiguration()
|
|
175
|
+
let cal = try session.getCalibration()
|
|
176
|
+
```
|
|
54
177
|
|
|
55
|
-
|
|
56
|
-
const macKey = macKeyFromAddress('28:2C:02:4F:00:12');
|
|
178
|
+
## Advertising (no pairing)
|
|
57
179
|
|
|
58
|
-
|
|
59
|
-
ingestManufacturerPayload(scanPayload, macKey, cache);
|
|
180
|
+
Filter manufacturer data on company id **0x026C**. Use **active scanning** so scan-response packets arrive. Product model is **not** in the broadcast. Connect uses QR `model` (HC7 is modern GATT).
|
|
60
181
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
)
|
|
182
|
+
```kotlin
|
|
183
|
+
val scanner = TempivoSensorBeaconScanner(context)
|
|
184
|
+
scanner.startScan { device ->
|
|
185
|
+
Log.d("scan", "${device.serialNumber} rssi=${device.rssi} ${device.summary}")
|
|
186
|
+
}
|
|
65
187
|
```
|
|
66
188
|
|
|
67
|
-
|
|
189
|
+
**Android `TempivoSensorBeaconDevice`**
|
|
190
|
+
|
|
191
|
+
| Field | Meaning |
|
|
192
|
+
|-------|---------|
|
|
193
|
+
| `deviceId` | Android BLE address. Often randomized. Not the sticker serial. |
|
|
194
|
+
| `bluetoothMacAddress` | MAC from the advertisement, with colons. |
|
|
195
|
+
| `serialNumber` | 12 hex chars from advertisement frame `0x03`. Same as QR `sn`. |
|
|
196
|
+
| `rssi` | Signal strength in dBm. |
|
|
197
|
+
| `summary` | Short display line. After scan response: measurement texts joined with ` · `. Before that: serial, or `Adv OK. Wait for scan response (measurements).` |
|
|
198
|
+
| `telemetry` | Decoded frames `0x03` + `0x04`, or null until enough bytes arrive. |
|
|
199
|
+
|
|
200
|
+
**`telemetry` (Android) / `reading` (iOS and Node)**
|
|
201
|
+
|
|
202
|
+
| Field | Meaning |
|
|
203
|
+
|-------|---------|
|
|
204
|
+
| `firmware` | `major.minor.patch` from the advertisement, e.g. `7.3.4`. |
|
|
205
|
+
| `batteryOk` | Battery status flag from the advertisement. |
|
|
206
|
+
| `encryptionEnabled` | Advertisement payload encryption flag. |
|
|
207
|
+
| `cellularStatus` | `ble_only`, `cell_ok`, `no_server`, or `net_issue`. |
|
|
208
|
+
| `readingTimestampUnix` | Sample time as unix seconds, or null. |
|
|
209
|
+
| `readingTimestampIso` | Same instant as UTC ISO-8601, or null. |
|
|
210
|
+
| `measurementIntervalSeconds` | Sample interval from the advertisement, in seconds. |
|
|
211
|
+
| `readings` | Decoded scan-response slots (see below). |
|
|
212
|
+
| `readingsCount` | Number of measurement slots. |
|
|
213
|
+
| `summary` | Same short line as on the device object. |
|
|
214
|
+
| `measurementCounter` | Counter from frame `0x03`, or null. |
|
|
215
|
+
|
|
216
|
+
Node also exposes `serialMac`, `temperatures[]`, `humidity`, and `rawHex`.
|
|
217
|
+
|
|
218
|
+
**Each `readings[]` / `measurements[]` slot**
|
|
219
|
+
|
|
220
|
+
| Field | Meaning |
|
|
221
|
+
|-------|---------|
|
|
222
|
+
| `typeHex` | Slot type, e.g. `0x01` temperature, `0x02` humidity. |
|
|
223
|
+
| `raw24` | Undecoded 24-bit payload. |
|
|
224
|
+
| `text` | Display value with unit, e.g. `21.8 °C`. No type name in the string. |
|
|
225
|
+
| `temperatureC` / `humidityPct` | Node only: numeric value when the slot is that type. |
|
|
226
|
+
|
|
227
|
+
iOS `SensorBeaconDiscovery` has `deviceId`, `rssi`, `serialNumber`, `bluetoothMacAddress`, and `reading` (same telemetry fields).
|
|
228
|
+
|
|
229
|
+
```swift
|
|
230
|
+
func sensorBeaconScanner(_ scanner: TempivoSensorBeaconScanner, didDiscover discovery: SensorBeaconDiscovery) {
|
|
231
|
+
print(discovery.serialNumber ?? "", discovery.rssi, discovery.reading?.summary ?? "")
|
|
232
|
+
}
|
|
233
|
+
```
|
|
68
234
|
|
|
69
|
-
|
|
70
|
-
|--------|---------|
|
|
71
|
-
| `TEMPVO_SENSOR_MANUFACTURER_ID` | BLE company id `0x026c` |
|
|
72
|
-
| `normalizeManufacturerBytes` | Strip company id prefix when present |
|
|
73
|
-
| `decodeSensorBeaconPayload` | One-shot decode of payload bytes |
|
|
74
|
-
| `ingestManufacturerPayload` | Update frame cache from one advertisement |
|
|
75
|
-
| `buildSensorBeaconReading` | Merge cached `0x03` / `0x04` frames |
|
|
76
|
-
| `SensorBeaconReading` | Parsed device + measurements |
|
|
77
|
-
| `SensorBeaconMeasurement` | One slot in `0x04` scan data |
|
|
78
|
-
| `SensorBeaconFrameCache` | Per-device last `0x03` / `0x04` frames |
|
|
235
|
+
## Errors
|
|
79
236
|
|
|
80
|
-
|
|
237
|
+
Native GATT maps to: `invalidPin`, `invalidQr`, `invalidConfig`, `notConnected`, `unsupportedCommand`, `connectFailed`, `runtimeUnavailable`, `unknown`.
|
|
81
238
|
|
|
82
|
-
##
|
|
239
|
+
## Tests
|
|
83
240
|
|
|
84
|
-
|
|
241
|
+
```bash
|
|
242
|
+
npm run test:unit
|
|
243
|
+
```
|
|
85
244
|
|
|
86
245
|
## License
|
|
87
246
|
|
|
Binary file
|
package/android/gradlew
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# Copyright © 2015-2021 the original authors.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
19
|
+
#
|
|
20
|
+
|
|
21
|
+
##############################################################################
|
|
22
|
+
#
|
|
23
|
+
# Gradle start up script for POSIX generated by Gradle.
|
|
24
|
+
#
|
|
25
|
+
# Important for running:
|
|
26
|
+
#
|
|
27
|
+
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
|
28
|
+
# noncompliant, but you have some other compliant shell such as ksh or
|
|
29
|
+
# bash, then to run this script, type that shell name before the whole
|
|
30
|
+
# command line, like:
|
|
31
|
+
#
|
|
32
|
+
# ksh Gradle
|
|
33
|
+
#
|
|
34
|
+
# Busybox and similar reduced shells will NOT work, because this script
|
|
35
|
+
# requires all of these POSIX shell features:
|
|
36
|
+
# * functions;
|
|
37
|
+
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
|
38
|
+
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
|
39
|
+
# * compound commands having a testable exit status, especially «case»;
|
|
40
|
+
# * various built-in commands including «command», «set», and «ulimit».
|
|
41
|
+
#
|
|
42
|
+
# Important for patching:
|
|
43
|
+
#
|
|
44
|
+
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
|
45
|
+
# by Bash, Ksh, etc; in particular arrays are avoided.
|
|
46
|
+
#
|
|
47
|
+
# The "traditional" practice of packing multiple parameters into a
|
|
48
|
+
# space-separated string is a well documented source of bugs and security
|
|
49
|
+
# problems, so this is (mostly) avoided, by progressively accumulating
|
|
50
|
+
# options in "$@", and eventually passing that to Java.
|
|
51
|
+
#
|
|
52
|
+
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
|
53
|
+
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
|
54
|
+
# see the in-line comments for details.
|
|
55
|
+
#
|
|
56
|
+
# There are tweaks for specific operating systems such as AIX, CygWin,
|
|
57
|
+
# Darwin, MinGW, and NonStop.
|
|
58
|
+
#
|
|
59
|
+
# (3) This script is generated from the Groovy template
|
|
60
|
+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
|
61
|
+
# within the Gradle project.
|
|
62
|
+
#
|
|
63
|
+
# You can find Gradle at https://github.com/gradle/gradle/.
|
|
64
|
+
#
|
|
65
|
+
##############################################################################
|
|
66
|
+
|
|
67
|
+
# Attempt to set APP_HOME
|
|
68
|
+
|
|
69
|
+
# Resolve links: $0 may be a link
|
|
70
|
+
app_path=$0
|
|
71
|
+
|
|
72
|
+
# Need this for daisy-chained symlinks.
|
|
73
|
+
while
|
|
74
|
+
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
|
75
|
+
[ -h "$app_path" ]
|
|
76
|
+
do
|
|
77
|
+
ls=$( ls -ld "$app_path" )
|
|
78
|
+
link=${ls#*' -> '}
|
|
79
|
+
case $link in #(
|
|
80
|
+
/*) app_path=$link ;; #(
|
|
81
|
+
*) app_path=$APP_HOME$link ;;
|
|
82
|
+
esac
|
|
83
|
+
done
|
|
84
|
+
|
|
85
|
+
# This is normally unused
|
|
86
|
+
# shellcheck disable=SC2034
|
|
87
|
+
APP_BASE_NAME=${0##*/}
|
|
88
|
+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
|
89
|
+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
|
90
|
+
|
|
91
|
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
92
|
+
MAX_FD=maximum
|
|
93
|
+
|
|
94
|
+
warn () {
|
|
95
|
+
echo "$*"
|
|
96
|
+
} >&2
|
|
97
|
+
|
|
98
|
+
die () {
|
|
99
|
+
echo
|
|
100
|
+
echo "$*"
|
|
101
|
+
echo
|
|
102
|
+
exit 1
|
|
103
|
+
} >&2
|
|
104
|
+
|
|
105
|
+
# OS specific support (must be 'true' or 'false').
|
|
106
|
+
cygwin=false
|
|
107
|
+
msys=false
|
|
108
|
+
darwin=false
|
|
109
|
+
nonstop=false
|
|
110
|
+
case "$( uname )" in #(
|
|
111
|
+
CYGWIN* ) cygwin=true ;; #(
|
|
112
|
+
Darwin* ) darwin=true ;; #(
|
|
113
|
+
MSYS* | MINGW* ) msys=true ;; #(
|
|
114
|
+
NONSTOP* ) nonstop=true ;;
|
|
115
|
+
esac
|
|
116
|
+
|
|
117
|
+
CLASSPATH="\\\"\\\""
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
# Determine the Java command to use to start the JVM.
|
|
121
|
+
if [ -n "$JAVA_HOME" ] ; then
|
|
122
|
+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
123
|
+
# IBM's JDK on AIX uses strange locations for the executables
|
|
124
|
+
JAVACMD=$JAVA_HOME/jre/sh/java
|
|
125
|
+
else
|
|
126
|
+
JAVACMD=$JAVA_HOME/bin/java
|
|
127
|
+
fi
|
|
128
|
+
if [ ! -x "$JAVACMD" ] ; then
|
|
129
|
+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
|
130
|
+
|
|
131
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
132
|
+
location of your Java installation."
|
|
133
|
+
fi
|
|
134
|
+
else
|
|
135
|
+
JAVACMD=java
|
|
136
|
+
if ! command -v java >/dev/null 2>&1
|
|
137
|
+
then
|
|
138
|
+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
139
|
+
|
|
140
|
+
Please set the JAVA_HOME variable in your environment to match the
|
|
141
|
+
location of your Java installation."
|
|
142
|
+
fi
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
# Increase the maximum file descriptors if we can.
|
|
146
|
+
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|
147
|
+
case $MAX_FD in #(
|
|
148
|
+
max*)
|
|
149
|
+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
|
150
|
+
# shellcheck disable=SC2039,SC3045
|
|
151
|
+
MAX_FD=$( ulimit -H -n ) ||
|
|
152
|
+
warn "Could not query maximum file descriptor limit"
|
|
153
|
+
esac
|
|
154
|
+
case $MAX_FD in #(
|
|
155
|
+
'' | soft) :;; #(
|
|
156
|
+
*)
|
|
157
|
+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
|
158
|
+
# shellcheck disable=SC2039,SC3045
|
|
159
|
+
ulimit -n "$MAX_FD" ||
|
|
160
|
+
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
|
161
|
+
esac
|
|
162
|
+
fi
|
|
163
|
+
|
|
164
|
+
# Collect all arguments for the java command, stacking in reverse order:
|
|
165
|
+
# * args from the command line
|
|
166
|
+
# * the main class name
|
|
167
|
+
# * -classpath
|
|
168
|
+
# * -D...appname settings
|
|
169
|
+
# * --module-path (only if needed)
|
|
170
|
+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
|
171
|
+
|
|
172
|
+
# For Cygwin or MSYS, switch paths to Windows format before running java
|
|
173
|
+
if "$cygwin" || "$msys" ; then
|
|
174
|
+
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
|
175
|
+
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
|
176
|
+
|
|
177
|
+
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
|
178
|
+
|
|
179
|
+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
|
180
|
+
for arg do
|
|
181
|
+
if
|
|
182
|
+
case $arg in #(
|
|
183
|
+
-*) false ;; # don't mess with options #(
|
|
184
|
+
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
|
185
|
+
[ -e "$t" ] ;; #(
|
|
186
|
+
*) false ;;
|
|
187
|
+
esac
|
|
188
|
+
then
|
|
189
|
+
arg=$( cygpath --path --ignore --mixed "$arg" )
|
|
190
|
+
fi
|
|
191
|
+
# Roll the args list around exactly as many times as the number of
|
|
192
|
+
# args, so each arg winds up back in the position where it started, but
|
|
193
|
+
# possibly modified.
|
|
194
|
+
#
|
|
195
|
+
# NB: a `for` loop captures its iteration list before it begins, so
|
|
196
|
+
# changing the positional parameters here affects neither the number of
|
|
197
|
+
# iterations, nor the values presented in `arg`.
|
|
198
|
+
shift # remove old arg
|
|
199
|
+
set -- "$@" "$arg" # push replacement arg
|
|
200
|
+
done
|
|
201
|
+
fi
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
205
|
+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
206
|
+
|
|
207
|
+
# Collect all arguments for the java command:
|
|
208
|
+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
|
209
|
+
# and any embedded shellness will be escaped.
|
|
210
|
+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
|
211
|
+
# treated as '${Hostname}' itself on the command line.
|
|
212
|
+
|
|
213
|
+
set -- \
|
|
214
|
+
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
|
215
|
+
-classpath "$CLASSPATH" \
|
|
216
|
+
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
|
217
|
+
"$@"
|
|
218
|
+
|
|
219
|
+
# Stop when "xargs" is not available.
|
|
220
|
+
if ! command -v xargs >/dev/null 2>&1
|
|
221
|
+
then
|
|
222
|
+
die "xargs is not available"
|
|
223
|
+
fi
|
|
224
|
+
|
|
225
|
+
# Use "xargs" to parse quoted args.
|
|
226
|
+
#
|
|
227
|
+
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
|
228
|
+
#
|
|
229
|
+
# In Bash we could simply go:
|
|
230
|
+
#
|
|
231
|
+
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
|
232
|
+
# set -- "${ARGS[@]}" "$@"
|
|
233
|
+
#
|
|
234
|
+
# but POSIX shell has neither arrays nor command substitution, so instead we
|
|
235
|
+
# post-process each arg (as a line of input to sed) to backslash-escape any
|
|
236
|
+
# character that might be a shell metacharacter, then use eval to reverse
|
|
237
|
+
# that process (while maintaining the separation between arguments), and wrap
|
|
238
|
+
# the whole thing up as a single "set" statement.
|
|
239
|
+
#
|
|
240
|
+
# This will of course break if any of these variables contains a newline or
|
|
241
|
+
# an unmatched quote.
|
|
242
|
+
#
|
|
243
|
+
|
|
244
|
+
eval "set -- $(
|
|
245
|
+
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
|
246
|
+
xargs -n1 |
|
|
247
|
+
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
|
248
|
+
tr '\n' ' '
|
|
249
|
+
)" '"$@"'
|
|
250
|
+
|
|
251
|
+
exec "$JAVACMD" "$@"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
plugins {
|
|
2
|
+
id "com.android.library"
|
|
3
|
+
id "org.jetbrains.kotlin.android"
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
android {
|
|
7
|
+
namespace "com.tempivo.sensor.beacon"
|
|
8
|
+
compileSdk 36
|
|
9
|
+
|
|
10
|
+
defaultConfig {
|
|
11
|
+
minSdk 26
|
|
12
|
+
consumerProguardFiles "consumer-rules.pro"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
compileOptions {
|
|
16
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
17
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
kotlinOptions {
|
|
21
|
+
jvmTarget = "17"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
dependencies {
|
|
26
|
+
implementation "androidx.core:core-ktx:1.17.0"
|
|
27
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2"
|
|
28
|
+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2"
|
|
29
|
+
implementation "pl.efento.mobile:bluetooth:2.3.0"
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Partner apps keep com.tempivo.sensor.beacon types.
|