tirecheck-device-sdk 0.1.999 → 0.2.1
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 +49 -0
- package/dist/index.mjs +49 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2907,6 +2907,22 @@ const bridgeSimulator = {
|
|
|
2907
2907
|
async setVehicle(deviceId, vehicle) {
|
|
2908
2908
|
const bridge = getSimulatedBridge(deviceId);
|
|
2909
2909
|
bridge.vin = vehicle.vin ?? bridge.vin;
|
|
2910
|
+
for (const tcTyre of vehicle.tcTyres) {
|
|
2911
|
+
if (tcTyre.tcTpmsSensor?.id && tcTyre.mountedOn?.positionId) {
|
|
2912
|
+
const currentSensor = bridge.simulatorData.sensors[tcTyre.mountedOn.positionId];
|
|
2913
|
+
if (currentSensor?.sensorId === tcTyre.tcTpmsSensor.id) {
|
|
2914
|
+
continue;
|
|
2915
|
+
}
|
|
2916
|
+
const tyreAxle = bridge.simulatorData.vehicle.axles[Math.floor(tcTyre.mountedOn.positionId / 100) - 1];
|
|
2917
|
+
if (!tyreAxle) continue;
|
|
2918
|
+
const sensorIdInBinary = bridgeTools.hexToDecimalArray(tcTyre.tcTpmsSensor.id).reverse();
|
|
2919
|
+
bridge.simulatorData.sensors[tcTyre.mountedOn.positionId] = createSensorData(
|
|
2920
|
+
tyreAxle,
|
|
2921
|
+
tcTyre.tcTpmsSensor.id,
|
|
2922
|
+
sensorIdInBinary
|
|
2923
|
+
);
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2910
2926
|
bridge.simulatorData.vehicle = vehicle;
|
|
2911
2927
|
},
|
|
2912
2928
|
async getConfiguration(deviceId) {
|
|
@@ -3162,6 +3178,39 @@ function getSimulatedBridgeTemplate() {
|
|
|
3162
3178
|
}
|
|
3163
3179
|
};
|
|
3164
3180
|
}
|
|
3181
|
+
function createSensorData(tyreAxle, sensorId, sensorIdInBinary) {
|
|
3182
|
+
return {
|
|
3183
|
+
date: Date.now(),
|
|
3184
|
+
eceStatus: 0,
|
|
3185
|
+
sensorId,
|
|
3186
|
+
sensorStatus: 0,
|
|
3187
|
+
pressure: {
|
|
3188
|
+
bar: tyreAxle.targetPressure ?? 0,
|
|
3189
|
+
meas: tyreAxle.targetPressure ?? 0,
|
|
3190
|
+
raw: (tyreAxle.targetPressure ?? 0) * 19.753086
|
|
3191
|
+
},
|
|
3192
|
+
pressureIssue: void 0,
|
|
3193
|
+
temperature: { amb: 20, celsius: 24, raw: 64 },
|
|
3194
|
+
byteReading: [
|
|
3195
|
+
16,
|
|
3196
|
+
1,
|
|
3197
|
+
12,
|
|
3198
|
+
253,
|
|
3199
|
+
25,
|
|
3200
|
+
...sensorIdInBinary,
|
|
3201
|
+
tyreAxle.targetPressure ? tyreAxle.targetPressure * 19.753086 : 0,
|
|
3202
|
+
64,
|
|
3203
|
+
255,
|
|
3204
|
+
0,
|
|
3205
|
+
0,
|
|
3206
|
+
40,
|
|
3207
|
+
255,
|
|
3208
|
+
255,
|
|
3209
|
+
255,
|
|
3210
|
+
255
|
|
3211
|
+
]
|
|
3212
|
+
};
|
|
3213
|
+
}
|
|
3165
3214
|
|
|
3166
3215
|
const flexiGaugeTpmsSimulator = {
|
|
3167
3216
|
createSimulatedDevice(initialData) {
|
package/dist/index.mjs
CHANGED
|
@@ -2900,6 +2900,22 @@ const bridgeSimulator = {
|
|
|
2900
2900
|
async setVehicle(deviceId, vehicle) {
|
|
2901
2901
|
const bridge = getSimulatedBridge(deviceId);
|
|
2902
2902
|
bridge.vin = vehicle.vin ?? bridge.vin;
|
|
2903
|
+
for (const tcTyre of vehicle.tcTyres) {
|
|
2904
|
+
if (tcTyre.tcTpmsSensor?.id && tcTyre.mountedOn?.positionId) {
|
|
2905
|
+
const currentSensor = bridge.simulatorData.sensors[tcTyre.mountedOn.positionId];
|
|
2906
|
+
if (currentSensor?.sensorId === tcTyre.tcTpmsSensor.id) {
|
|
2907
|
+
continue;
|
|
2908
|
+
}
|
|
2909
|
+
const tyreAxle = bridge.simulatorData.vehicle.axles[Math.floor(tcTyre.mountedOn.positionId / 100) - 1];
|
|
2910
|
+
if (!tyreAxle) continue;
|
|
2911
|
+
const sensorIdInBinary = bridgeTools.hexToDecimalArray(tcTyre.tcTpmsSensor.id).reverse();
|
|
2912
|
+
bridge.simulatorData.sensors[tcTyre.mountedOn.positionId] = createSensorData(
|
|
2913
|
+
tyreAxle,
|
|
2914
|
+
tcTyre.tcTpmsSensor.id,
|
|
2915
|
+
sensorIdInBinary
|
|
2916
|
+
);
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2903
2919
|
bridge.simulatorData.vehicle = vehicle;
|
|
2904
2920
|
},
|
|
2905
2921
|
async getConfiguration(deviceId) {
|
|
@@ -3155,6 +3171,39 @@ function getSimulatedBridgeTemplate() {
|
|
|
3155
3171
|
}
|
|
3156
3172
|
};
|
|
3157
3173
|
}
|
|
3174
|
+
function createSensorData(tyreAxle, sensorId, sensorIdInBinary) {
|
|
3175
|
+
return {
|
|
3176
|
+
date: Date.now(),
|
|
3177
|
+
eceStatus: 0,
|
|
3178
|
+
sensorId,
|
|
3179
|
+
sensorStatus: 0,
|
|
3180
|
+
pressure: {
|
|
3181
|
+
bar: tyreAxle.targetPressure ?? 0,
|
|
3182
|
+
meas: tyreAxle.targetPressure ?? 0,
|
|
3183
|
+
raw: (tyreAxle.targetPressure ?? 0) * 19.753086
|
|
3184
|
+
},
|
|
3185
|
+
pressureIssue: void 0,
|
|
3186
|
+
temperature: { amb: 20, celsius: 24, raw: 64 },
|
|
3187
|
+
byteReading: [
|
|
3188
|
+
16,
|
|
3189
|
+
1,
|
|
3190
|
+
12,
|
|
3191
|
+
253,
|
|
3192
|
+
25,
|
|
3193
|
+
...sensorIdInBinary,
|
|
3194
|
+
tyreAxle.targetPressure ? tyreAxle.targetPressure * 19.753086 : 0,
|
|
3195
|
+
64,
|
|
3196
|
+
255,
|
|
3197
|
+
0,
|
|
3198
|
+
0,
|
|
3199
|
+
40,
|
|
3200
|
+
255,
|
|
3201
|
+
255,
|
|
3202
|
+
255,
|
|
3203
|
+
255
|
|
3204
|
+
]
|
|
3205
|
+
};
|
|
3206
|
+
}
|
|
3158
3207
|
|
|
3159
3208
|
const flexiGaugeTpmsSimulator = {
|
|
3160
3209
|
createSimulatedDevice(initialData) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tirecheck-device-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.01",
|
|
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",
|