tirecheck-device-sdk 0.2.22 → 0.2.23
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 +61 -9
- package/dist/index.d.cts +42 -3
- package/dist/index.d.mts +42 -3
- package/dist/index.d.ts +42 -3
- package/dist/index.mjs +61 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -47,6 +47,8 @@ const store = {
|
|
|
47
47
|
// undefined => connecting => connected => paired => disconnecting => undefined
|
|
48
48
|
/** some bridge commands require bridge reboot to be completed */
|
|
49
49
|
bridgeRebootRequired: {},
|
|
50
|
+
/** Torque wrench properties, about device settings, mainly used for unit conversion */
|
|
51
|
+
torqueWrenchProperties: {},
|
|
50
52
|
//** Ios uses generated device Id, bridges send mac address in advertising so internaly we always use mac address but when real device id is needed we check mapping table for it */
|
|
51
53
|
deviceIdMapingTable: {},
|
|
52
54
|
/** Used to change device state in store, also notifies app via calback. Every undefined state should have its reason so that app can handle it accordingly */
|
|
@@ -522,8 +524,26 @@ const deviceMeta = {
|
|
|
522
524
|
},
|
|
523
525
|
getDeviceInfoFromAdvertising: bridgeOtaAdvertisingParser.getDeviceInfoFromAdvertising
|
|
524
526
|
},
|
|
527
|
+
// flexiGauge: {
|
|
528
|
+
// nameRegex: /^Flexi.*v.*/,
|
|
529
|
+
// communication: {
|
|
530
|
+
// serviceId: '4880c12c-fdcb-4077-8920-a450d7f9b907',
|
|
531
|
+
// characteristicId: 'fec26ec4-6d71-4442-9f81-55bc21d658d6',
|
|
532
|
+
// },
|
|
533
|
+
// battery: {
|
|
534
|
+
// serviceId: '180f',
|
|
535
|
+
// characteristicId: '2a19',
|
|
536
|
+
// },
|
|
537
|
+
// getDeviceInfoFromAdvertising: (device: PeripheralData) => {
|
|
538
|
+
// const bleDevice: BleDevice = {
|
|
539
|
+
// ...device,
|
|
540
|
+
// type: 'flexiGauge',
|
|
541
|
+
// }
|
|
542
|
+
// return bleDevice
|
|
543
|
+
// },
|
|
544
|
+
// },
|
|
525
545
|
flexiGaugeTpms: {
|
|
526
|
-
nameRegex: /^Flexi.*/,
|
|
546
|
+
nameRegex: /^Flexi.*TPMS.*/,
|
|
527
547
|
communication: {
|
|
528
548
|
serviceId: "4880c12c-fdcb-4077-8920-a450d7f9b907",
|
|
529
549
|
characteristicId: "fec26ec4-6d71-4442-9f81-55bc21d658d6"
|
|
@@ -538,9 +558,7 @@ const deviceMeta = {
|
|
|
538
558
|
type: "flexiGaugeTpms"
|
|
539
559
|
};
|
|
540
560
|
return bleDevice;
|
|
541
|
-
}
|
|
542
|
-
reconnect: true
|
|
543
|
-
// Do we need it here?
|
|
561
|
+
}
|
|
544
562
|
},
|
|
545
563
|
pressureStick: {
|
|
546
564
|
nameRegex: /Pressure Stick.*/,
|
|
@@ -555,6 +573,42 @@ const deviceMeta = {
|
|
|
555
573
|
};
|
|
556
574
|
return bleDevice;
|
|
557
575
|
}
|
|
576
|
+
},
|
|
577
|
+
// ateq: {
|
|
578
|
+
// nameRegex: /ATEQ.*/,
|
|
579
|
+
// communication: {
|
|
580
|
+
// serviceId: 'a002',
|
|
581
|
+
// characteristicId: 'c305',
|
|
582
|
+
// },
|
|
583
|
+
// indicate: {
|
|
584
|
+
// serviceId: 'a002',
|
|
585
|
+
// characteristicId: 'c306',
|
|
586
|
+
// },
|
|
587
|
+
// getDeviceInfoFromAdvertising: (device: PeripheralData) => {
|
|
588
|
+
// const bleDevice: BleDevice = {
|
|
589
|
+
// ...device,
|
|
590
|
+
// type: 'ateq',
|
|
591
|
+
// }
|
|
592
|
+
// return bleDevice
|
|
593
|
+
// },
|
|
594
|
+
// },
|
|
595
|
+
torqueWrench: {
|
|
596
|
+
nameRegex: /^\d+(lbft|NM)-\d+$/i,
|
|
597
|
+
communication: {
|
|
598
|
+
serviceId: "49535343-fe7d-4ae5-8fa9-9fafd205e455",
|
|
599
|
+
characteristicId: "49535343-1e4d-4bd9-ba61-23c647249616"
|
|
600
|
+
},
|
|
601
|
+
battery: {
|
|
602
|
+
serviceId: "180f",
|
|
603
|
+
characteristicId: "2a19"
|
|
604
|
+
},
|
|
605
|
+
getDeviceInfoFromAdvertising: (device) => {
|
|
606
|
+
const bleDevice = {
|
|
607
|
+
...device,
|
|
608
|
+
type: "torqueWrench"
|
|
609
|
+
};
|
|
610
|
+
return bleDevice;
|
|
611
|
+
}
|
|
558
612
|
}
|
|
559
613
|
};
|
|
560
614
|
|
|
@@ -3078,7 +3132,6 @@ const torqueWrenchService = {
|
|
|
3078
3132
|
async startJob(deviceId, params) {
|
|
3079
3133
|
await this.stopJob(deviceId);
|
|
3080
3134
|
const { units, span, ppr, threshold } = store.torqueWrenchProperties[deviceId];
|
|
3081
|
-
console.log("\u{1F680} ~ startJob ~ units:", units);
|
|
3082
3135
|
const { torqueMin, torqueMax, angleMin, angleMax, direction, jobTimeout } = params;
|
|
3083
3136
|
const msgParams = {
|
|
3084
3137
|
id: "01",
|
|
@@ -3103,14 +3156,11 @@ const torqueWrenchService = {
|
|
|
3103
3156
|
await torqueWrenchCommands.sendCommand(deviceId, "startJob", paramsString);
|
|
3104
3157
|
jobInterval = setInterval(async () => {
|
|
3105
3158
|
const numberOfReading = await this.getNumberOfReadings(deviceId);
|
|
3106
|
-
console.log("\u{1F680} ~ jobInterval=setInterval ~ numberOfReading:", numberOfReading);
|
|
3107
3159
|
if (numberOfReading.count > 0) this.getReading(deviceId);
|
|
3108
|
-
},
|
|
3160
|
+
}, 2e3);
|
|
3109
3161
|
if (jobTimeout) {
|
|
3110
3162
|
await new Promise(
|
|
3111
3163
|
(resolve) => setTimeout(() => {
|
|
3112
|
-
console.log("job terminated");
|
|
3113
|
-
clearInterval(jobInterval);
|
|
3114
3164
|
this.stopJob(deviceId);
|
|
3115
3165
|
resolve("");
|
|
3116
3166
|
}, jobTimeout * 1e3)
|
|
@@ -3118,6 +3168,7 @@ const torqueWrenchService = {
|
|
|
3118
3168
|
}
|
|
3119
3169
|
},
|
|
3120
3170
|
async stopJob(deviceId) {
|
|
3171
|
+
clearInterval(jobInterval);
|
|
3121
3172
|
return torqueWrenchCommands.sendCommand(deviceId, "stopJob");
|
|
3122
3173
|
},
|
|
3123
3174
|
async getNumberOfReadings(deviceId) {
|
|
@@ -3224,6 +3275,7 @@ const torqueWrench = {
|
|
|
3224
3275
|
},
|
|
3225
3276
|
async disconnect(deviceId, reason) {
|
|
3226
3277
|
store.setState(deviceId, "disconnecting");
|
|
3278
|
+
await torqueWrenchService.stopJob(deviceId);
|
|
3227
3279
|
await bluetooth.disconnect(deviceId);
|
|
3228
3280
|
store.setState(deviceId, void 0, reason ?? "manualDisconnection");
|
|
3229
3281
|
},
|
package/dist/index.d.cts
CHANGED
|
@@ -81,7 +81,6 @@ declare const _default$1: {
|
|
|
81
81
|
characteristicId: string;
|
|
82
82
|
};
|
|
83
83
|
getDeviceInfoFromAdvertising: (device: PeripheralData) => BleFlexiGaugeTpms;
|
|
84
|
-
reconnect: boolean;
|
|
85
84
|
};
|
|
86
85
|
pressureStick: {
|
|
87
86
|
nameRegex: RegExp;
|
|
@@ -91,6 +90,18 @@ declare const _default$1: {
|
|
|
91
90
|
};
|
|
92
91
|
getDeviceInfoFromAdvertising: (device: PeripheralData) => BlePressureStick;
|
|
93
92
|
};
|
|
93
|
+
torqueWrench: {
|
|
94
|
+
nameRegex: RegExp;
|
|
95
|
+
communication: {
|
|
96
|
+
serviceId: string;
|
|
97
|
+
characteristicId: string;
|
|
98
|
+
};
|
|
99
|
+
battery: {
|
|
100
|
+
serviceId: string;
|
|
101
|
+
characteristicId: string;
|
|
102
|
+
};
|
|
103
|
+
getDeviceInfoFromAdvertising: (device: PeripheralData) => BleTorqueWrench;
|
|
104
|
+
};
|
|
94
105
|
};
|
|
95
106
|
|
|
96
107
|
declare const _default: {
|
|
@@ -739,7 +750,7 @@ type BridgeCommandStructurized<T extends BridgeCommandStructureProperties> = {
|
|
|
739
750
|
};
|
|
740
751
|
type BleDeviceType = keyof typeof _default$1;
|
|
741
752
|
/** distinguish by type, e.g. `if (device.type === 'bridge')`, to access furhter fields */
|
|
742
|
-
type BleDevice = BleBridge | BleBridgeOta | BleFlexiGaugeTpms | BlePressureStick;
|
|
753
|
+
type BleDevice = BleBridge | BleBridgeOta | BleFlexiGaugeTpms | BlePressureStick | BleTorqueWrench;
|
|
743
754
|
type BleDeviceSimulated = BleBridgeSimulated | BleFlexiGaugeTpmsSimulated;
|
|
744
755
|
type BleDeviceStatus = 'connected' | 'connecting' | 'disconnecting' | undefined;
|
|
745
756
|
interface BleDeviceBase {
|
|
@@ -763,6 +774,9 @@ interface BleBridge extends BleDeviceBase {
|
|
|
763
774
|
interface BleFlexiGaugeTpms extends BleDeviceBase {
|
|
764
775
|
type: 'flexiGaugeTpms';
|
|
765
776
|
}
|
|
777
|
+
interface BleTorqueWrench extends BleDeviceBase {
|
|
778
|
+
type: 'torqueWrench';
|
|
779
|
+
}
|
|
766
780
|
interface BleBridgeOta extends BleDeviceBase {
|
|
767
781
|
advertisingData: {
|
|
768
782
|
bridgeId: string;
|
|
@@ -834,6 +848,31 @@ interface EventHandlers {
|
|
|
834
848
|
'fg:button'?: (deviceId: string, value: string) => void;
|
|
835
849
|
'fg:tpms'?: (deviceId: string, value: FgSensorReading | undefined) => void;
|
|
836
850
|
'ps:pressure'?: (deviceId: string, value: number) => void;
|
|
851
|
+
'tw:reading'?: (deviceId: string, value: TorqueWrenchReading) => void;
|
|
852
|
+
}
|
|
853
|
+
interface TorqueWrenchStartJobParams {
|
|
854
|
+
nuts: number;
|
|
855
|
+
direction: 'clockwise' | 'counter-clockwise';
|
|
856
|
+
torqueMin?: number;
|
|
857
|
+
torqueMax?: number;
|
|
858
|
+
angleMin?: number;
|
|
859
|
+
angleMax?: number;
|
|
860
|
+
jobTimeout: number;
|
|
861
|
+
}
|
|
862
|
+
interface TorqueWrenchProperties {
|
|
863
|
+
serialNumber: string;
|
|
864
|
+
calibrationDate: string;
|
|
865
|
+
units: 'Nm' | 'lb-ft';
|
|
866
|
+
span: number;
|
|
867
|
+
ppr: number;
|
|
868
|
+
threshold: number;
|
|
869
|
+
}
|
|
870
|
+
interface TorqueWrenchReading {
|
|
871
|
+
jobId: number;
|
|
872
|
+
nut: number;
|
|
873
|
+
torque: number;
|
|
874
|
+
angle: number;
|
|
875
|
+
duration: number;
|
|
837
876
|
}
|
|
838
877
|
type EventName = keyof EventHandlers;
|
|
839
878
|
|
|
@@ -919,4 +958,4 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
|
|
|
919
958
|
};
|
|
920
959
|
};
|
|
921
960
|
|
|
922
|
-
export { type BleBridge, type BleBridgeAdvertisingData, type BleBridgeOta, type BleBridgeSimulated, type BleDevice, type BleDeviceBase, type BleDeviceSimulated, type BleDeviceStatus, type BleDeviceType, type BleFlexiGaugeTpms, type BleFlexiGaugeTpmsSimulated, type BlePressureStick, type BleSecurityKeys, type BridgeAccessLevel, type BridgeAutolearnStatus, type BridgeCommandStructure, type BridgeCommandStructureProperties, type BridgeCommandStructurized, type BridgeConfiguration, type BridgeReading, type BridgeTcIssue, type BridgeTcTyre, type BridgeTcVehicle, BridgeTcVehicleAxle, type DeepPartial, type DevicePlatform, type DeviceState, type EventHandlers, type EventName, type FgSensorReading, type PositionInfo, type ReportStatusFn, type Simulator, type StateReason, type Wrapper, createTirecheckDeviceSdk };
|
|
961
|
+
export { type BleBridge, type BleBridgeAdvertisingData, type BleBridgeOta, type BleBridgeSimulated, type BleDevice, type BleDeviceBase, type BleDeviceSimulated, type BleDeviceStatus, type BleDeviceType, type BleFlexiGaugeTpms, type BleFlexiGaugeTpmsSimulated, type BlePressureStick, type BleSecurityKeys, type BleTorqueWrench, type BridgeAccessLevel, type BridgeAutolearnStatus, type BridgeCommandStructure, type BridgeCommandStructureProperties, type BridgeCommandStructurized, type BridgeConfiguration, type BridgeReading, type BridgeTcIssue, type BridgeTcTyre, type BridgeTcVehicle, BridgeTcVehicleAxle, type DeepPartial, type DevicePlatform, type DeviceState, type EventHandlers, type EventName, type FgSensorReading, type PositionInfo, type ReportStatusFn, type Simulator, type StateReason, type TorqueWrenchProperties, type TorqueWrenchReading, type TorqueWrenchStartJobParams, type Wrapper, createTirecheckDeviceSdk };
|
package/dist/index.d.mts
CHANGED
|
@@ -81,7 +81,6 @@ declare const _default$1: {
|
|
|
81
81
|
characteristicId: string;
|
|
82
82
|
};
|
|
83
83
|
getDeviceInfoFromAdvertising: (device: PeripheralData) => BleFlexiGaugeTpms;
|
|
84
|
-
reconnect: boolean;
|
|
85
84
|
};
|
|
86
85
|
pressureStick: {
|
|
87
86
|
nameRegex: RegExp;
|
|
@@ -91,6 +90,18 @@ declare const _default$1: {
|
|
|
91
90
|
};
|
|
92
91
|
getDeviceInfoFromAdvertising: (device: PeripheralData) => BlePressureStick;
|
|
93
92
|
};
|
|
93
|
+
torqueWrench: {
|
|
94
|
+
nameRegex: RegExp;
|
|
95
|
+
communication: {
|
|
96
|
+
serviceId: string;
|
|
97
|
+
characteristicId: string;
|
|
98
|
+
};
|
|
99
|
+
battery: {
|
|
100
|
+
serviceId: string;
|
|
101
|
+
characteristicId: string;
|
|
102
|
+
};
|
|
103
|
+
getDeviceInfoFromAdvertising: (device: PeripheralData) => BleTorqueWrench;
|
|
104
|
+
};
|
|
94
105
|
};
|
|
95
106
|
|
|
96
107
|
declare const _default: {
|
|
@@ -739,7 +750,7 @@ type BridgeCommandStructurized<T extends BridgeCommandStructureProperties> = {
|
|
|
739
750
|
};
|
|
740
751
|
type BleDeviceType = keyof typeof _default$1;
|
|
741
752
|
/** distinguish by type, e.g. `if (device.type === 'bridge')`, to access furhter fields */
|
|
742
|
-
type BleDevice = BleBridge | BleBridgeOta | BleFlexiGaugeTpms | BlePressureStick;
|
|
753
|
+
type BleDevice = BleBridge | BleBridgeOta | BleFlexiGaugeTpms | BlePressureStick | BleTorqueWrench;
|
|
743
754
|
type BleDeviceSimulated = BleBridgeSimulated | BleFlexiGaugeTpmsSimulated;
|
|
744
755
|
type BleDeviceStatus = 'connected' | 'connecting' | 'disconnecting' | undefined;
|
|
745
756
|
interface BleDeviceBase {
|
|
@@ -763,6 +774,9 @@ interface BleBridge extends BleDeviceBase {
|
|
|
763
774
|
interface BleFlexiGaugeTpms extends BleDeviceBase {
|
|
764
775
|
type: 'flexiGaugeTpms';
|
|
765
776
|
}
|
|
777
|
+
interface BleTorqueWrench extends BleDeviceBase {
|
|
778
|
+
type: 'torqueWrench';
|
|
779
|
+
}
|
|
766
780
|
interface BleBridgeOta extends BleDeviceBase {
|
|
767
781
|
advertisingData: {
|
|
768
782
|
bridgeId: string;
|
|
@@ -834,6 +848,31 @@ interface EventHandlers {
|
|
|
834
848
|
'fg:button'?: (deviceId: string, value: string) => void;
|
|
835
849
|
'fg:tpms'?: (deviceId: string, value: FgSensorReading | undefined) => void;
|
|
836
850
|
'ps:pressure'?: (deviceId: string, value: number) => void;
|
|
851
|
+
'tw:reading'?: (deviceId: string, value: TorqueWrenchReading) => void;
|
|
852
|
+
}
|
|
853
|
+
interface TorqueWrenchStartJobParams {
|
|
854
|
+
nuts: number;
|
|
855
|
+
direction: 'clockwise' | 'counter-clockwise';
|
|
856
|
+
torqueMin?: number;
|
|
857
|
+
torqueMax?: number;
|
|
858
|
+
angleMin?: number;
|
|
859
|
+
angleMax?: number;
|
|
860
|
+
jobTimeout: number;
|
|
861
|
+
}
|
|
862
|
+
interface TorqueWrenchProperties {
|
|
863
|
+
serialNumber: string;
|
|
864
|
+
calibrationDate: string;
|
|
865
|
+
units: 'Nm' | 'lb-ft';
|
|
866
|
+
span: number;
|
|
867
|
+
ppr: number;
|
|
868
|
+
threshold: number;
|
|
869
|
+
}
|
|
870
|
+
interface TorqueWrenchReading {
|
|
871
|
+
jobId: number;
|
|
872
|
+
nut: number;
|
|
873
|
+
torque: number;
|
|
874
|
+
angle: number;
|
|
875
|
+
duration: number;
|
|
837
876
|
}
|
|
838
877
|
type EventName = keyof EventHandlers;
|
|
839
878
|
|
|
@@ -919,4 +958,4 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
|
|
|
919
958
|
};
|
|
920
959
|
};
|
|
921
960
|
|
|
922
|
-
export { type BleBridge, type BleBridgeAdvertisingData, type BleBridgeOta, type BleBridgeSimulated, type BleDevice, type BleDeviceBase, type BleDeviceSimulated, type BleDeviceStatus, type BleDeviceType, type BleFlexiGaugeTpms, type BleFlexiGaugeTpmsSimulated, type BlePressureStick, type BleSecurityKeys, type BridgeAccessLevel, type BridgeAutolearnStatus, type BridgeCommandStructure, type BridgeCommandStructureProperties, type BridgeCommandStructurized, type BridgeConfiguration, type BridgeReading, type BridgeTcIssue, type BridgeTcTyre, type BridgeTcVehicle, BridgeTcVehicleAxle, type DeepPartial, type DevicePlatform, type DeviceState, type EventHandlers, type EventName, type FgSensorReading, type PositionInfo, type ReportStatusFn, type Simulator, type StateReason, type Wrapper, createTirecheckDeviceSdk };
|
|
961
|
+
export { type BleBridge, type BleBridgeAdvertisingData, type BleBridgeOta, type BleBridgeSimulated, type BleDevice, type BleDeviceBase, type BleDeviceSimulated, type BleDeviceStatus, type BleDeviceType, type BleFlexiGaugeTpms, type BleFlexiGaugeTpmsSimulated, type BlePressureStick, type BleSecurityKeys, type BleTorqueWrench, type BridgeAccessLevel, type BridgeAutolearnStatus, type BridgeCommandStructure, type BridgeCommandStructureProperties, type BridgeCommandStructurized, type BridgeConfiguration, type BridgeReading, type BridgeTcIssue, type BridgeTcTyre, type BridgeTcVehicle, BridgeTcVehicleAxle, type DeepPartial, type DevicePlatform, type DeviceState, type EventHandlers, type EventName, type FgSensorReading, type PositionInfo, type ReportStatusFn, type Simulator, type StateReason, type TorqueWrenchProperties, type TorqueWrenchReading, type TorqueWrenchStartJobParams, type Wrapper, createTirecheckDeviceSdk };
|
package/dist/index.d.ts
CHANGED
|
@@ -81,7 +81,6 @@ declare const _default$1: {
|
|
|
81
81
|
characteristicId: string;
|
|
82
82
|
};
|
|
83
83
|
getDeviceInfoFromAdvertising: (device: PeripheralData) => BleFlexiGaugeTpms;
|
|
84
|
-
reconnect: boolean;
|
|
85
84
|
};
|
|
86
85
|
pressureStick: {
|
|
87
86
|
nameRegex: RegExp;
|
|
@@ -91,6 +90,18 @@ declare const _default$1: {
|
|
|
91
90
|
};
|
|
92
91
|
getDeviceInfoFromAdvertising: (device: PeripheralData) => BlePressureStick;
|
|
93
92
|
};
|
|
93
|
+
torqueWrench: {
|
|
94
|
+
nameRegex: RegExp;
|
|
95
|
+
communication: {
|
|
96
|
+
serviceId: string;
|
|
97
|
+
characteristicId: string;
|
|
98
|
+
};
|
|
99
|
+
battery: {
|
|
100
|
+
serviceId: string;
|
|
101
|
+
characteristicId: string;
|
|
102
|
+
};
|
|
103
|
+
getDeviceInfoFromAdvertising: (device: PeripheralData) => BleTorqueWrench;
|
|
104
|
+
};
|
|
94
105
|
};
|
|
95
106
|
|
|
96
107
|
declare const _default: {
|
|
@@ -739,7 +750,7 @@ type BridgeCommandStructurized<T extends BridgeCommandStructureProperties> = {
|
|
|
739
750
|
};
|
|
740
751
|
type BleDeviceType = keyof typeof _default$1;
|
|
741
752
|
/** distinguish by type, e.g. `if (device.type === 'bridge')`, to access furhter fields */
|
|
742
|
-
type BleDevice = BleBridge | BleBridgeOta | BleFlexiGaugeTpms | BlePressureStick;
|
|
753
|
+
type BleDevice = BleBridge | BleBridgeOta | BleFlexiGaugeTpms | BlePressureStick | BleTorqueWrench;
|
|
743
754
|
type BleDeviceSimulated = BleBridgeSimulated | BleFlexiGaugeTpmsSimulated;
|
|
744
755
|
type BleDeviceStatus = 'connected' | 'connecting' | 'disconnecting' | undefined;
|
|
745
756
|
interface BleDeviceBase {
|
|
@@ -763,6 +774,9 @@ interface BleBridge extends BleDeviceBase {
|
|
|
763
774
|
interface BleFlexiGaugeTpms extends BleDeviceBase {
|
|
764
775
|
type: 'flexiGaugeTpms';
|
|
765
776
|
}
|
|
777
|
+
interface BleTorqueWrench extends BleDeviceBase {
|
|
778
|
+
type: 'torqueWrench';
|
|
779
|
+
}
|
|
766
780
|
interface BleBridgeOta extends BleDeviceBase {
|
|
767
781
|
advertisingData: {
|
|
768
782
|
bridgeId: string;
|
|
@@ -834,6 +848,31 @@ interface EventHandlers {
|
|
|
834
848
|
'fg:button'?: (deviceId: string, value: string) => void;
|
|
835
849
|
'fg:tpms'?: (deviceId: string, value: FgSensorReading | undefined) => void;
|
|
836
850
|
'ps:pressure'?: (deviceId: string, value: number) => void;
|
|
851
|
+
'tw:reading'?: (deviceId: string, value: TorqueWrenchReading) => void;
|
|
852
|
+
}
|
|
853
|
+
interface TorqueWrenchStartJobParams {
|
|
854
|
+
nuts: number;
|
|
855
|
+
direction: 'clockwise' | 'counter-clockwise';
|
|
856
|
+
torqueMin?: number;
|
|
857
|
+
torqueMax?: number;
|
|
858
|
+
angleMin?: number;
|
|
859
|
+
angleMax?: number;
|
|
860
|
+
jobTimeout: number;
|
|
861
|
+
}
|
|
862
|
+
interface TorqueWrenchProperties {
|
|
863
|
+
serialNumber: string;
|
|
864
|
+
calibrationDate: string;
|
|
865
|
+
units: 'Nm' | 'lb-ft';
|
|
866
|
+
span: number;
|
|
867
|
+
ppr: number;
|
|
868
|
+
threshold: number;
|
|
869
|
+
}
|
|
870
|
+
interface TorqueWrenchReading {
|
|
871
|
+
jobId: number;
|
|
872
|
+
nut: number;
|
|
873
|
+
torque: number;
|
|
874
|
+
angle: number;
|
|
875
|
+
duration: number;
|
|
837
876
|
}
|
|
838
877
|
type EventName = keyof EventHandlers;
|
|
839
878
|
|
|
@@ -919,4 +958,4 @@ declare function createTirecheckDeviceSdk(platform: DevicePlatform, bleImplement
|
|
|
919
958
|
};
|
|
920
959
|
};
|
|
921
960
|
|
|
922
|
-
export { type BleBridge, type BleBridgeAdvertisingData, type BleBridgeOta, type BleBridgeSimulated, type BleDevice, type BleDeviceBase, type BleDeviceSimulated, type BleDeviceStatus, type BleDeviceType, type BleFlexiGaugeTpms, type BleFlexiGaugeTpmsSimulated, type BlePressureStick, type BleSecurityKeys, type BridgeAccessLevel, type BridgeAutolearnStatus, type BridgeCommandStructure, type BridgeCommandStructureProperties, type BridgeCommandStructurized, type BridgeConfiguration, type BridgeReading, type BridgeTcIssue, type BridgeTcTyre, type BridgeTcVehicle, BridgeTcVehicleAxle, type DeepPartial, type DevicePlatform, type DeviceState, type EventHandlers, type EventName, type FgSensorReading, type PositionInfo, type ReportStatusFn, type Simulator, type StateReason, type Wrapper, createTirecheckDeviceSdk };
|
|
961
|
+
export { type BleBridge, type BleBridgeAdvertisingData, type BleBridgeOta, type BleBridgeSimulated, type BleDevice, type BleDeviceBase, type BleDeviceSimulated, type BleDeviceStatus, type BleDeviceType, type BleFlexiGaugeTpms, type BleFlexiGaugeTpmsSimulated, type BlePressureStick, type BleSecurityKeys, type BleTorqueWrench, type BridgeAccessLevel, type BridgeAutolearnStatus, type BridgeCommandStructure, type BridgeCommandStructureProperties, type BridgeCommandStructurized, type BridgeConfiguration, type BridgeReading, type BridgeTcIssue, type BridgeTcTyre, type BridgeTcVehicle, BridgeTcVehicleAxle, type DeepPartial, type DevicePlatform, type DeviceState, type EventHandlers, type EventName, type FgSensorReading, type PositionInfo, type ReportStatusFn, type Simulator, type StateReason, type TorqueWrenchProperties, type TorqueWrenchReading, type TorqueWrenchStartJobParams, type Wrapper, createTirecheckDeviceSdk };
|
package/dist/index.mjs
CHANGED
|
@@ -40,6 +40,8 @@ const store = {
|
|
|
40
40
|
// undefined => connecting => connected => paired => disconnecting => undefined
|
|
41
41
|
/** some bridge commands require bridge reboot to be completed */
|
|
42
42
|
bridgeRebootRequired: {},
|
|
43
|
+
/** Torque wrench properties, about device settings, mainly used for unit conversion */
|
|
44
|
+
torqueWrenchProperties: {},
|
|
43
45
|
//** Ios uses generated device Id, bridges send mac address in advertising so internaly we always use mac address but when real device id is needed we check mapping table for it */
|
|
44
46
|
deviceIdMapingTable: {},
|
|
45
47
|
/** Used to change device state in store, also notifies app via calback. Every undefined state should have its reason so that app can handle it accordingly */
|
|
@@ -515,8 +517,26 @@ const deviceMeta = {
|
|
|
515
517
|
},
|
|
516
518
|
getDeviceInfoFromAdvertising: bridgeOtaAdvertisingParser.getDeviceInfoFromAdvertising
|
|
517
519
|
},
|
|
520
|
+
// flexiGauge: {
|
|
521
|
+
// nameRegex: /^Flexi.*v.*/,
|
|
522
|
+
// communication: {
|
|
523
|
+
// serviceId: '4880c12c-fdcb-4077-8920-a450d7f9b907',
|
|
524
|
+
// characteristicId: 'fec26ec4-6d71-4442-9f81-55bc21d658d6',
|
|
525
|
+
// },
|
|
526
|
+
// battery: {
|
|
527
|
+
// serviceId: '180f',
|
|
528
|
+
// characteristicId: '2a19',
|
|
529
|
+
// },
|
|
530
|
+
// getDeviceInfoFromAdvertising: (device: PeripheralData) => {
|
|
531
|
+
// const bleDevice: BleDevice = {
|
|
532
|
+
// ...device,
|
|
533
|
+
// type: 'flexiGauge',
|
|
534
|
+
// }
|
|
535
|
+
// return bleDevice
|
|
536
|
+
// },
|
|
537
|
+
// },
|
|
518
538
|
flexiGaugeTpms: {
|
|
519
|
-
nameRegex: /^Flexi.*/,
|
|
539
|
+
nameRegex: /^Flexi.*TPMS.*/,
|
|
520
540
|
communication: {
|
|
521
541
|
serviceId: "4880c12c-fdcb-4077-8920-a450d7f9b907",
|
|
522
542
|
characteristicId: "fec26ec4-6d71-4442-9f81-55bc21d658d6"
|
|
@@ -531,9 +551,7 @@ const deviceMeta = {
|
|
|
531
551
|
type: "flexiGaugeTpms"
|
|
532
552
|
};
|
|
533
553
|
return bleDevice;
|
|
534
|
-
}
|
|
535
|
-
reconnect: true
|
|
536
|
-
// Do we need it here?
|
|
554
|
+
}
|
|
537
555
|
},
|
|
538
556
|
pressureStick: {
|
|
539
557
|
nameRegex: /Pressure Stick.*/,
|
|
@@ -548,6 +566,42 @@ const deviceMeta = {
|
|
|
548
566
|
};
|
|
549
567
|
return bleDevice;
|
|
550
568
|
}
|
|
569
|
+
},
|
|
570
|
+
// ateq: {
|
|
571
|
+
// nameRegex: /ATEQ.*/,
|
|
572
|
+
// communication: {
|
|
573
|
+
// serviceId: 'a002',
|
|
574
|
+
// characteristicId: 'c305',
|
|
575
|
+
// },
|
|
576
|
+
// indicate: {
|
|
577
|
+
// serviceId: 'a002',
|
|
578
|
+
// characteristicId: 'c306',
|
|
579
|
+
// },
|
|
580
|
+
// getDeviceInfoFromAdvertising: (device: PeripheralData) => {
|
|
581
|
+
// const bleDevice: BleDevice = {
|
|
582
|
+
// ...device,
|
|
583
|
+
// type: 'ateq',
|
|
584
|
+
// }
|
|
585
|
+
// return bleDevice
|
|
586
|
+
// },
|
|
587
|
+
// },
|
|
588
|
+
torqueWrench: {
|
|
589
|
+
nameRegex: /^\d+(lbft|NM)-\d+$/i,
|
|
590
|
+
communication: {
|
|
591
|
+
serviceId: "49535343-fe7d-4ae5-8fa9-9fafd205e455",
|
|
592
|
+
characteristicId: "49535343-1e4d-4bd9-ba61-23c647249616"
|
|
593
|
+
},
|
|
594
|
+
battery: {
|
|
595
|
+
serviceId: "180f",
|
|
596
|
+
characteristicId: "2a19"
|
|
597
|
+
},
|
|
598
|
+
getDeviceInfoFromAdvertising: (device) => {
|
|
599
|
+
const bleDevice = {
|
|
600
|
+
...device,
|
|
601
|
+
type: "torqueWrench"
|
|
602
|
+
};
|
|
603
|
+
return bleDevice;
|
|
604
|
+
}
|
|
551
605
|
}
|
|
552
606
|
};
|
|
553
607
|
|
|
@@ -3071,7 +3125,6 @@ const torqueWrenchService = {
|
|
|
3071
3125
|
async startJob(deviceId, params) {
|
|
3072
3126
|
await this.stopJob(deviceId);
|
|
3073
3127
|
const { units, span, ppr, threshold } = store.torqueWrenchProperties[deviceId];
|
|
3074
|
-
console.log("\u{1F680} ~ startJob ~ units:", units);
|
|
3075
3128
|
const { torqueMin, torqueMax, angleMin, angleMax, direction, jobTimeout } = params;
|
|
3076
3129
|
const msgParams = {
|
|
3077
3130
|
id: "01",
|
|
@@ -3096,14 +3149,11 @@ const torqueWrenchService = {
|
|
|
3096
3149
|
await torqueWrenchCommands.sendCommand(deviceId, "startJob", paramsString);
|
|
3097
3150
|
jobInterval = setInterval(async () => {
|
|
3098
3151
|
const numberOfReading = await this.getNumberOfReadings(deviceId);
|
|
3099
|
-
console.log("\u{1F680} ~ jobInterval=setInterval ~ numberOfReading:", numberOfReading);
|
|
3100
3152
|
if (numberOfReading.count > 0) this.getReading(deviceId);
|
|
3101
|
-
},
|
|
3153
|
+
}, 2e3);
|
|
3102
3154
|
if (jobTimeout) {
|
|
3103
3155
|
await new Promise(
|
|
3104
3156
|
(resolve) => setTimeout(() => {
|
|
3105
|
-
console.log("job terminated");
|
|
3106
|
-
clearInterval(jobInterval);
|
|
3107
3157
|
this.stopJob(deviceId);
|
|
3108
3158
|
resolve("");
|
|
3109
3159
|
}, jobTimeout * 1e3)
|
|
@@ -3111,6 +3161,7 @@ const torqueWrenchService = {
|
|
|
3111
3161
|
}
|
|
3112
3162
|
},
|
|
3113
3163
|
async stopJob(deviceId) {
|
|
3164
|
+
clearInterval(jobInterval);
|
|
3114
3165
|
return torqueWrenchCommands.sendCommand(deviceId, "stopJob");
|
|
3115
3166
|
},
|
|
3116
3167
|
async getNumberOfReadings(deviceId) {
|
|
@@ -3217,6 +3268,7 @@ const torqueWrench = {
|
|
|
3217
3268
|
},
|
|
3218
3269
|
async disconnect(deviceId, reason) {
|
|
3219
3270
|
store.setState(deviceId, "disconnecting");
|
|
3271
|
+
await torqueWrenchService.stopJob(deviceId);
|
|
3220
3272
|
await bluetooth.disconnect(deviceId);
|
|
3221
3273
|
store.setState(deviceId, void 0, reason ?? "manualDisconnection");
|
|
3222
3274
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tirecheck-device-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.23",
|
|
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",
|