incyclist-devices 2.1.12 → 2.1.14
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/LICENSE +0 -0
- package/README.MD +238 -238
- package/lib/antv2/base/adapter.d.ts +0 -0
- package/lib/antv2/base/adapter.js +0 -0
- package/lib/antv2/base/binding.d.ts +0 -0
- package/lib/antv2/base/binding.js +0 -0
- package/lib/antv2/base/interface.d.ts +0 -0
- package/lib/antv2/base/interface.js +0 -0
- package/lib/antv2/cad/adapter.d.ts +0 -0
- package/lib/antv2/cad/adapter.js +0 -0
- package/lib/antv2/cad/index.d.ts +0 -0
- package/lib/antv2/cad/index.js +0 -0
- package/lib/antv2/consts.d.ts +0 -0
- package/lib/antv2/consts.js +0 -0
- package/lib/antv2/factories/adapter-factory.d.ts +0 -0
- package/lib/antv2/factories/adapter-factory.js +0 -0
- package/lib/antv2/factories/sensor-factory.d.ts +0 -0
- package/lib/antv2/factories/sensor-factory.js +0 -0
- package/lib/antv2/fe/adapter.d.ts +0 -0
- package/lib/antv2/fe/adapter.js +0 -0
- package/lib/antv2/fe/index.d.ts +0 -0
- package/lib/antv2/fe/index.js +0 -0
- package/lib/antv2/hr/adapter.d.ts +0 -0
- package/lib/antv2/hr/adapter.js +0 -0
- package/lib/antv2/hr/index.d.ts +0 -0
- package/lib/antv2/hr/index.js +0 -0
- package/lib/antv2/index.d.ts +0 -0
- package/lib/antv2/index.js +0 -0
- package/lib/antv2/pwr/adapter.d.ts +0 -0
- package/lib/antv2/pwr/adapter.js +0 -0
- package/lib/antv2/pwr/index.d.ts +0 -0
- package/lib/antv2/pwr/index.js +0 -0
- package/lib/antv2/types.d.ts +0 -0
- package/lib/antv2/types.js +0 -0
- package/lib/antv2/utils.d.ts +0 -0
- package/lib/antv2/utils.js +0 -0
- package/lib/base/adpater.d.ts +0 -0
- package/lib/base/adpater.js +0 -0
- package/lib/base/consts.d.ts +0 -0
- package/lib/base/consts.js +0 -0
- package/lib/ble/adapter-factory.d.ts +0 -0
- package/lib/ble/adapter-factory.js +0 -0
- package/lib/ble/base/adapter.d.ts +0 -0
- package/lib/ble/base/adapter.js +0 -0
- package/lib/ble/base/comms-utils.d.ts +0 -0
- package/lib/ble/base/comms-utils.js +0 -0
- package/lib/ble/base/comms.d.ts +0 -0
- package/lib/ble/base/comms.js +0 -0
- package/lib/ble/base/types.d.ts +0 -0
- package/lib/ble/base/types.js +0 -0
- package/lib/ble/bindings/index.d.ts +0 -0
- package/lib/ble/bindings/index.js +0 -0
- package/lib/ble/bindings/linux.d.ts +0 -0
- package/lib/ble/bindings/linux.js +0 -0
- package/lib/ble/bindings/mock.d.ts +0 -0
- package/lib/ble/bindings/mock.js +0 -0
- package/lib/ble/bindings/types.d.ts +0 -0
- package/lib/ble/bindings/types.js +0 -0
- package/lib/ble/ble-interface.d.ts +0 -0
- package/lib/ble/ble-interface.js +0 -0
- package/lib/ble/ble-peripheral.d.ts +0 -0
- package/lib/ble/ble-peripheral.js +0 -0
- package/lib/ble/consts.d.ts +0 -0
- package/lib/ble/consts.js +0 -0
- package/lib/ble/cp/adapter.d.ts +0 -0
- package/lib/ble/cp/adapter.js +0 -0
- package/lib/ble/cp/comm.d.ts +0 -0
- package/lib/ble/cp/comm.js +0 -0
- package/lib/ble/cp/index.d.ts +0 -0
- package/lib/ble/cp/index.js +0 -0
- package/lib/ble/cp/types.d.ts +0 -0
- package/lib/ble/cp/types.js +0 -0
- package/lib/ble/elite/adapter.d.ts +0 -0
- package/lib/ble/elite/adapter.js +0 -0
- package/lib/ble/elite/comms.d.ts +0 -0
- package/lib/ble/elite/comms.js +0 -0
- package/lib/ble/elite/index.d.ts +0 -0
- package/lib/ble/elite/index.js +0 -0
- package/lib/ble/fm/adapter.d.ts +0 -0
- package/lib/ble/fm/adapter.js +0 -0
- package/lib/ble/fm/comms.d.ts +0 -0
- package/lib/ble/fm/comms.js +0 -0
- package/lib/ble/fm/consts.d.ts +0 -0
- package/lib/ble/fm/consts.js +0 -0
- package/lib/ble/fm/index.d.ts +0 -0
- package/lib/ble/fm/index.js +0 -0
- package/lib/ble/fm/types.d.ts +0 -0
- package/lib/ble/fm/types.js +0 -0
- package/lib/ble/hr/adapter.d.ts +0 -0
- package/lib/ble/hr/adapter.js +0 -0
- package/lib/ble/hr/comm.d.ts +0 -0
- package/lib/ble/hr/comm.js +0 -0
- package/lib/ble/hr/index.d.ts +0 -0
- package/lib/ble/hr/index.js +0 -0
- package/lib/ble/hr/mock.d.ts +0 -0
- package/lib/ble/hr/mock.js +0 -0
- package/lib/ble/hr/types.d.ts +0 -0
- package/lib/ble/hr/types.js +0 -0
- package/lib/ble/index.d.ts +0 -0
- package/lib/ble/index.js +0 -0
- package/lib/ble/peripheral-cache.d.ts +0 -0
- package/lib/ble/peripheral-cache.js +0 -0
- package/lib/ble/tacx/adapter.d.ts +0 -0
- package/lib/ble/tacx/adapter.js +0 -0
- package/lib/ble/tacx/comms.d.ts +0 -0
- package/lib/ble/tacx/comms.js +0 -0
- package/lib/ble/tacx/index.d.ts +0 -0
- package/lib/ble/tacx/index.js +0 -0
- package/lib/ble/tacx/types.d.ts +0 -0
- package/lib/ble/tacx/types.js +0 -0
- package/lib/ble/types.d.ts +0 -0
- package/lib/ble/types.js +0 -0
- package/lib/ble/utils.d.ts +0 -0
- package/lib/ble/utils.js +0 -0
- package/lib/ble/wahoo/adapter.d.ts +0 -0
- package/lib/ble/wahoo/adapter.js +0 -0
- package/lib/ble/wahoo/comms.d.ts +0 -0
- package/lib/ble/wahoo/comms.js +0 -0
- package/lib/ble/wahoo/index.d.ts +0 -0
- package/lib/ble/wahoo/index.js +0 -0
- package/lib/ble/wahoo/types.d.ts +0 -0
- package/lib/ble/wahoo/types.js +0 -0
- package/lib/factories/adapters.d.ts +0 -0
- package/lib/factories/adapters.js +0 -0
- package/lib/factories/index.d.ts +0 -0
- package/lib/factories/index.js +0 -0
- package/lib/factories/interfaces.d.ts +0 -0
- package/lib/factories/interfaces.js +0 -0
- package/lib/index.d.ts +0 -0
- package/lib/index.js +0 -0
- package/lib/modes/ant-fe-adv-st-mode.d.ts +0 -0
- package/lib/modes/ant-fe-adv-st-mode.js +0 -0
- package/lib/modes/antble-erg.d.ts +0 -0
- package/lib/modes/antble-erg.js +0 -0
- package/lib/modes/antble-smarttrainer.d.ts +0 -0
- package/lib/modes/antble-smarttrainer.js +0 -0
- package/lib/modes/base.d.ts +0 -0
- package/lib/modes/base.js +0 -0
- package/lib/modes/daum-classic-standard.d.ts +0 -0
- package/lib/modes/daum-classic-standard.js +0 -0
- package/lib/modes/daum-erg.d.ts +0 -0
- package/lib/modes/daum-erg.js +0 -0
- package/lib/modes/daum-power.d.ts +0 -0
- package/lib/modes/daum-power.js +0 -0
- package/lib/modes/daum-premium-standard.d.ts +0 -0
- package/lib/modes/daum-premium-standard.js +0 -0
- package/lib/modes/daum-smarttrainer.d.ts +0 -0
- package/lib/modes/daum-smarttrainer.js +0 -0
- package/lib/modes/kettler-erg.d.ts +0 -0
- package/lib/modes/kettler-erg.js +0 -0
- package/lib/modes/power-base.d.ts +0 -0
- package/lib/modes/power-base.js +0 -0
- package/lib/modes/power-meter.d.ts +0 -0
- package/lib/modes/power-meter.js +0 -0
- package/lib/modes/simulator.d.ts +0 -0
- package/lib/modes/simulator.js +0 -0
- package/lib/modes/types.d.ts +0 -0
- package/lib/modes/types.js +0 -0
- package/lib/serial/base/adapter.d.ts +0 -0
- package/lib/serial/base/adapter.js +0 -0
- package/lib/serial/base/comms.d.ts +0 -0
- package/lib/serial/base/comms.js +0 -0
- package/lib/serial/base/serial-interface.d.ts +0 -0
- package/lib/serial/base/serial-interface.js +2 -3
- package/lib/serial/base/serial-scanner.d.ts +0 -0
- package/lib/serial/base/serial-scanner.js +0 -0
- package/lib/serial/base/serialport.d.ts +0 -0
- package/lib/serial/base/serialport.js +0 -0
- package/lib/serial/bindings/tcp.d.ts +0 -0
- package/lib/serial/bindings/tcp.js +0 -0
- package/lib/serial/daum/DaumAdapter.d.ts +0 -0
- package/lib/serial/daum/DaumAdapter.js +0 -0
- package/lib/serial/daum/classic/adapter.d.ts +0 -0
- package/lib/serial/daum/classic/adapter.js +0 -0
- package/lib/serial/daum/classic/comms.d.ts +0 -0
- package/lib/serial/daum/classic/comms.js +8 -2
- package/lib/serial/daum/classic/consts.d.ts +0 -0
- package/lib/serial/daum/classic/consts.js +0 -0
- package/lib/serial/daum/classic/mock.d.ts +3 -1
- package/lib/serial/daum/classic/mock.js +27 -3
- package/lib/serial/daum/classic/types.d.ts +0 -0
- package/lib/serial/daum/classic/types.js +0 -0
- package/lib/serial/daum/classic/utils.d.ts +0 -0
- package/lib/serial/daum/classic/utils.js +0 -0
- package/lib/serial/daum/premium/adapter.d.ts +0 -0
- package/lib/serial/daum/premium/adapter.js +0 -0
- package/lib/serial/daum/premium/comms.d.ts +0 -0
- package/lib/serial/daum/premium/comms.js +0 -0
- package/lib/serial/daum/premium/consts.d.ts +0 -0
- package/lib/serial/daum/premium/consts.js +0 -0
- package/lib/serial/daum/premium/mock.d.ts +0 -0
- package/lib/serial/daum/premium/mock.js +0 -0
- package/lib/serial/daum/premium/types.d.ts +0 -0
- package/lib/serial/daum/premium/types.js +0 -0
- package/lib/serial/daum/premium/utils.d.ts +0 -0
- package/lib/serial/daum/premium/utils.js +0 -0
- package/lib/serial/daum/types.d.ts +0 -0
- package/lib/serial/daum/types.js +0 -0
- package/lib/serial/factories/adapter-factory.d.ts +0 -0
- package/lib/serial/factories/adapter-factory.js +0 -0
- package/lib/serial/index.d.ts +0 -0
- package/lib/serial/index.js +0 -0
- package/lib/serial/kettler/comms.d.ts +0 -0
- package/lib/serial/kettler/comms.js +0 -0
- package/lib/serial/kettler/ergo-racer/adapter.d.ts +1 -1
- package/lib/serial/kettler/ergo-racer/adapter.js +3 -2
- package/lib/serial/kettler/ergo-racer/mock.d.ts +0 -0
- package/lib/serial/kettler/ergo-racer/mock.js +0 -0
- package/lib/serial/kettler/types.d.ts +0 -0
- package/lib/serial/kettler/types.js +0 -0
- package/lib/serial/types.d.ts +0 -0
- package/lib/serial/types.js +0 -0
- package/lib/simulator/Simulator.d.ts +0 -0
- package/lib/simulator/Simulator.js +0 -0
- package/lib/types/adapter.d.ts +0 -0
- package/lib/types/adapter.js +0 -0
- package/lib/types/capabilities.d.ts +0 -0
- package/lib/types/capabilities.js +0 -0
- package/lib/types/data.d.ts +0 -0
- package/lib/types/data.js +0 -0
- package/lib/types/device.d.ts +0 -0
- package/lib/types/device.js +0 -0
- package/lib/types/index.d.ts +0 -0
- package/lib/types/index.js +0 -0
- package/lib/types/interface.d.ts +0 -0
- package/lib/types/interface.js +0 -0
- package/lib/types/user.d.ts +0 -0
- package/lib/types/user.js +0 -0
- package/lib/utils/calculations.d.ts +0 -0
- package/lib/utils/calculations.js +0 -0
- package/lib/utils/utils.d.ts +0 -0
- package/lib/utils/utils.js +0 -0
- package/package.json +51 -51
- package/lib/adapters.d.ts +0 -7
- package/lib/adapters.js +0 -49
- package/lib/antv2/adapter-factory.d.ts +0 -14
- package/lib/antv2/adapter-factory.js +0 -65
- package/lib/antv2/adapter.d.ts +0 -54
- package/lib/antv2/adapter.js +0 -291
- package/lib/antv2/ant-interface.d.ts +0 -35
- package/lib/antv2/ant-interface.js +0 -285
- package/lib/antv2/base/ant-interface.d.ts +0 -35
- package/lib/antv2/base/ant-interface.js +0 -285
- package/lib/antv2/binding.d.ts +0 -13
- package/lib/antv2/binding.js +0 -27
- package/lib/antv2/hr copy/adapter.d.ts +0 -11
- package/lib/antv2/hr copy/adapter.js +0 -30
- package/lib/antv2/hr copy/index.d.ts +0 -2
- package/lib/antv2/hr copy/index.js +0 -7
- package/lib/antv2/sensor-factory.d.ts +0 -5
- package/lib/antv2/sensor-factory.js +0 -20
- package/lib/interfaces.d.ts +0 -7
- package/lib/interfaces.js +0 -27
- package/lib/serial/SinglePathScanner.d.ts +0 -17
- package/lib/serial/SinglePathScanner.js +0 -87
- package/lib/serial/adapter-factory.d.ts +0 -14
- package/lib/serial/adapter-factory.js +0 -30
- package/lib/serial/adapter.d.ts +0 -17
- package/lib/serial/adapter.js +0 -67
- package/lib/serial/comm.d.ts +0 -7
- package/lib/serial/comm.js +0 -2
- package/lib/serial/comms.d.ts +0 -62
- package/lib/serial/comms.js +0 -280
- package/lib/serial/daum/classic/PROTOCOL_NAME.d.ts +0 -2
- package/lib/serial/daum/classic/PROTOCOL_NAME.js +0 -5
- package/lib/serial/daum/consts.d.ts +0 -0
- package/lib/serial/daum/consts.js +0 -0
- package/lib/serial/serial-interface.d.ts +0 -36
- package/lib/serial/serial-interface.js +0 -288
- package/lib/serial/serial-scanner.d.ts +0 -16
- package/lib/serial/serial-scanner.js +0 -87
- package/lib/serial/serialport.d.ts +0 -17
- package/lib/serial/serialport.js +0 -87
- package/lib/types/Command.d.ts +0 -8
- package/lib/types/Command.js +0 -2
- package/lib/types/command.d.ts +0 -0
- package/lib/types/command.js +0 -0
- package/lib/types/route.d.ts +0 -0
- package/lib/types/route.js +0 -0
- package/lib/types/types.d.ts +0 -8
- package/lib/types/types.js +0 -2
package/package.json
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "incyclist-devices",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"dependencies": {
|
|
5
|
-
"@serialport/bindings-interface": "^1.2.2",
|
|
6
|
-
"@serialport/parser-byte-length": "^9.0.1",
|
|
7
|
-
"@serialport/parser-delimiter": "^9.0.1",
|
|
8
|
-
"@serialport/parser-readline": "^10.5.0",
|
|
9
|
-
"@serialport/stream": "^10.5.0",
|
|
10
|
-
"incyclist-ant-plus": "^0.2.0",
|
|
11
|
-
"win32filetime": "^1.0.2"
|
|
12
|
-
},
|
|
13
|
-
"peerDependencies": {
|
|
14
|
-
"gd-eventlog": "^0.1.24"
|
|
15
|
-
},
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"@serialport/binding-mock": "^10.2.2",
|
|
18
|
-
"@serialport/bindings-cpp": "^10.8.0",
|
|
19
|
-
"@types/jest": "^29.5.3",
|
|
20
|
-
"@types/node": "^20.5.0",
|
|
21
|
-
"eslint": "^8.47.0",
|
|
22
|
-
"eslint-config-react-app": "^7.0.1",
|
|
23
|
-
"jest": "^29.6.2",
|
|
24
|
-
"ts-jest": "^29.1.1",
|
|
25
|
-
"typescript": "^5.1.6"
|
|
26
|
-
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"lint": "eslint . --ext .ts",
|
|
29
|
-
"build": "tsc",
|
|
30
|
-
"test": "npx jest --coverage",
|
|
31
|
-
"test:ci": "npx jest --coverage --forceExit",
|
|
32
|
-
"dev": "tsc --watch",
|
|
33
|
-
"postversion": "git push && git push --tags"
|
|
34
|
-
},
|
|
35
|
-
"files": [
|
|
36
|
-
"lib/"
|
|
37
|
-
],
|
|
38
|
-
"main": "lib/index.js",
|
|
39
|
-
"directories": {
|
|
40
|
-
"example": "./sample",
|
|
41
|
-
"lib": "./src"
|
|
42
|
-
},
|
|
43
|
-
"eslintConfig": {
|
|
44
|
-
"extends": "react-app",
|
|
45
|
-
"rules": {
|
|
46
|
-
"jsx-a11y/anchor-is-valid": [
|
|
47
|
-
"off"
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "incyclist-devices",
|
|
3
|
+
"version": "2.1.14",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@serialport/bindings-interface": "^1.2.2",
|
|
6
|
+
"@serialport/parser-byte-length": "^9.0.1",
|
|
7
|
+
"@serialport/parser-delimiter": "^9.0.1",
|
|
8
|
+
"@serialport/parser-readline": "^10.5.0",
|
|
9
|
+
"@serialport/stream": "^10.5.0",
|
|
10
|
+
"incyclist-ant-plus": "^0.2.0",
|
|
11
|
+
"win32filetime": "^1.0.2"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"gd-eventlog": "^0.1.24"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@serialport/binding-mock": "^10.2.2",
|
|
18
|
+
"@serialport/bindings-cpp": "^10.8.0",
|
|
19
|
+
"@types/jest": "^29.5.3",
|
|
20
|
+
"@types/node": "^20.5.0",
|
|
21
|
+
"eslint": "^8.47.0",
|
|
22
|
+
"eslint-config-react-app": "^7.0.1",
|
|
23
|
+
"jest": "^29.6.2",
|
|
24
|
+
"ts-jest": "^29.1.1",
|
|
25
|
+
"typescript": "^5.1.6"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"lint": "eslint . --ext .ts",
|
|
29
|
+
"build": "tsc",
|
|
30
|
+
"test": "npx jest --coverage",
|
|
31
|
+
"test:ci": "npx jest --coverage --forceExit",
|
|
32
|
+
"dev": "tsc --watch",
|
|
33
|
+
"postversion": "git push && git push --tags"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"lib/"
|
|
37
|
+
],
|
|
38
|
+
"main": "lib/index.js",
|
|
39
|
+
"directories": {
|
|
40
|
+
"example": "./sample",
|
|
41
|
+
"lib": "./src"
|
|
42
|
+
},
|
|
43
|
+
"eslintConfig": {
|
|
44
|
+
"extends": "react-app",
|
|
45
|
+
"rules": {
|
|
46
|
+
"jsx-a11y/anchor-is-valid": [
|
|
47
|
+
"off"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
package/lib/adapters.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { IncyclistDeviceAdapter } from "./base/adpater";
|
|
2
|
-
import { DeviceProperties, DeviceSettings } from "./types/device";
|
|
3
|
-
export default class AdapterFactory {
|
|
4
|
-
static adapters: IncyclistDeviceAdapter[];
|
|
5
|
-
static reset(): void;
|
|
6
|
-
static create(settings: DeviceSettings, props?: DeviceProperties): any;
|
|
7
|
-
}
|
package/lib/adapters.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const antv2_1 = require("./antv2");
|
|
4
|
-
const ble_1 = require("./ble");
|
|
5
|
-
const serial_1 = require("./serial");
|
|
6
|
-
const Simulator_1 = require("./simulator/Simulator");
|
|
7
|
-
const device_1 = require("./types/device");
|
|
8
|
-
class AdapterFactory {
|
|
9
|
-
static reset() {
|
|
10
|
-
AdapterFactory.adapters = [];
|
|
11
|
-
ble_1.BleAdapterFactory.getInstance().instances = [];
|
|
12
|
-
}
|
|
13
|
-
static create(settings, props) {
|
|
14
|
-
const adapters = AdapterFactory.adapters;
|
|
15
|
-
if (!settings.interface && settings.protocol === 'Simulator') {
|
|
16
|
-
const adapter = new Simulator_1.Simulator(settings);
|
|
17
|
-
if (adapter) {
|
|
18
|
-
adapters.push(adapter);
|
|
19
|
-
}
|
|
20
|
-
return adapter;
|
|
21
|
-
}
|
|
22
|
-
const existing = adapters.find(a => a.isEqual(settings));
|
|
23
|
-
if (existing)
|
|
24
|
-
return existing;
|
|
25
|
-
const ifaceName = typeof settings.interface === 'string' ? settings.interface : settings.interface.getName();
|
|
26
|
-
let adapter;
|
|
27
|
-
switch (ifaceName) {
|
|
28
|
-
case device_1.INTERFACE.SERIAL:
|
|
29
|
-
case device_1.INTERFACE.TCPIP:
|
|
30
|
-
adapter = serial_1.SerialAdapterFactory.getInstance().createInstance(settings, props);
|
|
31
|
-
break;
|
|
32
|
-
case device_1.INTERFACE.ANT:
|
|
33
|
-
adapter = antv2_1.AntAdapterFactory.getInstance().createInstance(settings, props);
|
|
34
|
-
break;
|
|
35
|
-
case device_1.INTERFACE.BLE:
|
|
36
|
-
adapter = ble_1.BleAdapterFactory.getInstance().createInstance(settings, props);
|
|
37
|
-
break;
|
|
38
|
-
case device_1.INTERFACE.SIMULATOR:
|
|
39
|
-
adapter = new Simulator_1.Simulator(settings, props);
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
if (adapter) {
|
|
43
|
-
adapters.push(adapter);
|
|
44
|
-
}
|
|
45
|
-
return adapter;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
AdapterFactory.adapters = [];
|
|
49
|
-
exports.default = AdapterFactory;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Profile } from "incyclist-ant-plus";
|
|
2
|
-
import AntAdapter from "./base/adapter";
|
|
3
|
-
import { AntDeviceProperties, AntDeviceSettings, LegacyProfile, BaseDeviceData } from "./types";
|
|
4
|
-
import { AntAdapterInfo, AdapterQuery } from "./types";
|
|
5
|
-
export default class AntAdapterFactory {
|
|
6
|
-
static _instance: AntAdapterFactory;
|
|
7
|
-
adapters: AntAdapterInfo[];
|
|
8
|
-
static getInstance(): AntAdapterFactory;
|
|
9
|
-
constructor();
|
|
10
|
-
register<TDeviceData extends BaseDeviceData>(antProfile: Profile, incyclistProfile: LegacyProfile, Adapter: typeof AntAdapter<TDeviceData>): void;
|
|
11
|
-
getAdapter(query?: AdapterQuery): any;
|
|
12
|
-
createInstance(settings: AntDeviceSettings, props?: AntDeviceProperties): any;
|
|
13
|
-
createFromDetected(profile: Profile, deviceID: number, props?: AntDeviceProperties): any;
|
|
14
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
class AntAdapterFactory {
|
|
4
|
-
static getInstance() {
|
|
5
|
-
if (!AntAdapterFactory._instance)
|
|
6
|
-
AntAdapterFactory._instance = new AntAdapterFactory();
|
|
7
|
-
return AntAdapterFactory._instance;
|
|
8
|
-
}
|
|
9
|
-
constructor() {
|
|
10
|
-
this.adapters = [];
|
|
11
|
-
}
|
|
12
|
-
register(antProfile, incyclistProfile, Adapter) {
|
|
13
|
-
const info = Object.assign({}, { antProfile, incyclistProfile, Adapter });
|
|
14
|
-
const existing = this.adapters.findIndex(a => a.antProfile === antProfile);
|
|
15
|
-
if (existing !== -1)
|
|
16
|
-
this.adapters[existing] = info;
|
|
17
|
-
else
|
|
18
|
-
this.adapters.push(info);
|
|
19
|
-
}
|
|
20
|
-
getAdapter(query) {
|
|
21
|
-
const { antProfile, incyclistProfile } = query;
|
|
22
|
-
if (!antProfile && !incyclistProfile)
|
|
23
|
-
throw new Error('Illegal arguments: either "antProfile" or "incyclistProfile" must be set');
|
|
24
|
-
let found;
|
|
25
|
-
if (antProfile)
|
|
26
|
-
found = this.adapters.find(a => a.antProfile === antProfile);
|
|
27
|
-
if (incyclistProfile)
|
|
28
|
-
found = this.adapters.find(a => a.incyclistProfile === incyclistProfile);
|
|
29
|
-
return found;
|
|
30
|
-
}
|
|
31
|
-
createInstance(settings, props) {
|
|
32
|
-
let info;
|
|
33
|
-
const { profile, protocol } = settings;
|
|
34
|
-
let isLegacy = false;
|
|
35
|
-
if (protocol) {
|
|
36
|
-
try {
|
|
37
|
-
const incyclistProfile = profile;
|
|
38
|
-
info = this.getAdapter({ incyclistProfile });
|
|
39
|
-
isLegacy = true;
|
|
40
|
-
}
|
|
41
|
-
catch (_a) {
|
|
42
|
-
isLegacy = false;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (!isLegacy) {
|
|
46
|
-
const antProfile = profile;
|
|
47
|
-
info = this.getAdapter({ antProfile });
|
|
48
|
-
}
|
|
49
|
-
if (info && info.Adapter)
|
|
50
|
-
return new info.Adapter(settings, props);
|
|
51
|
-
}
|
|
52
|
-
createFromDetected(profile, deviceID, props) {
|
|
53
|
-
const info = this.getAdapter({ antProfile: profile });
|
|
54
|
-
if (!info || !info.Adapter)
|
|
55
|
-
return;
|
|
56
|
-
const settings = Object.assign({}, {
|
|
57
|
-
profile: info.incyclistProfile,
|
|
58
|
-
deviceID: deviceID.toString(),
|
|
59
|
-
interface: 'ant',
|
|
60
|
-
protocol: 'Ant'
|
|
61
|
-
});
|
|
62
|
-
return new info.Adapter(settings, props);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.default = AntAdapterFactory;
|
package/lib/antv2/adapter.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IChannel, ISensor, Profile } from 'incyclist-ant-plus';
|
|
3
|
-
import AntInterface from './ant-interface';
|
|
4
|
-
import IncyclistDevice from '../base/adpater';
|
|
5
|
-
import { AntDeviceProperties, AntDeviceSettings, BaseDeviceData } from './types';
|
|
6
|
-
import { IAdapter, IncyclistAdapterData, IncyclistBikeData } from '../types';
|
|
7
|
-
export default class AntAdapter<TDeviceData extends BaseDeviceData> extends IncyclistDevice<AntDeviceProperties> {
|
|
8
|
-
sensor: ISensor;
|
|
9
|
-
data: IncyclistAdapterData;
|
|
10
|
-
deviceData: TDeviceData;
|
|
11
|
-
updateFrequency: number;
|
|
12
|
-
channel: IChannel;
|
|
13
|
-
ant: AntInterface;
|
|
14
|
-
userSettings: {
|
|
15
|
-
weight?: number;
|
|
16
|
-
};
|
|
17
|
-
bikeSettings: {
|
|
18
|
-
weight?: number;
|
|
19
|
-
};
|
|
20
|
-
onDataFn: (data: IncyclistAdapterData) => void;
|
|
21
|
-
startupRetryPause: number;
|
|
22
|
-
protected ivDataTimeout: NodeJS.Timeout;
|
|
23
|
-
protected lastDataTS: number;
|
|
24
|
-
protected dataMsgCount: number;
|
|
25
|
-
protected ivWaitForData: NodeJS.Timeout;
|
|
26
|
-
constructor(settings: AntDeviceSettings, props?: AntDeviceProperties);
|
|
27
|
-
createSensor(settings: AntDeviceSettings): ISensor;
|
|
28
|
-
isEqual(settings: AntDeviceSettings): boolean;
|
|
29
|
-
connect(): Promise<boolean>;
|
|
30
|
-
close(): Promise<boolean>;
|
|
31
|
-
resetData(): void;
|
|
32
|
-
isSame(device: IAdapter): boolean;
|
|
33
|
-
hasData(): boolean;
|
|
34
|
-
mapData(deviceData: TDeviceData): IncyclistBikeData;
|
|
35
|
-
transformData(data: IncyclistBikeData): void;
|
|
36
|
-
mapToAdapterData(deviceData: any): void;
|
|
37
|
-
onDeviceData(deviceData: TDeviceData): void;
|
|
38
|
-
isWaitingForData(): boolean;
|
|
39
|
-
waitForData(timeout: number): Promise<boolean>;
|
|
40
|
-
getID(): string;
|
|
41
|
-
getName(): string;
|
|
42
|
-
getInterface(): string;
|
|
43
|
-
getProfile(): Profile;
|
|
44
|
-
getLogData(data: any, excludeList: any): any;
|
|
45
|
-
triggerTimeoutCheck(): void;
|
|
46
|
-
startDataTimeoutCheck(): void;
|
|
47
|
-
stopDataTimeoutCheck(): void;
|
|
48
|
-
check(): Promise<boolean>;
|
|
49
|
-
checkCapabilities(): Promise<void>;
|
|
50
|
-
initControl(): Promise<void>;
|
|
51
|
-
sendUpdate(request: any): void;
|
|
52
|
-
start(props?: AntDeviceProperties): Promise<boolean>;
|
|
53
|
-
stop(): Promise<boolean>;
|
|
54
|
-
}
|
package/lib/antv2/adapter.js
DELETED
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const ant_interface_1 = __importDefault(require("./ant-interface"));
|
|
16
|
-
const adpater_1 = __importDefault(require("../base/adpater"));
|
|
17
|
-
const types_1 = require("./types");
|
|
18
|
-
const types_2 = require("../types");
|
|
19
|
-
const utils_1 = require("../utils/utils");
|
|
20
|
-
const utils_2 = require("./utils");
|
|
21
|
-
const consts_1 = require("./consts");
|
|
22
|
-
const INTERFACE_NAME = 'ant';
|
|
23
|
-
class AntAdapter extends adpater_1.default {
|
|
24
|
-
constructor(settings, props) {
|
|
25
|
-
super(settings, props);
|
|
26
|
-
this.startupRetryPause = 1000;
|
|
27
|
-
const antSettings = this.settings;
|
|
28
|
-
if ((0, types_1.isLegacyProfile)(antSettings.profile))
|
|
29
|
-
antSettings.profile = (0, utils_2.mapLegacyProfile)(antSettings.profile);
|
|
30
|
-
if (this.settings.interface !== 'ant')
|
|
31
|
-
throw new Error('Incorrect interface');
|
|
32
|
-
this.sensor = this.createSensor(settings);
|
|
33
|
-
this.deviceData = {};
|
|
34
|
-
this.data = {};
|
|
35
|
-
this.dataMsgCount = 0;
|
|
36
|
-
this.updateFrequency = consts_1.DEFAULT_UPDATE_FREQUENCY;
|
|
37
|
-
this.channel = undefined;
|
|
38
|
-
this.ant = ant_interface_1.default.getInstance();
|
|
39
|
-
}
|
|
40
|
-
createSensor(settings) {
|
|
41
|
-
throw new Error('Method not implemented.');
|
|
42
|
-
}
|
|
43
|
-
isEqual(settings) {
|
|
44
|
-
const as = this.settings;
|
|
45
|
-
if (as.interface !== settings.interface)
|
|
46
|
-
return false;
|
|
47
|
-
if (Number(as.deviceID) !== Number(settings.deviceID) || as.profile !== settings.profile)
|
|
48
|
-
return false;
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
connect() {
|
|
52
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const connected = yield ant_interface_1.default.getInstance().connect();
|
|
54
|
-
return connected;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
close() {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
return true;
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
resetData() {
|
|
63
|
-
this.dataMsgCount = 0;
|
|
64
|
-
const { DeviceID } = this.deviceData;
|
|
65
|
-
this.deviceData = { DeviceID };
|
|
66
|
-
this.lastDataTS = undefined;
|
|
67
|
-
}
|
|
68
|
-
isSame(device) {
|
|
69
|
-
if (!(device instanceof AntAdapter))
|
|
70
|
-
return false;
|
|
71
|
-
const adapter = device;
|
|
72
|
-
return (adapter.getID() === this.getID() && adapter.getProfile() === this.getProfile());
|
|
73
|
-
}
|
|
74
|
-
hasData() {
|
|
75
|
-
return this.dataMsgCount > 0;
|
|
76
|
-
}
|
|
77
|
-
mapData(deviceData) {
|
|
78
|
-
throw new Error('message not implemented');
|
|
79
|
-
}
|
|
80
|
-
transformData(data) {
|
|
81
|
-
throw new Error('message not implemented');
|
|
82
|
-
}
|
|
83
|
-
mapToAdapterData(deviceData) {
|
|
84
|
-
throw new Error('message not implemented');
|
|
85
|
-
}
|
|
86
|
-
onDeviceData(deviceData) {
|
|
87
|
-
this.dataMsgCount++;
|
|
88
|
-
this.lastDataTS = Date.now();
|
|
89
|
-
try {
|
|
90
|
-
const { ManId } = this.deviceData;
|
|
91
|
-
this.deviceData = Object.assign({}, deviceData);
|
|
92
|
-
if (!ManId && deviceData.ManId) {
|
|
93
|
-
this.emit('device-info', { device: this.getSettings(), manufacturer: (0, utils_2.getBrand)(deviceData.ManId) });
|
|
94
|
-
}
|
|
95
|
-
if (!this.started || this.isStopped())
|
|
96
|
-
return;
|
|
97
|
-
this.triggerTimeoutCheck();
|
|
98
|
-
if (!this.canEmitData())
|
|
99
|
-
return;
|
|
100
|
-
const logData = this.getLogData(deviceData, ['PairedDevices', 'RawData']);
|
|
101
|
-
this.logEvent({ message: 'onDeviceData', data: logData, paused: this.paused });
|
|
102
|
-
if (this.isControllable()) {
|
|
103
|
-
let incyclistData = this.mapData(deviceData);
|
|
104
|
-
incyclistData = this.getCyclingMode().updateData(incyclistData);
|
|
105
|
-
this.transformData(incyclistData);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
this.mapToAdapterData(deviceData);
|
|
109
|
-
}
|
|
110
|
-
this.emitData(this.data);
|
|
111
|
-
}
|
|
112
|
-
catch (err) {
|
|
113
|
-
console.log('~~~ERROR', err);
|
|
114
|
-
this.logEvent({ message: 'error', fn: 'onDeviceData()', error: err.message || err, stack: err.stack });
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
isWaitingForData() {
|
|
118
|
-
return this.ivWaitForData !== undefined && this.ivWaitForData !== null;
|
|
119
|
-
}
|
|
120
|
-
waitForData(timeout) {
|
|
121
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
const startTs = Date.now();
|
|
123
|
-
const timeoutTs = startTs + timeout;
|
|
124
|
-
if (this.hasData())
|
|
125
|
-
return true;
|
|
126
|
-
return new Promise((resolve, reject) => {
|
|
127
|
-
if (this.ivWaitForData)
|
|
128
|
-
return reject(new Error('busy'));
|
|
129
|
-
this.ivWaitForData = setInterval(() => {
|
|
130
|
-
const nowTs = Date.now();
|
|
131
|
-
const hasData = this.hasData();
|
|
132
|
-
if (nowTs > timeoutTs && !hasData) {
|
|
133
|
-
clearInterval(this.ivWaitForData);
|
|
134
|
-
this.ivWaitForData = undefined;
|
|
135
|
-
reject(new Error('No Data Received'));
|
|
136
|
-
}
|
|
137
|
-
if (hasData) {
|
|
138
|
-
clearInterval(this.ivWaitForData);
|
|
139
|
-
this.ivWaitForData = undefined;
|
|
140
|
-
resolve(true);
|
|
141
|
-
}
|
|
142
|
-
}, 500);
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
getID() {
|
|
147
|
-
return this.sensor.getDeviceID().toString();
|
|
148
|
-
}
|
|
149
|
-
getName() {
|
|
150
|
-
const deviceID = this.sensor.getDeviceID();
|
|
151
|
-
const profile = this.sensor.getProfile();
|
|
152
|
-
return `Ant+${profile} ${deviceID}`;
|
|
153
|
-
}
|
|
154
|
-
getInterface() {
|
|
155
|
-
return INTERFACE_NAME;
|
|
156
|
-
}
|
|
157
|
-
getProfile() {
|
|
158
|
-
const settings = this.settings;
|
|
159
|
-
if (settings.protocol === undefined)
|
|
160
|
-
return settings.profile;
|
|
161
|
-
else {
|
|
162
|
-
return (0, utils_2.mapLegacyProfile)(settings.profile);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
getLogData(data, excludeList) {
|
|
166
|
-
const logData = JSON.parse(JSON.stringify(data));
|
|
167
|
-
excludeList.forEach((key) => {
|
|
168
|
-
delete logData[key];
|
|
169
|
-
});
|
|
170
|
-
return logData;
|
|
171
|
-
}
|
|
172
|
-
triggerTimeoutCheck() {
|
|
173
|
-
if (!this.ivDataTimeout && this.dataMsgCount > 0) {
|
|
174
|
-
this.startDataTimeoutCheck();
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
startDataTimeoutCheck() {
|
|
178
|
-
if (this.ivDataTimeout)
|
|
179
|
-
return;
|
|
180
|
-
this.ivDataTimeout = setInterval(() => {
|
|
181
|
-
if (!this.lastDataTS)
|
|
182
|
-
return;
|
|
183
|
-
if (this.lastDataTS + consts_1.NO_DATA_TIMEOUT < Date.now()) {
|
|
184
|
-
this.emit('disconnected', Date.now() - this.lastDataTS);
|
|
185
|
-
}
|
|
186
|
-
}, 1000);
|
|
187
|
-
}
|
|
188
|
-
stopDataTimeoutCheck() {
|
|
189
|
-
if (!this.ivDataTimeout)
|
|
190
|
-
return;
|
|
191
|
-
clearInterval(this.ivDataTimeout);
|
|
192
|
-
this.ivDataTimeout = undefined;
|
|
193
|
-
this.lastDataTS = undefined;
|
|
194
|
-
this.dataMsgCount = 0;
|
|
195
|
-
}
|
|
196
|
-
check() {
|
|
197
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
198
|
-
try {
|
|
199
|
-
return yield this.start();
|
|
200
|
-
}
|
|
201
|
-
catch (error) {
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
checkCapabilities() {
|
|
207
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
-
return;
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
initControl() {
|
|
212
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
213
|
-
return;
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
sendUpdate(request) {
|
|
217
|
-
if (!this.isControllable())
|
|
218
|
-
return;
|
|
219
|
-
if (this.isPaused() || this.isStopped())
|
|
220
|
-
return;
|
|
221
|
-
if (!this.hasCapability(types_2.IncyclistCapability.Control))
|
|
222
|
-
this.getCyclingMode().sendBikeUpdate(request);
|
|
223
|
-
else
|
|
224
|
-
throw new Error('method not implemented');
|
|
225
|
-
}
|
|
226
|
-
start(props = {}) {
|
|
227
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
228
|
-
if (this.started && !this.stopped) {
|
|
229
|
-
if (this.paused)
|
|
230
|
-
this.resume();
|
|
231
|
-
return true;
|
|
232
|
-
}
|
|
233
|
-
this.stopped = false;
|
|
234
|
-
const connected = yield this.connect();
|
|
235
|
-
if (!connected)
|
|
236
|
-
throw new Error(`could not start device, reason:could not connect`);
|
|
237
|
-
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
238
|
-
this.resetData();
|
|
239
|
-
this.stopped = false;
|
|
240
|
-
this.resume();
|
|
241
|
-
const { startupTimeout = 20000 } = props;
|
|
242
|
-
let to = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
243
|
-
try {
|
|
244
|
-
yield this.stop();
|
|
245
|
-
}
|
|
246
|
-
catch (_a) { }
|
|
247
|
-
this.started = false;
|
|
248
|
-
reject(new Error(`could not start device, reason:timeout`));
|
|
249
|
-
}), startupTimeout);
|
|
250
|
-
let started = false;
|
|
251
|
-
do {
|
|
252
|
-
started = yield this.ant.startSensor(this.sensor, (data) => {
|
|
253
|
-
this.onDeviceData(data);
|
|
254
|
-
});
|
|
255
|
-
if (!started)
|
|
256
|
-
yield (0, utils_1.sleep)(this.startupRetryPause);
|
|
257
|
-
} while (!started);
|
|
258
|
-
try {
|
|
259
|
-
yield this.waitForData(startupTimeout - 100);
|
|
260
|
-
yield this.checkCapabilities();
|
|
261
|
-
if (this.hasCapability(types_2.IncyclistCapability.Control))
|
|
262
|
-
yield this.initControl();
|
|
263
|
-
this.started = true;
|
|
264
|
-
if (to)
|
|
265
|
-
clearTimeout(to);
|
|
266
|
-
resolve(true);
|
|
267
|
-
}
|
|
268
|
-
catch (err) {
|
|
269
|
-
}
|
|
270
|
-
}));
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
stop() {
|
|
274
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
275
|
-
let stopped;
|
|
276
|
-
try {
|
|
277
|
-
this.stopDataTimeoutCheck();
|
|
278
|
-
stopped = yield this.ant.stopSensor(this.sensor);
|
|
279
|
-
}
|
|
280
|
-
catch (err) {
|
|
281
|
-
this.logEvent({ message: 'stop sensor failed', reason: err.message });
|
|
282
|
-
}
|
|
283
|
-
this.started = false;
|
|
284
|
-
this.stopped = true;
|
|
285
|
-
this.paused = false;
|
|
286
|
-
this.removeAllListeners();
|
|
287
|
-
return stopped;
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
exports.default = AntAdapter;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import EventEmitter from "events";
|
|
3
|
-
import { EventLogger } from "gd-eventlog";
|
|
4
|
-
import { IAntDevice, IChannel, ISensor } from "incyclist-ant-plus";
|
|
5
|
-
import { AntDeviceSettings, AntScanProps, AntInterfaceProps, ConnectState } from "./types";
|
|
6
|
-
import { IncyclistInterface } from "../types";
|
|
7
|
-
import AntDeviceBinding from "./base/binding";
|
|
8
|
-
export default class AntInterface extends EventEmitter implements IncyclistInterface {
|
|
9
|
-
static _instance: AntInterface;
|
|
10
|
-
static INTERFACE_NAME: string;
|
|
11
|
-
static getInstance(props?: AntInterfaceProps): AntInterface;
|
|
12
|
-
static hasInstance(): boolean;
|
|
13
|
-
protected logger: EventLogger;
|
|
14
|
-
protected device: IAntDevice;
|
|
15
|
-
protected Binding: typeof AntDeviceBinding;
|
|
16
|
-
protected connectState: ConnectState;
|
|
17
|
-
protected props: AntInterfaceProps;
|
|
18
|
-
protected activeScan: IChannel;
|
|
19
|
-
constructor(props: AntInterfaceProps);
|
|
20
|
-
getName(): string;
|
|
21
|
-
getBinding(): typeof AntDeviceBinding;
|
|
22
|
-
setBinding(binding: typeof AntDeviceBinding): void;
|
|
23
|
-
setLogger(logger: EventLogger): void;
|
|
24
|
-
logEvent(event: any): void;
|
|
25
|
-
isConnected(): boolean;
|
|
26
|
-
connect(): Promise<boolean>;
|
|
27
|
-
disconnect(): Promise<boolean>;
|
|
28
|
-
onError(profile: any, error: any): void;
|
|
29
|
-
onData(profile: any, id: any, data: any, tag: any): void;
|
|
30
|
-
scan(props?: AntScanProps): Promise<AntDeviceSettings[]>;
|
|
31
|
-
stopScan(): Promise<boolean>;
|
|
32
|
-
startSensor(sensor: ISensor, onDeviceData: (data: any) => void): Promise<boolean>;
|
|
33
|
-
stopSensor(sensor: ISensor): Promise<boolean>;
|
|
34
|
-
isScanning(): boolean;
|
|
35
|
-
}
|