@voltras/node-sdk 0.1.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/LICENSE +21 -0
- package/README.md +272 -0
- package/dist/cjs/bluetooth/adapters/base.js +116 -0
- package/dist/cjs/bluetooth/adapters/base.js.map +1 -0
- package/dist/cjs/bluetooth/adapters/index.js +58 -0
- package/dist/cjs/bluetooth/adapters/index.js.map +1 -0
- package/dist/cjs/bluetooth/adapters/native.js +473 -0
- package/dist/cjs/bluetooth/adapters/native.js.map +1 -0
- package/dist/cjs/bluetooth/adapters/node.js +228 -0
- package/dist/cjs/bluetooth/adapters/node.js.map +1 -0
- package/dist/cjs/bluetooth/adapters/types.js +11 -0
- package/dist/cjs/bluetooth/adapters/types.js.map +1 -0
- package/dist/cjs/bluetooth/adapters/web-bluetooth-base.js +187 -0
- package/dist/cjs/bluetooth/adapters/web-bluetooth-base.js.map +1 -0
- package/dist/cjs/bluetooth/adapters/web.js +112 -0
- package/dist/cjs/bluetooth/adapters/web.js.map +1 -0
- package/dist/cjs/bluetooth/controllers/scanner-controller.js +145 -0
- package/dist/cjs/bluetooth/controllers/scanner-controller.js.map +1 -0
- package/dist/cjs/bluetooth/index.js +27 -0
- package/dist/cjs/bluetooth/index.js.map +1 -0
- package/dist/cjs/bluetooth/models/connection.js +68 -0
- package/dist/cjs/bluetooth/models/connection.js.map +1 -0
- package/dist/cjs/bluetooth/models/device.js +26 -0
- package/dist/cjs/bluetooth/models/device.js.map +1 -0
- package/dist/cjs/bluetooth/models/environment.js +106 -0
- package/dist/cjs/bluetooth/models/environment.js.map +1 -0
- package/dist/cjs/errors.js +167 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/index.js +116 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/react/hooks.js +262 -0
- package/dist/cjs/react/hooks.js.map +1 -0
- package/dist/cjs/react/index.js +18 -0
- package/dist/cjs/react/index.js.map +1 -0
- package/dist/cjs/sdk/index.js +14 -0
- package/dist/cjs/sdk/index.js.map +1 -0
- package/dist/cjs/sdk/types.js +8 -0
- package/dist/cjs/sdk/types.js.map +1 -0
- package/dist/cjs/sdk/voltra-client.js +632 -0
- package/dist/cjs/sdk/voltra-client.js.map +1 -0
- package/dist/cjs/sdk/voltra-manager.js +419 -0
- package/dist/cjs/sdk/voltra-manager.js.map +1 -0
- package/dist/cjs/shared/index.js +12 -0
- package/dist/cjs/shared/index.js.map +1 -0
- package/dist/cjs/shared/utils.js +51 -0
- package/dist/cjs/shared/utils.js.map +1 -0
- package/dist/cjs/voltra/index.js +56 -0
- package/dist/cjs/voltra/index.js.map +1 -0
- package/dist/cjs/voltra/models/connection.js +68 -0
- package/dist/cjs/voltra/models/connection.js.map +1 -0
- package/dist/cjs/voltra/models/device-filter.js +28 -0
- package/dist/cjs/voltra/models/device-filter.js.map +1 -0
- package/dist/cjs/voltra/models/device.js +152 -0
- package/dist/cjs/voltra/models/device.js.map +1 -0
- package/dist/cjs/voltra/models/telemetry/frame.js +46 -0
- package/dist/cjs/voltra/models/telemetry/frame.js.map +1 -0
- package/dist/cjs/voltra/models/telemetry/index.js +14 -0
- package/dist/cjs/voltra/models/telemetry/index.js.map +1 -0
- package/dist/cjs/voltra/protocol/commands.js +230 -0
- package/dist/cjs/voltra/protocol/commands.js.map +1 -0
- package/dist/cjs/voltra/protocol/constants.js +136 -0
- package/dist/cjs/voltra/protocol/constants.js.map +1 -0
- package/dist/cjs/voltra/protocol/data/chains.json +830 -0
- package/dist/cjs/voltra/protocol/data/eccentric.json +1598 -0
- package/dist/cjs/voltra/protocol/data/protocol.json +54 -0
- package/dist/cjs/voltra/protocol/data/weights.json +62 -0
- package/dist/cjs/voltra/protocol/index.js +25 -0
- package/dist/cjs/voltra/protocol/index.js.map +1 -0
- package/dist/cjs/voltra/protocol/telemetry-decoder.js +146 -0
- package/dist/cjs/voltra/protocol/telemetry-decoder.js.map +1 -0
- package/dist/esm/bluetooth/adapters/base.js +112 -0
- package/dist/esm/bluetooth/adapters/base.js.map +1 -0
- package/dist/esm/bluetooth/adapters/index.js +51 -0
- package/dist/esm/bluetooth/adapters/index.js.map +1 -0
- package/dist/esm/bluetooth/adapters/native.js +469 -0
- package/dist/esm/bluetooth/adapters/native.js.map +1 -0
- package/dist/esm/bluetooth/adapters/node.js +191 -0
- package/dist/esm/bluetooth/adapters/node.js.map +1 -0
- package/dist/esm/bluetooth/adapters/types.js +10 -0
- package/dist/esm/bluetooth/adapters/types.js.map +1 -0
- package/dist/esm/bluetooth/adapters/web-bluetooth-base.js +183 -0
- package/dist/esm/bluetooth/adapters/web-bluetooth-base.js.map +1 -0
- package/dist/esm/bluetooth/adapters/web.js +108 -0
- package/dist/esm/bluetooth/adapters/web.js.map +1 -0
- package/dist/esm/bluetooth/controllers/scanner-controller.js +141 -0
- package/dist/esm/bluetooth/controllers/scanner-controller.js.map +1 -0
- package/dist/esm/bluetooth/index.js +17 -0
- package/dist/esm/bluetooth/index.js.map +1 -0
- package/dist/esm/bluetooth/models/connection.js +63 -0
- package/dist/esm/bluetooth/models/connection.js.map +1 -0
- package/dist/esm/bluetooth/models/device.js +22 -0
- package/dist/esm/bluetooth/models/device.js.map +1 -0
- package/dist/esm/bluetooth/models/environment.js +101 -0
- package/dist/esm/bluetooth/models/environment.js.map +1 -0
- package/dist/esm/errors.js +155 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.js +72 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/react/hooks.js +257 -0
- package/dist/esm/react/hooks.js.map +1 -0
- package/dist/esm/react/index.js +12 -0
- package/dist/esm/react/index.js.map +1 -0
- package/dist/esm/sdk/index.js +9 -0
- package/dist/esm/sdk/index.js.map +1 -0
- package/dist/esm/sdk/types.js +7 -0
- package/dist/esm/sdk/types.js.map +1 -0
- package/dist/esm/sdk/voltra-client.js +628 -0
- package/dist/esm/sdk/voltra-client.js.map +1 -0
- package/dist/esm/sdk/voltra-manager.js +415 -0
- package/dist/esm/sdk/voltra-manager.js.map +1 -0
- package/dist/esm/shared/index.js +5 -0
- package/dist/esm/shared/index.js.map +1 -0
- package/dist/esm/shared/utils.js +45 -0
- package/dist/esm/shared/utils.js.map +1 -0
- package/dist/esm/voltra/index.js +26 -0
- package/dist/esm/voltra/index.js.map +1 -0
- package/dist/esm/voltra/models/connection.js +63 -0
- package/dist/esm/voltra/models/connection.js.map +1 -0
- package/dist/esm/voltra/models/device-filter.js +23 -0
- package/dist/esm/voltra/models/device-filter.js.map +1 -0
- package/dist/esm/voltra/models/device.js +148 -0
- package/dist/esm/voltra/models/device.js.map +1 -0
- package/dist/esm/voltra/models/telemetry/frame.js +40 -0
- package/dist/esm/voltra/models/telemetry/frame.js.map +1 -0
- package/dist/esm/voltra/models/telemetry/index.js +7 -0
- package/dist/esm/voltra/models/telemetry/index.js.map +1 -0
- package/dist/esm/voltra/protocol/commands.js +224 -0
- package/dist/esm/voltra/protocol/commands.js.map +1 -0
- package/dist/esm/voltra/protocol/constants.js +130 -0
- package/dist/esm/voltra/protocol/constants.js.map +1 -0
- package/dist/esm/voltra/protocol/data/chains.json +830 -0
- package/dist/esm/voltra/protocol/data/eccentric.json +1598 -0
- package/dist/esm/voltra/protocol/data/protocol.json +54 -0
- package/dist/esm/voltra/protocol/data/weights.json +62 -0
- package/dist/esm/voltra/protocol/index.js +9 -0
- package/dist/esm/voltra/protocol/index.js.map +1 -0
- package/dist/esm/voltra/protocol/telemetry-decoder.js +140 -0
- package/dist/esm/voltra/protocol/telemetry-decoder.js.map +1 -0
- package/dist/types/bluetooth/adapters/base.d.ts +85 -0
- package/dist/types/bluetooth/adapters/base.d.ts.map +1 -0
- package/dist/types/bluetooth/adapters/index.d.ts +35 -0
- package/dist/types/bluetooth/adapters/index.d.ts.map +1 -0
- package/dist/types/bluetooth/adapters/native.d.ts +109 -0
- package/dist/types/bluetooth/adapters/native.d.ts.map +1 -0
- package/dist/types/bluetooth/adapters/node.d.ts +91 -0
- package/dist/types/bluetooth/adapters/node.d.ts.map +1 -0
- package/dist/types/bluetooth/adapters/types.d.ts +102 -0
- package/dist/types/bluetooth/adapters/types.d.ts.map +1 -0
- package/dist/types/bluetooth/adapters/web-bluetooth-base.d.ts +90 -0
- package/dist/types/bluetooth/adapters/web-bluetooth-base.d.ts.map +1 -0
- package/dist/types/bluetooth/adapters/web.d.ts +57 -0
- package/dist/types/bluetooth/adapters/web.d.ts.map +1 -0
- package/dist/types/bluetooth/controllers/scanner-controller.d.ts +93 -0
- package/dist/types/bluetooth/controllers/scanner-controller.d.ts.map +1 -0
- package/dist/types/bluetooth/index.d.ts +14 -0
- package/dist/types/bluetooth/index.d.ts.map +1 -0
- package/dist/types/bluetooth/models/connection.d.ts +37 -0
- package/dist/types/bluetooth/models/connection.d.ts.map +1 -0
- package/dist/types/bluetooth/models/device.d.ts +25 -0
- package/dist/types/bluetooth/models/device.d.ts.map +1 -0
- package/dist/types/bluetooth/models/environment.d.ts +45 -0
- package/dist/types/bluetooth/models/environment.d.ts.map +1 -0
- package/dist/types/errors.d.ts +113 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/index.d.ts +55 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/react/hooks.d.ts +130 -0
- package/dist/types/react/hooks.d.ts.map +1 -0
- package/dist/types/react/index.d.ts +12 -0
- package/dist/types/react/index.d.ts.map +1 -0
- package/dist/types/sdk/index.d.ts +11 -0
- package/dist/types/sdk/index.d.ts.map +1 -0
- package/dist/types/sdk/types.d.ts +104 -0
- package/dist/types/sdk/types.d.ts.map +1 -0
- package/dist/types/sdk/voltra-client.d.ts +221 -0
- package/dist/types/sdk/voltra-client.d.ts.map +1 -0
- package/dist/types/sdk/voltra-manager.d.ts +226 -0
- package/dist/types/sdk/voltra-manager.d.ts.map +1 -0
- package/dist/types/shared/index.d.ts +5 -0
- package/dist/types/shared/index.d.ts.map +1 -0
- package/dist/types/shared/utils.d.ts +25 -0
- package/dist/types/shared/utils.d.ts.map +1 -0
- package/dist/types/voltra/index.d.ts +13 -0
- package/dist/types/voltra/index.d.ts.map +1 -0
- package/dist/types/voltra/models/connection.d.ts +37 -0
- package/dist/types/voltra/models/connection.d.ts.map +1 -0
- package/dist/types/voltra/models/device-filter.d.ts +19 -0
- package/dist/types/voltra/models/device-filter.d.ts.map +1 -0
- package/dist/types/voltra/models/device.d.ts +105 -0
- package/dist/types/voltra/models/device.d.ts.map +1 -0
- package/dist/types/voltra/models/telemetry/frame.d.ts +41 -0
- package/dist/types/voltra/models/telemetry/frame.d.ts.map +1 -0
- package/dist/types/voltra/models/telemetry/index.d.ts +8 -0
- package/dist/types/voltra/models/telemetry/index.d.ts.map +1 -0
- package/dist/types/voltra/protocol/commands.d.ts +99 -0
- package/dist/types/voltra/protocol/commands.d.ts.map +1 -0
- package/dist/types/voltra/protocol/constants.d.ts +103 -0
- package/dist/types/voltra/protocol/constants.d.ts.map +1 -0
- package/dist/types/voltra/protocol/index.d.ts +9 -0
- package/dist/types/voltra/protocol/index.d.ts.map +1 -0
- package/dist/types/voltra/protocol/telemetry-decoder.d.ts +45 -0
- package/dist/types/voltra/protocol/telemetry-decoder.d.ts.map +1 -0
- package/package.json +111 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @voltras/node-sdk
|
|
4
|
+
*
|
|
5
|
+
* SDK for connecting to and controlling Voltra fitness devices.
|
|
6
|
+
*
|
|
7
|
+
* Use VoltraManager as the main entry point. It handles device discovery
|
|
8
|
+
* and returns VoltraClient instances for controlling individual devices.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { VoltraManager } from '@voltras/node-sdk';
|
|
13
|
+
*
|
|
14
|
+
* // Create manager (auto-detects platform for web/node)
|
|
15
|
+
* const manager = new VoltraManager();
|
|
16
|
+
*
|
|
17
|
+
* // Scan and connect
|
|
18
|
+
* const devices = await manager.scan();
|
|
19
|
+
* const client = await manager.connect(devices[0]);
|
|
20
|
+
*
|
|
21
|
+
* // Or connect by name in one step
|
|
22
|
+
* const client = await manager.connectByName('VTR-123456');
|
|
23
|
+
*
|
|
24
|
+
* // Control the device
|
|
25
|
+
* await client.setWeight(50);
|
|
26
|
+
* client.onFrame((frame) => console.log('Position:', frame.position));
|
|
27
|
+
* await client.startRecording();
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* For React Native, specify the platform:
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const manager = VoltraManager.forNative();
|
|
33
|
+
* // or
|
|
34
|
+
* const manager = new VoltraManager({ platform: 'native' });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.delay = exports.ErrorCode = exports.TelemetryError = exports.CommandError = exports.BluetoothUnavailableError = exports.InvalidSettingError = exports.NotConnectedError = exports.TimeoutError = exports.AuthenticationError = exports.ConnectionError = exports.VoltraSDKError = exports.Workout = exports.Init = exports.Auth = exports.Timing = exports.BLE = exports.EccentricCommands = exports.ChainsCommands = exports.WeightCommands = exports.TelemetryOffsets = exports.MessageTypes = exports.PhaseNames = exports.MovementPhase = exports.identifyMessageType = exports.encodeTelemetryFrame = exports.decodeNotification = exports.decodeTelemetryFrame = exports.createFrame = exports.DEFAULT_SETTINGS = exports.VoltraDevice = exports.filterVoltraDevices = exports.isVoltraDevice = exports.VOLTRA_DEVICE_PREFIX = exports.sortBySignalStrength = exports.getDeviceDisplayName = exports.createBLEAdapter = exports.NativeBLEAdapter = exports.NodeBLEAdapter = exports.WebBLEAdapter = exports.VoltraManager = exports.VoltraClient = void 0;
|
|
39
|
+
// =============================================================================
|
|
40
|
+
// High-Level API
|
|
41
|
+
// =============================================================================
|
|
42
|
+
var sdk_1 = require("./sdk");
|
|
43
|
+
Object.defineProperty(exports, "VoltraClient", { enumerable: true, get: function () { return sdk_1.VoltraClient; } });
|
|
44
|
+
Object.defineProperty(exports, "VoltraManager", { enumerable: true, get: function () { return sdk_1.VoltraManager; } });
|
|
45
|
+
// =============================================================================
|
|
46
|
+
// Platform Adapters
|
|
47
|
+
// =============================================================================
|
|
48
|
+
var web_1 = require("./bluetooth/adapters/web");
|
|
49
|
+
Object.defineProperty(exports, "WebBLEAdapter", { enumerable: true, get: function () { return web_1.WebBLEAdapter; } });
|
|
50
|
+
var node_1 = require("./bluetooth/adapters/node");
|
|
51
|
+
Object.defineProperty(exports, "NodeBLEAdapter", { enumerable: true, get: function () { return node_1.NodeBLEAdapter; } });
|
|
52
|
+
var native_1 = require("./bluetooth/adapters/native");
|
|
53
|
+
Object.defineProperty(exports, "NativeBLEAdapter", { enumerable: true, get: function () { return native_1.NativeBLEAdapter; } });
|
|
54
|
+
var adapters_1 = require("./bluetooth/adapters");
|
|
55
|
+
Object.defineProperty(exports, "createBLEAdapter", { enumerable: true, get: function () { return adapters_1.createBLEAdapter; } });
|
|
56
|
+
var device_1 = require("./bluetooth/models/device");
|
|
57
|
+
Object.defineProperty(exports, "getDeviceDisplayName", { enumerable: true, get: function () { return device_1.getDeviceDisplayName; } });
|
|
58
|
+
Object.defineProperty(exports, "sortBySignalStrength", { enumerable: true, get: function () { return device_1.sortBySignalStrength; } });
|
|
59
|
+
var device_filter_1 = require("./voltra/models/device-filter");
|
|
60
|
+
Object.defineProperty(exports, "VOLTRA_DEVICE_PREFIX", { enumerable: true, get: function () { return device_filter_1.VOLTRA_DEVICE_PREFIX; } });
|
|
61
|
+
Object.defineProperty(exports, "isVoltraDevice", { enumerable: true, get: function () { return device_filter_1.isVoltraDevice; } });
|
|
62
|
+
Object.defineProperty(exports, "filterVoltraDevices", { enumerable: true, get: function () { return device_filter_1.filterVoltraDevices; } });
|
|
63
|
+
// =============================================================================
|
|
64
|
+
// Voltra Device
|
|
65
|
+
// =============================================================================
|
|
66
|
+
var device_2 = require("./voltra/models/device");
|
|
67
|
+
Object.defineProperty(exports, "VoltraDevice", { enumerable: true, get: function () { return device_2.VoltraDevice; } });
|
|
68
|
+
Object.defineProperty(exports, "DEFAULT_SETTINGS", { enumerable: true, get: function () { return device_2.DEFAULT_SETTINGS; } });
|
|
69
|
+
var telemetry_1 = require("./voltra/models/telemetry");
|
|
70
|
+
Object.defineProperty(exports, "createFrame", { enumerable: true, get: function () { return telemetry_1.createFrame; } });
|
|
71
|
+
var telemetry_decoder_1 = require("./voltra/protocol/telemetry-decoder");
|
|
72
|
+
Object.defineProperty(exports, "decodeTelemetryFrame", { enumerable: true, get: function () { return telemetry_decoder_1.decodeTelemetryFrame; } });
|
|
73
|
+
Object.defineProperty(exports, "decodeNotification", { enumerable: true, get: function () { return telemetry_decoder_1.decodeNotification; } });
|
|
74
|
+
Object.defineProperty(exports, "encodeTelemetryFrame", { enumerable: true, get: function () { return telemetry_decoder_1.encodeTelemetryFrame; } });
|
|
75
|
+
Object.defineProperty(exports, "identifyMessageType", { enumerable: true, get: function () { return telemetry_decoder_1.identifyMessageType; } });
|
|
76
|
+
var constants_1 = require("./voltra/protocol/constants");
|
|
77
|
+
Object.defineProperty(exports, "MovementPhase", { enumerable: true, get: function () { return constants_1.MovementPhase; } });
|
|
78
|
+
Object.defineProperty(exports, "PhaseNames", { enumerable: true, get: function () { return constants_1.PhaseNames; } });
|
|
79
|
+
Object.defineProperty(exports, "MessageTypes", { enumerable: true, get: function () { return constants_1.MessageTypes; } });
|
|
80
|
+
Object.defineProperty(exports, "TelemetryOffsets", { enumerable: true, get: function () { return constants_1.TelemetryOffsets; } });
|
|
81
|
+
// =============================================================================
|
|
82
|
+
// Commands
|
|
83
|
+
// =============================================================================
|
|
84
|
+
var commands_1 = require("./voltra/protocol/commands");
|
|
85
|
+
Object.defineProperty(exports, "WeightCommands", { enumerable: true, get: function () { return commands_1.WeightCommands; } });
|
|
86
|
+
Object.defineProperty(exports, "ChainsCommands", { enumerable: true, get: function () { return commands_1.ChainsCommands; } });
|
|
87
|
+
Object.defineProperty(exports, "EccentricCommands", { enumerable: true, get: function () { return commands_1.EccentricCommands; } });
|
|
88
|
+
// =============================================================================
|
|
89
|
+
// Protocol Constants
|
|
90
|
+
// =============================================================================
|
|
91
|
+
var constants_2 = require("./voltra/protocol/constants");
|
|
92
|
+
Object.defineProperty(exports, "BLE", { enumerable: true, get: function () { return constants_2.BLE; } });
|
|
93
|
+
Object.defineProperty(exports, "Timing", { enumerable: true, get: function () { return constants_2.Timing; } });
|
|
94
|
+
Object.defineProperty(exports, "Auth", { enumerable: true, get: function () { return constants_2.Auth; } });
|
|
95
|
+
Object.defineProperty(exports, "Init", { enumerable: true, get: function () { return constants_2.Init; } });
|
|
96
|
+
Object.defineProperty(exports, "Workout", { enumerable: true, get: function () { return constants_2.Workout; } });
|
|
97
|
+
// =============================================================================
|
|
98
|
+
// Errors
|
|
99
|
+
// =============================================================================
|
|
100
|
+
var errors_1 = require("./errors");
|
|
101
|
+
Object.defineProperty(exports, "VoltraSDKError", { enumerable: true, get: function () { return errors_1.VoltraSDKError; } });
|
|
102
|
+
Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return errors_1.ConnectionError; } });
|
|
103
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return errors_1.AuthenticationError; } });
|
|
104
|
+
Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return errors_1.TimeoutError; } });
|
|
105
|
+
Object.defineProperty(exports, "NotConnectedError", { enumerable: true, get: function () { return errors_1.NotConnectedError; } });
|
|
106
|
+
Object.defineProperty(exports, "InvalidSettingError", { enumerable: true, get: function () { return errors_1.InvalidSettingError; } });
|
|
107
|
+
Object.defineProperty(exports, "BluetoothUnavailableError", { enumerable: true, get: function () { return errors_1.BluetoothUnavailableError; } });
|
|
108
|
+
Object.defineProperty(exports, "CommandError", { enumerable: true, get: function () { return errors_1.CommandError; } });
|
|
109
|
+
Object.defineProperty(exports, "TelemetryError", { enumerable: true, get: function () { return errors_1.TelemetryError; } });
|
|
110
|
+
Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return errors_1.ErrorCode; } });
|
|
111
|
+
// =============================================================================
|
|
112
|
+
// Utilities
|
|
113
|
+
// =============================================================================
|
|
114
|
+
var utils_1 = require("./shared/utils");
|
|
115
|
+
Object.defineProperty(exports, "delay", { enumerable: true, get: function () { return utils_1.delay; } });
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;;AAEH,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF,6BAee;AAdb,mGAAA,YAAY,OAAA;AACZ,oGAAA,aAAa,OAAA;AAef,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF,gDAAyD;AAAhD,oGAAA,aAAa,OAAA;AACtB,kDAA+E;AAAtE,sGAAA,cAAc,OAAA;AACvB,sDAA+D;AAAtD,0GAAA,gBAAgB,OAAA;AACzB,iDAAwD;AAA/C,4GAAA,gBAAgB,OAAA;AAiBzB,oDAAuF;AAA9E,8GAAA,oBAAoB,OAAA;AAAE,8GAAA,oBAAoB,OAAA;AAEnD,+DAIuC;AAHrC,qHAAA,oBAAoB,OAAA;AACpB,+GAAA,cAAc,OAAA;AACd,oHAAA,mBAAmB,OAAA;AAGrB,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF,iDAMgC;AAL9B,sGAAA,YAAY,OAAA;AACZ,0GAAA,gBAAgB,OAAA;AAalB,uDAAwD;AAA/C,wGAAA,WAAW,OAAA;AAEpB,yEAO6C;AAN3C,yHAAA,oBAAoB,OAAA;AACpB,uHAAA,kBAAkB,OAAA;AAClB,yHAAA,oBAAoB,OAAA;AACpB,wHAAA,mBAAmB,OAAA;AAKrB,yDAKqC;AAJnC,0GAAA,aAAa,OAAA;AACb,uGAAA,UAAU,OAAA;AACV,yGAAA,YAAY,OAAA;AACZ,6GAAA,gBAAgB,OAAA;AAGlB,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF,uDAKoC;AAJlC,0GAAA,cAAc,OAAA;AACd,0GAAA,cAAc,OAAA;AACd,6GAAA,iBAAiB,OAAA;AAInB,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAEhF,yDAMqC;AALnC,gGAAA,GAAG,OAAA;AACH,mGAAA,MAAM,OAAA;AACN,iGAAA,IAAI,OAAA;AACJ,iGAAA,IAAI,OAAA;AACJ,oGAAA,OAAO,OAAA;AAGT,gFAAgF;AAChF,SAAS;AACT,gFAAgF;AAEhF,mCAYkB;AAXhB,wGAAA,cAAc,OAAA;AACd,yGAAA,eAAe,OAAA;AACf,6GAAA,mBAAmB,OAAA;AACnB,sGAAA,YAAY,OAAA;AACZ,2GAAA,iBAAiB,OAAA;AACjB,6GAAA,mBAAmB,OAAA;AACnB,mHAAA,yBAAyB,OAAA;AACzB,sGAAA,YAAY,OAAA;AACZ,wGAAA,cAAc,OAAA;AACd,mGAAA,SAAS,OAAA;AAIX,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,wCAAuC;AAA9B,8FAAA,KAAK,OAAA"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* React Hooks for Voltra SDK
|
|
4
|
+
*
|
|
5
|
+
* Clean, focused hooks for device scanning and state management.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { VoltraManager } from '@voltras/node-sdk';
|
|
10
|
+
* import { useVoltraScanner, useVoltraDevice } from '@voltras/node-sdk/react';
|
|
11
|
+
*
|
|
12
|
+
* function WorkoutScreen() {
|
|
13
|
+
* const manager = useMemo(() => new VoltraManager(), []);
|
|
14
|
+
* const [client, setClient] = useState<VoltraClient | null>(null);
|
|
15
|
+
*
|
|
16
|
+
* // Scanner state
|
|
17
|
+
* const { devices, isScanning, scan } = useVoltraScanner(manager);
|
|
18
|
+
*
|
|
19
|
+
* // Device state (when connected)
|
|
20
|
+
* const { connectionState, currentFrame, settings } = useVoltraDevice(client);
|
|
21
|
+
*
|
|
22
|
+
* const handleConnect = async (device: DiscoveredDevice) => {
|
|
23
|
+
* const connected = await manager.connect(device);
|
|
24
|
+
* setClient(connected);
|
|
25
|
+
* };
|
|
26
|
+
*
|
|
27
|
+
* return (
|
|
28
|
+
* <View>
|
|
29
|
+
* <Button onPress={() => scan()}>
|
|
30
|
+
* {isScanning ? 'Scanning...' : 'Scan'}
|
|
31
|
+
* </Button>
|
|
32
|
+
* {devices.map((d) => (
|
|
33
|
+
* <Button key={d.id} onPress={() => handleConnect(d)}>
|
|
34
|
+
* {d.name}
|
|
35
|
+
* </Button>
|
|
36
|
+
* ))}
|
|
37
|
+
* {connectionState === 'connected' && (
|
|
38
|
+
* <Text>Position: {currentFrame?.position}</Text>
|
|
39
|
+
* )}
|
|
40
|
+
* </View>
|
|
41
|
+
* );
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.useVoltraScanner = useVoltraScanner;
|
|
47
|
+
exports.useVoltraDevice = useVoltraDevice;
|
|
48
|
+
exports.useVoltra = useVoltra;
|
|
49
|
+
const react_1 = require("react");
|
|
50
|
+
/**
|
|
51
|
+
* Hook for scanning for Voltra devices.
|
|
52
|
+
*
|
|
53
|
+
* @param manager VoltraManager instance
|
|
54
|
+
* @returns Scanner state and controls
|
|
55
|
+
*/
|
|
56
|
+
function useVoltraScanner(manager) {
|
|
57
|
+
const [devices, setDevices] = (0, react_1.useState)([]);
|
|
58
|
+
const [isScanning, setIsScanning] = (0, react_1.useState)(false);
|
|
59
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
60
|
+
// Sync with manager's scan state
|
|
61
|
+
(0, react_1.useEffect)(() => {
|
|
62
|
+
if (!manager)
|
|
63
|
+
return;
|
|
64
|
+
const unsubscribe = manager.subscribe((event) => {
|
|
65
|
+
switch (event.type) {
|
|
66
|
+
case 'scanStarted':
|
|
67
|
+
setIsScanning(true);
|
|
68
|
+
setError(null);
|
|
69
|
+
break;
|
|
70
|
+
case 'scanStopped':
|
|
71
|
+
setIsScanning(false);
|
|
72
|
+
setDevices(event.devices);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
// Sync initial state
|
|
77
|
+
setDevices(manager.devices);
|
|
78
|
+
setIsScanning(manager.isScanning);
|
|
79
|
+
return unsubscribe;
|
|
80
|
+
}, [manager]);
|
|
81
|
+
const scan = (0, react_1.useCallback)(async (options) => {
|
|
82
|
+
if (!manager) {
|
|
83
|
+
const err = new Error('No manager provided');
|
|
84
|
+
setError(err);
|
|
85
|
+
throw err;
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
return await manager.scan(options);
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
const err = e instanceof Error ? e : new Error(String(e));
|
|
92
|
+
setError(err);
|
|
93
|
+
throw err;
|
|
94
|
+
}
|
|
95
|
+
}, [manager]);
|
|
96
|
+
const clear = (0, react_1.useCallback)(() => {
|
|
97
|
+
setDevices([]);
|
|
98
|
+
setError(null);
|
|
99
|
+
}, []);
|
|
100
|
+
return { devices, isScanning, error, scan, clear };
|
|
101
|
+
}
|
|
102
|
+
const DEFAULT_SETTINGS = {
|
|
103
|
+
weight: 0,
|
|
104
|
+
chains: 0,
|
|
105
|
+
eccentric: 0,
|
|
106
|
+
};
|
|
107
|
+
const DEFAULT_STATE = {
|
|
108
|
+
connectionState: 'disconnected',
|
|
109
|
+
isConnected: false,
|
|
110
|
+
recordingState: 'idle',
|
|
111
|
+
isRecording: false,
|
|
112
|
+
settings: DEFAULT_SETTINGS,
|
|
113
|
+
currentFrame: null,
|
|
114
|
+
error: null,
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Hook for observing a Voltra device's state.
|
|
118
|
+
*
|
|
119
|
+
* @param client VoltraClient instance (or null if not connected)
|
|
120
|
+
* @returns Device state
|
|
121
|
+
*/
|
|
122
|
+
function useVoltraDevice(client) {
|
|
123
|
+
const [state, setState] = (0, react_1.useState)(DEFAULT_STATE);
|
|
124
|
+
(0, react_1.useEffect)(() => {
|
|
125
|
+
if (!client) {
|
|
126
|
+
setState(DEFAULT_STATE);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
// Initial state from client
|
|
130
|
+
setState({
|
|
131
|
+
connectionState: client.connectionState,
|
|
132
|
+
isConnected: client.isConnected,
|
|
133
|
+
recordingState: client.recordingState,
|
|
134
|
+
isRecording: client.isRecording,
|
|
135
|
+
settings: client.settings,
|
|
136
|
+
currentFrame: null,
|
|
137
|
+
error: client.error,
|
|
138
|
+
});
|
|
139
|
+
// Subscribe to client events
|
|
140
|
+
const unsubscribe = client.subscribe((event) => {
|
|
141
|
+
switch (event.type) {
|
|
142
|
+
case 'connectionStateChanged':
|
|
143
|
+
setState((prev) => ({
|
|
144
|
+
...prev,
|
|
145
|
+
connectionState: event.state,
|
|
146
|
+
isConnected: event.state === 'connected',
|
|
147
|
+
}));
|
|
148
|
+
break;
|
|
149
|
+
case 'recordingStateChanged':
|
|
150
|
+
setState((prev) => ({
|
|
151
|
+
...prev,
|
|
152
|
+
recordingState: event.state,
|
|
153
|
+
isRecording: event.state === 'active',
|
|
154
|
+
}));
|
|
155
|
+
break;
|
|
156
|
+
case 'frame':
|
|
157
|
+
setState((prev) => ({ ...prev, currentFrame: event.frame }));
|
|
158
|
+
break;
|
|
159
|
+
case 'error':
|
|
160
|
+
setState((prev) => ({ ...prev, error: event.error }));
|
|
161
|
+
break;
|
|
162
|
+
case 'connected':
|
|
163
|
+
setState((prev) => ({
|
|
164
|
+
...prev,
|
|
165
|
+
settings: client.settings,
|
|
166
|
+
error: null,
|
|
167
|
+
}));
|
|
168
|
+
break;
|
|
169
|
+
case 'disconnected':
|
|
170
|
+
setState(DEFAULT_STATE);
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
return unsubscribe;
|
|
175
|
+
}, [client]);
|
|
176
|
+
return state;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* All-in-one hook for simple single-device scenarios.
|
|
180
|
+
* Combines scanner and device state.
|
|
181
|
+
*
|
|
182
|
+
* For multi-device scenarios, use useVoltraScanner and useVoltraDevice separately.
|
|
183
|
+
*
|
|
184
|
+
* @param manager VoltraManager instance
|
|
185
|
+
* @returns Combined state and controls
|
|
186
|
+
*/
|
|
187
|
+
function useVoltra(manager) {
|
|
188
|
+
const [client, setClient] = (0, react_1.useState)(null);
|
|
189
|
+
const scanner = useVoltraScanner(manager);
|
|
190
|
+
const device = useVoltraDevice(client);
|
|
191
|
+
// Listen for device connections/disconnections
|
|
192
|
+
(0, react_1.useEffect)(() => {
|
|
193
|
+
if (!manager)
|
|
194
|
+
return;
|
|
195
|
+
const unsubConnect = manager.onDeviceConnected((connectedClient) => {
|
|
196
|
+
setClient(connectedClient);
|
|
197
|
+
});
|
|
198
|
+
const unsubDisconnect = manager.onDeviceDisconnected(() => {
|
|
199
|
+
setClient(null);
|
|
200
|
+
});
|
|
201
|
+
return () => {
|
|
202
|
+
unsubConnect();
|
|
203
|
+
unsubDisconnect();
|
|
204
|
+
};
|
|
205
|
+
}, [manager]);
|
|
206
|
+
const connect = (0, react_1.useCallback)(async (deviceToConnect) => {
|
|
207
|
+
if (!manager)
|
|
208
|
+
throw new Error('No manager provided');
|
|
209
|
+
const connectedClient = await manager.connect(deviceToConnect);
|
|
210
|
+
setClient(connectedClient);
|
|
211
|
+
return connectedClient;
|
|
212
|
+
}, [manager]);
|
|
213
|
+
const disconnect = (0, react_1.useCallback)(async () => {
|
|
214
|
+
if (!client)
|
|
215
|
+
return;
|
|
216
|
+
await client.disconnect();
|
|
217
|
+
setClient(null);
|
|
218
|
+
}, [client]);
|
|
219
|
+
// Shorthand methods
|
|
220
|
+
const setWeight = (0, react_1.useCallback)(async (lbs) => {
|
|
221
|
+
if (!client)
|
|
222
|
+
throw new Error('Not connected');
|
|
223
|
+
await client.setWeight(lbs);
|
|
224
|
+
}, [client]);
|
|
225
|
+
const setChains = (0, react_1.useCallback)(async (lbs) => {
|
|
226
|
+
if (!client)
|
|
227
|
+
throw new Error('Not connected');
|
|
228
|
+
await client.setChains(lbs);
|
|
229
|
+
}, [client]);
|
|
230
|
+
const setEccentric = (0, react_1.useCallback)(async (percent) => {
|
|
231
|
+
if (!client)
|
|
232
|
+
throw new Error('Not connected');
|
|
233
|
+
await client.setEccentric(percent);
|
|
234
|
+
}, [client]);
|
|
235
|
+
const startRecording = (0, react_1.useCallback)(async () => {
|
|
236
|
+
if (!client)
|
|
237
|
+
throw new Error('Not connected');
|
|
238
|
+
await client.startRecording();
|
|
239
|
+
}, [client]);
|
|
240
|
+
const stopRecording = (0, react_1.useCallback)(async () => {
|
|
241
|
+
if (!client)
|
|
242
|
+
throw new Error('Not connected');
|
|
243
|
+
await client.stopRecording();
|
|
244
|
+
}, [client]);
|
|
245
|
+
return {
|
|
246
|
+
// Scanner state
|
|
247
|
+
...scanner,
|
|
248
|
+
// Device state
|
|
249
|
+
...device,
|
|
250
|
+
// Client reference
|
|
251
|
+
client,
|
|
252
|
+
// Actions
|
|
253
|
+
connect,
|
|
254
|
+
disconnect,
|
|
255
|
+
setWeight,
|
|
256
|
+
setChains,
|
|
257
|
+
setEccentric,
|
|
258
|
+
startRecording,
|
|
259
|
+
stopRecording,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../../src/react/hooks.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;;AAqCH,4CAsDC;AAgDD,0CAiEC;AAqCD,8BA2FC;AA1UD,iCAAyD;AA6BzD;;;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C5C,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;QAC9C,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC;IAChC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,MAAM,aAAa,GAAG,IAAA,mBAAW,EAAC,KAAK,IAAI,EAAE;QAC3C,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;QAC9C,MAAM,MAAM,CAAC,aAAa,EAAE,CAAC;IAC/B,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO;QACL,gBAAgB;QAChB,GAAG,OAAO;QACV,eAAe;QACf,GAAG,MAAM;QACT,mBAAmB;QACnB,MAAM;QACN,UAAU;QACV,OAAO;QACP,UAAU;QACV,SAAS;QACT,SAAS;QACT,YAAY;QACZ,cAAc;QACd,aAAa;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* React Hooks for Voltra SDK
|
|
4
|
+
*
|
|
5
|
+
* Import from '@voltras/node-sdk/react'
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { useVoltraScanner, useVoltraDevice, useVoltra } from '@voltras/node-sdk/react';
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.useVoltra = exports.useVoltraDevice = exports.useVoltraScanner = void 0;
|
|
14
|
+
var hooks_1 = require("./hooks");
|
|
15
|
+
Object.defineProperty(exports, "useVoltraScanner", { enumerable: true, get: function () { return hooks_1.useVoltraScanner; } });
|
|
16
|
+
Object.defineProperty(exports, "useVoltraDevice", { enumerable: true, get: function () { return hooks_1.useVoltraDevice; } });
|
|
17
|
+
Object.defineProperty(exports, "useVoltra", { enumerable: true, get: function () { return hooks_1.useVoltra; } });
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,iCAOiB;AANf,yGAAA,gBAAgB,OAAA;AAChB,wGAAA,eAAe,OAAA;AACf,kGAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SDK - High-level API
|
|
4
|
+
*
|
|
5
|
+
* VoltraManager is the main entry point. It handles device discovery and returns
|
|
6
|
+
* VoltraClient instances for controlling individual devices.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.VoltraManager = exports.VoltraClient = void 0;
|
|
10
|
+
var voltra_client_1 = require("./voltra-client");
|
|
11
|
+
Object.defineProperty(exports, "VoltraClient", { enumerable: true, get: function () { return voltra_client_1.VoltraClient; } });
|
|
12
|
+
var voltra_manager_1 = require("./voltra-manager");
|
|
13
|
+
Object.defineProperty(exports, "VoltraManager", { enumerable: true, get: function () { return voltra_manager_1.VoltraManager; } });
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sdk/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/sdk/types.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|