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.
Files changed (652) hide show
  1. package/.eslintrc.json +23 -0
  2. package/.github/workflows/PR.yml +48 -0
  3. package/.github/workflows/tag.yml +23 -0
  4. package/package.json +55 -66
  5. package/protos/zwift_hub.proto +194 -0
  6. package/samples/DaumClassic/index.js +118 -0
  7. package/samples/DaumClassic/package-lock.json +960 -0
  8. package/samples/DaumClassic/package.json +26 -0
  9. package/samples/DaumPremium/index.js +117 -0
  10. package/samples/DaumPremium/package-lock.json +839 -0
  11. package/samples/DaumPremium/package.json +26 -0
  12. package/samples/ant/index.js +104 -0
  13. package/samples/ant/package-lock.json +131 -0
  14. package/samples/ant/package.json +22 -0
  15. package/samples/ble/bindings.js +376 -0
  16. package/samples/ble/index.js +239 -0
  17. package/samples/ble/package-lock.json +1852 -0
  18. package/samples/ble/package.json +24 -0
  19. package/samples/ble/prebuilt/BLEServer.exe +0 -0
  20. package/samples/ble/prebuilt/README.txt +4 -0
  21. package/samples/direct-connect/index.js +172 -0
  22. package/samples/direct-connect/package-lock.json +105 -0
  23. package/samples/direct-connect/package.json +22 -0
  24. package/src/antv2/__snapshots__/utils.unit.test.ts.snap +364 -0
  25. package/src/antv2/base/adapter.ts +635 -0
  26. package/src/antv2/base/adapter.unit.test.ts +424 -0
  27. package/src/antv2/base/binding.ts +34 -0
  28. package/src/antv2/base/interface.ts +532 -0
  29. package/src/antv2/base/interface.unit.test.ts +613 -0
  30. package/src/antv2/cad/adapter.ts +26 -0
  31. package/src/antv2/cad/adpater.unit.test.ts +191 -0
  32. package/src/antv2/cad/index.ts +4 -0
  33. package/src/antv2/consts.ts +5 -0
  34. package/src/antv2/factories/adapter-factory.integration.test.ts +193 -0
  35. package/src/antv2/factories/adapter-factory.ts +98 -0
  36. package/src/antv2/factories/index.ts +1 -0
  37. package/src/antv2/factories/sensor-factory.ts +28 -0
  38. package/src/antv2/fe/adapter.ts +371 -0
  39. package/src/antv2/fe/adapter.unit.test.ts +953 -0
  40. package/src/antv2/fe/index.ts +5 -0
  41. package/src/antv2/hr/adapter.ts +34 -0
  42. package/src/antv2/hr/adpater.unit.test.ts +443 -0
  43. package/src/antv2/hr/index.ts +4 -0
  44. package/src/antv2/index.ts +31 -0
  45. package/src/antv2/pwr/adapter.ts +87 -0
  46. package/src/antv2/pwr/adapter.unit.test.ts +321 -0
  47. package/src/antv2/pwr/index.ts +4 -0
  48. package/src/antv2/sc/adapter.ts +33 -0
  49. package/src/antv2/sc/adpater.unit.test.ts +230 -0
  50. package/src/antv2/sc/index.ts +4 -0
  51. package/src/antv2/scan.e2e.test.ts +80 -0
  52. package/src/antv2/spd/adapter.ts +26 -0
  53. package/src/antv2/spd/adpater.unit.test.ts +200 -0
  54. package/src/antv2/spd/index.ts +4 -0
  55. package/src/antv2/types.ts +62 -0
  56. package/{lib/antv2/utils.js → src/antv2/utils.ts} +26 -23
  57. package/src/antv2/utils.unit.test.ts +42 -0
  58. package/src/base/adpater.ts +445 -0
  59. package/src/base/consts.ts +10 -0
  60. package/src/ble/base/adapter.ts +567 -0
  61. package/src/ble/base/interface.ts +1016 -0
  62. package/src/ble/base/interface.unit.test.ts +504 -0
  63. package/src/ble/base/peripheral.ts +520 -0
  64. package/src/ble/base/sensor.ts +195 -0
  65. package/src/ble/base/types.ts +20 -0
  66. package/src/ble/bindings/index.ts +3 -0
  67. package/src/ble/bindings/linux.ts +59 -0
  68. package/src/ble/bindings/mock.ts +153 -0
  69. package/src/ble/bindings/types.ts +145 -0
  70. package/src/ble/characteristics/csc/features.ts +29 -0
  71. package/src/ble/characteristics/csc/measurement.ts +143 -0
  72. package/src/ble/characteristics/csc/measurement.unit.test.ts +35 -0
  73. package/{lib/ble/characteristics/types.d.ts → src/ble/characteristics/types.ts} +5 -3
  74. package/src/ble/consts.ts +20 -0
  75. package/src/ble/cp/adapter.ts +118 -0
  76. package/src/ble/cp/adapter.unit.test.ts +165 -0
  77. package/src/ble/cp/index.ts +6 -0
  78. package/src/ble/cp/sensor.ts +130 -0
  79. package/{lib/ble/cp/types.d.ts → src/ble/cp/types.ts} +8 -5
  80. package/src/ble/csc/adapter.ts +73 -0
  81. package/src/ble/csc/index.ts +3 -0
  82. package/src/ble/csc/sensor.ts +74 -0
  83. package/src/ble/csc/types.ts +7 -0
  84. package/src/ble/factories/adapter-factory.test.ts +63 -0
  85. package/src/ble/factories/adapter-factory.ts +189 -0
  86. package/src/ble/factories/index.ts +2 -0
  87. package/src/ble/factories/interface-factory.ts +22 -0
  88. package/src/ble/factories/types.ts +16 -0
  89. package/src/ble/fm/adapter.e2e.test.ts +131 -0
  90. package/src/ble/fm/adapter.ts +473 -0
  91. package/src/ble/fm/adapter.unit.test.ts +139 -0
  92. package/src/ble/fm/consts.ts +105 -0
  93. package/src/ble/fm/index.ts +7 -0
  94. package/src/ble/fm/sensor.ts +614 -0
  95. package/src/ble/fm/sensor.unit.test.ts +225 -0
  96. package/{lib/ble/fm/types.d.ts → src/ble/fm/types.ts} +10 -4
  97. package/src/ble/hr/adapter.ts +51 -0
  98. package/src/ble/hr/adapter.unit.test.ts +17 -0
  99. package/src/ble/hr/index.ts +6 -0
  100. package/src/ble/hr/mock.ts +63 -0
  101. package/src/ble/hr/sensor.ts +71 -0
  102. package/src/ble/hr/types.ts +5 -0
  103. package/src/ble/index.ts +41 -0
  104. package/src/ble/tacx/adapter.ts +76 -0
  105. package/src/ble/tacx/consts.ts +25 -0
  106. package/src/ble/tacx/index.ts +7 -0
  107. package/src/ble/tacx/sensor.ts +689 -0
  108. package/src/ble/tacx/sensor.unit.test.ts +122 -0
  109. package/src/ble/tacx/types.ts +35 -0
  110. package/{lib/ble/types.d.ts → src/ble/types.ts} +155 -87
  111. package/src/ble/utils.ts +168 -0
  112. package/src/ble/wahoo/adapter.ts +48 -0
  113. package/src/ble/wahoo/consts.ts +18 -0
  114. package/src/ble/wahoo/index.ts +6 -0
  115. package/src/ble/wahoo/sensor.ts +447 -0
  116. package/src/ble/wahoo/sensor.unit.test.ts +88 -0
  117. package/{lib/ble/wahoo/types.d.ts → src/ble/wahoo/types.ts} +2 -1
  118. package/src/ble/zwift/play/adapter.ts +75 -0
  119. package/src/ble/zwift/play/index.ts +3 -0
  120. package/src/ble/zwift/play/sensor.ts +692 -0
  121. package/src/ble/zwift/play/types.ts +8 -0
  122. package/src/direct-connect/base/interface.ts +575 -0
  123. package/src/direct-connect/base/interface.unit.test.ts +155 -0
  124. package/src/direct-connect/base/peripheral.ts +641 -0
  125. package/src/direct-connect/base/peripheral.unit.test.ts +41 -0
  126. package/src/direct-connect/bindings/index.ts +2 -0
  127. package/src/direct-connect/bindings/types.ts +51 -0
  128. package/src/direct-connect/consts.ts +27 -0
  129. package/src/direct-connect/index.ts +8 -0
  130. package/src/direct-connect/messages/CharacteristicNotification.ts +38 -0
  131. package/src/direct-connect/messages/DiscoverCharacteristics.ts +75 -0
  132. package/src/direct-connect/messages/DiscoverServices.ts +54 -0
  133. package/src/direct-connect/messages/EnableCharacteristicNotifications.ts +55 -0
  134. package/src/direct-connect/messages/EnableCharacteristicNotifications.unit.test.ts +17 -0
  135. package/src/direct-connect/messages/ReadCharacteristic.ts +58 -0
  136. package/src/direct-connect/messages/WriteCharacteristic.ts +58 -0
  137. package/src/direct-connect/messages/error.ts +18 -0
  138. package/src/direct-connect/messages/factory.ts +46 -0
  139. package/src/direct-connect/messages/index.ts +9 -0
  140. package/src/direct-connect/messages/message.ts +145 -0
  141. package/src/direct-connect/types.ts +33 -0
  142. package/src/direct-connect/utils.unit.test.ts +60 -0
  143. package/src/factories/adapters.ts +72 -0
  144. package/src/factories/interfaces.ts +37 -0
  145. package/src/features/features.ts +38 -0
  146. package/src/features/index.ts +1 -0
  147. package/src/index.ts +47 -0
  148. package/src/modes/__snapshots__/ant-fe-adv-st-mode.test.ts.snap +123 -0
  149. package/src/modes/__snapshots__/antble-erg.test.ts.snap +57 -0
  150. package/src/modes/__snapshots__/antble-smarttrainer.test.ts.snap +123 -0
  151. package/src/modes/__snapshots__/daum-classic-standard.test.ts.snap +43 -0
  152. package/src/modes/__snapshots__/daum-power.test.ts.snap +11 -0
  153. package/src/modes/__snapshots__/daum-premium-standard.test.ts.snap +43 -0
  154. package/src/modes/__snapshots__/fm-resistance.unit.test.ts.snap +5 -0
  155. package/src/modes/__snapshots__/power-base.unit.test.ts.snap +621 -0
  156. package/src/modes/__snapshots__/power-meter.unit.test.ts.snap +11 -0
  157. package/src/modes/ant-fe-adv-st-mode.test.ts +280 -0
  158. package/src/modes/ant-fe-adv-st-mode.ts +110 -0
  159. package/src/modes/antble-erg.test.ts +256 -0
  160. package/src/modes/antble-erg.ts +31 -0
  161. package/src/modes/antble-smarttrainer.test.ts +425 -0
  162. package/src/modes/antble-smarttrainer.ts +584 -0
  163. package/src/modes/base.ts +142 -0
  164. package/src/modes/daum-classic-standard.test.ts +205 -0
  165. package/src/modes/daum-classic-standard.ts +82 -0
  166. package/src/modes/daum-erg.test.ts +534 -0
  167. package/src/modes/daum-erg.ts +261 -0
  168. package/src/modes/daum-erg.unit.test.ts +30 -0
  169. package/src/modes/daum-power.test.ts +21 -0
  170. package/src/modes/daum-power.ts +13 -0
  171. package/src/modes/daum-premium-standard.test.ts +205 -0
  172. package/src/modes/daum-premium-standard.ts +101 -0
  173. package/src/modes/daum-smarttrainer.test.ts +431 -0
  174. package/src/modes/daum-smarttrainer.ts +479 -0
  175. package/src/modes/fm-resistance.ts +181 -0
  176. package/src/modes/fm-resistance.unit.test.ts +117 -0
  177. package/src/modes/kettler-erg.test.ts +341 -0
  178. package/src/modes/kettler-erg.ts +180 -0
  179. package/src/modes/power-base.ts +368 -0
  180. package/src/modes/power-base.unit.test.ts +204 -0
  181. package/src/modes/power-meter.ts +52 -0
  182. package/src/modes/power-meter.unit.test.ts +125 -0
  183. package/src/modes/simulator.ts +157 -0
  184. package/src/modes/types.ts +156 -0
  185. package/src/proto/zwift_hub.ts +1877 -0
  186. package/src/serial/base/adapter.ts +70 -0
  187. package/src/serial/base/comms.ts +411 -0
  188. package/src/serial/base/serial-interface.test.ts +170 -0
  189. package/src/serial/base/serial-interface.ts +384 -0
  190. package/src/serial/base/serial-scanner.ts +113 -0
  191. package/src/serial/base/serialport.test.ts +65 -0
  192. package/src/serial/base/serialport.ts +103 -0
  193. package/src/serial/bindings/tcp.test.ts +186 -0
  194. package/src/serial/bindings/tcp.ts +421 -0
  195. package/src/serial/daum/DaumAdapter.test.ts +1236 -0
  196. package/src/serial/daum/DaumAdapter.ts +667 -0
  197. package/src/serial/daum/classic/__snapshots__/utils.unit.test.ts.snap +559 -0
  198. package/src/serial/daum/classic/adapter.integration.test.ts +94 -0
  199. package/src/serial/daum/classic/adapter.test.ts +171 -0
  200. package/src/serial/daum/classic/adapter.ts +243 -0
  201. package/src/serial/daum/classic/comms.test.ts +913 -0
  202. package/src/serial/daum/classic/comms.ts +284 -0
  203. package/src/serial/daum/classic/consts.ts +2 -0
  204. package/src/serial/daum/classic/mock.ts +542 -0
  205. package/src/serial/daum/classic/types.ts +77 -0
  206. package/src/serial/daum/classic/utils.ts +132 -0
  207. package/src/serial/daum/classic/utils.unit.test.ts +129 -0
  208. package/src/serial/daum/premium/__snapshots__/utils.unit.test.ts.snap +25 -0
  209. package/src/serial/daum/premium/adapter.integration.test.ts +90 -0
  210. package/src/serial/daum/premium/adapter.ts +297 -0
  211. package/src/serial/daum/premium/adapter.unit.test.ts +916 -0
  212. package/src/serial/daum/premium/comms.test.ts +1431 -0
  213. package/src/serial/daum/premium/comms.ts +699 -0
  214. package/src/serial/daum/premium/consts.ts +8 -0
  215. package/src/serial/daum/premium/mock.ts +568 -0
  216. package/src/serial/daum/premium/types.ts +86 -0
  217. package/src/serial/daum/premium/utils.ts +389 -0
  218. package/src/serial/daum/premium/utils.unit.test.ts +397 -0
  219. package/src/serial/daum/types.ts +27 -0
  220. package/src/serial/factories/adapter-factory.test.ts +175 -0
  221. package/src/serial/factories/adapter-factory.ts +40 -0
  222. package/src/serial/index.ts +28 -0
  223. package/src/serial/kettler/comms.test.ts +140 -0
  224. package/src/serial/kettler/comms.ts +373 -0
  225. package/src/serial/kettler/ergo-racer/adapter.test.ts +101 -0
  226. package/src/serial/kettler/ergo-racer/adapter.ts +763 -0
  227. package/src/serial/kettler/ergo-racer/mock.ts +290 -0
  228. package/{lib/serial/types.d.ts → src/serial/types.ts} +25 -13
  229. package/src/simulator/Simulator.ts +259 -0
  230. package/src/simulator/Simulator.unit.test.ts +238 -0
  231. package/src/types/adapter.ts +74 -0
  232. package/src/types/capabilities.ts +9 -0
  233. package/src/types/data.ts +27 -0
  234. package/src/types/device.ts +39 -0
  235. package/src/types/index.ts +6 -0
  236. package/src/types/interface.ts +24 -0
  237. package/src/types/user.ts +14 -0
  238. package/src/utils/__snapshots__/calculation.test.ts.snap +13851 -0
  239. package/src/utils/calculation.test.ts +298 -0
  240. package/src/utils/calculations.ts +243 -0
  241. package/src/utils/task.ts +204 -0
  242. package/src/utils/utils.ts +211 -0
  243. package/src/utils/utils.unit.test.ts +270 -0
  244. package/test/logger.ts +19 -0
  245. package/test/mock-adapter.ts +27 -0
  246. package/tools/ble-forwarder/eslint.config.mjs +12 -0
  247. package/tools/ble-forwarder/package-lock.json +7183 -0
  248. package/tools/ble-forwarder/package.json +44 -0
  249. package/tools/ble-forwarder/src/index.ts +193 -0
  250. package/tools/ble-forwarder/src/parseArgs.ts +50 -0
  251. package/tools/ble-forwarder/tsconfig.json +21 -0
  252. package/tools/ble-simulator/eslint.config.mjs +12 -0
  253. package/tools/ble-simulator/package-lock.json +6716 -0
  254. package/tools/ble-simulator/package.json +43 -0
  255. package/tools/ble-simulator/src/emulator/characteristics/characteristic.ts +111 -0
  256. package/tools/ble-simulator/src/emulator/characteristics/cycling-power-measurement-characteristic.ts +94 -0
  257. package/tools/ble-simulator/src/emulator/characteristics/cycling-power-wahoo-extension-characteristic.ts +57 -0
  258. package/tools/ble-simulator/src/emulator/characteristics/read-characteristic.ts +19 -0
  259. package/tools/ble-simulator/src/emulator/services/csp.ts +32 -0
  260. package/tools/ble-simulator/src/emulator/services/service.ts +41 -0
  261. package/tools/ble-simulator/src/emulator/services/wahoo.ts +23 -0
  262. package/tools/ble-simulator/src/emulator/types.ts +38 -0
  263. package/tools/ble-simulator/src/index.ts +21 -0
  264. package/tools/ble-simulator/src/wahoo.ts +131 -0
  265. package/tools/ble-simulator/tsconfig.json +21 -0
  266. package/tools/dc-simulator/config/powermeter.json +27 -0
  267. package/tools/dc-simulator/config/smarttrainer-0W.json +28 -0
  268. package/tools/dc-simulator/config/smarttrainer-260W.json +28 -0
  269. package/tools/dc-simulator/config/smarttrainer-shifting.json +27 -0
  270. package/tools/dc-simulator/config/smarttrainer.json +27 -0
  271. package/tools/dc-simulator/eslint.config.mjs +12 -0
  272. package/tools/dc-simulator/package-lock.json +5436 -0
  273. package/tools/dc-simulator/package.json +45 -0
  274. package/tools/dc-simulator/protos/zwift_hub.proto +181 -0
  275. package/tools/dc-simulator/src/comms.ts +324 -0
  276. package/tools/dc-simulator/src/config.ts +60 -0
  277. package/tools/dc-simulator/src/emulator/characteristics/characteristic.ts +83 -0
  278. package/tools/dc-simulator/src/emulator/characteristics/cycling-power-measurement-characteristic.ts +94 -0
  279. package/tools/dc-simulator/src/emulator/characteristics/cycling-power-wahoo-extension-characteristic.ts +57 -0
  280. package/tools/dc-simulator/src/emulator/characteristics/fitness-machine-control-point-characteristic.ts +188 -0
  281. package/tools/dc-simulator/src/emulator/characteristics/fitness-machine-feature-characteristic.ts +39 -0
  282. package/tools/dc-simulator/src/emulator/characteristics/heart-rate-measurement-characteristic.ts +34 -0
  283. package/tools/dc-simulator/src/emulator/characteristics/index.ts +2 -0
  284. package/tools/dc-simulator/src/emulator/characteristics/indoor-bike-data-characteristic.ts +86 -0
  285. package/tools/dc-simulator/src/emulator/characteristics/read-characteristic.ts +19 -0
  286. package/tools/dc-simulator/src/emulator/characteristics/zwift-play-control-point.ts +53 -0
  287. package/tools/dc-simulator/src/emulator/characteristics/zwift-play-measurement.ts +70 -0
  288. package/tools/dc-simulator/src/emulator/characteristics/zwift-play-response.ts +47 -0
  289. package/tools/dc-simulator/src/emulator/index.ts +190 -0
  290. package/tools/dc-simulator/src/emulator/services/csp.ts +32 -0
  291. package/tools/dc-simulator/src/emulator/services/ftms.ts +33 -0
  292. package/tools/dc-simulator/src/emulator/services/hrs.ts +18 -0
  293. package/tools/dc-simulator/src/emulator/services/index.ts +4 -0
  294. package/tools/dc-simulator/src/emulator/services/service.ts +39 -0
  295. package/tools/dc-simulator/src/emulator/services/zwift-play.ts +31 -0
  296. package/tools/dc-simulator/src/emulator/types.ts +46 -0
  297. package/tools/dc-simulator/src/index.ts +112 -0
  298. package/tools/dc-simulator/src/net.ts +37 -0
  299. package/tools/dc-simulator/tsconfig.json +21 -0
  300. package/tsconfig.base.json +28 -0
  301. package/tsconfig.cjs.json +9 -0
  302. package/tsconfig.esm.json +10 -0
  303. package/tsconfig.test.json +19 -0
  304. package/vitest.config.js +28 -0
  305. package/vitest.setup.ts +4 -0
  306. package/lib/antv2/base/adapter.d.ts +0 -74
  307. package/lib/antv2/base/adapter.js +0 -485
  308. package/lib/antv2/base/binding.d.ts +0 -12
  309. package/lib/antv2/base/binding.js +0 -27
  310. package/lib/antv2/base/interface.d.ts +0 -57
  311. package/lib/antv2/base/interface.js +0 -420
  312. package/lib/antv2/cad/adapter.d.ts +0 -10
  313. package/lib/antv2/cad/adapter.js +0 -25
  314. package/lib/antv2/cad/index.d.ts +0 -2
  315. package/lib/antv2/cad/index.js +0 -7
  316. package/lib/antv2/consts.d.ts +0 -2
  317. package/lib/antv2/consts.js +0 -5
  318. package/lib/antv2/factories/adapter-factory.d.ts +0 -14
  319. package/lib/antv2/factories/adapter-factory.js +0 -73
  320. package/lib/antv2/factories/index.d.ts +0 -1
  321. package/lib/antv2/factories/index.js +0 -17
  322. package/lib/antv2/factories/sensor-factory.d.ts +0 -5
  323. package/lib/antv2/factories/sensor-factory.js +0 -24
  324. package/lib/antv2/fe/adapter.d.ts +0 -40
  325. package/lib/antv2/fe/adapter.js +0 -306
  326. package/lib/antv2/fe/index.d.ts +0 -2
  327. package/lib/antv2/fe/index.js +0 -7
  328. package/lib/antv2/hr/adapter.d.ts +0 -11
  329. package/lib/antv2/hr/adapter.js +0 -30
  330. package/lib/antv2/hr/index.d.ts +0 -2
  331. package/lib/antv2/hr/index.js +0 -7
  332. package/lib/antv2/index.d.ts +0 -12
  333. package/lib/antv2/index.js +0 -33
  334. package/lib/antv2/pwr/adapter.d.ts +0 -15
  335. package/lib/antv2/pwr/adapter.js +0 -78
  336. package/lib/antv2/pwr/index.d.ts +0 -2
  337. package/lib/antv2/pwr/index.js +0 -7
  338. package/lib/antv2/sc/adapter.d.ts +0 -11
  339. package/lib/antv2/sc/adapter.js +0 -30
  340. package/lib/antv2/sc/index.d.ts +0 -2
  341. package/lib/antv2/sc/index.js +0 -7
  342. package/lib/antv2/spd/adapter.d.ts +0 -11
  343. package/lib/antv2/spd/adapter.js +0 -25
  344. package/lib/antv2/spd/index.d.ts +0 -2
  345. package/lib/antv2/spd/index.js +0 -7
  346. package/lib/antv2/types.d.ts +0 -51
  347. package/lib/antv2/types.js +0 -5
  348. package/lib/antv2/utils.d.ts +0 -4
  349. package/lib/base/adpater.d.ts +0 -79
  350. package/lib/base/adpater.js +0 -322
  351. package/lib/base/consts.d.ts +0 -4
  352. package/lib/base/consts.js +0 -9
  353. package/lib/ble/adapter-factory.d.ts +0 -34
  354. package/lib/ble/adapter-factory.js +0 -110
  355. package/lib/ble/base/adapter.d.ts +0 -63
  356. package/lib/ble/base/adapter.js +0 -453
  357. package/lib/ble/base/comms-utils.d.ts +0 -7
  358. package/lib/ble/base/comms-utils.js +0 -90
  359. package/lib/ble/base/comms.d.ts +0 -75
  360. package/lib/ble/base/comms.js +0 -599
  361. package/lib/ble/base/interface.d.ts +0 -116
  362. package/lib/ble/base/interface.js +0 -710
  363. package/lib/ble/base/peripheral.d.ts +0 -46
  364. package/lib/ble/base/peripheral.js +0 -449
  365. package/lib/ble/base/sensor.d.ts +0 -36
  366. package/lib/ble/base/sensor.js +0 -169
  367. package/lib/ble/base/types.d.ts +0 -15
  368. package/lib/ble/base/types.js +0 -9
  369. package/lib/ble/bindings/index.d.ts +0 -2
  370. package/lib/ble/bindings/index.js +0 -8
  371. package/lib/ble/bindings/linux.d.ts +0 -17
  372. package/lib/ble/bindings/linux.js +0 -45
  373. package/lib/ble/bindings/mock.d.ts +0 -9
  374. package/lib/ble/bindings/mock.js +0 -120
  375. package/lib/ble/bindings/types.d.ts +0 -53
  376. package/lib/ble/bindings/types.js +0 -96
  377. package/lib/ble/ble-interface.d.ts +0 -84
  378. package/lib/ble/ble-interface.js +0 -622
  379. package/lib/ble/ble-peripheral.d.ts +0 -39
  380. package/lib/ble/ble-peripheral.js +0 -252
  381. package/lib/ble/characteristics/csc/features.d.ts +0 -10
  382. package/lib/ble/characteristics/csc/features.js +0 -19
  383. package/lib/ble/characteristics/csc/measurement.d.ts +0 -33
  384. package/lib/ble/characteristics/csc/measurement.js +0 -111
  385. package/lib/ble/characteristics/types.js +0 -2
  386. package/lib/ble/consts.d.ts +0 -15
  387. package/lib/ble/consts.js +0 -18
  388. package/lib/ble/cp/adapter.d.ts +0 -21
  389. package/lib/ble/cp/adapter.js +0 -108
  390. package/lib/ble/cp/comm.d.ts +0 -30
  391. package/lib/ble/cp/comm.js +0 -126
  392. package/lib/ble/cp/index.d.ts +0 -4
  393. package/lib/ble/cp/index.js +0 -10
  394. package/lib/ble/cp/sensor.d.ts +0 -27
  395. package/lib/ble/cp/sensor.js +0 -108
  396. package/lib/ble/cp/types.js +0 -2
  397. package/lib/ble/csc/adapter.d.ts +0 -17
  398. package/lib/ble/csc/adapter.js +0 -66
  399. package/lib/ble/csc/index.d.ts +0 -3
  400. package/lib/ble/csc/index.js +0 -19
  401. package/lib/ble/csc/sensor.d.ts +0 -21
  402. package/lib/ble/csc/sensor.js +0 -67
  403. package/lib/ble/csc/types.d.ts +0 -6
  404. package/lib/ble/csc/types.js +0 -2
  405. package/lib/ble/elite/adapter.d.ts +0 -21
  406. package/lib/ble/elite/adapter.js +0 -118
  407. package/lib/ble/elite/comms.d.ts +0 -31
  408. package/lib/ble/elite/comms.js +0 -127
  409. package/lib/ble/elite/index.d.ts +0 -3
  410. package/lib/ble/elite/index.js +0 -10
  411. package/lib/ble/factories/adapter-factory.d.ts +0 -34
  412. package/lib/ble/factories/adapter-factory.js +0 -137
  413. package/lib/ble/factories/index.d.ts +0 -2
  414. package/lib/ble/factories/index.js +0 -18
  415. package/lib/ble/factories/interface-factory.d.ts +0 -7
  416. package/lib/ble/factories/interface-factory.js +0 -18
  417. package/lib/ble/factories/types.d.ts +0 -18
  418. package/lib/ble/factories/types.js +0 -2
  419. package/lib/ble/fm/adapter.d.ts +0 -38
  420. package/lib/ble/fm/adapter.js +0 -380
  421. package/lib/ble/fm/comms.d.ts +0 -49
  422. package/lib/ble/fm/comms.js +0 -506
  423. package/lib/ble/fm/consts.d.ts +0 -100
  424. package/lib/ble/fm/consts.js +0 -64
  425. package/lib/ble/fm/index.d.ts +0 -5
  426. package/lib/ble/fm/index.js +0 -13
  427. package/lib/ble/fm/sensor.d.ts +0 -49
  428. package/lib/ble/fm/sensor.js +0 -531
  429. package/lib/ble/fm/types.js +0 -2
  430. package/lib/ble/hr/adapter.d.ts +0 -15
  431. package/lib/ble/hr/adapter.js +0 -40
  432. package/lib/ble/hr/comm.d.ts +0 -19
  433. package/lib/ble/hr/comm.js +0 -65
  434. package/lib/ble/hr/index.d.ts +0 -4
  435. package/lib/ble/hr/index.js +0 -10
  436. package/lib/ble/hr/mock.d.ts +0 -7
  437. package/lib/ble/hr/mock.js +0 -47
  438. package/lib/ble/hr/sensor.d.ts +0 -17
  439. package/lib/ble/hr/sensor.js +0 -53
  440. package/lib/ble/hr/types.d.ts +0 -5
  441. package/lib/ble/hr/types.js +0 -2
  442. package/lib/ble/index.d.ts +0 -10
  443. package/lib/ble/index.js +0 -46
  444. package/lib/ble/peripheral-cache.d.ts +0 -45
  445. package/lib/ble/peripheral-cache.js +0 -109
  446. package/lib/ble/tacx/adapter.d.ts +0 -13
  447. package/lib/ble/tacx/adapter.js +0 -68
  448. package/lib/ble/tacx/comms.d.ts +0 -59
  449. package/lib/ble/tacx/comms.js +0 -634
  450. package/lib/ble/tacx/consts.d.ts +0 -23
  451. package/lib/ble/tacx/consts.js +0 -27
  452. package/lib/ble/tacx/index.d.ts +0 -4
  453. package/lib/ble/tacx/index.js +0 -10
  454. package/lib/ble/tacx/sensor.d.ts +0 -64
  455. package/lib/ble/tacx/sensor.js +0 -604
  456. package/lib/ble/tacx/types.d.ts +0 -26
  457. package/lib/ble/tacx/types.js +0 -2
  458. package/lib/ble/types.js +0 -2
  459. package/lib/ble/utils.d.ts +0 -23
  460. package/lib/ble/utils.js +0 -144
  461. package/lib/ble/wahoo/adapter.d.ts +0 -12
  462. package/lib/ble/wahoo/adapter.js +0 -47
  463. package/lib/ble/wahoo/comms.d.ts +0 -64
  464. package/lib/ble/wahoo/comms.js +0 -399
  465. package/lib/ble/wahoo/consts.d.ts +0 -16
  466. package/lib/ble/wahoo/consts.js +0 -7
  467. package/lib/ble/wahoo/index.d.ts +0 -4
  468. package/lib/ble/wahoo/index.js +0 -10
  469. package/lib/ble/wahoo/sensor.d.ts +0 -49
  470. package/lib/ble/wahoo/sensor.js +0 -372
  471. package/lib/ble/wahoo/types.js +0 -2
  472. package/lib/ble/zwift/click/adapter.d.ts +0 -19
  473. package/lib/ble/zwift/click/adapter.js +0 -74
  474. package/lib/ble/zwift/click/index.d.ts +0 -2
  475. package/lib/ble/zwift/click/index.js +0 -18
  476. package/lib/ble/zwift/click/sensor.d.ts +0 -40
  477. package/lib/ble/zwift/click/sensor.js +0 -221
  478. package/lib/ble/zwift/play/adapter.d.ts +0 -18
  479. package/lib/ble/zwift/play/adapter.js +0 -73
  480. package/lib/ble/zwift/play/helperfactory.d.ts +0 -7
  481. package/lib/ble/zwift/play/helperfactory.js +0 -17
  482. package/lib/ble/zwift/play/index.d.ts +0 -2
  483. package/lib/ble/zwift/play/index.js +0 -18
  484. package/lib/ble/zwift/play/protohelper.d.ts +0 -4
  485. package/lib/ble/zwift/play/protohelper.js +0 -11
  486. package/lib/ble/zwift/play/sensor.d.ts +0 -70
  487. package/lib/ble/zwift/play/sensor.js +0 -533
  488. package/lib/ble/zwift/play/types.d.ts +0 -6
  489. package/lib/ble/zwift/play/types.js +0 -2
  490. package/lib/direct-connect/base/comms.d.ts +0 -3
  491. package/lib/direct-connect/base/comms.js +0 -7
  492. package/lib/direct-connect/base/interface.d.ts +0 -80
  493. package/lib/direct-connect/base/interface.js +0 -377
  494. package/lib/direct-connect/base/peripheral.d.ts +0 -54
  495. package/lib/direct-connect/base/peripheral.js +0 -543
  496. package/lib/direct-connect/base/sensor.d.ts +0 -3
  497. package/lib/direct-connect/base/sensor.js +0 -7
  498. package/lib/direct-connect/bindings/index.d.ts +0 -1
  499. package/lib/direct-connect/bindings/index.js +0 -17
  500. package/lib/direct-connect/bindings/types.d.ts +0 -37
  501. package/lib/direct-connect/bindings/types.js +0 -2
  502. package/lib/direct-connect/consts.d.ts +0 -17
  503. package/lib/direct-connect/consts.js +0 -20
  504. package/lib/direct-connect/index.d.ts +0 -3
  505. package/lib/direct-connect/index.js +0 -22
  506. package/lib/direct-connect/messages/CharacteristicNotification.d.ts +0 -12
  507. package/lib/direct-connect/messages/CharacteristicNotification.js +0 -23
  508. package/lib/direct-connect/messages/DiscoverCharacteristics.d.ts +0 -22
  509. package/lib/direct-connect/messages/DiscoverCharacteristics.js +0 -44
  510. package/lib/direct-connect/messages/DiscoverServices.d.ts +0 -15
  511. package/lib/direct-connect/messages/DiscoverServices.js +0 -35
  512. package/lib/direct-connect/messages/EnableCharacteristicNotifications.d.ts +0 -18
  513. package/lib/direct-connect/messages/EnableCharacteristicNotifications.js +0 -35
  514. package/lib/direct-connect/messages/ReadCharacteristic.d.ts +0 -18
  515. package/lib/direct-connect/messages/ReadCharacteristic.js +0 -34
  516. package/lib/direct-connect/messages/WriteCharacteristic.d.ts +0 -18
  517. package/lib/direct-connect/messages/WriteCharacteristic.js +0 -36
  518. package/lib/direct-connect/messages/error.d.ts +0 -5
  519. package/lib/direct-connect/messages/error.js +0 -18
  520. package/lib/direct-connect/messages/factory.d.ts +0 -6
  521. package/lib/direct-connect/messages/factory.js +0 -44
  522. package/lib/direct-connect/messages/index.d.ts +0 -9
  523. package/lib/direct-connect/messages/index.js +0 -25
  524. package/lib/direct-connect/messages/message.d.ts +0 -21
  525. package/lib/direct-connect/messages/message.js +0 -106
  526. package/lib/direct-connect/types.d.ts +0 -24
  527. package/lib/direct-connect/types.js +0 -9
  528. package/lib/direct-connect/utils.d.ts +0 -5
  529. package/lib/direct-connect/utils.js +0 -73
  530. package/lib/factories/adapters.d.ts +0 -7
  531. package/lib/factories/adapters.js +0 -56
  532. package/lib/factories/index.d.ts +0 -3
  533. package/lib/factories/index.js +0 -10
  534. package/lib/factories/interfaces.d.ts +0 -8
  535. package/lib/factories/interfaces.js +0 -30
  536. package/lib/features/features.d.ts +0 -11
  537. package/lib/features/features.js +0 -29
  538. package/lib/features/index.d.ts +0 -1
  539. package/lib/features/index.js +0 -17
  540. package/lib/index.d.ts +0 -17
  541. package/lib/index.js +0 -38
  542. package/lib/modes/ant-fe-adv-st-mode.d.ts +0 -19
  543. package/lib/modes/ant-fe-adv-st-mode.js +0 -84
  544. package/lib/modes/antble-erg.d.ts +0 -31
  545. package/lib/modes/antble-erg.js +0 -28
  546. package/lib/modes/antble-smarttrainer.d.ts +0 -63
  547. package/lib/modes/antble-smarttrainer.js +0 -480
  548. package/lib/modes/base.d.ts +0 -34
  549. package/lib/modes/base.js +0 -99
  550. package/lib/modes/daum-classic-standard.d.ts +0 -18
  551. package/lib/modes/daum-classic-standard.js +0 -60
  552. package/lib/modes/daum-erg.d.ts +0 -51
  553. package/lib/modes/daum-erg.js +0 -200
  554. package/lib/modes/daum-power.d.ts +0 -5
  555. package/lib/modes/daum-power.js +0 -12
  556. package/lib/modes/daum-premium-standard.d.ts +0 -24
  557. package/lib/modes/daum-premium-standard.js +0 -74
  558. package/lib/modes/daum-smarttrainer.d.ts +0 -83
  559. package/lib/modes/daum-smarttrainer.js +0 -347
  560. package/lib/modes/fm-resistance.d.ts +0 -39
  561. package/lib/modes/fm-resistance.js +0 -139
  562. package/lib/modes/kettler-erg.d.ts +0 -44
  563. package/lib/modes/kettler-erg.js +0 -133
  564. package/lib/modes/power-base.d.ts +0 -46
  565. package/lib/modes/power-base.js +0 -275
  566. package/lib/modes/power-meter.d.ts +0 -15
  567. package/lib/modes/power-meter.js +0 -39
  568. package/lib/modes/simulator.d.ts +0 -57
  569. package/lib/modes/simulator.js +0 -113
  570. package/lib/modes/types.d.ts +0 -91
  571. package/lib/modes/types.js +0 -74
  572. package/lib/proto/org/cagnulen/qdomyoszwift/zwift_hub_pb.d.ts +0 -156
  573. package/lib/proto/org/cagnulen/qdomyoszwift/zwift_hub_pb.js +0 -59
  574. package/lib/proto/zwift_hub.d.ts +0 -303
  575. package/lib/proto/zwift_hub.js +0 -1234
  576. package/lib/serial/base/adapter.d.ts +0 -17
  577. package/lib/serial/base/adapter.js +0 -67
  578. package/lib/serial/base/comms.d.ts +0 -65
  579. package/lib/serial/base/comms.js +0 -304
  580. package/lib/serial/base/serial-interface.d.ts +0 -35
  581. package/lib/serial/base/serial-interface.js +0 -296
  582. package/lib/serial/base/serial-scanner.d.ts +0 -16
  583. package/lib/serial/base/serial-scanner.js +0 -95
  584. package/lib/serial/base/serialport.d.ts +0 -17
  585. package/lib/serial/base/serialport.js +0 -87
  586. package/lib/serial/bindings/tcp.d.ts +0 -50
  587. package/lib/serial/bindings/tcp.js +0 -309
  588. package/lib/serial/daum/DaumAdapter.d.ts +0 -66
  589. package/lib/serial/daum/DaumAdapter.js +0 -556
  590. package/lib/serial/daum/classic/adapter.d.ts +0 -20
  591. package/lib/serial/daum/classic/adapter.js +0 -196
  592. package/lib/serial/daum/classic/comms.d.ts +0 -43
  593. package/lib/serial/daum/classic/comms.js +0 -263
  594. package/lib/serial/daum/classic/consts.d.ts +0 -2
  595. package/lib/serial/daum/classic/consts.js +0 -5
  596. package/lib/serial/daum/classic/mock.d.ts +0 -102
  597. package/lib/serial/daum/classic/mock.js +0 -407
  598. package/lib/serial/daum/classic/types.d.ts +0 -57
  599. package/lib/serial/daum/classic/types.js +0 -2
  600. package/lib/serial/daum/classic/utils.d.ts +0 -13
  601. package/lib/serial/daum/classic/utils.js +0 -108
  602. package/lib/serial/daum/premium/adapter.d.ts +0 -28
  603. package/lib/serial/daum/premium/adapter.js +0 -238
  604. package/lib/serial/daum/premium/comms.d.ts +0 -49
  605. package/lib/serial/daum/premium/comms.js +0 -617
  606. package/lib/serial/daum/premium/consts.d.ts +0 -6
  607. package/lib/serial/daum/premium/consts.js +0 -9
  608. package/lib/serial/daum/premium/mock.d.ts +0 -108
  609. package/lib/serial/daum/premium/mock.js +0 -419
  610. package/lib/serial/daum/premium/types.d.ts +0 -61
  611. package/lib/serial/daum/premium/types.js +0 -31
  612. package/lib/serial/daum/premium/utils.d.ts +0 -51
  613. package/lib/serial/daum/premium/utils.js +0 -350
  614. package/lib/serial/daum/types.d.ts +0 -15
  615. package/lib/serial/daum/types.js +0 -13
  616. package/lib/serial/factories/adapter-factory.d.ts +0 -14
  617. package/lib/serial/factories/adapter-factory.js +0 -30
  618. package/lib/serial/index.d.ts +0 -12
  619. package/lib/serial/index.js +0 -59
  620. package/lib/serial/kettler/comms.d.ts +0 -60
  621. package/lib/serial/kettler/comms.js +0 -284
  622. package/lib/serial/kettler/ergo-racer/adapter.d.ts +0 -85
  623. package/lib/serial/kettler/ergo-racer/adapter.js +0 -569
  624. package/lib/serial/kettler/ergo-racer/mock.d.ts +0 -65
  625. package/lib/serial/kettler/ergo-racer/mock.js +0 -216
  626. package/lib/serial/kettler/types.js +0 -2
  627. package/lib/serial/types.js +0 -9
  628. package/lib/simulator/Simulator.d.ts +0 -52
  629. package/lib/simulator/Simulator.js +0 -200
  630. package/lib/types/adapter.d.ts +0 -55
  631. package/lib/types/adapter.js +0 -2
  632. package/lib/types/capabilities.d.ts +0 -8
  633. package/lib/types/capabilities.js +0 -12
  634. package/lib/types/data.d.ts +0 -26
  635. package/lib/types/data.js +0 -2
  636. package/lib/types/device.d.ts +0 -31
  637. package/lib/types/device.js +0 -13
  638. package/lib/types/index.d.ts +0 -6
  639. package/lib/types/index.js +0 -22
  640. package/lib/types/interface.d.ts +0 -19
  641. package/lib/types/interface.js +0 -2
  642. package/lib/types/user.d.ts +0 -11
  643. package/lib/types/user.js +0 -9
  644. package/lib/utils/calculations.d.ts +0 -14
  645. package/lib/utils/calculations.js +0 -158
  646. package/lib/utils/operation.d.ts +0 -17
  647. package/lib/utils/operation.js +0 -20
  648. package/lib/utils/task.d.ts +0 -47
  649. package/lib/utils/task.js +0 -139
  650. package/lib/utils/utils.d.ts +0 -18
  651. package/lib/utils/utils.js +0 -196
  652. /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
- "name": "incyclist-devices",
3
- "version": "2.4.14",
4
- "dependencies": {
5
- "@protobuf-ts/runtime": "^2.11.1",
6
- "@serialport/bindings-interface": "^1.2.2",
7
- "@serialport/parser-byte-length": "^9.0.1",
8
- "@serialport/parser-delimiter": "^9.0.1",
9
- "@serialport/parser-readline": "^10.5.0",
10
- "@serialport/stream": "^10.5.0",
11
- "incyclist-ant-plus": "^0.3.5",
12
- "win32filetime": "^1.0.2"
13
- },
14
- "peerDependencies": {
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
- "plugins": [
62
- "@typescript-eslint"
63
- ],
64
- "rules": {
65
- "jsx-a11y/anchor-is-valid": [
66
- "off"
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
+