@dg-kit/protocol 1.6.0 → 1.7.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/dist/civet-edging.d.ts.map +1 -1
- package/dist/civet-edging.js +8 -30
- package/dist/civet-edging.js.map +1 -1
- package/dist/gatt-utils.d.ts +28 -0
- package/dist/gatt-utils.d.ts.map +1 -1
- package/dist/gatt-utils.js +57 -1
- package/dist/gatt-utils.js.map +1 -1
- package/dist/paw-prints.d.ts +0 -1
- package/dist/paw-prints.d.ts.map +1 -1
- package/dist/paw-prints.js +18 -34
- package/dist/paw-prints.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"civet-edging.d.ts","sourceRoot":"","sources":["../src/civet-edging.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,KAAK,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"civet-edging.d.ts","sourceRoot":"","sources":["../src/civet-edging.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,KAAK,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAS1F;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,KAAK,eAAe,GAAG,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;AAC/D,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAElD;;;;;;GAMG;AACH,qBAAa,0BAA2B,YAAW,yBAAyB,CAAC,oBAAoB,CAAC;IAChG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA8B;IAC/D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;IAE3D,OAAO,CAAC,KAAK,CAAyC;IACtD,OAAO,CAAC,SAAS,CAAsD;IACvE,OAAO,CAAC,UAAU,CAAsD;IACxE,mIAAmI;IACnI,OAAO,CAAC,SAAS,CAAS;IAEpB,WAAW,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BlE,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAUrC,QAAQ,IAAI,WAAW;IAIvB,SAAS,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,IAAI;IAOhD,cAAc,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,IAAI;IAOnD,gFAAgF;IAC1E,sBAAsB,CAAC,KAAK,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzD,+EAA+E;IACzE,qBAAqB,CAAC,KAAK,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxD;;;;;;;;OAQG;IACG,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrD,8EAA8E;IACxE,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAKpC,gEAAgE;IAC1D,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtD,OAAO,CAAC,4BAA4B;YAStB,KAAK;IAOnB,OAAO,CAAC,SAAS;IAOjB,QAAQ,CAAC,kBAAkB,GAAI,OAAO,KAAK,KAAG,IAAI,CAWhD;CACH"}
|
package/dist/civet-edging.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createEmptySensorState } from '@dg-kit/core';
|
|
2
|
-
import {
|
|
3
|
-
import { clampIndicatorColor, performV3FamilyConnectHandshake, writeCharacteristicValue, } from './gatt-utils.js';
|
|
2
|
+
import { clampIndicatorColor, connectSensorGatt, disconnectSensorGatt, writeCharacteristicValue, } from './gatt-utils.js';
|
|
4
3
|
/**
|
|
5
4
|
* Web Bluetooth adapter for the Civet Edging Sensor.
|
|
6
5
|
*
|
|
@@ -18,27 +17,14 @@ export class CivetPressureSensorAdapter {
|
|
|
18
17
|
streaming = false;
|
|
19
18
|
async onConnected(context) {
|
|
20
19
|
try {
|
|
21
|
-
const
|
|
22
|
-
this.writeChar =
|
|
23
|
-
this.notifyChar =
|
|
24
|
-
await this.notifyChar.startNotifications();
|
|
25
|
-
this.notifyChar.addEventListener('characteristicvaluechanged', this.handleNotification);
|
|
26
|
-
await performV3FamilyConnectHandshake(context.server, this.writeChar);
|
|
27
|
-
let battery = 0;
|
|
28
|
-
try {
|
|
29
|
-
const batteryService = await context.server.getPrimaryService(V3_BATTERY_SERVICE);
|
|
30
|
-
const batteryChar = await batteryService.getCharacteristic(V3_BATTERY_CHAR);
|
|
31
|
-
const value = await batteryChar.readValue();
|
|
32
|
-
battery = value.getUint8(0);
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
battery = 0;
|
|
36
|
-
}
|
|
20
|
+
const connection = await connectSensorGatt(context, this.handleNotification);
|
|
21
|
+
this.writeChar = connection.writeChar;
|
|
22
|
+
this.notifyChar = connection.notifyChar;
|
|
37
23
|
this.state = {
|
|
38
24
|
connected: true,
|
|
39
|
-
deviceName:
|
|
40
|
-
address:
|
|
41
|
-
battery,
|
|
25
|
+
deviceName: connection.deviceName,
|
|
26
|
+
address: connection.address,
|
|
27
|
+
battery: connection.battery,
|
|
42
28
|
};
|
|
43
29
|
this.emitState();
|
|
44
30
|
// Auto-start streaming right after connecting so the adapter is
|
|
@@ -54,15 +40,7 @@ export class CivetPressureSensorAdapter {
|
|
|
54
40
|
}
|
|
55
41
|
}
|
|
56
42
|
async onDisconnected() {
|
|
57
|
-
|
|
58
|
-
this.notifyChar.removeEventListener('characteristicvaluechanged', this.handleNotification);
|
|
59
|
-
try {
|
|
60
|
-
await this.notifyChar.stopNotifications();
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
// best-effort: device may already be gone.
|
|
64
|
-
}
|
|
65
|
-
}
|
|
43
|
+
await disconnectSensorGatt(this.notifyChar, this.handleNotification);
|
|
66
44
|
this.writeChar = null;
|
|
67
45
|
this.notifyChar = null;
|
|
68
46
|
this.streaming = false;
|
package/dist/civet-edging.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"civet-edging.js","sourceRoot":"","sources":["../src/civet-edging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAoB,MAAM,cAAc,CAAC;AAExE,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"civet-edging.js","sourceRoot":"","sources":["../src/civet-edging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAoB,MAAM,cAAc,CAAC;AAExE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,iBAAiB,CAAC;AAmBzB;;;;;;GAMG;AACH,MAAM,OAAO,0BAA0B;IACpB,gBAAgB,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC9C,cAAc,GAAG,IAAI,GAAG,EAAiB,CAAC;IAEnD,KAAK,GAAgB,sBAAsB,EAAE,CAAC;IAC9C,SAAS,GAAiD,IAAI,CAAC;IAC/D,UAAU,GAAiD,IAAI,CAAC;IACxE,mIAAmI;IAC3H,SAAS,GAAG,KAAK,CAAC;IAE1B,KAAK,CAAC,WAAW,CAAC,OAAsC;QACtD,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC7E,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;YACtC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;YAExC,IAAI,CAAC,KAAK,GAAG;gBACX,SAAS,EAAE,IAAI;gBACf,UAAU,EAAE,UAAU,CAAC,UAAU;gBACjC,OAAO,EAA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,EAAE,CAAC;YAC7C,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,CAAC;CACH"}
|
package/dist/gatt-utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WebBluetoothConnectionContext } from './base.js';
|
|
1
2
|
import type { BluetoothRemoteGATTCharacteristicLike, BluetoothRemoteGATTServerLike } from './types.js';
|
|
2
3
|
/**
|
|
3
4
|
* Shared GATT write with a fallback chain across the three write methods a
|
|
@@ -39,4 +40,31 @@ export declare function performV3FamilyConnectHandshake(server: BluetoothRemoteG
|
|
|
39
40
|
* color picker would otherwise reach the wire unclamped).
|
|
40
41
|
*/
|
|
41
42
|
export declare function clampIndicatorColor(color: number): number;
|
|
43
|
+
export interface SensorGattConnection {
|
|
44
|
+
writeChar: BluetoothRemoteGATTCharacteristicLike;
|
|
45
|
+
notifyChar: BluetoothRemoteGATTCharacteristicLike;
|
|
46
|
+
deviceName: string;
|
|
47
|
+
address: string;
|
|
48
|
+
battery: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Shared connect sequence for the sensor-family adapters (paw-prints,
|
|
52
|
+
* civet-edging): open the shared 0x180C write/notify characteristics, wire
|
|
53
|
+
* the notification listener, run the V3-family handshake, then a
|
|
54
|
+
* best-effort battery read. Both adapters had this exact sequence
|
|
55
|
+
* byte-for-byte duplicated before this was extracted — kept as a plain
|
|
56
|
+
* function (not a base class) so each adapter's own `onConnected` keeps
|
|
57
|
+
* full control over how/when it constructs and emits its `SensorState`,
|
|
58
|
+
* which differs subtly between them (e.g. paw-prints resets stale chars
|
|
59
|
+
* before a fresh attempt; civet-edging auto-starts pressure streaming right
|
|
60
|
+
* after) and shouldn't be forced into a shared shape.
|
|
61
|
+
*/
|
|
62
|
+
export declare function connectSensorGatt(context: WebBluetoothConnectionContext, onNotification: (event: Event) => void): Promise<SensorGattConnection>;
|
|
63
|
+
/**
|
|
64
|
+
* Shared teardown counterpart to `connectSensorGatt` — removes the
|
|
65
|
+
* notification listener and best-effort stops notifications. Safe to call
|
|
66
|
+
* with `notifyChar: null` (e.g. disconnecting before a connection attempt
|
|
67
|
+
* ever got this far).
|
|
68
|
+
*/
|
|
69
|
+
export declare function disconnectSensorGatt(notifyChar: BluetoothRemoteGATTCharacteristicLike | null, onNotification: (event: Event) => void): Promise<void>;
|
|
42
70
|
//# sourceMappingURL=gatt-utils.d.ts.map
|
package/dist/gatt-utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatt-utils.d.ts","sourceRoot":"","sources":["../src/gatt-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gatt-utils.d.ts","sourceRoot":"","sources":["../src/gatt-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,WAAW,CAAC;AAc/D,OAAO,KAAK,EAAE,qCAAqC,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAEvG;;;;;;;GAOG;AACH,wBAAsB,wBAAwB,CAC5C,cAAc,EAAE,qCAAqC,EACrD,KAAK,EAAE,eAAe,GAAG,WAAW,EACpC,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GACzC,OAAO,CAAC,IAAI,CAAC,CAyBf;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,+BAA+B,CACnD,MAAM,EAAE,6BAA6B,EACrC,SAAS,EAAE,qCAAqC,GAC/C,OAAO,CAAC,IAAI,CAAC,CA4Bf;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIzD;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,qCAAqC,CAAC;IACjD,UAAU,EAAE,qCAAqC,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,6BAA6B,EACtC,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GACrC,OAAO,CAAC,oBAAoB,CAAC,CA4B/B;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,qCAAqC,GAAG,IAAI,EACxD,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GACrC,OAAO,CAAC,IAAI,CAAC,CAQf"}
|
package/dist/gatt-utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V3_HANDSHAKE_MTU, V3_INIT_PACKET, V3_LEGACY_NOTIFY_CHAR, V3_LEGACY_SERVICE, V3_NORDIC_OTA_CHAR, V3_NORDIC_OTA_SERVICE, } from './constants.js';
|
|
1
|
+
import { V3_BATTERY_CHAR, V3_BATTERY_SERVICE, V3_HANDSHAKE_MTU, V3_INIT_PACKET, V3_LEGACY_NOTIFY_CHAR, V3_LEGACY_SERVICE, V3_NORDIC_OTA_CHAR, V3_NORDIC_OTA_SERVICE, V3_NOTIFY_CHAR, V3_PRIMARY_SERVICE, V3_WRITE_CHAR, } from './constants.js';
|
|
2
2
|
/**
|
|
3
3
|
* Shared GATT write with a fallback chain across the three write methods a
|
|
4
4
|
* characteristic might expose. Standalone (not a class method) so every
|
|
@@ -96,4 +96,60 @@ export function clampIndicatorColor(color) {
|
|
|
96
96
|
return 0;
|
|
97
97
|
return Math.max(0, Math.min(7, Math.round(value)));
|
|
98
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Shared connect sequence for the sensor-family adapters (paw-prints,
|
|
101
|
+
* civet-edging): open the shared 0x180C write/notify characteristics, wire
|
|
102
|
+
* the notification listener, run the V3-family handshake, then a
|
|
103
|
+
* best-effort battery read. Both adapters had this exact sequence
|
|
104
|
+
* byte-for-byte duplicated before this was extracted — kept as a plain
|
|
105
|
+
* function (not a base class) so each adapter's own `onConnected` keeps
|
|
106
|
+
* full control over how/when it constructs and emits its `SensorState`,
|
|
107
|
+
* which differs subtly between them (e.g. paw-prints resets stale chars
|
|
108
|
+
* before a fresh attempt; civet-edging auto-starts pressure streaming right
|
|
109
|
+
* after) and shouldn't be forced into a shared shape.
|
|
110
|
+
*/
|
|
111
|
+
export async function connectSensorGatt(context, onNotification) {
|
|
112
|
+
const primaryService = await context.server.getPrimaryService(V3_PRIMARY_SERVICE);
|
|
113
|
+
const writeChar = await primaryService.getCharacteristic(V3_WRITE_CHAR);
|
|
114
|
+
const notifyChar = await primaryService.getCharacteristic(V3_NOTIFY_CHAR);
|
|
115
|
+
await notifyChar.startNotifications();
|
|
116
|
+
notifyChar.addEventListener('characteristicvaluechanged', onNotification);
|
|
117
|
+
await performV3FamilyConnectHandshake(context.server, writeChar);
|
|
118
|
+
let battery = 0;
|
|
119
|
+
try {
|
|
120
|
+
const batteryService = await context.server.getPrimaryService(V3_BATTERY_SERVICE);
|
|
121
|
+
const batteryChar = await batteryService.getCharacteristic(V3_BATTERY_CHAR);
|
|
122
|
+
const value = await batteryChar.readValue();
|
|
123
|
+
battery = value.getUint8(0);
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
// Best-effort — some firmware/pairing states expose the service but
|
|
127
|
+
// reject the read; a failure here shouldn't fail the whole connection.
|
|
128
|
+
// `battery` already defaults to 0 above.
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
writeChar,
|
|
132
|
+
notifyChar,
|
|
133
|
+
deviceName: context.device.name ?? '',
|
|
134
|
+
address: context.device.id ?? '',
|
|
135
|
+
battery,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Shared teardown counterpart to `connectSensorGatt` — removes the
|
|
140
|
+
* notification listener and best-effort stops notifications. Safe to call
|
|
141
|
+
* with `notifyChar: null` (e.g. disconnecting before a connection attempt
|
|
142
|
+
* ever got this far).
|
|
143
|
+
*/
|
|
144
|
+
export async function disconnectSensorGatt(notifyChar, onNotification) {
|
|
145
|
+
if (!notifyChar)
|
|
146
|
+
return;
|
|
147
|
+
notifyChar.removeEventListener('characteristicvaluechanged', onNotification);
|
|
148
|
+
try {
|
|
149
|
+
await notifyChar.stopNotifications();
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
// best-effort: device may already be gone.
|
|
153
|
+
}
|
|
154
|
+
}
|
|
99
155
|
//# sourceMappingURL=gatt-utils.js.map
|
package/dist/gatt-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatt-utils.js","sourceRoot":"","sources":["../src/gatt-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gatt-utils.js","sourceRoot":"","sources":["../src/gatt-utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,cAAqD,EACrD,KAAoC,EACpC,UAAwC,EAAE;IAE1C,MAAM,QAAQ,GAAG,OAAO,CAAC,cAAc;QACrC,CAAC,CAAC;YACE,cAAc,CAAC,sBAAsB,EAAE,IAAI,CAAC,cAAc,CAAC;YAC3D,cAAc,CAAC,yBAAyB,EAAE,IAAI,CAAC,cAAc,CAAC;YAC9D,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC;SAChD;QACH,CAAC,CAAC;YACE,cAAc,CAAC,yBAAyB,EAAE,IAAI,CAAC,cAAc,CAAC;YAC9D,cAAc,CAAC,sBAAsB,EAAE,IAAI,CAAC,cAAc,CAAC;YAC3D,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC;SAChD,CAAC;IAEN,I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B,CAAC;IAAC,MAAM,CAAC;QACP,oEAAoE;QACpE,uEAAuE;QACvE,yCAAyC;IAC3C,CAAC;IAED,OAAO;QACL,SAAS;QACT,UAAU;QACV,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE;QACrC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE;QAChC,OAAO;KACR,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,UAAwD,EACxD,cAAsC;IAEtC,IAAI,CAAC,UAAU;QAAE,OAAO;IACxB,UAAU,CAAC,mBAAmB,CAAC,4BAA4B,EAAE,cAAc,CAAC,CAAC;IAC7E,IAAI,CAAC;QACH,MAAM,UAAU,CAAC,iBAAiB,EAAE,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,2CAA2C;IAC7C,CAAC;AACH,CAAC"}
|
package/dist/paw-prints.d.ts
CHANGED
|
@@ -51,7 +51,6 @@ export declare class PawPrintsSensorAdapter implements WebBluetoothSensorAdapter
|
|
|
51
51
|
private state;
|
|
52
52
|
private writeChar;
|
|
53
53
|
private notifyChar;
|
|
54
|
-
private batteryChar;
|
|
55
54
|
private readonly readingListeners;
|
|
56
55
|
private readonly stateListeners;
|
|
57
56
|
onConnected(context: WebBluetoothConnectionContext): Promise<void>;
|
package/dist/paw-prints.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paw-prints.d.ts","sourceRoot":"","sources":["../src/paw-prints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"paw-prints.d.ts","sourceRoot":"","sources":["../src/paw-prints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;A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AC,SAAS,CAAsD;IACvE,OAAO,CAAC,UAAU,CAAsD;IAExE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAuC;IACxE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAqC;IAE9D,WAAW,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BlE,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrC,QAAQ,IAAI,WAAW;IAIvB,SAAS,CAAC,QAAQ,EAAE,wBAAwB,GAAG,MAAM,IAAI;IAOzD,cAAc,CAAC,QAAQ,EAAE,sBAAsB,GAAG,MAAM,IAAI;IAO5D;;;;OAIG;IACG,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAWjF,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAIpC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAWjE,eAAe;IAmB7B,OAAO,CAAC,SAAS;YAOH,YAAY;IAO1B,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAWjC;IAEF,OAAO,CAAC,YAAY;CA8ErB"}
|
package/dist/paw-prints.js
CHANGED
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
* authoritative.
|
|
14
14
|
*/
|
|
15
15
|
import { createEmptySensorState } from '@dg-kit/core';
|
|
16
|
-
import {
|
|
17
|
-
import { clampIndicatorColor, performV3FamilyConnectHandshake, writeCharacteristicValue, } from './gatt-utils.js';
|
|
16
|
+
import { clampIndicatorColor, connectSensorGatt, disconnectSensorGatt, writeCharacteristicValue, } from './gatt-utils.js';
|
|
18
17
|
// Outbound command opcodes.
|
|
19
18
|
const CMD_CONFIGURE_TRIGGER = 0x50;
|
|
20
19
|
const CMD_RESET_PARAMETERS = 0x5f;
|
|
@@ -32,36 +31,30 @@ export class PawPrintsSensorAdapter {
|
|
|
32
31
|
state = createEmptySensorState();
|
|
33
32
|
writeChar = null;
|
|
34
33
|
notifyChar = null;
|
|
35
|
-
batteryChar = null;
|
|
36
34
|
readingListeners = new Set();
|
|
37
35
|
stateListeners = new Set();
|
|
38
36
|
async onConnected(context) {
|
|
39
37
|
await this.resetConnection(false);
|
|
38
|
+
// Set the attempted device's name/address optimistically, before GATT
|
|
39
|
+
// connect even starts — if connectSensorGatt() below throws partway
|
|
40
|
+
// through, resetConnection() still has a name/address to preserve, so a
|
|
41
|
+
// failed attempt is distinguishable from "never tried" rather than
|
|
42
|
+
// silently reverting to blank.
|
|
43
|
+
this.state = {
|
|
44
|
+
...createEmptySensorState(),
|
|
45
|
+
deviceName: context.device.name ?? '',
|
|
46
|
+
address: context.device.id ?? '',
|
|
47
|
+
};
|
|
40
48
|
try {
|
|
49
|
+
const connection = await connectSensorGatt(context, this.handleNotification);
|
|
50
|
+
this.writeChar = connection.writeChar;
|
|
51
|
+
this.notifyChar = connection.notifyChar;
|
|
41
52
|
this.state = {
|
|
42
|
-
...createEmptySensorState(),
|
|
43
53
|
connected: true,
|
|
44
|
-
deviceName:
|
|
45
|
-
address:
|
|
54
|
+
deviceName: connection.deviceName,
|
|
55
|
+
address: connection.address,
|
|
56
|
+
battery: connection.battery,
|
|
46
57
|
};
|
|
47
|
-
const primaryService = await context.server.getPrimaryService(V3_PRIMARY_SERVICE);
|
|
48
|
-
this.writeChar = await primaryService.getCharacteristic(V3_WRITE_CHAR);
|
|
49
|
-
this.notifyChar = await primaryService.getCharacteristic(V3_NOTIFY_CHAR);
|
|
50
|
-
await this.notifyChar.startNotifications();
|
|
51
|
-
this.notifyChar.addEventListener('characteristicvaluechanged', this.handleNotification);
|
|
52
|
-
await performV3FamilyConnectHandshake(context.server, this.writeChar);
|
|
53
|
-
// Battery read is best-effort: some firmware/pairing states expose the
|
|
54
|
-
// service but reject the read, so a failure here shouldn't fail the
|
|
55
|
-
// whole connection.
|
|
56
|
-
try {
|
|
57
|
-
const batteryService = await context.server.getPrimaryService(V3_BATTERY_SERVICE);
|
|
58
|
-
this.batteryChar = await batteryService.getCharacteristic(V3_BATTERY_CHAR);
|
|
59
|
-
const value = await this.batteryChar.readValue();
|
|
60
|
-
this.state = { ...this.state, battery: value.getUint8(0) };
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
this.state = { ...this.state, battery: 0 };
|
|
64
|
-
}
|
|
65
58
|
this.emitState();
|
|
66
59
|
}
|
|
67
60
|
catch (error) {
|
|
@@ -115,18 +108,9 @@ export class PawPrintsSensorAdapter {
|
|
|
115
108
|
await this.writeCommand(Uint8Array.of(CMD_LED_CONTROL, clampIndicatorColor(color1), clampIndicatorColor(color2), speed));
|
|
116
109
|
}
|
|
117
110
|
async resetConnection(emit) {
|
|
118
|
-
|
|
119
|
-
this.notifyChar.removeEventListener('characteristicvaluechanged', this.handleNotification);
|
|
120
|
-
try {
|
|
121
|
-
await this.notifyChar.stopNotifications();
|
|
122
|
-
}
|
|
123
|
-
catch {
|
|
124
|
-
// best effort — device may already be gone
|
|
125
|
-
}
|
|
126
|
-
}
|
|
111
|
+
await disconnectSensorGatt(this.notifyChar, this.handleNotification);
|
|
127
112
|
this.writeChar = null;
|
|
128
113
|
this.notifyChar = null;
|
|
129
|
-
this.batteryChar = null;
|
|
130
114
|
const previousDeviceName = this.state.deviceName;
|
|
131
115
|
const previousAddress = this.state.address;
|
|
132
116
|
this.state = {
|
package/dist/paw-prints.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paw-prints.js","sourceRoot":"","sources":["../src/paw-prints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,sBAAsB,EAAo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,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;oBAC1D,MAAM,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;iBAC7D,CAAC;YACJ,CAAC;YAED;gBACE,OAAO,IAAI,CAAC;QAChB,CAAC;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dg-kit/protocol",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "DG-Lab Coyote V2 / V3 BLE protocol adapters (transport-agnostic)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "0xNullAI",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@dg-kit/core": "1.
|
|
30
|
+
"@dg-kit/core": "1.7.0"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsc -p tsconfig.json",
|