brilliantsole 0.0.27 → 0.0.29
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/assets/3d/anchor.glb +0 -0
- package/assets/3d/coin.glb +0 -0
- package/assets/3d/glasses.glb +0 -0
- package/assets/audio/bounceMedium.wav +0 -0
- package/assets/audio/bounceStrong.wav +0 -0
- package/assets/audio/bounceWeak.wav +0 -0
- package/assets/audio/coin.wav +0 -0
- package/assets/audio/getUp.wav +0 -0
- package/assets/audio/grab.wav +0 -0
- package/assets/audio/kick.wav +0 -0
- package/assets/audio/platterFadeIn old.wav +0 -0
- package/assets/audio/platterFadeIn.wav +0 -0
- package/assets/audio/platterFadeOut.wav +0 -0
- package/assets/audio/punch.wav +0 -0
- package/assets/audio/punchSqueak.wav +0 -0
- package/assets/audio/purr.wav +0 -0
- package/assets/audio/purrFadeOut.wav +0 -0
- package/assets/audio/release.wav +0 -0
- package/assets/audio/splat.wav +0 -0
- package/assets/audio/stomp.wav +0 -0
- package/build/brilliantsole.cjs +3091 -741
- package/build/brilliantsole.cjs.map +1 -1
- package/build/brilliantsole.js +2759 -709
- package/build/brilliantsole.js.map +1 -1
- package/build/brilliantsole.ls.js +2602 -543
- package/build/brilliantsole.ls.js.map +1 -1
- package/build/brilliantsole.min.js +1 -1
- package/build/brilliantsole.min.js.map +1 -1
- package/build/brilliantsole.module.d.ts +295 -65
- package/build/brilliantsole.module.js +2749 -710
- package/build/brilliantsole.module.js.map +1 -1
- package/build/brilliantsole.module.min.d.ts +295 -65
- package/build/brilliantsole.module.min.js +1 -1
- package/build/brilliantsole.module.min.js.map +1 -1
- package/build/brilliantsole.node.module.d.ts +289 -62
- package/build/brilliantsole.node.module.js +3080 -742
- package/build/brilliantsole.node.module.js.map +1 -1
- package/build/dts/BS-output.d.ts +10 -0
- package/build/dts/BS.d.ts +21 -8
- package/build/dts/CameraManager.d.ts +72 -0
- package/build/dts/Device.d.ts +64 -13
- package/build/dts/DeviceInformationManager.d.ts +4 -4
- package/build/dts/DeviceManager.d.ts +2 -0
- package/build/dts/FileTransferManager.d.ts +18 -8
- package/build/dts/InformationManager.d.ts +2 -0
- package/build/dts/MicrophoneManager.d.ts +88 -0
- package/build/dts/TfliteManager.d.ts +22 -2
- package/build/dts/WifiManager.d.ts +61 -0
- package/build/dts/connection/BaseConnectionManager.d.ts +35 -3
- package/build/dts/connection/ClientConnectionManager.d.ts +7 -2
- package/build/dts/connection/bluetooth/NobleConnectionManager.d.ts +2 -1
- package/build/dts/connection/bluetooth/WebBluetoothConnectionManager.d.ts +1 -0
- package/build/dts/connection/bluetooth/bluetoothUUIDs.d.ts +2 -2
- package/build/dts/connection/udp/UDPConnectionManager.d.ts +28 -0
- package/build/dts/connection/webSocket/WebSocketConnectionManager.d.ts +25 -0
- package/build/dts/devicePair/DevicePair.d.ts +5 -5
- package/build/dts/scanner/BaseScanner.d.ts +4 -1
- package/build/dts/scanner/NobleScanner.d.ts +2 -1
- package/build/dts/sensor/MotionSensorDataManager.d.ts +5 -2
- package/build/dts/sensor/SensorDataManager.d.ts +5 -4
- package/build/dts/server/BaseClient.d.ts +5 -3
- package/build/dts/server/ServerUtils.d.ts +1 -1
- package/build/dts/server/websocket/WebSocketUtils.d.ts +1 -1
- package/build/dts/utils/AudioUtils.d.ts +2 -0
- package/build/dts/utils/Console.d.ts +2 -0
- package/build/dts/utils/ThrottleUtils.d.ts +2 -0
- package/build/dts/vibration/VibrationManager.d.ts +19 -2
- package/build/index.d.ts +292 -62
- package/build/index.node.d.ts +286 -59
- package/examples/3d/scene.html +19 -5
- package/examples/3d-generic/index.html +144 -0
- package/examples/3d-generic/script.js +266 -0
- package/examples/basic/index.html +267 -17
- package/examples/basic/script.js +958 -105
- package/examples/camera/barcode-detector.js +109 -0
- package/examples/camera/depth-estimation.js +71 -0
- package/examples/camera/face-detector.js +119 -0
- package/examples/camera/face-landmark.js +111 -0
- package/examples/camera/gesture-recognition.js +97 -0
- package/examples/camera/hand-landmark.js +74 -0
- package/examples/camera/image-segmentation.js +98 -0
- package/examples/camera/image-to-text.js +43 -0
- package/examples/camera/image-upscale.js +75 -0
- package/examples/camera/index.html +129 -0
- package/examples/camera/object-detection.js +98 -0
- package/examples/camera/pose-landmark.js +60 -0
- package/examples/camera/script.js +316 -0
- package/examples/camera/utils.js +165 -0
- package/examples/camera/yolo-tiny.js +54 -0
- package/examples/camera/yolo.js +119 -0
- package/examples/edge-impulse/script.js +157 -48
- package/examples/edge-impulse-test/README.md +11 -0
- package/examples/edge-impulse-test/edge-impulse-standalone.js +7228 -0
- package/examples/edge-impulse-test/edge-impulse-standalone.wasm +0 -0
- package/examples/edge-impulse-test/index.html +75 -0
- package/examples/edge-impulse-test/run-impulse.js +135 -0
- package/examples/edge-impulse-test/script.js +200 -0
- package/examples/glasses-gestures/README.md +11 -0
- package/examples/glasses-gestures/edge-impulse-standalone.js +7228 -0
- package/examples/glasses-gestures/edge-impulse-standalone.wasm +0 -0
- package/examples/glasses-gestures/index.html +69 -0
- package/examples/glasses-gestures/run-impulse.js +135 -0
- package/examples/glasses-gestures/script.js +226 -0
- package/examples/gloves/edge-impulse-standalone.js +7228 -0
- package/examples/gloves/edge-impulse-standalone.wasm +0 -0
- package/examples/gloves/index.html +4 -1
- package/examples/gloves/run-impulse.js +135 -0
- package/examples/gloves/script.js +367 -51
- package/examples/graph/script.js +94 -37
- package/examples/microphone/gender.js +54 -0
- package/examples/microphone/index.html +102 -0
- package/examples/microphone/script.js +394 -0
- package/examples/microphone/utils.js +45 -0
- package/examples/microphone/whisper-realtime.js +166 -0
- package/examples/microphone/whisper.js +132 -0
- package/examples/punch/index.html +135 -0
- package/examples/punch/punch.tflite +0 -0
- package/examples/punch/script.js +169 -0
- package/examples/server/index.html +98 -22
- package/examples/server/script.js +317 -109
- package/examples/ukaton-firmware-update/merged-firmware.bin +0 -0
- package/examples/utils/aframe/aframe-master.min.js +2 -0
- package/examples/utils/aframe/bs-vibration.js +150 -0
- package/examples/utils/aframe/force-pushable.js +80 -0
- package/examples/utils/aframe/grabbable-anchor.js +46 -0
- package/examples/utils/aframe/grabbable-listener.js +31 -0
- package/examples/utils/aframe/grabbable-physics-body.js +190 -0
- package/examples/utils/aframe/grow-shrink.js +25 -0
- package/examples/utils/aframe/hand-punch.js +119 -0
- package/examples/utils/aframe/my-obb-collider.js +293 -0
- package/examples/utils/aframe/occlude-hand-tracking-controls.js +47 -0
- package/examples/utils/aframe/occlude-mesh.js +42 -0
- package/examples/utils/aframe/palm-up-detector.js +47 -0
- package/examples/utils/aframe/shadow-material.js +20 -0
- package/examples/utils/aframe/soft-shadow-light.js +9 -0
- package/examples/webxr-2/assets/3d/soccerBall.glb +0 -0
- package/examples/webxr-2/assets/audio/shellBounce.wav +0 -0
- package/examples/webxr-2/assets/audio/shellHit.wav +0 -0
- package/examples/webxr-2/assets/audio/shellKick.wav +0 -0
- package/examples/webxr-2/assets/audio/soccerBounce.wav +0 -0
- package/examples/webxr-2/assets/audio/soccerKick.mp3 +0 -0
- package/examples/webxr-2/assets/images/shellTexture.png +0 -0
- package/examples/webxr-2/components/bs-ankle.js +337 -0
- package/examples/webxr-2/components/coin.js +84 -0
- package/examples/webxr-2/components/custom-wrap.js +17 -0
- package/examples/webxr-2/components/goomba.js +3250 -0
- package/examples/webxr-2/components/init-shell-material.js +215 -0
- package/examples/webxr-2/components/platter.js +172 -0
- package/examples/webxr-2/components/shell.js +374 -0
- package/examples/webxr-2/components/soccer-ball.js +250 -0
- package/examples/webxr-2/components/squashed-goomba.js +249 -0
- package/examples/webxr-2/edge-impulse-standalone.js +7228 -0
- package/examples/webxr-2/edge-impulse-standalone.wasm +0 -0
- package/examples/webxr-2/index.html +996 -0
- package/examples/webxr-2/kick.tflite +0 -0
- package/examples/webxr-2/kick2.tflite +0 -0
- package/examples/webxr-2/run-impulse.js +135 -0
- package/examples/webxr-2/script.js +384 -0
- package/examples/webxr-3/components/bs-camera.js +65 -0
- package/examples/webxr-3/index.html +134 -0
- package/examples/webxr-3/script.js +432 -0
- package/package.json +2 -1
- package/src/.prettierrc +4 -0
- package/src/BS.ts +79 -8
- package/src/CameraManager.ts +497 -0
- package/src/Device.ts +691 -86
- package/src/DeviceInformationManager.ts +19 -10
- package/src/DeviceManager.ts +85 -25
- package/src/FileTransferManager.ts +145 -20
- package/src/InformationManager.ts +40 -15
- package/src/MicrophoneManager.ts +599 -0
- package/src/TfliteManager.ts +171 -25
- package/src/WifiManager.ts +323 -0
- package/src/connection/BaseConnectionManager.ts +130 -30
- package/src/connection/ClientConnectionManager.ts +34 -10
- package/src/connection/bluetooth/BluetoothConnectionManager.ts +8 -2
- package/src/connection/bluetooth/NobleConnectionManager.ts +147 -41
- package/src/connection/bluetooth/WebBluetoothConnectionManager.ts +99 -34
- package/src/connection/bluetooth/bluetoothUUIDs.ts +40 -13
- package/src/connection/udp/UDPConnectionManager.ts +356 -0
- package/src/connection/websocket/WebSocketConnectionManager.ts +282 -0
- package/src/devicePair/DevicePair.ts +95 -25
- package/src/devicePair/DevicePairPressureSensorDataManager.ts +27 -7
- package/src/scanner/BaseScanner.ts +49 -11
- package/src/scanner/NobleScanner.ts +76 -14
- package/src/sensor/MotionSensorDataManager.ts +21 -6
- package/src/sensor/PressureSensorDataManager.ts +37 -8
- package/src/sensor/SensorConfigurationManager.ts +73 -22
- package/src/sensor/SensorDataManager.ts +109 -23
- package/src/server/BaseClient.ts +150 -36
- package/src/server/BaseServer.ts +50 -2
- package/src/server/ServerUtils.ts +39 -9
- package/src/server/udp/UDPServer.ts +73 -22
- package/src/server/udp/UDPUtils.ts +9 -2
- package/src/server/websocket/WebSocketClient.ts +27 -7
- package/src/server/websocket/WebSocketUtils.ts +4 -2
- package/src/utils/AudioUtils.ts +65 -0
- package/src/utils/Console.ts +62 -9
- package/src/utils/ParseUtils.ts +24 -5
- package/src/utils/ThrottleUtils.ts +62 -0
- package/src/utils/Timer.ts +1 -1
- package/src/vibration/VibrationManager.ts +166 -40
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import Device, { SendMessageCallback } from "./Device.ts";
|
|
2
|
+
import EventDispatcher from "./utils/EventDispatcher.ts";
|
|
3
|
+
export declare const MinWifiSSIDLength = 1;
|
|
4
|
+
export declare const MaxWifiSSIDLength = 32;
|
|
5
|
+
export declare const MinWifiPasswordLength = 8;
|
|
6
|
+
export declare const MaxWifiPasswordLength = 64;
|
|
7
|
+
export declare const WifiMessageTypes: readonly ["isWifiAvailable", "getWifiSSID", "setWifiSSID", "getWifiPassword", "setWifiPassword", "getWifiConnectionEnabled", "setWifiConnectionEnabled", "isWifiConnected", "ipAddress", "isWifiSecure"];
|
|
8
|
+
export type WifiMessageType = (typeof WifiMessageTypes)[number];
|
|
9
|
+
export declare const RequiredWifiMessageTypes: WifiMessageType[];
|
|
10
|
+
export declare const WifiEventTypes: readonly ["isWifiAvailable", "getWifiSSID", "setWifiSSID", "getWifiPassword", "setWifiPassword", "getWifiConnectionEnabled", "setWifiConnectionEnabled", "isWifiConnected", "ipAddress", "isWifiSecure"];
|
|
11
|
+
export type WifiEventType = (typeof WifiEventTypes)[number];
|
|
12
|
+
export interface WifiEventMessages {
|
|
13
|
+
isWifiAvailable: {
|
|
14
|
+
isWifiAvailable: boolean;
|
|
15
|
+
};
|
|
16
|
+
getWifiSSID: {
|
|
17
|
+
wifiSSID: string;
|
|
18
|
+
};
|
|
19
|
+
getWifiPassword: {
|
|
20
|
+
wifiPassword: string;
|
|
21
|
+
};
|
|
22
|
+
getEnableWifiConnection: {
|
|
23
|
+
wifiConnectionEnabled: boolean;
|
|
24
|
+
};
|
|
25
|
+
isWifiConnected: {
|
|
26
|
+
isWifiConnected: boolean;
|
|
27
|
+
};
|
|
28
|
+
ipAddress: {
|
|
29
|
+
ipAddress?: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export type WifiEventDispatcher = EventDispatcher<Device, WifiEventType, WifiEventMessages>;
|
|
33
|
+
export type SendWifiMessageCallback = SendMessageCallback<WifiMessageType>;
|
|
34
|
+
declare class WifiManager {
|
|
35
|
+
#private;
|
|
36
|
+
constructor();
|
|
37
|
+
sendMessage: SendWifiMessageCallback;
|
|
38
|
+
eventDispatcher: WifiEventDispatcher;
|
|
39
|
+
get waitForEvent(): <T extends "isWifiAvailable" | "getWifiSSID" | "setWifiSSID" | "getWifiPassword" | "setWifiPassword" | "getWifiConnectionEnabled" | "setWifiConnectionEnabled" | "isWifiConnected" | "ipAddress" | "isWifiSecure">(type: T) => Promise<{
|
|
40
|
+
type: T;
|
|
41
|
+
target: Device;
|
|
42
|
+
message: WifiEventMessages[T];
|
|
43
|
+
}>;
|
|
44
|
+
requestRequiredInformation(): void;
|
|
45
|
+
get isWifiAvailable(): boolean;
|
|
46
|
+
get wifiSSID(): string;
|
|
47
|
+
setWifiSSID(newWifiSSID: string): Promise<void>;
|
|
48
|
+
get wifiPassword(): string;
|
|
49
|
+
setWifiPassword(newWifiPassword: string): Promise<void>;
|
|
50
|
+
get wifiConnectionEnabled(): boolean;
|
|
51
|
+
setWifiConnectionEnabled(newWifiConnectionEnabled: boolean, sendImmediately?: boolean): Promise<void>;
|
|
52
|
+
toggleWifiConnection(): Promise<void>;
|
|
53
|
+
enableWifiConnection(): Promise<void>;
|
|
54
|
+
disableWifiConnection(): Promise<void>;
|
|
55
|
+
get isWifiConnected(): boolean;
|
|
56
|
+
get ipAddress(): string | undefined;
|
|
57
|
+
get isWifiSecure(): boolean;
|
|
58
|
+
parseMessage(messageType: WifiMessageType, dataView: DataView): void;
|
|
59
|
+
clear(): void;
|
|
60
|
+
}
|
|
61
|
+
export default WifiManager;
|
|
@@ -1,5 +1,29 @@
|
|
|
1
|
-
export declare const ConnectionTypes: readonly ["webBluetooth", "noble", "client"];
|
|
1
|
+
export declare const ConnectionTypes: readonly ["webBluetooth", "noble", "client", "webSocket", "udp"];
|
|
2
2
|
export type ConnectionType = (typeof ConnectionTypes)[number];
|
|
3
|
+
export declare const ClientConnectionTypes: readonly ["noble", "webSocket", "udp"];
|
|
4
|
+
export type ClientConnectionType = (typeof ClientConnectionTypes)[number];
|
|
5
|
+
interface BaseConnectOptions {
|
|
6
|
+
type: "client" | "webBluetooth" | "webSocket" | "udp";
|
|
7
|
+
}
|
|
8
|
+
export interface WebBluetoothConnectOptions extends BaseConnectOptions {
|
|
9
|
+
type: "webBluetooth";
|
|
10
|
+
}
|
|
11
|
+
interface BaseWifiConnectOptions extends BaseConnectOptions {
|
|
12
|
+
ipAddress: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ClientConnectOptions extends BaseConnectOptions {
|
|
15
|
+
type: "client";
|
|
16
|
+
subType?: "noble" | "webSocket" | "udp";
|
|
17
|
+
}
|
|
18
|
+
export interface WebSocketConnectOptions extends BaseWifiConnectOptions {
|
|
19
|
+
type: "webSocket";
|
|
20
|
+
isWifiSecure?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface UDPConnectOptions extends BaseWifiConnectOptions {
|
|
23
|
+
type: "udp";
|
|
24
|
+
receivePort?: number;
|
|
25
|
+
}
|
|
26
|
+
export type ConnectOptions = WebBluetoothConnectOptions | WebSocketConnectOptions | UDPConnectOptions | ClientConnectOptions;
|
|
3
27
|
export declare const ConnectionStatuses: readonly ["notConnected", "connecting", "connected", "disconnecting"];
|
|
4
28
|
export type ConnectionStatus = (typeof ConnectionStatuses)[number];
|
|
5
29
|
export declare const ConnectionEventTypes: readonly ["notConnected", "connecting", "connected", "disconnecting", "connectionStatus", "isConnected"];
|
|
@@ -20,7 +44,7 @@ export interface TxMessage {
|
|
|
20
44
|
type: TxRxMessageType;
|
|
21
45
|
data?: ArrayBuffer;
|
|
22
46
|
}
|
|
23
|
-
export declare const TxRxMessageTypes: readonly ["isCharging", "getBatteryCurrent", "getMtu", "getId", "getName", "setName", "getType", "setType", "getCurrentTime", "setCurrentTime", "getSensorConfiguration", "setSensorConfiguration", "getPressurePositions", "getSensorScalars", "sensorData", "triggerVibration", "getTfliteName", "setTfliteName", "getTfliteTask", "setTfliteTask", "getTfliteSampleRate", "setTfliteSampleRate", "getTfliteSensorTypes", "setTfliteSensorTypes", "tfliteIsReady", "getTfliteCaptureDelay", "setTfliteCaptureDelay", "getTfliteThreshold", "setTfliteThreshold", "getTfliteInferencingEnabled", "setTfliteInferencingEnabled", "tfliteInference", "
|
|
47
|
+
export declare const TxRxMessageTypes: readonly ["isCharging", "getBatteryCurrent", "getMtu", "getId", "getName", "setName", "getType", "setType", "getCurrentTime", "setCurrentTime", "getSensorConfiguration", "setSensorConfiguration", "getPressurePositions", "getSensorScalars", "sensorData", "getVibrationLocations", "triggerVibration", "getFileTypes", "maxFileLength", "getFileType", "setFileType", "getFileLength", "setFileLength", "getFileChecksum", "setFileChecksum", "setFileTransferCommand", "fileTransferStatus", "getFileBlock", "setFileBlock", "fileBytesTransferred", "getTfliteName", "setTfliteName", "getTfliteTask", "setTfliteTask", "getTfliteSampleRate", "setTfliteSampleRate", "getTfliteSensorTypes", "setTfliteSensorTypes", "tfliteIsReady", "getTfliteCaptureDelay", "setTfliteCaptureDelay", "getTfliteThreshold", "setTfliteThreshold", "getTfliteInferencingEnabled", "setTfliteInferencingEnabled", "tfliteInference", "isWifiAvailable", "getWifiSSID", "setWifiSSID", "getWifiPassword", "setWifiPassword", "getWifiConnectionEnabled", "setWifiConnectionEnabled", "isWifiConnected", "ipAddress", "isWifiSecure", "cameraStatus", "cameraCommand", "getCameraConfiguration", "setCameraConfiguration", "cameraData", "microphoneStatus", "microphoneCommand", "getMicrophoneConfiguration", "setMicrophoneConfiguration", "microphoneData"];
|
|
24
48
|
export type TxRxMessageType = (typeof TxRxMessageTypes)[number];
|
|
25
49
|
export declare const SMPMessageTypes: readonly ["smp"];
|
|
26
50
|
export type SMPMessageType = (typeof SMPMessageTypes)[number];
|
|
@@ -28,7 +52,7 @@ export declare const BatteryLevelMessageTypes: readonly ["batteryLevel"];
|
|
|
28
52
|
export type BatteryLevelMessageType = (typeof BatteryLevelMessageTypes)[number];
|
|
29
53
|
export declare const MetaConnectionMessageTypes: readonly ["rx", "tx"];
|
|
30
54
|
export type MetaConnectionMessageType = (typeof MetaConnectionMessageTypes)[number];
|
|
31
|
-
export declare const ConnectionMessageTypes: readonly ["batteryLevel", "manufacturerName", "modelNumber", "
|
|
55
|
+
export declare const ConnectionMessageTypes: readonly ["batteryLevel", "manufacturerName", "modelNumber", "hardwareRevision", "firmwareRevision", "softwareRevision", "pnpId", "serialNumber", "rx", "tx", "isCharging", "getBatteryCurrent", "getMtu", "getId", "getName", "setName", "getType", "setType", "getCurrentTime", "setCurrentTime", "getSensorConfiguration", "setSensorConfiguration", "getPressurePositions", "getSensorScalars", "sensorData", "getVibrationLocations", "triggerVibration", "getFileTypes", "maxFileLength", "getFileType", "setFileType", "getFileLength", "setFileLength", "getFileChecksum", "setFileChecksum", "setFileTransferCommand", "fileTransferStatus", "getFileBlock", "setFileBlock", "fileBytesTransferred", "getTfliteName", "setTfliteName", "getTfliteTask", "setTfliteTask", "getTfliteSampleRate", "setTfliteSampleRate", "getTfliteSensorTypes", "setTfliteSensorTypes", "tfliteIsReady", "getTfliteCaptureDelay", "setTfliteCaptureDelay", "getTfliteThreshold", "setTfliteThreshold", "getTfliteInferencingEnabled", "setTfliteInferencingEnabled", "tfliteInference", "isWifiAvailable", "getWifiSSID", "setWifiSSID", "getWifiPassword", "setWifiPassword", "getWifiConnectionEnabled", "setWifiConnectionEnabled", "isWifiConnected", "ipAddress", "isWifiSecure", "cameraStatus", "cameraCommand", "getCameraConfiguration", "setCameraConfiguration", "cameraData", "microphoneStatus", "microphoneCommand", "getMicrophoneConfiguration", "setMicrophoneConfiguration", "microphoneData", "smp"];
|
|
32
56
|
export type ConnectionMessageType = (typeof ConnectionMessageTypes)[number];
|
|
33
57
|
export type ConnectionStatusCallback = (status: ConnectionStatus) => void;
|
|
34
58
|
export type MessageReceivedCallback = (messageType: ConnectionMessageType, dataView: DataView) => void;
|
|
@@ -50,15 +74,23 @@ declare abstract class BaseConnectionManager {
|
|
|
50
74
|
protected set status(newConnectionStatus: "notConnected" | "connecting" | "connected" | "disconnecting");
|
|
51
75
|
get isConnected(): boolean;
|
|
52
76
|
get isAvailable(): boolean;
|
|
77
|
+
/** @throws {Error} if connected */
|
|
78
|
+
protected assertIsNotConnected(): void;
|
|
79
|
+
/** @throws {Error} if not connected */
|
|
80
|
+
protected assertIsConnected(): void;
|
|
81
|
+
/** @throws {Error} if not connected or is disconnecting */
|
|
82
|
+
assertIsConnectedAndNotDisconnecting(): void;
|
|
53
83
|
connect(): Promise<void>;
|
|
54
84
|
get canReconnect(): boolean;
|
|
55
85
|
reconnect(): Promise<void>;
|
|
56
86
|
disconnect(): Promise<void>;
|
|
57
87
|
sendSmpMessage(data: ArrayBuffer): Promise<void>;
|
|
58
88
|
sendTxMessages(messages: TxMessage[] | undefined, sendImmediately?: boolean): Promise<void>;
|
|
89
|
+
protected defaultMtu: number;
|
|
59
90
|
mtu?: number;
|
|
60
91
|
sendTxData(data: ArrayBuffer): Promise<void>;
|
|
61
92
|
parseRxMessage(dataView: DataView): void;
|
|
62
93
|
clear(): void;
|
|
94
|
+
remove(): void;
|
|
63
95
|
}
|
|
64
96
|
export default BaseConnectionManager;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import BaseConnectionManager, { ConnectionType } from "./BaseConnectionManager.ts";
|
|
1
|
+
import BaseConnectionManager, { ConnectionType, ClientConnectionType } from "./BaseConnectionManager.ts";
|
|
2
2
|
import { ClientDeviceMessage } from "../server/ServerUtils.ts";
|
|
3
3
|
import BaseClient from "../server/BaseClient.ts";
|
|
4
|
+
import { DiscoveredDevice } from "../BS.ts";
|
|
4
5
|
export type SendClientMessageCallback = (...messages: ClientDeviceMessage[]) => void;
|
|
6
|
+
export type SendClientConnectMessageCallback = (connectionType?: ClientConnectionType) => void;
|
|
5
7
|
declare class ClientConnectionManager extends BaseConnectionManager {
|
|
6
8
|
#private;
|
|
7
9
|
static get isSupported(): boolean;
|
|
8
10
|
static get type(): ConnectionType;
|
|
11
|
+
subType?: ClientConnectionType;
|
|
9
12
|
get canUpdateFirmware(): boolean;
|
|
10
13
|
client: BaseClient;
|
|
14
|
+
discoveredDevice: DiscoveredDevice;
|
|
11
15
|
get bluetoothId(): string;
|
|
12
16
|
set bluetoothId(newBluetoothId: string);
|
|
13
17
|
get isConnected(): boolean;
|
|
@@ -18,8 +22,9 @@ declare class ClientConnectionManager extends BaseConnectionManager {
|
|
|
18
22
|
get canReconnect(): boolean;
|
|
19
23
|
reconnect(): Promise<void>;
|
|
20
24
|
sendClientMessage: SendClientMessageCallback;
|
|
21
|
-
sendClientConnectMessage:
|
|
25
|
+
sendClientConnectMessage: SendClientConnectMessageCallback;
|
|
22
26
|
sendClientDisconnectMessage: Function;
|
|
27
|
+
sendRequiredDeviceInformationMessage: Function;
|
|
23
28
|
sendSmpMessage(data: ArrayBuffer): Promise<void>;
|
|
24
29
|
sendTxData(data: ArrayBuffer): Promise<void>;
|
|
25
30
|
onClientMessage(dataView: DataView): void;
|
|
@@ -30,7 +30,7 @@ declare class NobleConnectionManager extends BluetoothConnectionManager {
|
|
|
30
30
|
get canReconnect(): boolean;
|
|
31
31
|
reconnect(): Promise<void>;
|
|
32
32
|
get noblePeripheral(): NoblePeripheral | undefined;
|
|
33
|
-
set noblePeripheral(newNoblePeripheral: NoblePeripheral);
|
|
33
|
+
set noblePeripheral(newNoblePeripheral: NoblePeripheral | undefined);
|
|
34
34
|
onNoblePeripheralConnect(noblePeripheral: NoblePeripheral): Promise<void>;
|
|
35
35
|
onNoblePeripheralDisconnect(noblePeripheral: NoblePeripheral): Promise<void>;
|
|
36
36
|
onNoblePeripheralRssiUpdate(noblePeripheral: NoblePeripheral, rssi: number): Promise<void>;
|
|
@@ -39,5 +39,6 @@ declare class NobleConnectionManager extends BluetoothConnectionManager {
|
|
|
39
39
|
onNobleCharacteristicData(characteristic: NobleCharacteristic, data: Buffer, isNotification: boolean): void;
|
|
40
40
|
onNobleCharacteristicWrite(characteristic: NobleCharacteristic): void;
|
|
41
41
|
onNobleCharacteristicNotify(characteristic: NobleCharacteristic, isSubscribed: boolean): void;
|
|
42
|
+
remove(): void;
|
|
42
43
|
}
|
|
43
44
|
export default NobleConnectionManager;
|
|
@@ -17,5 +17,6 @@ declare class WebBluetoothConnectionManager extends BluetoothConnectionManager {
|
|
|
17
17
|
writeCharacteristic(characteristicName: BluetoothCharacteristicName, data: ArrayBuffer): Promise<void>;
|
|
18
18
|
get canReconnect(): boolean;
|
|
19
19
|
reconnect(): Promise<void>;
|
|
20
|
+
remove(): void;
|
|
20
21
|
}
|
|
21
22
|
export default WebBluetoothConnectionManager;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type BluetoothServiceName = "deviceInformation" | "battery" | "main" | "smp";
|
|
2
|
-
import {
|
|
3
|
-
export type BluetoothCharacteristicName =
|
|
2
|
+
import { DeviceInformationType } from "../../DeviceInformationManager.ts";
|
|
3
|
+
export type BluetoothCharacteristicName = DeviceInformationType | "batteryLevel" | "rx" | "tx" | "smp";
|
|
4
4
|
export declare const serviceUUIDs: BluetoothServiceUUID[];
|
|
5
5
|
export declare const optionalServiceUUIDs: BluetoothServiceUUID[];
|
|
6
6
|
export declare const allServiceUUIDs: BluetoothServiceUUID[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import BaseConnectionManager, { ConnectionType } from "../BaseConnectionManager.ts";
|
|
2
|
+
import * as dgram from "dgram";
|
|
3
|
+
export declare const UDPSendPort = 3000;
|
|
4
|
+
export declare const UDPPingInterval = 2000;
|
|
5
|
+
declare class UDPConnectionManager extends BaseConnectionManager {
|
|
6
|
+
#private;
|
|
7
|
+
get bluetoothId(): string;
|
|
8
|
+
defaultMtu: number;
|
|
9
|
+
constructor(ipAddress: string, bluetoothId?: string, receivePort?: number);
|
|
10
|
+
get isAvailable(): boolean;
|
|
11
|
+
static get isSupported(): boolean;
|
|
12
|
+
static get type(): ConnectionType;
|
|
13
|
+
get ipAddress(): string;
|
|
14
|
+
set ipAddress(newIpAddress: string);
|
|
15
|
+
get receivePort(): number | undefined;
|
|
16
|
+
set receivePort(newReceivePort: number | undefined);
|
|
17
|
+
get socket(): dgram.Socket | undefined;
|
|
18
|
+
set socket(newSocket: dgram.Socket | undefined);
|
|
19
|
+
sendSmpMessage(data: ArrayBuffer): Promise<void>;
|
|
20
|
+
sendTxData(data: ArrayBuffer): Promise<void>;
|
|
21
|
+
connect(): Promise<void>;
|
|
22
|
+
disconnect(): Promise<void>;
|
|
23
|
+
get canReconnect(): boolean;
|
|
24
|
+
reconnect(): Promise<void>;
|
|
25
|
+
clear(): void;
|
|
26
|
+
remove(): void;
|
|
27
|
+
}
|
|
28
|
+
export default UDPConnectionManager;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import BaseConnectionManager, { ConnectionType } from "../BaseConnectionManager.ts";
|
|
2
|
+
declare class WebSocketConnectionManager extends BaseConnectionManager {
|
|
3
|
+
#private;
|
|
4
|
+
get bluetoothId(): string;
|
|
5
|
+
defaultMtu: number;
|
|
6
|
+
constructor(ipAddress: string, isSecure?: boolean, bluetoothId?: string);
|
|
7
|
+
get isAvailable(): boolean;
|
|
8
|
+
static get isSupported(): boolean;
|
|
9
|
+
static get type(): ConnectionType;
|
|
10
|
+
get webSocket(): WebSocket | undefined;
|
|
11
|
+
set webSocket(newWebSocket: WebSocket | undefined);
|
|
12
|
+
get ipAddress(): string;
|
|
13
|
+
set ipAddress(newIpAddress: string);
|
|
14
|
+
get isSecure(): boolean;
|
|
15
|
+
set isSecure(newIsSecure: boolean);
|
|
16
|
+
get url(): string;
|
|
17
|
+
connect(): Promise<void>;
|
|
18
|
+
disconnect(): Promise<void>;
|
|
19
|
+
get canReconnect(): boolean;
|
|
20
|
+
reconnect(): Promise<void>;
|
|
21
|
+
sendSmpMessage(data: ArrayBuffer): Promise<void>;
|
|
22
|
+
sendTxData(data: ArrayBuffer): Promise<void>;
|
|
23
|
+
remove(): void;
|
|
24
|
+
}
|
|
25
|
+
export default WebSocketConnectionManager;
|
|
@@ -17,7 +17,7 @@ export interface DevicePairConnectionEventMessages {
|
|
|
17
17
|
isConnected: boolean;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
export declare const DevicePairEventTypes: readonly ["isConnected", "pressure", "sensorData", ...("deviceOrientation" | "deviceConnected" | "deviceIsConnected" | "devicePressure" | "deviceMaxFileLength" | "deviceGetFileType" | "deviceGetFileLength" | "deviceGetFileChecksum" | "deviceFileTransferStatus" | "deviceGetFileBlock" | "deviceFileTransferProgress" | "deviceFileTransferComplete" | "deviceFileReceived" | "deviceAcceleration" | "deviceGravity" | "deviceLinearAcceleration" | "deviceGyroscope" | "deviceMagnetometer" | "deviceGameRotation" | "deviceRotation" | "deviceActivity" | "deviceStepCounter" | "deviceStepDetector" | "deviceDeviceOrientation" | "deviceBarometer" | "deviceSensorData" | "deviceGetSensorConfiguration" | "deviceGetTfliteName" | "deviceGetTfliteTask" | "deviceGetTfliteSampleRate" | "deviceGetTfliteSensorTypes" | "deviceTfliteIsReady" | "deviceGetTfliteCaptureDelay" | "deviceGetTfliteThreshold" | "deviceGetTfliteInferencingEnabled" | "deviceTfliteInference" | "deviceManufacturerName" | "deviceModelNumber" | "
|
|
20
|
+
export declare const DevicePairEventTypes: readonly ["isConnected", "pressure", "sensorData", ...("deviceOrientation" | "deviceConnected" | "deviceIsConnected" | "devicePressure" | "deviceGetFileTypes" | "deviceMaxFileLength" | "deviceGetFileType" | "deviceGetFileLength" | "deviceGetFileChecksum" | "deviceFileTransferStatus" | "deviceGetFileBlock" | "deviceFileTransferProgress" | "deviceFileTransferComplete" | "deviceFileReceived" | "deviceAcceleration" | "deviceGravity" | "deviceLinearAcceleration" | "deviceGyroscope" | "deviceMagnetometer" | "deviceGameRotation" | "deviceRotation" | "deviceActivity" | "deviceStepCounter" | "deviceStepDetector" | "deviceDeviceOrientation" | "deviceTapDetector" | "deviceBarometer" | "deviceCameraStatus" | "deviceGetCameraConfiguration" | "deviceCameraImageProgress" | "deviceCameraImage" | "deviceMicrophoneStatus" | "deviceGetMicrophoneConfiguration" | "deviceMicrophoneData" | "deviceIsRecordingMicrophone" | "deviceMicrophoneRecording" | "deviceSensorData" | "deviceGetSensorConfiguration" | "deviceGetTfliteName" | "deviceGetTfliteTask" | "deviceGetTfliteSampleRate" | "deviceGetTfliteSensorTypes" | "deviceTfliteIsReady" | "deviceGetTfliteCaptureDelay" | "deviceGetTfliteThreshold" | "deviceGetTfliteInferencingEnabled" | "deviceTfliteInference" | "deviceManufacturerName" | "deviceModelNumber" | "deviceHardwareRevision" | "deviceFirmwareRevision" | "deviceSoftwareRevision" | "devicePnpId" | "deviceSerialNumber" | "deviceDeviceInformation" | "deviceIsCharging" | "deviceGetBatteryCurrent" | "deviceGetMtu" | "deviceGetId" | "deviceGetName" | "deviceGetType" | "deviceGetCurrentTime" | "deviceIsWifiAvailable" | "deviceGetWifiSSID" | "deviceGetWifiPassword" | "deviceIsWifiConnected" | "deviceIpAddress" | "deviceNotConnected" | "deviceConnecting" | "deviceDisconnecting" | "deviceConnectionStatus" | "deviceSmp" | "deviceBatteryLevel" | "deviceFirmwareImages" | "deviceFirmwareUploadProgress" | "deviceFirmwareStatus" | "deviceConnectionMessage" | "deviceGetEnableWifiConnection")[]];
|
|
21
21
|
export type DevicePairEventType = (typeof DevicePairEventTypes)[number];
|
|
22
22
|
export type DevicePairEventMessages = DevicePairConnectionEventMessages & DevicePairSensorDataEventMessages & DevicePairDeviceEventMessages;
|
|
23
23
|
export type DevicePairEventDispatcher = EventDispatcher<DevicePair, DevicePairEventType, DevicePairEventMessages>;
|
|
@@ -32,24 +32,24 @@ declare class DevicePair {
|
|
|
32
32
|
constructor(type: DevicePairType);
|
|
33
33
|
get sides(): readonly ["left", "right"];
|
|
34
34
|
get type(): "insoles" | "gloves";
|
|
35
|
-
get addEventListener(): <T extends "pressure" | "deviceOrientation" | "sensorData" | "isConnected" | "deviceConnected" | "deviceIsConnected" | "devicePressure" | "deviceMaxFileLength" | "deviceGetFileType" | "deviceGetFileLength" | "deviceGetFileChecksum" | "deviceFileTransferStatus" | "deviceGetFileBlock" | "deviceFileTransferProgress" | "deviceFileTransferComplete" | "deviceFileReceived" | "deviceAcceleration" | "deviceGravity" | "deviceLinearAcceleration" | "deviceGyroscope" | "deviceMagnetometer" | "deviceGameRotation" | "deviceRotation" | "deviceActivity" | "deviceStepCounter" | "deviceStepDetector" | "deviceDeviceOrientation" | "deviceBarometer" | "deviceSensorData" | "deviceGetSensorConfiguration" | "deviceGetTfliteName" | "deviceGetTfliteTask" | "deviceGetTfliteSampleRate" | "deviceGetTfliteSensorTypes" | "deviceTfliteIsReady" | "deviceGetTfliteCaptureDelay" | "deviceGetTfliteThreshold" | "deviceGetTfliteInferencingEnabled" | "deviceTfliteInference" | "deviceManufacturerName" | "deviceModelNumber" | "
|
|
35
|
+
get addEventListener(): <T extends "pressure" | "deviceOrientation" | "sensorData" | "isConnected" | "deviceConnected" | "deviceIsConnected" | "devicePressure" | "deviceGetFileTypes" | "deviceMaxFileLength" | "deviceGetFileType" | "deviceGetFileLength" | "deviceGetFileChecksum" | "deviceFileTransferStatus" | "deviceGetFileBlock" | "deviceFileTransferProgress" | "deviceFileTransferComplete" | "deviceFileReceived" | "deviceAcceleration" | "deviceGravity" | "deviceLinearAcceleration" | "deviceGyroscope" | "deviceMagnetometer" | "deviceGameRotation" | "deviceRotation" | "deviceActivity" | "deviceStepCounter" | "deviceStepDetector" | "deviceDeviceOrientation" | "deviceTapDetector" | "deviceBarometer" | "deviceCameraStatus" | "deviceGetCameraConfiguration" | "deviceCameraImageProgress" | "deviceCameraImage" | "deviceMicrophoneStatus" | "deviceGetMicrophoneConfiguration" | "deviceMicrophoneData" | "deviceIsRecordingMicrophone" | "deviceMicrophoneRecording" | "deviceSensorData" | "deviceGetSensorConfiguration" | "deviceGetTfliteName" | "deviceGetTfliteTask" | "deviceGetTfliteSampleRate" | "deviceGetTfliteSensorTypes" | "deviceTfliteIsReady" | "deviceGetTfliteCaptureDelay" | "deviceGetTfliteThreshold" | "deviceGetTfliteInferencingEnabled" | "deviceTfliteInference" | "deviceManufacturerName" | "deviceModelNumber" | "deviceHardwareRevision" | "deviceFirmwareRevision" | "deviceSoftwareRevision" | "devicePnpId" | "deviceSerialNumber" | "deviceDeviceInformation" | "deviceIsCharging" | "deviceGetBatteryCurrent" | "deviceGetMtu" | "deviceGetId" | "deviceGetName" | "deviceGetType" | "deviceGetCurrentTime" | "deviceIsWifiAvailable" | "deviceGetWifiSSID" | "deviceGetWifiPassword" | "deviceIsWifiConnected" | "deviceIpAddress" | "deviceNotConnected" | "deviceConnecting" | "deviceDisconnecting" | "deviceConnectionStatus" | "deviceSmp" | "deviceBatteryLevel" | "deviceFirmwareImages" | "deviceFirmwareUploadProgress" | "deviceFirmwareStatus" | "deviceConnectionMessage" | "deviceGetEnableWifiConnection">(type: T, listener: (event: {
|
|
36
36
|
type: T;
|
|
37
37
|
target: DevicePair;
|
|
38
38
|
message: DevicePairEventMessages[T];
|
|
39
39
|
}) => void, options?: {
|
|
40
40
|
once?: boolean;
|
|
41
41
|
}) => void;
|
|
42
|
-
get removeEventListener(): <T extends "pressure" | "deviceOrientation" | "sensorData" | "isConnected" | "deviceConnected" | "deviceIsConnected" | "devicePressure" | "deviceMaxFileLength" | "deviceGetFileType" | "deviceGetFileLength" | "deviceGetFileChecksum" | "deviceFileTransferStatus" | "deviceGetFileBlock" | "deviceFileTransferProgress" | "deviceFileTransferComplete" | "deviceFileReceived" | "deviceAcceleration" | "deviceGravity" | "deviceLinearAcceleration" | "deviceGyroscope" | "deviceMagnetometer" | "deviceGameRotation" | "deviceRotation" | "deviceActivity" | "deviceStepCounter" | "deviceStepDetector" | "deviceDeviceOrientation" | "deviceBarometer" | "deviceSensorData" | "deviceGetSensorConfiguration" | "deviceGetTfliteName" | "deviceGetTfliteTask" | "deviceGetTfliteSampleRate" | "deviceGetTfliteSensorTypes" | "deviceTfliteIsReady" | "deviceGetTfliteCaptureDelay" | "deviceGetTfliteThreshold" | "deviceGetTfliteInferencingEnabled" | "deviceTfliteInference" | "deviceManufacturerName" | "deviceModelNumber" | "
|
|
42
|
+
get removeEventListener(): <T extends "pressure" | "deviceOrientation" | "sensorData" | "isConnected" | "deviceConnected" | "deviceIsConnected" | "devicePressure" | "deviceGetFileTypes" | "deviceMaxFileLength" | "deviceGetFileType" | "deviceGetFileLength" | "deviceGetFileChecksum" | "deviceFileTransferStatus" | "deviceGetFileBlock" | "deviceFileTransferProgress" | "deviceFileTransferComplete" | "deviceFileReceived" | "deviceAcceleration" | "deviceGravity" | "deviceLinearAcceleration" | "deviceGyroscope" | "deviceMagnetometer" | "deviceGameRotation" | "deviceRotation" | "deviceActivity" | "deviceStepCounter" | "deviceStepDetector" | "deviceDeviceOrientation" | "deviceTapDetector" | "deviceBarometer" | "deviceCameraStatus" | "deviceGetCameraConfiguration" | "deviceCameraImageProgress" | "deviceCameraImage" | "deviceMicrophoneStatus" | "deviceGetMicrophoneConfiguration" | "deviceMicrophoneData" | "deviceIsRecordingMicrophone" | "deviceMicrophoneRecording" | "deviceSensorData" | "deviceGetSensorConfiguration" | "deviceGetTfliteName" | "deviceGetTfliteTask" | "deviceGetTfliteSampleRate" | "deviceGetTfliteSensorTypes" | "deviceTfliteIsReady" | "deviceGetTfliteCaptureDelay" | "deviceGetTfliteThreshold" | "deviceGetTfliteInferencingEnabled" | "deviceTfliteInference" | "deviceManufacturerName" | "deviceModelNumber" | "deviceHardwareRevision" | "deviceFirmwareRevision" | "deviceSoftwareRevision" | "devicePnpId" | "deviceSerialNumber" | "deviceDeviceInformation" | "deviceIsCharging" | "deviceGetBatteryCurrent" | "deviceGetMtu" | "deviceGetId" | "deviceGetName" | "deviceGetType" | "deviceGetCurrentTime" | "deviceIsWifiAvailable" | "deviceGetWifiSSID" | "deviceGetWifiPassword" | "deviceIsWifiConnected" | "deviceIpAddress" | "deviceNotConnected" | "deviceConnecting" | "deviceDisconnecting" | "deviceConnectionStatus" | "deviceSmp" | "deviceBatteryLevel" | "deviceFirmwareImages" | "deviceFirmwareUploadProgress" | "deviceFirmwareStatus" | "deviceConnectionMessage" | "deviceGetEnableWifiConnection">(type: T, listener: (event: {
|
|
43
43
|
type: T;
|
|
44
44
|
target: DevicePair;
|
|
45
45
|
message: DevicePairEventMessages[T];
|
|
46
46
|
}) => void) => void;
|
|
47
|
-
get waitForEvent(): <T extends "pressure" | "deviceOrientation" | "sensorData" | "isConnected" | "deviceConnected" | "deviceIsConnected" | "devicePressure" | "deviceMaxFileLength" | "deviceGetFileType" | "deviceGetFileLength" | "deviceGetFileChecksum" | "deviceFileTransferStatus" | "deviceGetFileBlock" | "deviceFileTransferProgress" | "deviceFileTransferComplete" | "deviceFileReceived" | "deviceAcceleration" | "deviceGravity" | "deviceLinearAcceleration" | "deviceGyroscope" | "deviceMagnetometer" | "deviceGameRotation" | "deviceRotation" | "deviceActivity" | "deviceStepCounter" | "deviceStepDetector" | "deviceDeviceOrientation" | "deviceBarometer" | "deviceSensorData" | "deviceGetSensorConfiguration" | "deviceGetTfliteName" | "deviceGetTfliteTask" | "deviceGetTfliteSampleRate" | "deviceGetTfliteSensorTypes" | "deviceTfliteIsReady" | "deviceGetTfliteCaptureDelay" | "deviceGetTfliteThreshold" | "deviceGetTfliteInferencingEnabled" | "deviceTfliteInference" | "deviceManufacturerName" | "deviceModelNumber" | "
|
|
47
|
+
get waitForEvent(): <T extends "pressure" | "deviceOrientation" | "sensorData" | "isConnected" | "deviceConnected" | "deviceIsConnected" | "devicePressure" | "deviceGetFileTypes" | "deviceMaxFileLength" | "deviceGetFileType" | "deviceGetFileLength" | "deviceGetFileChecksum" | "deviceFileTransferStatus" | "deviceGetFileBlock" | "deviceFileTransferProgress" | "deviceFileTransferComplete" | "deviceFileReceived" | "deviceAcceleration" | "deviceGravity" | "deviceLinearAcceleration" | "deviceGyroscope" | "deviceMagnetometer" | "deviceGameRotation" | "deviceRotation" | "deviceActivity" | "deviceStepCounter" | "deviceStepDetector" | "deviceDeviceOrientation" | "deviceTapDetector" | "deviceBarometer" | "deviceCameraStatus" | "deviceGetCameraConfiguration" | "deviceCameraImageProgress" | "deviceCameraImage" | "deviceMicrophoneStatus" | "deviceGetMicrophoneConfiguration" | "deviceMicrophoneData" | "deviceIsRecordingMicrophone" | "deviceMicrophoneRecording" | "deviceSensorData" | "deviceGetSensorConfiguration" | "deviceGetTfliteName" | "deviceGetTfliteTask" | "deviceGetTfliteSampleRate" | "deviceGetTfliteSensorTypes" | "deviceTfliteIsReady" | "deviceGetTfliteCaptureDelay" | "deviceGetTfliteThreshold" | "deviceGetTfliteInferencingEnabled" | "deviceTfliteInference" | "deviceManufacturerName" | "deviceModelNumber" | "deviceHardwareRevision" | "deviceFirmwareRevision" | "deviceSoftwareRevision" | "devicePnpId" | "deviceSerialNumber" | "deviceDeviceInformation" | "deviceIsCharging" | "deviceGetBatteryCurrent" | "deviceGetMtu" | "deviceGetId" | "deviceGetName" | "deviceGetType" | "deviceGetCurrentTime" | "deviceIsWifiAvailable" | "deviceGetWifiSSID" | "deviceGetWifiPassword" | "deviceIsWifiConnected" | "deviceIpAddress" | "deviceNotConnected" | "deviceConnecting" | "deviceDisconnecting" | "deviceConnectionStatus" | "deviceSmp" | "deviceBatteryLevel" | "deviceFirmwareImages" | "deviceFirmwareUploadProgress" | "deviceFirmwareStatus" | "deviceConnectionMessage" | "deviceGetEnableWifiConnection">(type: T) => Promise<{
|
|
48
48
|
type: T;
|
|
49
49
|
target: DevicePair;
|
|
50
50
|
message: DevicePairEventMessages[T];
|
|
51
51
|
}>;
|
|
52
|
-
get removeEventListeners(): <T extends "pressure" | "deviceOrientation" | "sensorData" | "isConnected" | "deviceConnected" | "deviceIsConnected" | "devicePressure" | "deviceMaxFileLength" | "deviceGetFileType" | "deviceGetFileLength" | "deviceGetFileChecksum" | "deviceFileTransferStatus" | "deviceGetFileBlock" | "deviceFileTransferProgress" | "deviceFileTransferComplete" | "deviceFileReceived" | "deviceAcceleration" | "deviceGravity" | "deviceLinearAcceleration" | "deviceGyroscope" | "deviceMagnetometer" | "deviceGameRotation" | "deviceRotation" | "deviceActivity" | "deviceStepCounter" | "deviceStepDetector" | "deviceDeviceOrientation" | "deviceBarometer" | "deviceSensorData" | "deviceGetSensorConfiguration" | "deviceGetTfliteName" | "deviceGetTfliteTask" | "deviceGetTfliteSampleRate" | "deviceGetTfliteSensorTypes" | "deviceTfliteIsReady" | "deviceGetTfliteCaptureDelay" | "deviceGetTfliteThreshold" | "deviceGetTfliteInferencingEnabled" | "deviceTfliteInference" | "deviceManufacturerName" | "deviceModelNumber" | "
|
|
52
|
+
get removeEventListeners(): <T extends "pressure" | "deviceOrientation" | "sensorData" | "isConnected" | "deviceConnected" | "deviceIsConnected" | "devicePressure" | "deviceGetFileTypes" | "deviceMaxFileLength" | "deviceGetFileType" | "deviceGetFileLength" | "deviceGetFileChecksum" | "deviceFileTransferStatus" | "deviceGetFileBlock" | "deviceFileTransferProgress" | "deviceFileTransferComplete" | "deviceFileReceived" | "deviceAcceleration" | "deviceGravity" | "deviceLinearAcceleration" | "deviceGyroscope" | "deviceMagnetometer" | "deviceGameRotation" | "deviceRotation" | "deviceActivity" | "deviceStepCounter" | "deviceStepDetector" | "deviceDeviceOrientation" | "deviceTapDetector" | "deviceBarometer" | "deviceCameraStatus" | "deviceGetCameraConfiguration" | "deviceCameraImageProgress" | "deviceCameraImage" | "deviceMicrophoneStatus" | "deviceGetMicrophoneConfiguration" | "deviceMicrophoneData" | "deviceIsRecordingMicrophone" | "deviceMicrophoneRecording" | "deviceSensorData" | "deviceGetSensorConfiguration" | "deviceGetTfliteName" | "deviceGetTfliteTask" | "deviceGetTfliteSampleRate" | "deviceGetTfliteSensorTypes" | "deviceTfliteIsReady" | "deviceGetTfliteCaptureDelay" | "deviceGetTfliteThreshold" | "deviceGetTfliteInferencingEnabled" | "deviceTfliteInference" | "deviceManufacturerName" | "deviceModelNumber" | "deviceHardwareRevision" | "deviceFirmwareRevision" | "deviceSoftwareRevision" | "devicePnpId" | "deviceSerialNumber" | "deviceDeviceInformation" | "deviceIsCharging" | "deviceGetBatteryCurrent" | "deviceGetMtu" | "deviceGetId" | "deviceGetName" | "deviceGetType" | "deviceGetCurrentTime" | "deviceIsWifiAvailable" | "deviceGetWifiSSID" | "deviceGetWifiPassword" | "deviceIsWifiConnected" | "deviceIpAddress" | "deviceNotConnected" | "deviceConnecting" | "deviceDisconnecting" | "deviceConnectionStatus" | "deviceSmp" | "deviceBatteryLevel" | "deviceFirmwareImages" | "deviceFirmwareUploadProgress" | "deviceFirmwareStatus" | "deviceConnectionMessage" | "deviceGetEnableWifiConnection">(type: T) => void;
|
|
53
53
|
get removeAllEventListeners(): () => void;
|
|
54
54
|
get left(): Device | undefined;
|
|
55
55
|
get right(): Device | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import EventDispatcher, { BoundEventListeners, Event, EventMap } from "../utils/EventDispatcher.ts";
|
|
2
2
|
import { DeviceType } from "../InformationManager.ts";
|
|
3
|
+
import { ConnectionType } from "../connection/BaseConnectionManager.ts";
|
|
3
4
|
export declare const ScannerEventTypes: readonly ["isScanningAvailable", "isScanning", "discoveredDevice", "expiredDiscoveredDevice"];
|
|
4
5
|
export type ScannerEventType = (typeof ScannerEventTypes)[number];
|
|
5
6
|
export interface DiscoveredDevice {
|
|
@@ -7,6 +8,8 @@ export interface DiscoveredDevice {
|
|
|
7
8
|
name: string;
|
|
8
9
|
deviceType: DeviceType;
|
|
9
10
|
rssi: number;
|
|
11
|
+
ipAddress?: string;
|
|
12
|
+
isWifiSecure?: boolean;
|
|
10
13
|
}
|
|
11
14
|
interface ScannerDiscoveredDeviceEventMessage {
|
|
12
15
|
discoveredDevice: DiscoveredDevice;
|
|
@@ -59,7 +62,7 @@ declare abstract class BaseScanner {
|
|
|
59
62
|
get discoveredDevices(): Readonly<DiscoveredDevicesMap>;
|
|
60
63
|
get discoveredDevicesArray(): DiscoveredDevice[];
|
|
61
64
|
static get DiscoveredDeviceExpirationTimeout(): number;
|
|
62
|
-
connectToDevice(deviceId: string): Promise<void>;
|
|
65
|
+
connectToDevice(deviceId: string, connectionType?: ConnectionType): Promise<void>;
|
|
63
66
|
get canReset(): boolean;
|
|
64
67
|
reset(): void;
|
|
65
68
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import BaseScanner from "./BaseScanner.ts";
|
|
2
|
+
import { ClientConnectionType } from "../connection/BaseConnectionManager.ts";
|
|
2
3
|
/** NODE_END */
|
|
3
4
|
export declare const NobleStates: readonly ["unknown", "resetting", "unsupported", "unauthorized", "poweredOff", "poweredOn"];
|
|
4
5
|
export type NobleState = (typeof NobleStates)[number];
|
|
@@ -12,6 +13,6 @@ declare class NobleScanner extends BaseScanner {
|
|
|
12
13
|
stopScan(): void;
|
|
13
14
|
get canReset(): boolean;
|
|
14
15
|
reset(): void;
|
|
15
|
-
connectToDevice(deviceId: string): Promise<void>;
|
|
16
|
+
connectToDevice(deviceId: string, connectionType?: ClientConnectionType): Promise<void>;
|
|
16
17
|
}
|
|
17
18
|
export default NobleScanner;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const MotionSensorTypes: readonly ["acceleration", "gravity", "linearAcceleration", "gyroscope", "magnetometer", "gameRotation", "rotation", "orientation", "activity", "stepCounter", "stepDetector", "deviceOrientation"];
|
|
1
|
+
export declare const MotionSensorTypes: readonly ["acceleration", "gravity", "linearAcceleration", "gyroscope", "magnetometer", "gameRotation", "rotation", "orientation", "activity", "stepCounter", "stepDetector", "deviceOrientation", "tapDetector"];
|
|
2
2
|
export type MotionSensorType = (typeof MotionSensorTypes)[number];
|
|
3
|
-
export declare const ContinuousMotionTypes: readonly ["acceleration", "gravity", "linearAcceleration", "gyroscope", "magnetometer", "gameRotation", "rotation"];
|
|
3
|
+
export declare const ContinuousMotionTypes: readonly ["acceleration", "gravity", "linearAcceleration", "gyroscope", "magnetometer", "gameRotation", "rotation", "orientation"];
|
|
4
4
|
export type ContinuousMotionType = (typeof ContinuousMotionTypes)[number];
|
|
5
5
|
import { Vector3, Quaternion, Euler } from "../utils/MathUtils.ts";
|
|
6
6
|
import { ValueOf } from "../utils/TypeScriptUtils.ts";
|
|
@@ -56,6 +56,9 @@ export interface MotionSensorDataEventMessages {
|
|
|
56
56
|
deviceOrientation: {
|
|
57
57
|
deviceOrientation: DeviceOrientation;
|
|
58
58
|
};
|
|
59
|
+
tapDetector: {
|
|
60
|
+
tapDetector: Object;
|
|
61
|
+
};
|
|
59
62
|
}
|
|
60
63
|
export type MotionSensorDataEventMessage = ValueOf<MotionSensorDataEventMessages>;
|
|
61
64
|
declare class MotionSensorDataManager {
|
|
@@ -4,13 +4,14 @@ import BarometerSensorDataManager, { BarometerSensorDataEventMessages } from "./
|
|
|
4
4
|
import EventDispatcher from "../utils/EventDispatcher.ts";
|
|
5
5
|
import Device from "../Device.ts";
|
|
6
6
|
import { AddKeysAsPropertyToInterface, ExtendInterfaceValues, ValueOf } from "../utils/TypeScriptUtils.ts";
|
|
7
|
-
export declare const SensorTypes: readonly ["pressure", "acceleration", "gravity", "linearAcceleration", "gyroscope", "magnetometer", "gameRotation", "rotation", "orientation", "activity", "stepCounter", "stepDetector", "deviceOrientation", "barometer"];
|
|
7
|
+
export declare const SensorTypes: readonly ["pressure", "acceleration", "gravity", "linearAcceleration", "gyroscope", "magnetometer", "gameRotation", "rotation", "orientation", "activity", "stepCounter", "stepDetector", "deviceOrientation", "tapDetector", "barometer", "camera", "microphone"];
|
|
8
8
|
export type SensorType = (typeof SensorTypes)[number];
|
|
9
|
-
export declare const ContinuousSensorTypes: readonly ["pressure", "acceleration", "gravity", "linearAcceleration", "gyroscope", "magnetometer", "gameRotation", "rotation", "barometer"];
|
|
9
|
+
export declare const ContinuousSensorTypes: readonly ["pressure", "acceleration", "gravity", "linearAcceleration", "gyroscope", "magnetometer", "gameRotation", "rotation", "orientation", "barometer"];
|
|
10
10
|
export type ContinuousSensorType = (typeof ContinuousSensorTypes)[number];
|
|
11
11
|
export declare const SensorDataMessageTypes: readonly ["getPressurePositions", "getSensorScalars", "sensorData"];
|
|
12
12
|
export type SensorDataMessageType = (typeof SensorDataMessageTypes)[number];
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const RequiredPressureMessageTypes: SensorDataMessageType[];
|
|
14
|
+
export declare const SensorDataEventTypes: readonly ["getPressurePositions", "getSensorScalars", "sensorData", "pressure", "acceleration", "gravity", "linearAcceleration", "gyroscope", "magnetometer", "gameRotation", "rotation", "orientation", "activity", "stepCounter", "stepDetector", "deviceOrientation", "tapDetector", "barometer", "camera", "microphone"];
|
|
14
15
|
export type SensorDataEventType = (typeof SensorDataEventTypes)[number];
|
|
15
16
|
interface BaseSensorDataEventMessage {
|
|
16
17
|
timestamp: number;
|
|
@@ -31,7 +32,7 @@ declare class SensorDataManager {
|
|
|
31
32
|
static AssertValidSensorType(sensorType: SensorType): void;
|
|
32
33
|
static AssertValidSensorTypeEnum(sensorTypeEnum: number): void;
|
|
33
34
|
eventDispatcher: SensorDataEventDispatcher;
|
|
34
|
-
get dispatchEvent(): <T extends "pressure" | "acceleration" | "gravity" | "linearAcceleration" | "gyroscope" | "magnetometer" | "gameRotation" | "rotation" | "orientation" | "activity" | "stepCounter" | "stepDetector" | "deviceOrientation" | "barometer" | "getPressurePositions" | "getSensorScalars" | "sensorData">(type: T, message: SensorDataEventMessages[T]) => void;
|
|
35
|
+
get dispatchEvent(): <T extends "pressure" | "acceleration" | "gravity" | "linearAcceleration" | "gyroscope" | "magnetometer" | "gameRotation" | "rotation" | "orientation" | "activity" | "stepCounter" | "stepDetector" | "deviceOrientation" | "tapDetector" | "barometer" | "camera" | "microphone" | "getPressurePositions" | "getSensorScalars" | "sensorData">(type: T, message: SensorDataEventMessages[T]) => void;
|
|
35
36
|
parseMessage(messageType: SensorDataMessageType, dataView: DataView): void;
|
|
36
37
|
parseScalars(dataView: DataView): void;
|
|
37
38
|
private parseData;
|
|
@@ -2,6 +2,7 @@ import { ServerMessage, ClientDeviceMessage } from "./ServerUtils.ts";
|
|
|
2
2
|
import EventDispatcher, { BoundEventListeners, Event } from "../utils/EventDispatcher.ts";
|
|
3
3
|
import Device from "../Device.ts";
|
|
4
4
|
import { DiscoveredDevice, DiscoveredDevicesMap, ScannerEventMessages } from "../scanner/BaseScanner.ts";
|
|
5
|
+
import { ClientConnectionType } from "../connection/BaseConnectionManager.ts";
|
|
5
6
|
export declare const ClientConnectionStatuses: readonly ["notConnected", "connecting", "connected", "disconnecting"];
|
|
6
7
|
export type ClientConnectionStatus = (typeof ClientConnectionStatuses)[number];
|
|
7
8
|
export declare const ClientEventTypes: readonly ["notConnected", "connecting", "connected", "disconnecting", "connectionStatus", "isConnected", "isScanningAvailable", "isScanning", "discoveredDevice", "expiredDiscoveredDevice"];
|
|
@@ -73,14 +74,15 @@ declare abstract class BaseClient {
|
|
|
73
74
|
get discoveredDevices(): Readonly<DiscoveredDevicesMap>;
|
|
74
75
|
protected onDiscoveredDevice(discoveredDevice: DiscoveredDevice): void;
|
|
75
76
|
requestDiscoveredDevices(): void;
|
|
76
|
-
connectToDevice(bluetoothId: string): Device;
|
|
77
|
-
protected requestConnectionToDevice(bluetoothId: string): Device;
|
|
78
|
-
protected sendConnectToDeviceMessage(bluetoothId: string): void;
|
|
77
|
+
connectToDevice(bluetoothId: string, connectionType?: ClientConnectionType): Device;
|
|
78
|
+
protected requestConnectionToDevice(bluetoothId: string, connectionType?: ClientConnectionType): Device;
|
|
79
|
+
protected sendConnectToDeviceMessage(bluetoothId: string, connectionType?: ClientConnectionType): void;
|
|
79
80
|
createDevice(bluetoothId: string): Device;
|
|
80
81
|
protected onConnectedBluetoothDeviceIds(bluetoothIds: string[]): void;
|
|
81
82
|
disconnectFromDevice(bluetoothId: string): void;
|
|
82
83
|
protected requestDisconnectionFromDevice(bluetoothId: string): Device;
|
|
83
84
|
protected sendDisconnectFromDeviceMessage(bluetoothId: string): void;
|
|
84
85
|
protected sendDeviceMessage(bluetoothId: string, ...messages: ClientDeviceMessage[]): void;
|
|
86
|
+
protected sendRequiredDeviceInformationMessage(bluetoothId: string): void;
|
|
85
87
|
}
|
|
86
88
|
export default BaseClient;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConnectionMessageType } from "../connection/BaseConnectionManager.ts";
|
|
2
2
|
import { DeviceEventType } from "../Device.ts";
|
|
3
|
-
export declare const ServerMessageTypes: readonly ["isScanningAvailable", "isScanning", "startScan", "stopScan", "discoveredDevice", "discoveredDevices", "expiredDiscoveredDevice", "connectToDevice", "disconnectFromDevice", "connectedDevices", "deviceMessage"];
|
|
3
|
+
export declare const ServerMessageTypes: readonly ["isScanningAvailable", "isScanning", "startScan", "stopScan", "discoveredDevice", "discoveredDevices", "expiredDiscoveredDevice", "connectToDevice", "disconnectFromDevice", "connectedDevices", "deviceMessage", "requiredDeviceInformation"];
|
|
4
4
|
export type ServerMessageType = (typeof ServerMessageTypes)[number];
|
|
5
5
|
export declare const DeviceMessageTypes: readonly ["connectionStatus", "batteryLevel", "deviceInformation", "rx", "smp"];
|
|
6
6
|
export type DeviceMessageType = (typeof DeviceMessageTypes)[number];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Message } from "../ServerUtils.ts";
|
|
2
|
-
export declare const webSocketPingTimeout =
|
|
2
|
+
export declare const webSocketPingTimeout = 30000;
|
|
3
3
|
export declare const webSocketReconnectTimeout = 3000;
|
|
4
4
|
export declare const WebSocketMessageTypes: readonly ["ping", "pong", "serverMessage"];
|
|
5
5
|
export type WebSocketMessageType = (typeof WebSocketMessageTypes)[number];
|
|
@@ -26,6 +26,8 @@ declare class Console {
|
|
|
26
26
|
assertTypeWithError(value: any, type: string): void;
|
|
27
27
|
/** @throws {Error} if value's type doesn't match */
|
|
28
28
|
assertEnumWithError(value: string, enumeration: readonly string[]): void;
|
|
29
|
+
/** @throws {Error} if value is not within some range */
|
|
30
|
+
assertRangeWithError(name: string, value: number, min: number, max: number): void;
|
|
29
31
|
}
|
|
30
32
|
export declare function createConsole(type: string, levelFlags?: ConsoleLevelFlags): Console;
|
|
31
33
|
/** @throws {Error} if no console with type is found */
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare function throttle<T extends (...args: any[]) => void>(fn: T, interval: number, trailing?: boolean): (...args: Parameters<T>) => void;
|
|
2
|
+
export declare function debounce<T extends (...args: any[]) => void>(fn: T, interval: number, callImmediately?: boolean): (...args: Parameters<T>) => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { VibrationWaveformEffect } from "./VibrationWaveformEffects.ts";
|
|
2
|
-
import { SendMessageCallback } from "../Device.ts";
|
|
2
|
+
import Device, { SendMessageCallback } from "../Device.ts";
|
|
3
|
+
import EventDispatcher from "../utils/EventDispatcher.ts";
|
|
3
4
|
export declare const VibrationLocations: readonly ["front", "rear"];
|
|
4
5
|
export type VibrationLocation = (typeof VibrationLocations)[number];
|
|
5
6
|
export declare const VibrationTypes: readonly ["waveformEffect", "waveform"];
|
|
@@ -13,8 +14,15 @@ export interface VibrationWaveformSegment {
|
|
|
13
14
|
duration: number;
|
|
14
15
|
amplitude: number;
|
|
15
16
|
}
|
|
16
|
-
export declare const VibrationMessageTypes: readonly ["triggerVibration"];
|
|
17
|
+
export declare const VibrationMessageTypes: readonly ["getVibrationLocations", "triggerVibration"];
|
|
17
18
|
export type VibrationMessageType = (typeof VibrationMessageTypes)[number];
|
|
19
|
+
export declare const VibrationEventTypes: readonly ["getVibrationLocations", "triggerVibration"];
|
|
20
|
+
export type VibrationEventType = (typeof VibrationEventTypes)[number];
|
|
21
|
+
export interface VibrationEventMessages {
|
|
22
|
+
getVibrationLocations: {
|
|
23
|
+
vibrationLocations: VibrationLocation[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
18
26
|
export declare const MaxNumberOfVibrationWaveformEffectSegments = 8;
|
|
19
27
|
export declare const MaxVibrationWaveformSegmentDuration = 2550;
|
|
20
28
|
export declare const MaxVibrationWaveformEffectSegmentDelay = 1270;
|
|
@@ -36,10 +44,19 @@ export interface VibrationWaveformConfiguration extends BaseVibrationConfigurati
|
|
|
36
44
|
}
|
|
37
45
|
export type VibrationConfiguration = VibrationWaveformEffectConfiguration | VibrationWaveformConfiguration;
|
|
38
46
|
export type SendVibrationMessageCallback = SendMessageCallback<VibrationMessageType>;
|
|
47
|
+
export type VibrationEventDispatcher = EventDispatcher<Device, VibrationEventType, VibrationEventMessages>;
|
|
39
48
|
declare class VibrationManager {
|
|
40
49
|
#private;
|
|
41
50
|
constructor();
|
|
42
51
|
sendMessage: SendVibrationMessageCallback;
|
|
52
|
+
eventDispatcher: VibrationEventDispatcher;
|
|
53
|
+
get waitForEvent(): <T extends "getVibrationLocations" | "triggerVibration">(type: T) => Promise<{
|
|
54
|
+
type: T;
|
|
55
|
+
target: Device;
|
|
56
|
+
message: VibrationEventMessages[T];
|
|
57
|
+
}>;
|
|
43
58
|
triggerVibration(vibrationConfigurations: VibrationConfiguration[], sendImmediately?: boolean): Promise<void>;
|
|
59
|
+
get vibrationLocations(): ("front" | "rear")[];
|
|
60
|
+
parseMessage(messageType: VibrationMessageType, dataView: DataView): void;
|
|
44
61
|
}
|
|
45
62
|
export default VibrationManager;
|