tirecheck-device-sdk 0.2.55 → 0.2.56
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/index.cjs +28 -19
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +28 -19
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -670,7 +670,7 @@ const bluetooth = {
|
|
|
670
670
|
},
|
|
671
671
|
connect: connect$1,
|
|
672
672
|
disconnect: disconnect$1,
|
|
673
|
-
write,
|
|
673
|
+
write: write$1,
|
|
674
674
|
read
|
|
675
675
|
};
|
|
676
676
|
async function scanDevices(services = [], duration) {
|
|
@@ -746,7 +746,7 @@ async function disconnect$1(deviceId) {
|
|
|
746
746
|
store.setState(deviceId, void 0, "failedDisconnection");
|
|
747
747
|
throw new Error("Disconnect unsuccessful");
|
|
748
748
|
}
|
|
749
|
-
async function write(deviceId, serviceUuid, characteristicUuid, value, withResponse) {
|
|
749
|
+
async function write$1(deviceId, serviceUuid, characteristicUuid, value, withResponse) {
|
|
750
750
|
if (!toolsSvc.canCommunicateWith(deviceId)) throw new Error("Write Error: Not connected to device");
|
|
751
751
|
try {
|
|
752
752
|
const _deviceId = store.deviceIdMapingTable[deviceId] ?? deviceId;
|
|
@@ -3059,15 +3059,12 @@ async function setTpmsConfig(deviceId, config) {
|
|
|
3059
3059
|
const msg = `*TPMS CONFIG ${config}`;
|
|
3060
3060
|
return sendCommand(deviceId, msg);
|
|
3061
3061
|
}
|
|
3062
|
-
async function startTpmsScan(deviceId) {
|
|
3062
|
+
async function startTpmsScan(deviceId, filterBySensorId, time = 10) {
|
|
3063
3063
|
if (!canCommunicateWith(deviceId)) throw new Error("Flexi Gauge not connected");
|
|
3064
|
-
const
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
flexiGaugeTpmsMeta.communication.characteristicId,
|
|
3069
|
-
scanMsg
|
|
3070
|
-
);
|
|
3064
|
+
const massageParts = ["*TPMS ON"];
|
|
3065
|
+
if (filterBySensorId) massageParts.push(`FILTER=${filterBySensorId}`);
|
|
3066
|
+
if (time) massageParts.push(`TIME=${time}`);
|
|
3067
|
+
return write(deviceId, massageParts.join(" "));
|
|
3071
3068
|
}
|
|
3072
3069
|
async function getBattery(deviceId) {
|
|
3073
3070
|
const batteryValue = await bluetooth.read(
|
|
@@ -3102,13 +3099,8 @@ async function vdaRequestWriteAccess(deviceId, sensorId, signature) {
|
|
|
3102
3099
|
return sendCommand(deviceId, scanMsg);
|
|
3103
3100
|
}
|
|
3104
3101
|
async function vdaSendWriteModePin(deviceId) {
|
|
3105
|
-
const scanMsg =
|
|
3106
|
-
|
|
3107
|
-
deviceId,
|
|
3108
|
-
flexiGaugeTpmsMeta.communication.serviceId,
|
|
3109
|
-
flexiGaugeTpmsMeta.communication.characteristicId,
|
|
3110
|
-
scanMsg
|
|
3111
|
-
);
|
|
3102
|
+
const scanMsg = "*VDA_LF_SEND SID=A0 LID=AA PAR=00 DATA=FCCC71F6";
|
|
3103
|
+
return write(deviceId, scanMsg);
|
|
3112
3104
|
}
|
|
3113
3105
|
async function vdaReadConfiguration(deviceId) {
|
|
3114
3106
|
const scanMsg = "*VDA_LF_SEND SID=A0 LID=DA PAR=17";
|
|
@@ -3134,6 +3126,23 @@ async function sendCommand(deviceId, command) {
|
|
|
3134
3126
|
}
|
|
3135
3127
|
return String.fromCharCode(...result);
|
|
3136
3128
|
}
|
|
3129
|
+
async function write(deviceId, message, mtu = 20) {
|
|
3130
|
+
const payload = stringToDecimalArray(`${message}\r
|
|
3131
|
+
`);
|
|
3132
|
+
const chunks = [];
|
|
3133
|
+
for (let i = 0; i < payload.length; i += mtu) {
|
|
3134
|
+
chunks.push(payload.slice(i, i + mtu));
|
|
3135
|
+
}
|
|
3136
|
+
for (const chunk of chunks) {
|
|
3137
|
+
const convertedChunk = new Uint8Array(chunk);
|
|
3138
|
+
await bluetooth.write(
|
|
3139
|
+
deviceId,
|
|
3140
|
+
flexiGaugeTpmsMeta.communication.serviceId,
|
|
3141
|
+
flexiGaugeTpmsMeta.communication.characteristicId,
|
|
3142
|
+
convertedChunk.buffer
|
|
3143
|
+
);
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
3137
3146
|
function processMessage(deviceId, payload) {
|
|
3138
3147
|
promiseQueue.processMessage(deviceId, payload, getIdentifier$1, isComplete$1, isError$1);
|
|
3139
3148
|
}
|
|
@@ -3322,8 +3331,8 @@ const capabilities$1 = [
|
|
|
3322
3331
|
}
|
|
3323
3332
|
];
|
|
3324
3333
|
const flexiGaugeTpmsService = {
|
|
3325
|
-
startTpmsScan(deviceId) {
|
|
3326
|
-
flexiGaugeTpmsCommands.startTpmsScan(deviceId);
|
|
3334
|
+
startTpmsScan(deviceId, filterBySensorId, time = 10) {
|
|
3335
|
+
flexiGaugeTpmsCommands.startTpmsScan(deviceId, filterBySensorId, time);
|
|
3327
3336
|
},
|
|
3328
3337
|
getBattery(deviceId) {
|
|
3329
3338
|
return flexiGaugeTpmsCommands.getBattery(deviceId);
|
package/dist/index.d.cts
CHANGED
|
@@ -989,7 +989,7 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
|
|
|
989
989
|
onTpms: (callback: (deviceId: string, value: FgSensorReading | undefined) => void) => void;
|
|
990
990
|
getBattery: (deviceId: string) => Promise<number>;
|
|
991
991
|
getFirmwareVersion: (deviceId: string) => Promise<string>;
|
|
992
|
-
startTpmsScan: (deviceId: string) => void;
|
|
992
|
+
startTpmsScan: (deviceId: string, filterBySensorId?: string, time?: number) => void;
|
|
993
993
|
setSensorDisplayId: (deviceId: string, oldSensorId: string, newSensorId: string) => Promise<void>;
|
|
994
994
|
resetSensorDisplayId: (deviceId: string, sensorId: string) => Promise<void>;
|
|
995
995
|
getConfig: (deviceId: string) => Promise<FgConfig>;
|
package/dist/index.d.mts
CHANGED
|
@@ -989,7 +989,7 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
|
|
|
989
989
|
onTpms: (callback: (deviceId: string, value: FgSensorReading | undefined) => void) => void;
|
|
990
990
|
getBattery: (deviceId: string) => Promise<number>;
|
|
991
991
|
getFirmwareVersion: (deviceId: string) => Promise<string>;
|
|
992
|
-
startTpmsScan: (deviceId: string) => void;
|
|
992
|
+
startTpmsScan: (deviceId: string, filterBySensorId?: string, time?: number) => void;
|
|
993
993
|
setSensorDisplayId: (deviceId: string, oldSensorId: string, newSensorId: string) => Promise<void>;
|
|
994
994
|
resetSensorDisplayId: (deviceId: string, sensorId: string) => Promise<void>;
|
|
995
995
|
getConfig: (deviceId: string) => Promise<FgConfig>;
|
package/dist/index.d.ts
CHANGED
|
@@ -989,7 +989,7 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
|
|
|
989
989
|
onTpms: (callback: (deviceId: string, value: FgSensorReading | undefined) => void) => void;
|
|
990
990
|
getBattery: (deviceId: string) => Promise<number>;
|
|
991
991
|
getFirmwareVersion: (deviceId: string) => Promise<string>;
|
|
992
|
-
startTpmsScan: (deviceId: string) => void;
|
|
992
|
+
startTpmsScan: (deviceId: string, filterBySensorId?: string, time?: number) => void;
|
|
993
993
|
setSensorDisplayId: (deviceId: string, oldSensorId: string, newSensorId: string) => Promise<void>;
|
|
994
994
|
resetSensorDisplayId: (deviceId: string, sensorId: string) => Promise<void>;
|
|
995
995
|
getConfig: (deviceId: string) => Promise<FgConfig>;
|
package/dist/index.mjs
CHANGED
|
@@ -663,7 +663,7 @@ const bluetooth = {
|
|
|
663
663
|
},
|
|
664
664
|
connect: connect$1,
|
|
665
665
|
disconnect: disconnect$1,
|
|
666
|
-
write,
|
|
666
|
+
write: write$1,
|
|
667
667
|
read
|
|
668
668
|
};
|
|
669
669
|
async function scanDevices(services = [], duration) {
|
|
@@ -739,7 +739,7 @@ async function disconnect$1(deviceId) {
|
|
|
739
739
|
store.setState(deviceId, void 0, "failedDisconnection");
|
|
740
740
|
throw new Error("Disconnect unsuccessful");
|
|
741
741
|
}
|
|
742
|
-
async function write(deviceId, serviceUuid, characteristicUuid, value, withResponse) {
|
|
742
|
+
async function write$1(deviceId, serviceUuid, characteristicUuid, value, withResponse) {
|
|
743
743
|
if (!toolsSvc.canCommunicateWith(deviceId)) throw new Error("Write Error: Not connected to device");
|
|
744
744
|
try {
|
|
745
745
|
const _deviceId = store.deviceIdMapingTable[deviceId] ?? deviceId;
|
|
@@ -3052,15 +3052,12 @@ async function setTpmsConfig(deviceId, config) {
|
|
|
3052
3052
|
const msg = `*TPMS CONFIG ${config}`;
|
|
3053
3053
|
return sendCommand(deviceId, msg);
|
|
3054
3054
|
}
|
|
3055
|
-
async function startTpmsScan(deviceId) {
|
|
3055
|
+
async function startTpmsScan(deviceId, filterBySensorId, time = 10) {
|
|
3056
3056
|
if (!canCommunicateWith(deviceId)) throw new Error("Flexi Gauge not connected");
|
|
3057
|
-
const
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
flexiGaugeTpmsMeta.communication.characteristicId,
|
|
3062
|
-
scanMsg
|
|
3063
|
-
);
|
|
3057
|
+
const massageParts = ["*TPMS ON"];
|
|
3058
|
+
if (filterBySensorId) massageParts.push(`FILTER=${filterBySensorId}`);
|
|
3059
|
+
if (time) massageParts.push(`TIME=${time}`);
|
|
3060
|
+
return write(deviceId, massageParts.join(" "));
|
|
3064
3061
|
}
|
|
3065
3062
|
async function getBattery(deviceId) {
|
|
3066
3063
|
const batteryValue = await bluetooth.read(
|
|
@@ -3095,13 +3092,8 @@ async function vdaRequestWriteAccess(deviceId, sensorId, signature) {
|
|
|
3095
3092
|
return sendCommand(deviceId, scanMsg);
|
|
3096
3093
|
}
|
|
3097
3094
|
async function vdaSendWriteModePin(deviceId) {
|
|
3098
|
-
const scanMsg =
|
|
3099
|
-
|
|
3100
|
-
deviceId,
|
|
3101
|
-
flexiGaugeTpmsMeta.communication.serviceId,
|
|
3102
|
-
flexiGaugeTpmsMeta.communication.characteristicId,
|
|
3103
|
-
scanMsg
|
|
3104
|
-
);
|
|
3095
|
+
const scanMsg = "*VDA_LF_SEND SID=A0 LID=AA PAR=00 DATA=FCCC71F6";
|
|
3096
|
+
return write(deviceId, scanMsg);
|
|
3105
3097
|
}
|
|
3106
3098
|
async function vdaReadConfiguration(deviceId) {
|
|
3107
3099
|
const scanMsg = "*VDA_LF_SEND SID=A0 LID=DA PAR=17";
|
|
@@ -3127,6 +3119,23 @@ async function sendCommand(deviceId, command) {
|
|
|
3127
3119
|
}
|
|
3128
3120
|
return String.fromCharCode(...result);
|
|
3129
3121
|
}
|
|
3122
|
+
async function write(deviceId, message, mtu = 20) {
|
|
3123
|
+
const payload = stringToDecimalArray(`${message}\r
|
|
3124
|
+
`);
|
|
3125
|
+
const chunks = [];
|
|
3126
|
+
for (let i = 0; i < payload.length; i += mtu) {
|
|
3127
|
+
chunks.push(payload.slice(i, i + mtu));
|
|
3128
|
+
}
|
|
3129
|
+
for (const chunk of chunks) {
|
|
3130
|
+
const convertedChunk = new Uint8Array(chunk);
|
|
3131
|
+
await bluetooth.write(
|
|
3132
|
+
deviceId,
|
|
3133
|
+
flexiGaugeTpmsMeta.communication.serviceId,
|
|
3134
|
+
flexiGaugeTpmsMeta.communication.characteristicId,
|
|
3135
|
+
convertedChunk.buffer
|
|
3136
|
+
);
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3130
3139
|
function processMessage(deviceId, payload) {
|
|
3131
3140
|
promiseQueue.processMessage(deviceId, payload, getIdentifier$1, isComplete$1, isError$1);
|
|
3132
3141
|
}
|
|
@@ -3315,8 +3324,8 @@ const capabilities$1 = [
|
|
|
3315
3324
|
}
|
|
3316
3325
|
];
|
|
3317
3326
|
const flexiGaugeTpmsService = {
|
|
3318
|
-
startTpmsScan(deviceId) {
|
|
3319
|
-
flexiGaugeTpmsCommands.startTpmsScan(deviceId);
|
|
3327
|
+
startTpmsScan(deviceId, filterBySensorId, time = 10) {
|
|
3328
|
+
flexiGaugeTpmsCommands.startTpmsScan(deviceId, filterBySensorId, time);
|
|
3320
3329
|
},
|
|
3321
3330
|
getBattery(deviceId) {
|
|
3322
3331
|
return flexiGaugeTpmsCommands.getBattery(deviceId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tirecheck-device-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.56",
|
|
4
4
|
"description": "SDK for working with various devices produced by Tirecheck via Bluetooth (CAN Bridge, Routers, Sensors, FlexiGauge, PressureStick, etc)",
|
|
5
5
|
"author": "Leonid Buneev <leonid.buneev@tirecheck.com>",
|
|
6
6
|
"license": "ISC",
|