incyclist-devices 2.4.14 → 3.0.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/.eslintrc.json +23 -0
- package/.github/workflows/PR.yml +48 -0
- package/.github/workflows/tag.yml +23 -0
- package/package.json +55 -66
- package/protos/zwift_hub.proto +194 -0
- package/samples/DaumClassic/index.js +118 -0
- package/samples/DaumClassic/package-lock.json +960 -0
- package/samples/DaumClassic/package.json +26 -0
- package/samples/DaumPremium/index.js +117 -0
- package/samples/DaumPremium/package-lock.json +839 -0
- package/samples/DaumPremium/package.json +26 -0
- package/samples/ant/index.js +104 -0
- package/samples/ant/package-lock.json +131 -0
- package/samples/ant/package.json +22 -0
- package/samples/ble/bindings.js +376 -0
- package/samples/ble/index.js +239 -0
- package/samples/ble/package-lock.json +1852 -0
- package/samples/ble/package.json +24 -0
- package/samples/ble/prebuilt/BLEServer.exe +0 -0
- package/samples/ble/prebuilt/README.txt +4 -0
- package/samples/direct-connect/index.js +172 -0
- package/samples/direct-connect/package-lock.json +105 -0
- package/samples/direct-connect/package.json +22 -0
- package/src/antv2/__snapshots__/utils.unit.test.ts.snap +364 -0
- package/src/antv2/base/adapter.ts +635 -0
- package/src/antv2/base/adapter.unit.test.ts +424 -0
- package/src/antv2/base/binding.ts +34 -0
- package/src/antv2/base/interface.ts +532 -0
- package/src/antv2/base/interface.unit.test.ts +613 -0
- package/src/antv2/cad/adapter.ts +26 -0
- package/src/antv2/cad/adpater.unit.test.ts +191 -0
- package/src/antv2/cad/index.ts +4 -0
- package/src/antv2/consts.ts +5 -0
- package/src/antv2/factories/adapter-factory.integration.test.ts +193 -0
- package/src/antv2/factories/adapter-factory.ts +98 -0
- package/src/antv2/factories/index.ts +1 -0
- package/src/antv2/factories/sensor-factory.ts +28 -0
- package/src/antv2/fe/adapter.ts +371 -0
- package/src/antv2/fe/adapter.unit.test.ts +953 -0
- package/src/antv2/fe/index.ts +5 -0
- package/src/antv2/hr/adapter.ts +34 -0
- package/src/antv2/hr/adpater.unit.test.ts +443 -0
- package/src/antv2/hr/index.ts +4 -0
- package/src/antv2/index.ts +31 -0
- package/src/antv2/pwr/adapter.ts +87 -0
- package/src/antv2/pwr/adapter.unit.test.ts +321 -0
- package/src/antv2/pwr/index.ts +4 -0
- package/src/antv2/sc/adapter.ts +33 -0
- package/src/antv2/sc/adpater.unit.test.ts +230 -0
- package/src/antv2/sc/index.ts +4 -0
- package/src/antv2/scan.e2e.test.ts +80 -0
- package/src/antv2/spd/adapter.ts +26 -0
- package/src/antv2/spd/adpater.unit.test.ts +200 -0
- package/src/antv2/spd/index.ts +4 -0
- package/src/antv2/types.ts +62 -0
- package/{lib/antv2/utils.js → src/antv2/utils.ts} +26 -23
- package/src/antv2/utils.unit.test.ts +42 -0
- package/src/base/adpater.ts +445 -0
- package/src/base/consts.ts +10 -0
- package/src/ble/base/adapter.ts +567 -0
- package/src/ble/base/interface.ts +1016 -0
- package/src/ble/base/interface.unit.test.ts +504 -0
- package/src/ble/base/peripheral.ts +520 -0
- package/src/ble/base/sensor.ts +195 -0
- package/src/ble/base/types.ts +20 -0
- package/src/ble/bindings/index.ts +3 -0
- package/src/ble/bindings/linux.ts +59 -0
- package/src/ble/bindings/mock.ts +153 -0
- package/src/ble/bindings/types.ts +145 -0
- package/src/ble/characteristics/csc/features.ts +29 -0
- package/src/ble/characteristics/csc/measurement.ts +143 -0
- package/src/ble/characteristics/csc/measurement.unit.test.ts +35 -0
- package/{lib/ble/characteristics/types.d.ts → src/ble/characteristics/types.ts} +5 -3
- package/src/ble/consts.ts +20 -0
- package/src/ble/cp/adapter.ts +118 -0
- package/src/ble/cp/adapter.unit.test.ts +165 -0
- package/src/ble/cp/index.ts +6 -0
- package/src/ble/cp/sensor.ts +130 -0
- package/{lib/ble/cp/types.d.ts → src/ble/cp/types.ts} +8 -5
- package/src/ble/csc/adapter.ts +73 -0
- package/src/ble/csc/index.ts +3 -0
- package/src/ble/csc/sensor.ts +74 -0
- package/src/ble/csc/types.ts +7 -0
- package/src/ble/factories/adapter-factory.test.ts +63 -0
- package/src/ble/factories/adapter-factory.ts +189 -0
- package/src/ble/factories/index.ts +2 -0
- package/src/ble/factories/interface-factory.ts +22 -0
- package/src/ble/factories/types.ts +16 -0
- package/src/ble/fm/adapter.e2e.test.ts +131 -0
- package/src/ble/fm/adapter.ts +473 -0
- package/src/ble/fm/adapter.unit.test.ts +139 -0
- package/src/ble/fm/consts.ts +105 -0
- package/src/ble/fm/index.ts +7 -0
- package/src/ble/fm/sensor.ts +614 -0
- package/src/ble/fm/sensor.unit.test.ts +225 -0
- package/{lib/ble/fm/types.d.ts → src/ble/fm/types.ts} +10 -4
- package/src/ble/hr/adapter.ts +51 -0
- package/src/ble/hr/adapter.unit.test.ts +17 -0
- package/src/ble/hr/index.ts +6 -0
- package/src/ble/hr/mock.ts +63 -0
- package/src/ble/hr/sensor.ts +71 -0
- package/src/ble/hr/types.ts +5 -0
- package/src/ble/index.ts +41 -0
- package/src/ble/tacx/adapter.ts +76 -0
- package/src/ble/tacx/consts.ts +25 -0
- package/src/ble/tacx/index.ts +7 -0
- package/src/ble/tacx/sensor.ts +689 -0
- package/src/ble/tacx/sensor.unit.test.ts +122 -0
- package/src/ble/tacx/types.ts +35 -0
- package/{lib/ble/types.d.ts → src/ble/types.ts} +155 -87
- package/src/ble/utils.ts +168 -0
- package/src/ble/wahoo/adapter.ts +48 -0
- package/src/ble/wahoo/consts.ts +18 -0
- package/src/ble/wahoo/index.ts +6 -0
- package/src/ble/wahoo/sensor.ts +447 -0
- package/src/ble/wahoo/sensor.unit.test.ts +88 -0
- package/{lib/ble/wahoo/types.d.ts → src/ble/wahoo/types.ts} +2 -1
- package/src/ble/zwift/play/adapter.ts +75 -0
- package/src/ble/zwift/play/index.ts +3 -0
- package/src/ble/zwift/play/sensor.ts +692 -0
- package/src/ble/zwift/play/types.ts +8 -0
- package/src/direct-connect/base/interface.ts +575 -0
- package/src/direct-connect/base/interface.unit.test.ts +155 -0
- package/src/direct-connect/base/peripheral.ts +641 -0
- package/src/direct-connect/base/peripheral.unit.test.ts +41 -0
- package/src/direct-connect/bindings/index.ts +2 -0
- package/src/direct-connect/bindings/types.ts +51 -0
- package/src/direct-connect/consts.ts +27 -0
- package/src/direct-connect/index.ts +8 -0
- package/src/direct-connect/messages/CharacteristicNotification.ts +38 -0
- package/src/direct-connect/messages/DiscoverCharacteristics.ts +75 -0
- package/src/direct-connect/messages/DiscoverServices.ts +54 -0
- package/src/direct-connect/messages/EnableCharacteristicNotifications.ts +55 -0
- package/src/direct-connect/messages/EnableCharacteristicNotifications.unit.test.ts +17 -0
- package/src/direct-connect/messages/ReadCharacteristic.ts +58 -0
- package/src/direct-connect/messages/WriteCharacteristic.ts +58 -0
- package/src/direct-connect/messages/error.ts +18 -0
- package/src/direct-connect/messages/factory.ts +46 -0
- package/src/direct-connect/messages/index.ts +9 -0
- package/src/direct-connect/messages/message.ts +145 -0
- package/src/direct-connect/types.ts +33 -0
- package/src/direct-connect/utils.unit.test.ts +60 -0
- package/src/factories/adapters.ts +72 -0
- package/src/factories/interfaces.ts +37 -0
- package/src/features/features.ts +38 -0
- package/src/features/index.ts +1 -0
- package/src/index.ts +47 -0
- package/src/modes/__snapshots__/ant-fe-adv-st-mode.test.ts.snap +123 -0
- package/src/modes/__snapshots__/antble-erg.test.ts.snap +57 -0
- package/src/modes/__snapshots__/antble-smarttrainer.test.ts.snap +123 -0
- package/src/modes/__snapshots__/daum-classic-standard.test.ts.snap +43 -0
- package/src/modes/__snapshots__/daum-power.test.ts.snap +11 -0
- package/src/modes/__snapshots__/daum-premium-standard.test.ts.snap +43 -0
- package/src/modes/__snapshots__/fm-resistance.unit.test.ts.snap +5 -0
- package/src/modes/__snapshots__/power-base.unit.test.ts.snap +621 -0
- package/src/modes/__snapshots__/power-meter.unit.test.ts.snap +11 -0
- package/src/modes/ant-fe-adv-st-mode.test.ts +280 -0
- package/src/modes/ant-fe-adv-st-mode.ts +110 -0
- package/src/modes/antble-erg.test.ts +256 -0
- package/src/modes/antble-erg.ts +31 -0
- package/src/modes/antble-smarttrainer.test.ts +425 -0
- package/src/modes/antble-smarttrainer.ts +584 -0
- package/src/modes/base.ts +142 -0
- package/src/modes/daum-classic-standard.test.ts +205 -0
- package/src/modes/daum-classic-standard.ts +82 -0
- package/src/modes/daum-erg.test.ts +534 -0
- package/src/modes/daum-erg.ts +261 -0
- package/src/modes/daum-erg.unit.test.ts +30 -0
- package/src/modes/daum-power.test.ts +21 -0
- package/src/modes/daum-power.ts +13 -0
- package/src/modes/daum-premium-standard.test.ts +205 -0
- package/src/modes/daum-premium-standard.ts +101 -0
- package/src/modes/daum-smarttrainer.test.ts +431 -0
- package/src/modes/daum-smarttrainer.ts +479 -0
- package/src/modes/fm-resistance.ts +181 -0
- package/src/modes/fm-resistance.unit.test.ts +117 -0
- package/src/modes/kettler-erg.test.ts +341 -0
- package/src/modes/kettler-erg.ts +180 -0
- package/src/modes/power-base.ts +368 -0
- package/src/modes/power-base.unit.test.ts +204 -0
- package/src/modes/power-meter.ts +52 -0
- package/src/modes/power-meter.unit.test.ts +125 -0
- package/src/modes/simulator.ts +157 -0
- package/src/modes/types.ts +156 -0
- package/src/proto/zwift_hub.ts +1877 -0
- package/src/serial/base/adapter.ts +70 -0
- package/src/serial/base/comms.ts +411 -0
- package/src/serial/base/serial-interface.test.ts +170 -0
- package/src/serial/base/serial-interface.ts +384 -0
- package/src/serial/base/serial-scanner.ts +113 -0
- package/src/serial/base/serialport.test.ts +65 -0
- package/src/serial/base/serialport.ts +103 -0
- package/src/serial/bindings/tcp.test.ts +186 -0
- package/src/serial/bindings/tcp.ts +421 -0
- package/src/serial/daum/DaumAdapter.test.ts +1236 -0
- package/src/serial/daum/DaumAdapter.ts +667 -0
- package/src/serial/daum/classic/__snapshots__/utils.unit.test.ts.snap +559 -0
- package/src/serial/daum/classic/adapter.integration.test.ts +94 -0
- package/src/serial/daum/classic/adapter.test.ts +171 -0
- package/src/serial/daum/classic/adapter.ts +243 -0
- package/src/serial/daum/classic/comms.test.ts +913 -0
- package/src/serial/daum/classic/comms.ts +284 -0
- package/src/serial/daum/classic/consts.ts +2 -0
- package/src/serial/daum/classic/mock.ts +542 -0
- package/src/serial/daum/classic/types.ts +77 -0
- package/src/serial/daum/classic/utils.ts +132 -0
- package/src/serial/daum/classic/utils.unit.test.ts +129 -0
- package/src/serial/daum/premium/__snapshots__/utils.unit.test.ts.snap +25 -0
- package/src/serial/daum/premium/adapter.integration.test.ts +90 -0
- package/src/serial/daum/premium/adapter.ts +297 -0
- package/src/serial/daum/premium/adapter.unit.test.ts +916 -0
- package/src/serial/daum/premium/comms.test.ts +1431 -0
- package/src/serial/daum/premium/comms.ts +699 -0
- package/src/serial/daum/premium/consts.ts +8 -0
- package/src/serial/daum/premium/mock.ts +568 -0
- package/src/serial/daum/premium/types.ts +86 -0
- package/src/serial/daum/premium/utils.ts +389 -0
- package/src/serial/daum/premium/utils.unit.test.ts +397 -0
- package/src/serial/daum/types.ts +27 -0
- package/src/serial/factories/adapter-factory.test.ts +175 -0
- package/src/serial/factories/adapter-factory.ts +40 -0
- package/src/serial/index.ts +28 -0
- package/src/serial/kettler/comms.test.ts +140 -0
- package/src/serial/kettler/comms.ts +373 -0
- package/src/serial/kettler/ergo-racer/adapter.test.ts +101 -0
- package/src/serial/kettler/ergo-racer/adapter.ts +763 -0
- package/src/serial/kettler/ergo-racer/mock.ts +290 -0
- package/{lib/serial/types.d.ts → src/serial/types.ts} +25 -13
- package/src/simulator/Simulator.ts +259 -0
- package/src/simulator/Simulator.unit.test.ts +238 -0
- package/src/types/adapter.ts +74 -0
- package/src/types/capabilities.ts +9 -0
- package/src/types/data.ts +27 -0
- package/src/types/device.ts +39 -0
- package/src/types/index.ts +6 -0
- package/src/types/interface.ts +24 -0
- package/src/types/user.ts +14 -0
- package/src/utils/__snapshots__/calculation.test.ts.snap +13851 -0
- package/src/utils/calculation.test.ts +298 -0
- package/src/utils/calculations.ts +243 -0
- package/src/utils/task.ts +204 -0
- package/src/utils/utils.ts +211 -0
- package/src/utils/utils.unit.test.ts +270 -0
- package/test/logger.ts +19 -0
- package/test/mock-adapter.ts +27 -0
- package/tools/ble-forwarder/eslint.config.mjs +12 -0
- package/tools/ble-forwarder/package-lock.json +7183 -0
- package/tools/ble-forwarder/package.json +44 -0
- package/tools/ble-forwarder/src/index.ts +193 -0
- package/tools/ble-forwarder/src/parseArgs.ts +50 -0
- package/tools/ble-forwarder/tsconfig.json +21 -0
- package/tools/ble-simulator/eslint.config.mjs +12 -0
- package/tools/ble-simulator/package-lock.json +6716 -0
- package/tools/ble-simulator/package.json +43 -0
- package/tools/ble-simulator/src/emulator/characteristics/characteristic.ts +111 -0
- package/tools/ble-simulator/src/emulator/characteristics/cycling-power-measurement-characteristic.ts +94 -0
- package/tools/ble-simulator/src/emulator/characteristics/cycling-power-wahoo-extension-characteristic.ts +57 -0
- package/tools/ble-simulator/src/emulator/characteristics/read-characteristic.ts +19 -0
- package/tools/ble-simulator/src/emulator/services/csp.ts +32 -0
- package/tools/ble-simulator/src/emulator/services/service.ts +41 -0
- package/tools/ble-simulator/src/emulator/services/wahoo.ts +23 -0
- package/tools/ble-simulator/src/emulator/types.ts +38 -0
- package/tools/ble-simulator/src/index.ts +21 -0
- package/tools/ble-simulator/src/wahoo.ts +131 -0
- package/tools/ble-simulator/tsconfig.json +21 -0
- package/tools/dc-simulator/config/powermeter.json +27 -0
- package/tools/dc-simulator/config/smarttrainer-0W.json +28 -0
- package/tools/dc-simulator/config/smarttrainer-260W.json +28 -0
- package/tools/dc-simulator/config/smarttrainer-shifting.json +27 -0
- package/tools/dc-simulator/config/smarttrainer.json +27 -0
- package/tools/dc-simulator/eslint.config.mjs +12 -0
- package/tools/dc-simulator/package-lock.json +5436 -0
- package/tools/dc-simulator/package.json +45 -0
- package/tools/dc-simulator/protos/zwift_hub.proto +181 -0
- package/tools/dc-simulator/src/comms.ts +324 -0
- package/tools/dc-simulator/src/config.ts +60 -0
- package/tools/dc-simulator/src/emulator/characteristics/characteristic.ts +83 -0
- package/tools/dc-simulator/src/emulator/characteristics/cycling-power-measurement-characteristic.ts +94 -0
- package/tools/dc-simulator/src/emulator/characteristics/cycling-power-wahoo-extension-characteristic.ts +57 -0
- package/tools/dc-simulator/src/emulator/characteristics/fitness-machine-control-point-characteristic.ts +188 -0
- package/tools/dc-simulator/src/emulator/characteristics/fitness-machine-feature-characteristic.ts +39 -0
- package/tools/dc-simulator/src/emulator/characteristics/heart-rate-measurement-characteristic.ts +34 -0
- package/tools/dc-simulator/src/emulator/characteristics/index.ts +2 -0
- package/tools/dc-simulator/src/emulator/characteristics/indoor-bike-data-characteristic.ts +86 -0
- package/tools/dc-simulator/src/emulator/characteristics/read-characteristic.ts +19 -0
- package/tools/dc-simulator/src/emulator/characteristics/zwift-play-control-point.ts +53 -0
- package/tools/dc-simulator/src/emulator/characteristics/zwift-play-measurement.ts +70 -0
- package/tools/dc-simulator/src/emulator/characteristics/zwift-play-response.ts +47 -0
- package/tools/dc-simulator/src/emulator/index.ts +190 -0
- package/tools/dc-simulator/src/emulator/services/csp.ts +32 -0
- package/tools/dc-simulator/src/emulator/services/ftms.ts +33 -0
- package/tools/dc-simulator/src/emulator/services/hrs.ts +18 -0
- package/tools/dc-simulator/src/emulator/services/index.ts +4 -0
- package/tools/dc-simulator/src/emulator/services/service.ts +39 -0
- package/tools/dc-simulator/src/emulator/services/zwift-play.ts +31 -0
- package/tools/dc-simulator/src/emulator/types.ts +46 -0
- package/tools/dc-simulator/src/index.ts +112 -0
- package/tools/dc-simulator/src/net.ts +37 -0
- package/tools/dc-simulator/tsconfig.json +21 -0
- package/tsconfig.base.json +28 -0
- package/tsconfig.cjs.json +9 -0
- package/tsconfig.esm.json +10 -0
- package/tsconfig.test.json +19 -0
- package/vitest.config.js +28 -0
- package/vitest.setup.ts +4 -0
- package/lib/antv2/base/adapter.d.ts +0 -74
- package/lib/antv2/base/adapter.js +0 -485
- package/lib/antv2/base/binding.d.ts +0 -12
- package/lib/antv2/base/binding.js +0 -27
- package/lib/antv2/base/interface.d.ts +0 -57
- package/lib/antv2/base/interface.js +0 -420
- package/lib/antv2/cad/adapter.d.ts +0 -10
- package/lib/antv2/cad/adapter.js +0 -25
- package/lib/antv2/cad/index.d.ts +0 -2
- package/lib/antv2/cad/index.js +0 -7
- package/lib/antv2/consts.d.ts +0 -2
- package/lib/antv2/consts.js +0 -5
- package/lib/antv2/factories/adapter-factory.d.ts +0 -14
- package/lib/antv2/factories/adapter-factory.js +0 -73
- package/lib/antv2/factories/index.d.ts +0 -1
- package/lib/antv2/factories/index.js +0 -17
- package/lib/antv2/factories/sensor-factory.d.ts +0 -5
- package/lib/antv2/factories/sensor-factory.js +0 -24
- package/lib/antv2/fe/adapter.d.ts +0 -40
- package/lib/antv2/fe/adapter.js +0 -306
- package/lib/antv2/fe/index.d.ts +0 -2
- package/lib/antv2/fe/index.js +0 -7
- package/lib/antv2/hr/adapter.d.ts +0 -11
- package/lib/antv2/hr/adapter.js +0 -30
- package/lib/antv2/hr/index.d.ts +0 -2
- package/lib/antv2/hr/index.js +0 -7
- package/lib/antv2/index.d.ts +0 -12
- package/lib/antv2/index.js +0 -33
- package/lib/antv2/pwr/adapter.d.ts +0 -15
- package/lib/antv2/pwr/adapter.js +0 -78
- package/lib/antv2/pwr/index.d.ts +0 -2
- package/lib/antv2/pwr/index.js +0 -7
- package/lib/antv2/sc/adapter.d.ts +0 -11
- package/lib/antv2/sc/adapter.js +0 -30
- package/lib/antv2/sc/index.d.ts +0 -2
- package/lib/antv2/sc/index.js +0 -7
- package/lib/antv2/spd/adapter.d.ts +0 -11
- package/lib/antv2/spd/adapter.js +0 -25
- package/lib/antv2/spd/index.d.ts +0 -2
- package/lib/antv2/spd/index.js +0 -7
- package/lib/antv2/types.d.ts +0 -51
- package/lib/antv2/types.js +0 -5
- package/lib/antv2/utils.d.ts +0 -4
- package/lib/base/adpater.d.ts +0 -79
- package/lib/base/adpater.js +0 -322
- package/lib/base/consts.d.ts +0 -4
- package/lib/base/consts.js +0 -9
- package/lib/ble/adapter-factory.d.ts +0 -34
- package/lib/ble/adapter-factory.js +0 -110
- package/lib/ble/base/adapter.d.ts +0 -63
- package/lib/ble/base/adapter.js +0 -453
- package/lib/ble/base/comms-utils.d.ts +0 -7
- package/lib/ble/base/comms-utils.js +0 -90
- package/lib/ble/base/comms.d.ts +0 -75
- package/lib/ble/base/comms.js +0 -599
- package/lib/ble/base/interface.d.ts +0 -116
- package/lib/ble/base/interface.js +0 -710
- package/lib/ble/base/peripheral.d.ts +0 -46
- package/lib/ble/base/peripheral.js +0 -449
- package/lib/ble/base/sensor.d.ts +0 -36
- package/lib/ble/base/sensor.js +0 -169
- package/lib/ble/base/types.d.ts +0 -15
- package/lib/ble/base/types.js +0 -9
- package/lib/ble/bindings/index.d.ts +0 -2
- package/lib/ble/bindings/index.js +0 -8
- package/lib/ble/bindings/linux.d.ts +0 -17
- package/lib/ble/bindings/linux.js +0 -45
- package/lib/ble/bindings/mock.d.ts +0 -9
- package/lib/ble/bindings/mock.js +0 -120
- package/lib/ble/bindings/types.d.ts +0 -53
- package/lib/ble/bindings/types.js +0 -96
- package/lib/ble/ble-interface.d.ts +0 -84
- package/lib/ble/ble-interface.js +0 -622
- package/lib/ble/ble-peripheral.d.ts +0 -39
- package/lib/ble/ble-peripheral.js +0 -252
- package/lib/ble/characteristics/csc/features.d.ts +0 -10
- package/lib/ble/characteristics/csc/features.js +0 -19
- package/lib/ble/characteristics/csc/measurement.d.ts +0 -33
- package/lib/ble/characteristics/csc/measurement.js +0 -111
- package/lib/ble/characteristics/types.js +0 -2
- package/lib/ble/consts.d.ts +0 -15
- package/lib/ble/consts.js +0 -18
- package/lib/ble/cp/adapter.d.ts +0 -21
- package/lib/ble/cp/adapter.js +0 -108
- package/lib/ble/cp/comm.d.ts +0 -30
- package/lib/ble/cp/comm.js +0 -126
- package/lib/ble/cp/index.d.ts +0 -4
- package/lib/ble/cp/index.js +0 -10
- package/lib/ble/cp/sensor.d.ts +0 -27
- package/lib/ble/cp/sensor.js +0 -108
- package/lib/ble/cp/types.js +0 -2
- package/lib/ble/csc/adapter.d.ts +0 -17
- package/lib/ble/csc/adapter.js +0 -66
- package/lib/ble/csc/index.d.ts +0 -3
- package/lib/ble/csc/index.js +0 -19
- package/lib/ble/csc/sensor.d.ts +0 -21
- package/lib/ble/csc/sensor.js +0 -67
- package/lib/ble/csc/types.d.ts +0 -6
- package/lib/ble/csc/types.js +0 -2
- package/lib/ble/elite/adapter.d.ts +0 -21
- package/lib/ble/elite/adapter.js +0 -118
- package/lib/ble/elite/comms.d.ts +0 -31
- package/lib/ble/elite/comms.js +0 -127
- package/lib/ble/elite/index.d.ts +0 -3
- package/lib/ble/elite/index.js +0 -10
- package/lib/ble/factories/adapter-factory.d.ts +0 -34
- package/lib/ble/factories/adapter-factory.js +0 -137
- package/lib/ble/factories/index.d.ts +0 -2
- package/lib/ble/factories/index.js +0 -18
- package/lib/ble/factories/interface-factory.d.ts +0 -7
- package/lib/ble/factories/interface-factory.js +0 -18
- package/lib/ble/factories/types.d.ts +0 -18
- package/lib/ble/factories/types.js +0 -2
- package/lib/ble/fm/adapter.d.ts +0 -38
- package/lib/ble/fm/adapter.js +0 -380
- package/lib/ble/fm/comms.d.ts +0 -49
- package/lib/ble/fm/comms.js +0 -506
- package/lib/ble/fm/consts.d.ts +0 -100
- package/lib/ble/fm/consts.js +0 -64
- package/lib/ble/fm/index.d.ts +0 -5
- package/lib/ble/fm/index.js +0 -13
- package/lib/ble/fm/sensor.d.ts +0 -49
- package/lib/ble/fm/sensor.js +0 -531
- package/lib/ble/fm/types.js +0 -2
- package/lib/ble/hr/adapter.d.ts +0 -15
- package/lib/ble/hr/adapter.js +0 -40
- package/lib/ble/hr/comm.d.ts +0 -19
- package/lib/ble/hr/comm.js +0 -65
- package/lib/ble/hr/index.d.ts +0 -4
- package/lib/ble/hr/index.js +0 -10
- package/lib/ble/hr/mock.d.ts +0 -7
- package/lib/ble/hr/mock.js +0 -47
- package/lib/ble/hr/sensor.d.ts +0 -17
- package/lib/ble/hr/sensor.js +0 -53
- package/lib/ble/hr/types.d.ts +0 -5
- package/lib/ble/hr/types.js +0 -2
- package/lib/ble/index.d.ts +0 -10
- package/lib/ble/index.js +0 -46
- package/lib/ble/peripheral-cache.d.ts +0 -45
- package/lib/ble/peripheral-cache.js +0 -109
- package/lib/ble/tacx/adapter.d.ts +0 -13
- package/lib/ble/tacx/adapter.js +0 -68
- package/lib/ble/tacx/comms.d.ts +0 -59
- package/lib/ble/tacx/comms.js +0 -634
- package/lib/ble/tacx/consts.d.ts +0 -23
- package/lib/ble/tacx/consts.js +0 -27
- package/lib/ble/tacx/index.d.ts +0 -4
- package/lib/ble/tacx/index.js +0 -10
- package/lib/ble/tacx/sensor.d.ts +0 -64
- package/lib/ble/tacx/sensor.js +0 -604
- package/lib/ble/tacx/types.d.ts +0 -26
- package/lib/ble/tacx/types.js +0 -2
- package/lib/ble/types.js +0 -2
- package/lib/ble/utils.d.ts +0 -23
- package/lib/ble/utils.js +0 -144
- package/lib/ble/wahoo/adapter.d.ts +0 -12
- package/lib/ble/wahoo/adapter.js +0 -47
- package/lib/ble/wahoo/comms.d.ts +0 -64
- package/lib/ble/wahoo/comms.js +0 -399
- package/lib/ble/wahoo/consts.d.ts +0 -16
- package/lib/ble/wahoo/consts.js +0 -7
- package/lib/ble/wahoo/index.d.ts +0 -4
- package/lib/ble/wahoo/index.js +0 -10
- package/lib/ble/wahoo/sensor.d.ts +0 -49
- package/lib/ble/wahoo/sensor.js +0 -372
- package/lib/ble/wahoo/types.js +0 -2
- package/lib/ble/zwift/click/adapter.d.ts +0 -19
- package/lib/ble/zwift/click/adapter.js +0 -74
- package/lib/ble/zwift/click/index.d.ts +0 -2
- package/lib/ble/zwift/click/index.js +0 -18
- package/lib/ble/zwift/click/sensor.d.ts +0 -40
- package/lib/ble/zwift/click/sensor.js +0 -221
- package/lib/ble/zwift/play/adapter.d.ts +0 -18
- package/lib/ble/zwift/play/adapter.js +0 -73
- package/lib/ble/zwift/play/helperfactory.d.ts +0 -7
- package/lib/ble/zwift/play/helperfactory.js +0 -17
- package/lib/ble/zwift/play/index.d.ts +0 -2
- package/lib/ble/zwift/play/index.js +0 -18
- package/lib/ble/zwift/play/protohelper.d.ts +0 -4
- package/lib/ble/zwift/play/protohelper.js +0 -11
- package/lib/ble/zwift/play/sensor.d.ts +0 -70
- package/lib/ble/zwift/play/sensor.js +0 -533
- package/lib/ble/zwift/play/types.d.ts +0 -6
- package/lib/ble/zwift/play/types.js +0 -2
- package/lib/direct-connect/base/comms.d.ts +0 -3
- package/lib/direct-connect/base/comms.js +0 -7
- package/lib/direct-connect/base/interface.d.ts +0 -80
- package/lib/direct-connect/base/interface.js +0 -377
- package/lib/direct-connect/base/peripheral.d.ts +0 -54
- package/lib/direct-connect/base/peripheral.js +0 -543
- package/lib/direct-connect/base/sensor.d.ts +0 -3
- package/lib/direct-connect/base/sensor.js +0 -7
- package/lib/direct-connect/bindings/index.d.ts +0 -1
- package/lib/direct-connect/bindings/index.js +0 -17
- package/lib/direct-connect/bindings/types.d.ts +0 -37
- package/lib/direct-connect/bindings/types.js +0 -2
- package/lib/direct-connect/consts.d.ts +0 -17
- package/lib/direct-connect/consts.js +0 -20
- package/lib/direct-connect/index.d.ts +0 -3
- package/lib/direct-connect/index.js +0 -22
- package/lib/direct-connect/messages/CharacteristicNotification.d.ts +0 -12
- package/lib/direct-connect/messages/CharacteristicNotification.js +0 -23
- package/lib/direct-connect/messages/DiscoverCharacteristics.d.ts +0 -22
- package/lib/direct-connect/messages/DiscoverCharacteristics.js +0 -44
- package/lib/direct-connect/messages/DiscoverServices.d.ts +0 -15
- package/lib/direct-connect/messages/DiscoverServices.js +0 -35
- package/lib/direct-connect/messages/EnableCharacteristicNotifications.d.ts +0 -18
- package/lib/direct-connect/messages/EnableCharacteristicNotifications.js +0 -35
- package/lib/direct-connect/messages/ReadCharacteristic.d.ts +0 -18
- package/lib/direct-connect/messages/ReadCharacteristic.js +0 -34
- package/lib/direct-connect/messages/WriteCharacteristic.d.ts +0 -18
- package/lib/direct-connect/messages/WriteCharacteristic.js +0 -36
- package/lib/direct-connect/messages/error.d.ts +0 -5
- package/lib/direct-connect/messages/error.js +0 -18
- package/lib/direct-connect/messages/factory.d.ts +0 -6
- package/lib/direct-connect/messages/factory.js +0 -44
- package/lib/direct-connect/messages/index.d.ts +0 -9
- package/lib/direct-connect/messages/index.js +0 -25
- package/lib/direct-connect/messages/message.d.ts +0 -21
- package/lib/direct-connect/messages/message.js +0 -106
- package/lib/direct-connect/types.d.ts +0 -24
- package/lib/direct-connect/types.js +0 -9
- package/lib/direct-connect/utils.d.ts +0 -5
- package/lib/direct-connect/utils.js +0 -73
- package/lib/factories/adapters.d.ts +0 -7
- package/lib/factories/adapters.js +0 -56
- package/lib/factories/index.d.ts +0 -3
- package/lib/factories/index.js +0 -10
- package/lib/factories/interfaces.d.ts +0 -8
- package/lib/factories/interfaces.js +0 -30
- package/lib/features/features.d.ts +0 -11
- package/lib/features/features.js +0 -29
- package/lib/features/index.d.ts +0 -1
- package/lib/features/index.js +0 -17
- package/lib/index.d.ts +0 -17
- package/lib/index.js +0 -38
- package/lib/modes/ant-fe-adv-st-mode.d.ts +0 -19
- package/lib/modes/ant-fe-adv-st-mode.js +0 -84
- package/lib/modes/antble-erg.d.ts +0 -31
- package/lib/modes/antble-erg.js +0 -28
- package/lib/modes/antble-smarttrainer.d.ts +0 -63
- package/lib/modes/antble-smarttrainer.js +0 -480
- package/lib/modes/base.d.ts +0 -34
- package/lib/modes/base.js +0 -99
- package/lib/modes/daum-classic-standard.d.ts +0 -18
- package/lib/modes/daum-classic-standard.js +0 -60
- package/lib/modes/daum-erg.d.ts +0 -51
- package/lib/modes/daum-erg.js +0 -200
- package/lib/modes/daum-power.d.ts +0 -5
- package/lib/modes/daum-power.js +0 -12
- package/lib/modes/daum-premium-standard.d.ts +0 -24
- package/lib/modes/daum-premium-standard.js +0 -74
- package/lib/modes/daum-smarttrainer.d.ts +0 -83
- package/lib/modes/daum-smarttrainer.js +0 -347
- package/lib/modes/fm-resistance.d.ts +0 -39
- package/lib/modes/fm-resistance.js +0 -139
- package/lib/modes/kettler-erg.d.ts +0 -44
- package/lib/modes/kettler-erg.js +0 -133
- package/lib/modes/power-base.d.ts +0 -46
- package/lib/modes/power-base.js +0 -275
- package/lib/modes/power-meter.d.ts +0 -15
- package/lib/modes/power-meter.js +0 -39
- package/lib/modes/simulator.d.ts +0 -57
- package/lib/modes/simulator.js +0 -113
- package/lib/modes/types.d.ts +0 -91
- package/lib/modes/types.js +0 -74
- package/lib/proto/org/cagnulen/qdomyoszwift/zwift_hub_pb.d.ts +0 -156
- package/lib/proto/org/cagnulen/qdomyoszwift/zwift_hub_pb.js +0 -59
- package/lib/proto/zwift_hub.d.ts +0 -303
- package/lib/proto/zwift_hub.js +0 -1234
- package/lib/serial/base/adapter.d.ts +0 -17
- package/lib/serial/base/adapter.js +0 -67
- package/lib/serial/base/comms.d.ts +0 -65
- package/lib/serial/base/comms.js +0 -304
- package/lib/serial/base/serial-interface.d.ts +0 -35
- package/lib/serial/base/serial-interface.js +0 -296
- package/lib/serial/base/serial-scanner.d.ts +0 -16
- package/lib/serial/base/serial-scanner.js +0 -95
- package/lib/serial/base/serialport.d.ts +0 -17
- package/lib/serial/base/serialport.js +0 -87
- package/lib/serial/bindings/tcp.d.ts +0 -50
- package/lib/serial/bindings/tcp.js +0 -309
- package/lib/serial/daum/DaumAdapter.d.ts +0 -66
- package/lib/serial/daum/DaumAdapter.js +0 -556
- package/lib/serial/daum/classic/adapter.d.ts +0 -20
- package/lib/serial/daum/classic/adapter.js +0 -196
- package/lib/serial/daum/classic/comms.d.ts +0 -43
- package/lib/serial/daum/classic/comms.js +0 -263
- package/lib/serial/daum/classic/consts.d.ts +0 -2
- package/lib/serial/daum/classic/consts.js +0 -5
- package/lib/serial/daum/classic/mock.d.ts +0 -102
- package/lib/serial/daum/classic/mock.js +0 -407
- package/lib/serial/daum/classic/types.d.ts +0 -57
- package/lib/serial/daum/classic/types.js +0 -2
- package/lib/serial/daum/classic/utils.d.ts +0 -13
- package/lib/serial/daum/classic/utils.js +0 -108
- package/lib/serial/daum/premium/adapter.d.ts +0 -28
- package/lib/serial/daum/premium/adapter.js +0 -238
- package/lib/serial/daum/premium/comms.d.ts +0 -49
- package/lib/serial/daum/premium/comms.js +0 -617
- package/lib/serial/daum/premium/consts.d.ts +0 -6
- package/lib/serial/daum/premium/consts.js +0 -9
- package/lib/serial/daum/premium/mock.d.ts +0 -108
- package/lib/serial/daum/premium/mock.js +0 -419
- package/lib/serial/daum/premium/types.d.ts +0 -61
- package/lib/serial/daum/premium/types.js +0 -31
- package/lib/serial/daum/premium/utils.d.ts +0 -51
- package/lib/serial/daum/premium/utils.js +0 -350
- package/lib/serial/daum/types.d.ts +0 -15
- package/lib/serial/daum/types.js +0 -13
- package/lib/serial/factories/adapter-factory.d.ts +0 -14
- package/lib/serial/factories/adapter-factory.js +0 -30
- package/lib/serial/index.d.ts +0 -12
- package/lib/serial/index.js +0 -59
- package/lib/serial/kettler/comms.d.ts +0 -60
- package/lib/serial/kettler/comms.js +0 -284
- package/lib/serial/kettler/ergo-racer/adapter.d.ts +0 -85
- package/lib/serial/kettler/ergo-racer/adapter.js +0 -569
- package/lib/serial/kettler/ergo-racer/mock.d.ts +0 -65
- package/lib/serial/kettler/ergo-racer/mock.js +0 -216
- package/lib/serial/kettler/types.js +0 -2
- package/lib/serial/types.js +0 -9
- package/lib/simulator/Simulator.d.ts +0 -52
- package/lib/simulator/Simulator.js +0 -200
- package/lib/types/adapter.d.ts +0 -55
- package/lib/types/adapter.js +0 -2
- package/lib/types/capabilities.d.ts +0 -8
- package/lib/types/capabilities.js +0 -12
- package/lib/types/data.d.ts +0 -26
- package/lib/types/data.js +0 -2
- package/lib/types/device.d.ts +0 -31
- package/lib/types/device.js +0 -13
- package/lib/types/index.d.ts +0 -6
- package/lib/types/index.js +0 -22
- package/lib/types/interface.d.ts +0 -19
- package/lib/types/interface.js +0 -2
- package/lib/types/user.d.ts +0 -11
- package/lib/types/user.js +0 -9
- package/lib/utils/calculations.d.ts +0 -14
- package/lib/utils/calculations.js +0 -158
- package/lib/utils/operation.d.ts +0 -17
- package/lib/utils/operation.js +0 -20
- package/lib/utils/task.d.ts +0 -47
- package/lib/utils/task.js +0 -139
- package/lib/utils/utils.d.ts +0 -18
- package/lib/utils/utils.js +0 -196
- /package/{lib/serial/kettler/types.d.ts → src/serial/kettler/types.ts} +0 -0
package/.eslintrc.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"es2021": true,
|
|
4
|
+
"node": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:@typescript-eslint/recommended"
|
|
9
|
+
],
|
|
10
|
+
"overrides": [
|
|
11
|
+
],
|
|
12
|
+
"parser": "@typescript-eslint/parser",
|
|
13
|
+
"parserOptions": {
|
|
14
|
+
"ecmaVersion": "latest",
|
|
15
|
+
"sourceType": "module"
|
|
16
|
+
},
|
|
17
|
+
"plugins": [
|
|
18
|
+
"@typescript-eslint"
|
|
19
|
+
],
|
|
20
|
+
"rules": {
|
|
21
|
+
},
|
|
22
|
+
"ignorePatterns": [ "lib/"]
|
|
23
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
|
2
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
|
3
|
+
|
|
4
|
+
name: Commit and PR
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- '**'
|
|
10
|
+
tags-ignore:
|
|
11
|
+
- '**'
|
|
12
|
+
paths-ignore:
|
|
13
|
+
- 'README.MD'
|
|
14
|
+
- '.github/**'
|
|
15
|
+
|
|
16
|
+
pull_request:
|
|
17
|
+
branches: [ master ]
|
|
18
|
+
paths-ignore:
|
|
19
|
+
- 'README.MD'
|
|
20
|
+
- '.github/**'
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
|
|
25
|
+
build:
|
|
26
|
+
|
|
27
|
+
runs-on: ubuntu-latest
|
|
28
|
+
timeout-minutes: 30
|
|
29
|
+
|
|
30
|
+
strategy:
|
|
31
|
+
matrix:
|
|
32
|
+
node-version: [ 20.x, 21.x]
|
|
33
|
+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
|
34
|
+
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v3
|
|
37
|
+
- name: test ${{ matrix.node-version }}
|
|
38
|
+
uses: actions/setup-node@v3
|
|
39
|
+
with:
|
|
40
|
+
node-version: ${{ matrix.node-version }}
|
|
41
|
+
- run: npm ci
|
|
42
|
+
- run: npm run build --if-present
|
|
43
|
+
#- run: npm run lint
|
|
44
|
+
- run: npm run test:ci
|
|
45
|
+
env:
|
|
46
|
+
CI: true
|
|
47
|
+
|
|
48
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- '**'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
|
|
10
|
+
build:
|
|
11
|
+
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
timeout-minutes: 30
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v3
|
|
17
|
+
|
|
18
|
+
- name: test
|
|
19
|
+
uses: actions/setup-node@v3
|
|
20
|
+
with:
|
|
21
|
+
node-version: 16
|
|
22
|
+
- run: echo "Setting up a new release"
|
|
23
|
+
|
package/package.json
CHANGED
|
@@ -1,70 +1,59 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"gd-eventlog": "^0.1.27"
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@protobuf-ts/plugin": "^2.11.1",
|
|
19
|
-
"@serialport/binding-mock": "^10.2.2",
|
|
20
|
-
"@serialport/bindings-cpp": "^10.8.0",
|
|
21
|
-
"@stoprocent/noble": "^2.3.5",
|
|
22
|
-
"@types/jest": "^30.0.0",
|
|
23
|
-
"@types/node": "^24.3.1",
|
|
24
|
-
"@typescript-eslint/eslint-plugin": "^8.43.0",
|
|
25
|
-
"@typescript-eslint/parser": "^8.43.0",
|
|
26
|
-
"bonjour-service": "^1.3.0",
|
|
27
|
-
"eslint": "^9.35.0",
|
|
28
|
-
"jest": "^30.1.3",
|
|
29
|
-
"npm": "^11.6.4",
|
|
30
|
-
"protoc": "^32.1.0",
|
|
31
|
-
"ts-jest": "^29.4.1",
|
|
32
|
-
"typescript": "^5.9.2"
|
|
33
|
-
},
|
|
34
|
-
"scripts": {
|
|
35
|
-
"lint": "eslint . --ext .ts",
|
|
36
|
-
"build": "tsc",
|
|
37
|
-
"test:unit": "npx jest --coverage",
|
|
38
|
-
"test:ci": "npx jest --coverage --forceExit",
|
|
39
|
-
"dev": "tsc --watch",
|
|
40
|
-
"postversion": "git push && git push --tags",
|
|
41
|
-
"protogen": "protoc --ts_out src/proto --proto_path protos protos/*.proto "
|
|
42
|
-
},
|
|
43
|
-
"files": [
|
|
44
|
-
"lib/"
|
|
45
|
-
],
|
|
46
|
-
"main": "lib/index.js",
|
|
47
|
-
"directories": {
|
|
48
|
-
"example": "./sample",
|
|
49
|
-
"lib": "./src"
|
|
50
|
-
},
|
|
51
|
-
"eslintConfig": {
|
|
52
|
-
"extends": [
|
|
53
|
-
"eslint:recommended",
|
|
54
|
-
"plugin:@typescript-eslint/recommended"
|
|
55
|
-
],
|
|
56
|
-
"parser": "@typescript-eslint/parser",
|
|
57
|
-
"parserOptions": {
|
|
58
|
-
"ecmaVersion": "latest",
|
|
59
|
-
"sourceType": "module"
|
|
2
|
+
"name": "incyclist-devices",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"lint": "eslint . --ext .ts",
|
|
6
|
+
"build": "npm run build:esm && npm run build:cjs",
|
|
7
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
8
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
9
|
+
"test": "vitest run",
|
|
10
|
+
"test:unit": "vitest run --coverage",
|
|
11
|
+
"test:ci": "vitest run--coverage --forceExit",
|
|
12
|
+
"dev": "tsc -p tsconfig.esm.json --watch",
|
|
13
|
+
"postversion": "git push && git push --tags",
|
|
14
|
+
"protogen": "protoc --ts_out src/proto --proto_path protos protos/*.proto "
|
|
60
15
|
},
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"
|
|
67
|
-
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@protobuf-ts/runtime": "^2.11.1",
|
|
18
|
+
"@serialport/bindings-interface": "^1.2.2",
|
|
19
|
+
"@serialport/parser-byte-length": "^13.0.0",
|
|
20
|
+
"@serialport/parser-delimiter": "^13.0.0",
|
|
21
|
+
"@serialport/parser-readline": "^13.0.0",
|
|
22
|
+
"@serialport/stream": "^13.0.0",
|
|
23
|
+
"incyclist-ant-plus": "^0.3.6",
|
|
24
|
+
"win32filetime": "^1.0.2"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"gd-eventlog": "^0.1.27"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@protobuf-ts/plugin": "^2.11.1",
|
|
31
|
+
"@serialport/binding-mock": "^10.2.2",
|
|
32
|
+
"@serialport/bindings-cpp": "^13.0.1",
|
|
33
|
+
"@stoprocent/noble": "^2.3.10",
|
|
34
|
+
"@types/node": "^25.0.10",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
|
36
|
+
"@typescript-eslint/parser": "^8.54.0",
|
|
37
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
38
|
+
"bonjour-service": "^1.3.0",
|
|
39
|
+
"eslint": "^9.39.2",
|
|
40
|
+
"protoc": "^33.4.0",
|
|
41
|
+
"ts-node": "^10.9.2",
|
|
42
|
+
"typescript": "^5.9.2",
|
|
43
|
+
"vitest": "^4.0.18"
|
|
44
|
+
},
|
|
45
|
+
"module": "./lib/esm/index.js",
|
|
46
|
+
"main": "./lib/cjs/index.js",
|
|
47
|
+
"types": "./lib/types/index.d.ts",
|
|
48
|
+
"exports": {
|
|
49
|
+
".": {
|
|
50
|
+
"types": "./lib/types/index.d.ts",
|
|
51
|
+
"import": "./lib/esm/index.js",
|
|
52
|
+
"require": "./lib/cjs/index.js"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"directories": {
|
|
56
|
+
"example": "./sample",
|
|
57
|
+
"lib": "./src"
|
|
68
58
|
}
|
|
69
|
-
}
|
|
70
59
|
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
syntax = "proto2";
|
|
2
|
+
package org.cagnulen.qdomyoszwift;
|
|
3
|
+
|
|
4
|
+
//-------------- Zwift Hub messages
|
|
5
|
+
// The command code prepending this message is 0x00
|
|
6
|
+
// This message is sent always following the change of the gear ratio probably to verify it was received properly
|
|
7
|
+
message HubRequest {
|
|
8
|
+
optional uint32 DataId = 1; // Value observed 520 and 0, 0 requests general info, 1-7 are the fields# in DeviceInformationContent, 520 requests the gear ratio
|
|
9
|
+
// 512 to 534 responds unidentifiable data
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// The command code prepending this message is 0x03
|
|
13
|
+
message HubRidingData {
|
|
14
|
+
optional uint32 Power = 1;
|
|
15
|
+
optional uint32 Cadence = 2;
|
|
16
|
+
optional uint32 SpeedX100 = 3;
|
|
17
|
+
optional uint32 HR = 4;
|
|
18
|
+
optional uint32 Unknown1 = 5; // Values observed 0 when stopped, 2864, 4060, 4636, 6803
|
|
19
|
+
optional uint32 Unknown2 = 6; // Values observed 25714, 30091 (constant during session)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message SimulationParam {
|
|
23
|
+
optional sint32 Windx100 = 1; // Wind in m/s * 100. In zwift there is no wind (0). Negative is backwind
|
|
24
|
+
optional sint32 InclineX100 = 2; // Incline value * 100
|
|
25
|
+
optional uint32 CWax10000 = 3; // Wind coefficient CW * a * 10000. In zwift this is constant 0.51 (5100)
|
|
26
|
+
optional uint32 Crrx100000 = 4; // Rolling resistance Crr * 100000. In zwift this is constant 0.004 (400)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
message PhysicalParam {
|
|
30
|
+
optional uint32 GearRatioX10000 = 2;
|
|
31
|
+
optional uint32 BikeWeightx100 = 4;
|
|
32
|
+
optional uint32 RiderWeightx100 = 5;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// The command code prepending this message is 0x04
|
|
36
|
+
message HubCommand {
|
|
37
|
+
optional uint32 PowerTarget = 3;
|
|
38
|
+
optional SimulationParam Simulation = 4;
|
|
39
|
+
optional PhysicalParam Physical = 5;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
//---------------- Zwift Play messages
|
|
43
|
+
|
|
44
|
+
enum PlayButtonStatus {
|
|
45
|
+
ON = 0;
|
|
46
|
+
OFF = 1;
|
|
47
|
+
}
|
|
48
|
+
// The command code prepending this message is 0x07
|
|
49
|
+
message PlayKeyPadStatus {
|
|
50
|
+
optional PlayButtonStatus RightPad = 1;
|
|
51
|
+
optional PlayButtonStatus Button_Y_Up = 2;
|
|
52
|
+
optional PlayButtonStatus Button_Z_Left = 3;
|
|
53
|
+
optional PlayButtonStatus Button_A_Right = 4;
|
|
54
|
+
optional PlayButtonStatus Button_B_Down = 5;
|
|
55
|
+
optional PlayButtonStatus Button_On = 6;
|
|
56
|
+
optional PlayButtonStatus Button_Shift = 7;
|
|
57
|
+
optional sint32 Analog_LR = 8;
|
|
58
|
+
optional sint32 Analog_UD = 9;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
message PlayCommandParameters {
|
|
63
|
+
optional uint32 param1 = 1;
|
|
64
|
+
optional uint32 param2 = 2;
|
|
65
|
+
optional uint32 HapticPattern = 3;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
message PlayCommandContents {
|
|
69
|
+
optional PlayCommandParameters CommandParameters = 1;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// The command code prepending this message is 0x12
|
|
73
|
+
// This is sent to the control point to configure and make the controller vibrate
|
|
74
|
+
message PlayCommand {
|
|
75
|
+
optional PlayCommandContents CommandContents = 2;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// The command code prepending this message is 0x19
|
|
79
|
+
// This is sent periodically when there are no button presses
|
|
80
|
+
message Idle {
|
|
81
|
+
optional uint32 Unknown2 = 2;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//----------------- Zwift Ride messages
|
|
85
|
+
enum RideButtonMask {
|
|
86
|
+
LEFT_BTN = 0x00001;
|
|
87
|
+
UP_BTN = 0x00002;
|
|
88
|
+
RIGHT_BTN = 0x00004;
|
|
89
|
+
DOWN_BTN = 0x00008;
|
|
90
|
+
A_BTN = 0x00010;
|
|
91
|
+
B_BTN = 0x00020;
|
|
92
|
+
Y_BTN = 0x00040;
|
|
93
|
+
|
|
94
|
+
Z_BTN = 0x00100;
|
|
95
|
+
SHFT_UP_L_BTN = 0x00200;
|
|
96
|
+
SHFT_DN_L_BTN = 0x00400;
|
|
97
|
+
POWERUP_L_BTN = 0x00800;
|
|
98
|
+
ONOFF_L_BTN = 0x01000;
|
|
99
|
+
SHFT_UP_R_BTN = 0x02000;
|
|
100
|
+
SHFT_DN_R_BTN = 0x04000;
|
|
101
|
+
|
|
102
|
+
POWERUP_R_BTN = 0x10000;
|
|
103
|
+
ONOFF_R_BTN = 0x20000;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
enum RideAnalogLocation {
|
|
107
|
+
LEFT = 0;
|
|
108
|
+
RIGHT = 1;
|
|
109
|
+
UP = 2;
|
|
110
|
+
DOWN = 3;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
message RideAnalogKeyPress {
|
|
114
|
+
optional RideAnalogLocation Location = 1;
|
|
115
|
+
optional sint32 AnalogValue = 2;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
message RideAnalogKeyGroup {
|
|
119
|
+
repeated RideAnalogKeyPress GroupStatus = 1;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// The command code prepending this message is 0x23
|
|
123
|
+
message RideKeyPadStatus {
|
|
124
|
+
optional uint32 ButtonMap = 1;
|
|
125
|
+
optional RideAnalogKeyGroup AnalogButtons = 2;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
//------------------ Zwift Hub message after sending rideOn
|
|
130
|
+
// The command code prepending this message is 0x2a
|
|
131
|
+
message TrainerResponse {
|
|
132
|
+
optional uint32 Unknown = 1;
|
|
133
|
+
optional TrainerResponseContent Content = 2;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
message TrainerResponseContent {
|
|
137
|
+
optional string Text = 4;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
//------------------ Zwift Click messages
|
|
142
|
+
// The command code prepending this message is 0x37
|
|
143
|
+
message ClickKeyPadStatus {
|
|
144
|
+
optional PlayButtonStatus Button_Plus = 1;
|
|
145
|
+
optional PlayButtonStatus Button_Minus = 2;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
//------------------ Device Information requested after connection
|
|
149
|
+
// The command code prepending this message is 0x3c
|
|
150
|
+
message DeviceInformationContent {
|
|
151
|
+
optional uint32 Unknown1 = 1;
|
|
152
|
+
repeated uint32 SoftwareVersion = 2;
|
|
153
|
+
optional string DeviceName = 3;
|
|
154
|
+
optional uint32 Unknown4 = 4;
|
|
155
|
+
optional uint32 Unknown5 =5;
|
|
156
|
+
optional string SerialNumber = 6;
|
|
157
|
+
optional string HardwareVersion = 7;
|
|
158
|
+
repeated uint32 ReplyData = 8;
|
|
159
|
+
optional uint32 Unknown9 = 9;
|
|
160
|
+
optional uint32 Unknown10 = 10;
|
|
161
|
+
optional uint32 Unknown13 = 13;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
message SubContent {
|
|
165
|
+
optional DeviceInformationContent Content = 1;
|
|
166
|
+
optional uint32 Unknown2 = 2;
|
|
167
|
+
optional uint32 Unknown4 = 4;
|
|
168
|
+
optional uint32 Unknown5 = 5;
|
|
169
|
+
optional uint32 Unknown6 = 6;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
message DeviceInformation {
|
|
173
|
+
optional uint32 InformationId = 1;
|
|
174
|
+
optional SubContent DeviceInformationContent = 2;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
message DeviceSettings {
|
|
178
|
+
optional DeviceSettingsSubContent SubContent = 1;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
message DeviceSettingsSubContent {
|
|
182
|
+
optional sint32 Windx100 = 5; // Wind in m/s * 100. In zwift there is no wind (0). Negative is backwind
|
|
183
|
+
optional sint32 InclineX100 = 6; // Incline value * 100
|
|
184
|
+
optional uint32 GearRatiox10000 = 8;
|
|
185
|
+
optional uint32 BikeWeightx100 = 11;
|
|
186
|
+
optional uint32 RiderWeightx100 = 12;
|
|
187
|
+
optional uint32 Crrx100000 = 13; // Rolling resistance Crr * 100000. In zwift this is constant 0.004 (400)
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
message DeviceDataEnvelope {
|
|
192
|
+
optional uint32 message_type = 1;
|
|
193
|
+
optional bytes payload = 2; // raw inner bytes
|
|
194
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
const {EventLogger,ConsoleAdapter} = require( 'gd-eventlog');
|
|
2
|
+
const { autoDetect } = require('@serialport/bindings-cpp')
|
|
3
|
+
const { AdapterFactory, InterfaceFactory} = require('incyclist-devices');
|
|
4
|
+
const { DaumClassicMock, DaumClassicSimulator, DaumClassicMockImpl } = require('incyclist-devices');
|
|
5
|
+
|
|
6
|
+
EventLogger.registerAdapter(new ConsoleAdapter())
|
|
7
|
+
|
|
8
|
+
const logger = new EventLogger('DaumClassicSample');
|
|
9
|
+
|
|
10
|
+
function start(device) {
|
|
11
|
+
|
|
12
|
+
return new Promise( async (resolve,reject)=>{
|
|
13
|
+
try {
|
|
14
|
+
await device.start();
|
|
15
|
+
resolve(true);
|
|
16
|
+
} catch (e) {
|
|
17
|
+
logger.logEvent( {message:'error',error:e.message,device:device.getName()})
|
|
18
|
+
setTimeout(async ()=>{
|
|
19
|
+
try {
|
|
20
|
+
await device.start();
|
|
21
|
+
resolve(true)
|
|
22
|
+
} catch (e1) {
|
|
23
|
+
logger.logEvent( {message:'error',error:e.message,device:device.getName()})
|
|
24
|
+
reject();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
},30000);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function runDevice(device) {
|
|
35
|
+
logger.logEvent( {message:'starting device',device:device.getName()})
|
|
36
|
+
|
|
37
|
+
device.onData( (data)=> { logger.logEvent( {message:'onData',data}) })
|
|
38
|
+
|
|
39
|
+
return new Promise( resolve => {
|
|
40
|
+
start(device)
|
|
41
|
+
.then(()=>{
|
|
42
|
+
let slope =0
|
|
43
|
+
// setting power to 200W every 1s
|
|
44
|
+
const iv = setInterval( async ()=>{
|
|
45
|
+
//logger.logEvent( {message:'setting Power',power:200,device:device.getName()})
|
|
46
|
+
await device.sendUpdate( {slope});
|
|
47
|
+
slope+=0.1
|
|
48
|
+
|
|
49
|
+
}, 1000)
|
|
50
|
+
|
|
51
|
+
// stopping device after 10s
|
|
52
|
+
setTimeout( async ()=>{
|
|
53
|
+
logger.logEvent( {message:'stopping device',device:device.getName()})
|
|
54
|
+
await device.stop();
|
|
55
|
+
clearInterval(iv)
|
|
56
|
+
logger.log('stopped')
|
|
57
|
+
resolve(true);
|
|
58
|
+
}, 10000)
|
|
59
|
+
})
|
|
60
|
+
.catch((err)=>{resolve(false)})
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
async function run() {
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
const serial = InterfaceFactory.create('serial',{protocol:'Daum Classic'})
|
|
69
|
+
|
|
70
|
+
if (process.env.MOCK) {
|
|
71
|
+
logger.log('using MockBinding for ports',process.env.MOCK )
|
|
72
|
+
|
|
73
|
+
const mockPorts = process.env.MOCK.split(',')
|
|
74
|
+
|
|
75
|
+
DaumClassicMockImpl.reset();
|
|
76
|
+
const simulator = new DaumClassicSimulator();
|
|
77
|
+
|
|
78
|
+
serial.setBinding(DaumClassicMock)
|
|
79
|
+
|
|
80
|
+
mockPorts.forEach( port => {
|
|
81
|
+
DaumClassicMock.createPort(port)
|
|
82
|
+
DaumClassicMockImpl.getInstance().setSimulator(port,simulator)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
serial.setBinding(autoDetect())
|
|
88
|
+
}
|
|
89
|
+
await serial.connect()
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
var args = process.argv.slice(2);
|
|
93
|
+
if (args.length<1) {
|
|
94
|
+
logger.logEvent({message:'Scanning for devices ...'})
|
|
95
|
+
|
|
96
|
+
serial.on('device',(args)=> logger.logEvent({message:'Device Detected',...args}))
|
|
97
|
+
|
|
98
|
+
const devices = await serial.scan( { timeout: 10000,protocol:'Daum Classic'})
|
|
99
|
+
logger.logEvent({message:'devices found', devices})
|
|
100
|
+
|
|
101
|
+
if (devices.length>0) {
|
|
102
|
+
const device = AdapterFactory.create(devices[0])
|
|
103
|
+
await runDevice(device)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
const device = AdapterFactory.create({interface:serial, protocol:'Daum Classic',port:args[0], name:'Test'})
|
|
108
|
+
await runDevice(device)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
process.on('SIGINT', () => process.exit() ); // CTRL+C
|
|
113
|
+
process.on('SIGQUIT', () => process.exit() ); // Keyboard quit
|
|
114
|
+
process.on('SIGTERM', () => process.exit() ); // `kill` command
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
run();
|
|
118
|
+
|