@mentra/sdk 2.1.31-beta.5 → 3.0.0-alpha.1
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/README.md +54 -9
- package/dist/MiniAppServer.d.ts +58 -0
- package/dist/MiniAppServer.d.ts.map +1 -0
- package/dist/app/server/index.d.ts +208 -70
- package/dist/app/server/index.d.ts.map +1 -1
- package/dist/app/session/events.d.ts +20 -3
- package/dist/app/session/events.d.ts.map +1 -1
- package/dist/app/session/index.d.ts +56 -3
- package/dist/app/session/index.d.ts.map +1 -1
- package/dist/app/session/modules/audio-output-stream.d.ts +108 -0
- package/dist/app/session/modules/audio-output-stream.d.ts.map +1 -0
- package/dist/app/session/modules/audio.d.ts +36 -1
- package/dist/app/session/modules/audio.d.ts.map +1 -1
- package/dist/app/session/modules/camera-managed-extension.d.ts +37 -33
- package/dist/app/session/modules/camera-managed-extension.d.ts.map +1 -1
- package/dist/app/session/modules/camera.d.ts +113 -93
- package/dist/app/session/modules/camera.d.ts.map +1 -1
- package/dist/app/session/modules/index.d.ts +4 -3
- package/dist/app/session/modules/index.d.ts.map +1 -1
- package/dist/app/session/modules/led.d.ts.map +1 -1
- package/dist/app/session/modules/location.d.ts.map +1 -1
- package/dist/app/session/settings.d.ts +5 -1
- package/dist/app/session/settings.d.ts.map +1 -1
- package/dist/app/webview/index.d.ts +67 -9
- package/dist/app/webview/index.d.ts.map +1 -1
- package/dist/constants/log-messages/updates.d.ts +32 -9
- package/dist/constants/log-messages/updates.d.ts.map +1 -1
- package/dist/constants/log-messages/warning.d.ts +12 -0
- package/dist/constants/log-messages/warning.d.ts.map +1 -1
- package/dist/display-utils.d.ts +3 -1
- package/dist/display-utils.d.ts.map +1 -1
- package/dist/display-utils.js +443 -26
- package/dist/display-utils.js.map +10 -6
- package/dist/index.d.ts +22 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8957 -4428
- package/dist/index.js.map +63 -31
- package/dist/internal/_SessionManager.d.ts +76 -0
- package/dist/internal/_SessionManager.d.ts.map +1 -0
- package/dist/logging/clean-transport.d.ts +50 -0
- package/dist/logging/clean-transport.d.ts.map +1 -0
- package/dist/logging/errors.d.ts +90 -0
- package/dist/logging/errors.d.ts.map +1 -0
- package/dist/logging/logger.d.ts +72 -1
- package/dist/logging/logger.d.ts.map +1 -1
- package/dist/logging/telemetry-transport.d.ts +51 -0
- package/dist/logging/telemetry-transport.d.ts.map +1 -0
- package/dist/session/DataStreamRouter.d.ts +219 -0
- package/dist/session/DataStreamRouter.d.ts.map +1 -0
- package/dist/session/MentraSession.d.ts +102 -0
- package/dist/session/MentraSession.d.ts.map +1 -0
- package/dist/session/index.d.ts +2 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/internal/_ConnectionManager.d.ts +43 -0
- package/dist/session/internal/_ConnectionManager.d.ts.map +1 -0
- package/dist/session/internal/_MessageRouter.d.ts +11 -0
- package/dist/session/internal/_MessageRouter.d.ts.map +1 -0
- package/dist/session/internal/_SubscriptionManager.d.ts +32 -0
- package/dist/session/internal/_SubscriptionManager.d.ts.map +1 -0
- package/dist/session/internal/_V2AudioStreamShim.d.ts +12 -0
- package/dist/session/internal/_V2AudioStreamShim.d.ts.map +1 -0
- package/dist/session/internal/_V2CameraShim.d.ts +52 -0
- package/dist/session/internal/_V2CameraShim.d.ts.map +1 -0
- package/dist/session/internal/_V2EventManagerShim.d.ts +52 -0
- package/dist/session/internal/_V2EventManagerShim.d.ts.map +1 -0
- package/dist/session/internal/_V2SessionShim.d.ts +169 -0
- package/dist/session/internal/_V2SessionShim.d.ts.map +1 -0
- package/dist/session/internal/_V2SettingsShim.d.ts +17 -0
- package/dist/session/internal/_V2SettingsShim.d.ts.map +1 -0
- package/dist/session/managers/CameraManager.d.ts +198 -0
- package/dist/session/managers/CameraManager.d.ts.map +1 -0
- package/dist/session/managers/DashboardManager.d.ts +131 -0
- package/dist/session/managers/DashboardManager.d.ts.map +1 -0
- package/dist/session/managers/DeviceManager.d.ts +348 -0
- package/dist/session/managers/DeviceManager.d.ts.map +1 -0
- package/dist/session/managers/DisplayManager.d.ts +171 -0
- package/dist/session/managers/DisplayManager.d.ts.map +1 -0
- package/dist/session/managers/LedManager.d.ts +116 -0
- package/dist/session/managers/LedManager.d.ts.map +1 -0
- package/dist/session/managers/LocationManager.d.ts +224 -0
- package/dist/session/managers/LocationManager.d.ts.map +1 -0
- package/dist/session/managers/MicManager.d.ts +252 -0
- package/dist/session/managers/MicManager.d.ts.map +1 -0
- package/dist/session/managers/PermissionsManager.d.ts +139 -0
- package/dist/session/managers/PermissionsManager.d.ts.map +1 -0
- package/dist/session/managers/PhoneManager.d.ts +351 -0
- package/dist/session/managers/PhoneManager.d.ts.map +1 -0
- package/dist/session/managers/SpeakerManager.d.ts +285 -0
- package/dist/session/managers/SpeakerManager.d.ts.map +1 -0
- package/dist/session/managers/StorageManager.d.ts +289 -0
- package/dist/session/managers/StorageManager.d.ts.map +1 -0
- package/dist/session/managers/TimeUtils.d.ts +175 -0
- package/dist/session/managers/TimeUtils.d.ts.map +1 -0
- package/dist/session/managers/TranscriptionManager.d.ts +195 -0
- package/dist/session/managers/TranscriptionManager.d.ts.map +1 -0
- package/dist/session/managers/TranslationManager.d.ts +189 -0
- package/dist/session/managers/TranslationManager.d.ts.map +1 -0
- package/dist/session.d.ts +41 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +4110 -0
- package/dist/session.js.map +44 -0
- package/dist/transport/Transport.d.ts +119 -0
- package/dist/transport/Transport.d.ts.map +1 -0
- package/dist/transport/WebSocketTransport.d.ts +73 -0
- package/dist/transport/WebSocketTransport.d.ts.map +1 -0
- package/dist/types/index.d.ts +31 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/message-types.d.ts +25 -9
- package/dist/types/message-types.d.ts.map +1 -1
- package/dist/types/messages/app-to-cloud.d.ts +113 -16
- package/dist/types/messages/app-to-cloud.d.ts.map +1 -1
- package/dist/types/messages/cloud-to-app.d.ts +50 -4
- package/dist/types/messages/cloud-to-app.d.ts.map +1 -1
- package/dist/types/messages/cloud-to-glasses.d.ts +43 -14
- package/dist/types/messages/cloud-to-glasses.d.ts.map +1 -1
- package/dist/types/messages/glasses-to-cloud.d.ts +5 -5
- package/dist/types/messages/glasses-to-cloud.d.ts.map +1 -1
- package/dist/types/models.d.ts +17 -0
- package/dist/types/models.d.ts.map +1 -1
- package/dist/types/rtmp-stream.d.ts +4 -4
- package/dist/types/rtmp-stream.d.ts.map +1 -1
- package/dist/types/streams.d.ts +6 -1
- package/dist/types/streams.d.ts.map +1 -1
- package/dist/types/webhooks.d.ts +11 -0
- package/dist/types/webhooks.d.ts.map +1 -1
- package/dist/utils/error-utils.d.ts +139 -0
- package/dist/utils/error-utils.d.ts.map +1 -0
- package/dist/utils/permissions-utils.d.ts +30 -7
- package/dist/utils/permissions-utils.d.ts.map +1 -1
- package/node_modules/@mentra/types/dist/applet.d.ts +5 -1
- package/node_modules/@mentra/types/dist/applet.d.ts.map +1 -1
- package/node_modules/@mentra/types/dist/capabilities/even-realities-g2.d.ts +12 -0
- package/node_modules/@mentra/types/dist/capabilities/even-realities-g2.d.ts.map +1 -0
- package/node_modules/@mentra/types/dist/capabilities/even-realities-g2.js +61 -0
- package/node_modules/@mentra/types/dist/capabilities/mentra-display.d.ts +12 -0
- package/node_modules/@mentra/types/dist/capabilities/mentra-display.d.ts.map +1 -0
- package/node_modules/@mentra/types/dist/capabilities/mentra-display.js +54 -0
- package/node_modules/@mentra/types/dist/capabilities/none.d.ts +13 -0
- package/node_modules/@mentra/types/dist/capabilities/none.d.ts.map +1 -0
- package/node_modules/@mentra/types/dist/capabilities/none.js +67 -0
- package/node_modules/@mentra/types/dist/enums.d.ts +8 -2
- package/node_modules/@mentra/types/dist/enums.d.ts.map +1 -1
- package/node_modules/@mentra/types/dist/enums.js +9 -2
- package/node_modules/@mentra/types/dist/hardware.d.ts +3 -1
- package/node_modules/@mentra/types/dist/hardware.d.ts.map +1 -1
- package/node_modules/@mentra/types/dist/hardware.js +12 -2
- package/node_modules/@mentra/types/dist/index.d.ts +1 -1
- package/node_modules/@mentra/types/dist/index.d.ts.map +1 -1
- package/node_modules/@mentra/types/dist/index.js +2 -1
- package/node_modules/@mentra/types/package.json +2 -2
- package/package.json +24 -12
- package/dist/examples/managed-rtmp-streaming-example.d.ts +0 -2
- package/dist/examples/managed-rtmp-streaming-example.d.ts.map +0 -1
- package/dist/examples/managed-rtmp-streaming-with-restream-example.d.ts +0 -11
- package/dist/examples/managed-rtmp-streaming-with-restream-example.d.ts.map +0 -1
- package/dist/examples/rtmp-streaming-example.d.ts +0 -2
- package/dist/examples/rtmp-streaming-example.d.ts.map +0 -1
- package/node_modules/@mentra/types/src/applet.ts +0 -51
- package/node_modules/@mentra/types/src/capabilities/even-realities-g1.ts +0 -63
- package/node_modules/@mentra/types/src/capabilities/mentra-live.ts +0 -103
- package/node_modules/@mentra/types/src/capabilities/simulated-glasses.ts +0 -76
- package/node_modules/@mentra/types/src/capabilities/vuzix-z100.ts +0 -60
- package/node_modules/@mentra/types/src/cli.ts +0 -169
- package/node_modules/@mentra/types/src/device.ts +0 -43
- package/node_modules/@mentra/types/src/enums.ts +0 -36
- package/node_modules/@mentra/types/src/hardware.ts +0 -172
- package/node_modules/@mentra/types/src/index.ts +0 -64
- package/node_modules/@mentra/types/tsconfig.json +0 -22
- package/node_modules/@mentra/types/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeviceManager.d.ts","sourceRoot":"","sources":["../../../src/session/managers/DeviceManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI/D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,i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Acf;;;;;;;;;;OAUG;IACH,OAAO,CAAC,gBAAgB;CAsCzB"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🖥️ DisplayManager — AR Display Control
|
|
3
|
+
*
|
|
4
|
+
* v3 manager that wraps the existing LayoutManager display functionality.
|
|
5
|
+
* Sends DisplayRequest messages to the cloud with identical wire format
|
|
6
|
+
* to ensure backward compatibility.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const display = new DisplayManager(deps);
|
|
11
|
+
*
|
|
12
|
+
* // Simple text
|
|
13
|
+
* display.showText("Hello AR World!");
|
|
14
|
+
*
|
|
15
|
+
* // Pre-wrapped lines
|
|
16
|
+
* display.showText(["Line 1", "Line 2"]);
|
|
17
|
+
*
|
|
18
|
+
* // Structured layouts
|
|
19
|
+
* display.showReferenceCard("Weather", "Sunny and 75°F");
|
|
20
|
+
* display.showDashboardCard("BPM", "72");
|
|
21
|
+
*
|
|
22
|
+
* // Clear the display
|
|
23
|
+
* display.clear();
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Shared dependency bag injected by MentraSession.
|
|
28
|
+
* Keeps managers decoupled from the session implementation.
|
|
29
|
+
*/
|
|
30
|
+
export interface ManagerDeps {
|
|
31
|
+
/** DataStreamRouter — register for DATA_STREAM messages by streamType key. */
|
|
32
|
+
router: {
|
|
33
|
+
on(key: string, handler: (streamType: string, data: any, message: any) => void): () => void;
|
|
34
|
+
};
|
|
35
|
+
/** MessageHandlerRegistry — register for top-level message types. */
|
|
36
|
+
messageHandlers: {
|
|
37
|
+
register(type: string, handler: (msg: any) => void): () => void;
|
|
38
|
+
};
|
|
39
|
+
addSubscription: (stream: string) => void;
|
|
40
|
+
removeSubscription: (stream: string) => void;
|
|
41
|
+
sendMessage: (message: any) => void;
|
|
42
|
+
sendBinary: (data: ArrayBuffer | Uint8Array) => void;
|
|
43
|
+
logger: {
|
|
44
|
+
debug(...args: any[]): void;
|
|
45
|
+
info(...args: any[]): void;
|
|
46
|
+
warn(...args: any[]): void;
|
|
47
|
+
error(...args: any[]): void;
|
|
48
|
+
};
|
|
49
|
+
getPackageName: () => string;
|
|
50
|
+
getSessionId: () => string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Controls the AR display on the user's glasses.
|
|
54
|
+
*
|
|
55
|
+
* Provides high-level methods for showing text, cards, bitmaps, and
|
|
56
|
+
* clearing the display. All methods produce a `DisplayRequest` message
|
|
57
|
+
* with `type: "display_event"` — the exact same wire format the cloud
|
|
58
|
+
* and glasses firmware already understand from v2.
|
|
59
|
+
*/
|
|
60
|
+
export declare class DisplayManager {
|
|
61
|
+
private readonly deps;
|
|
62
|
+
constructor(deps: ManagerDeps);
|
|
63
|
+
/**
|
|
64
|
+
* Show text on the AR display.
|
|
65
|
+
*
|
|
66
|
+
* Accepts a single string or an array of pre-wrapped lines.
|
|
67
|
+
* When an array is provided the lines are joined with newlines
|
|
68
|
+
* and sent as a single TextWall layout.
|
|
69
|
+
*
|
|
70
|
+
* @param text - A string or array of strings to display
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* display.showText("Connected to server");
|
|
75
|
+
* display.showText(["Line 1", "Line 2", "Line 3"]);
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
showText(text: string | string[]): void;
|
|
79
|
+
/**
|
|
80
|
+
* 📝 Show a single block of text on the main display.
|
|
81
|
+
*
|
|
82
|
+
* Best for simple messages, status updates, and notifications.
|
|
83
|
+
*
|
|
84
|
+
* @param text - Text content to display
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* display.showTextWall("Listening…");
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
showTextWall(text: string): void;
|
|
92
|
+
/**
|
|
93
|
+
* ↕️ Show two sections of text, one above the other.
|
|
94
|
+
*
|
|
95
|
+
* Best for before/after content, question/answer, translations,
|
|
96
|
+
* or any two-part message.
|
|
97
|
+
*
|
|
98
|
+
* @param leftText - Text for the top section
|
|
99
|
+
* @param rightText - Text for the bottom section
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* display.showDoubleTextWall("Original: Hello", "Translated: Bonjour");
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
showDoubleTextWall(leftText: string, rightText: string): void;
|
|
107
|
+
/**
|
|
108
|
+
* 📇 Show a card with a title and body text.
|
|
109
|
+
*
|
|
110
|
+
* Best for titled content, important information, and notifications
|
|
111
|
+
* with context.
|
|
112
|
+
*
|
|
113
|
+
* @param title - Card title
|
|
114
|
+
* @param body - Main content text
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* display.showReferenceCard("Meeting Reminder", "Team standup in 5 minutes");
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
showReferenceCard(title: string, body: string): void;
|
|
122
|
+
/**
|
|
123
|
+
* 📊 Show a dashboard card with left and right text.
|
|
124
|
+
*
|
|
125
|
+
* Best for key-value pairs, metrics, and dashboard-style displays.
|
|
126
|
+
* Automatically uses the DASHBOARD view type.
|
|
127
|
+
*
|
|
128
|
+
* @param leftText - Left side text (typically label/key)
|
|
129
|
+
* @param rightText - Right side text (typically value)
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* display.showDashboardCard("Weather", "72°F");
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
showDashboardCard(leftText: string, rightText: string): void;
|
|
137
|
+
/**
|
|
138
|
+
* 🖼️ Show a bitmap image on the display.
|
|
139
|
+
*
|
|
140
|
+
* @param data - Hex or base64 encoded bitmap data string
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* display.showBitmap(base64EncodedBitmapString);
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
showBitmap(data: any): void;
|
|
148
|
+
/**
|
|
149
|
+
* 🧹 Clear the AR display.
|
|
150
|
+
*
|
|
151
|
+
* Removes any currently shown content from the main view.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```ts
|
|
155
|
+
* display.clear();
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
clear(): void;
|
|
159
|
+
/**
|
|
160
|
+
* Build and send a DisplayRequest message.
|
|
161
|
+
*
|
|
162
|
+
* Wire format is identical to v2 LayoutManager — the cloud receives
|
|
163
|
+
* the same `{ type: "display_event", packageName, view, layout, … }`.
|
|
164
|
+
*
|
|
165
|
+
* @param layout - The layout configuration to display
|
|
166
|
+
* @param view - View type (main or dashboard), defaults to MAIN
|
|
167
|
+
* @param durationMs - Optional display duration in milliseconds
|
|
168
|
+
*/
|
|
169
|
+
private sendDisplayEvent;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=DisplayManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DisplayManager.d.ts","sourceRoot":"","sources":["../../../src/session/managers/DisplayManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAiBH;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,8EAA8E;IAC9E,MAAM,EAAE;QACN,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;KAC7F,CAAC;IACF,qEAAqE;IACrE,eAAe,EAAE;QACf,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;KACjE,CAAC;IACF,eAAe,EAAE,CAAC,M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,EAAE,GAAG,GAAG,IAAI;IAkB3B;;;;;;;;;OASG;IACH,KAAK,IAAI,IAAI;IASb;;;;;;;;;OASG;IACH,OAAO,CAAC,gBAAgB;CAgCzB"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LedManager — v3 SDK LED Control API
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper around the existing LedModule patterns. Provides a simplified
|
|
5
|
+
* API for controlling RGB LEDs on connected smart glasses.
|
|
6
|
+
*
|
|
7
|
+
* Wire format is identical to v2:
|
|
8
|
+
* ```json
|
|
9
|
+
* {
|
|
10
|
+
* "type": "rgb_led_control",
|
|
11
|
+
* "packageName": "<packageName>",
|
|
12
|
+
* "sessionId": "<sessionId>",
|
|
13
|
+
* "requestId": "<requestId>",
|
|
14
|
+
* "action": "on" | "off",
|
|
15
|
+
* "color": "<LedColor>",
|
|
16
|
+
* "ontime": <ms>
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Dependencies injected by MentraSession.
|
|
24
|
+
*
|
|
25
|
+
* Structural type — no concrete imports so the manager stays unit-testable
|
|
26
|
+
* with plain stubs.
|
|
27
|
+
*/
|
|
28
|
+
export interface LedManagerDeps {
|
|
29
|
+
/** DataStreamRouter — register for DATA_STREAM messages by streamType key. */
|
|
30
|
+
router: {
|
|
31
|
+
on(key: string, handler: (streamType: string, data: any, message: any) => void): () => void;
|
|
32
|
+
};
|
|
33
|
+
/** MessageHandlerRegistry — register for top-level message types. */
|
|
34
|
+
messageHandlers: {
|
|
35
|
+
register(type: string, handler: (msg: any) => void): () => void;
|
|
36
|
+
};
|
|
37
|
+
/** Add a subscription string (triggers SUBSCRIPTION_UPDATE to cloud). */
|
|
38
|
+
addSubscription: (stream: string) => void;
|
|
39
|
+
/** Remove a subscription string. */
|
|
40
|
+
removeSubscription: (stream: string) => void;
|
|
41
|
+
/** Send an arbitrary JSON message over the WebSocket. */
|
|
42
|
+
sendMessage: (message: any) => void;
|
|
43
|
+
/** Structured logger. */
|
|
44
|
+
logger: {
|
|
45
|
+
debug(...args: any[]): void;
|
|
46
|
+
info(...args: any[]): void;
|
|
47
|
+
warn(...args: any[]): void;
|
|
48
|
+
error(...args: any[]): void;
|
|
49
|
+
};
|
|
50
|
+
/** Package name for outgoing messages. */
|
|
51
|
+
getPackageName: () => string;
|
|
52
|
+
/** Current session ID. */
|
|
53
|
+
getSessionId: () => string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Controls RGB LEDs on connected smart glasses.
|
|
57
|
+
*
|
|
58
|
+
* LED commands are fire-and-forget — the methods return immediately after
|
|
59
|
+
* sending the control message to the cloud. No response is awaited.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const session = await mentra.connect();
|
|
64
|
+
*
|
|
65
|
+
* // Solid green LED for 2 seconds
|
|
66
|
+
* session.led.setColor("green", 2000);
|
|
67
|
+
*
|
|
68
|
+
* // Turn LED off
|
|
69
|
+
* session.led.off();
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare class LedManager {
|
|
73
|
+
private readonly deps;
|
|
74
|
+
constructor(deps: LedManagerDeps);
|
|
75
|
+
/**
|
|
76
|
+
* Set the LED to a specific colour.
|
|
77
|
+
*
|
|
78
|
+
* Sends an `rgb_led_control` message with `action: "on"` to the cloud.
|
|
79
|
+
* The LED will remain on for `onTimeMs` milliseconds (defaults to 1000ms)
|
|
80
|
+
* then turn off automatically on the device.
|
|
81
|
+
*
|
|
82
|
+
* @param color - LED colour name. One of `"red"`, `"green"`, `"blue"`, `"orange"`, `"white"`.
|
|
83
|
+
* @param onTimeMs - Duration in milliseconds the LED stays on. Defaults to `1000`.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* // Red LED for 500ms
|
|
88
|
+
* session.led.setColor("red", 500);
|
|
89
|
+
*
|
|
90
|
+
* // White LED for the default 1s
|
|
91
|
+
* session.led.setColor("white");
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
setColor(color: string, onTimeMs?: number): void;
|
|
95
|
+
/**
|
|
96
|
+
* Turn the LED off.
|
|
97
|
+
*
|
|
98
|
+
* Sends an `rgb_led_control` message with `action: "off"` to the cloud.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* session.led.off();
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
off(): void;
|
|
106
|
+
/**
|
|
107
|
+
* Clean up resources.
|
|
108
|
+
*
|
|
109
|
+
* Called by MentraSession during disconnect/cleanup. LED commands are
|
|
110
|
+
* fire-and-forget so there is no pending state to drain.
|
|
111
|
+
*
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
destroy(): void;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=LedManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LedManager.d.ts","sourceRoot":"","sources":["../../../src/session/managers/LedManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAOH;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,MAAM,EAAE;QACN,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;KAC7F,CAAC;IACF,qEAAqE;IACrE,eAAe,EAAE;QACf,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;KACjE,CAAC;IACF,yEAAyE;IACzE,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,oCAAoC;IACpC,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,yDAAyD;IACzD,WAAW,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACpC,yBAAyB;IACzB,MAAM,EAAE;QACN,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAC5B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAC3B,KAAK,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;KAC7B,CAAC;IACF,0CAA0C;IAC1C,cAAc,EAAE,MAAM,MAAM,CAAC;IAC7B,0BAA0B;IAC1B,YAAY,EAAE,MAAM,MAAM,CAAC;CAC5B;AAiBD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAiB;gBAE1B,IAAI,EAAE,cAAc;IAMhC;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI;IAqBhD;;;;;;;;;OASG;IACH,GAAG,IAAI,IAAI;IAmBX;;;;;;;OAOG;IACH,OAAO,IAAI,IAAI;CAGhB"}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LocationManager — v3 SDK Location API
|
|
3
|
+
*
|
|
4
|
+
* Wraps the existing LocationManager patterns from v2 with a cleaner,
|
|
5
|
+
* composable API. Subscribes to location data streams, caches the latest
|
|
6
|
+
* known position, and supports one-shot location polls.
|
|
7
|
+
*
|
|
8
|
+
* Wire format is identical to v2:
|
|
9
|
+
* - Location stream subscription: `"location_stream"` added to subscriptions
|
|
10
|
+
* - Location poll: `{ type: "location_poll_request", packageName, sessionId, accuracy, correlationId }`
|
|
11
|
+
* - Location updates arrive as DATA_STREAM messages with streamType `"location_update"` or `"location_stream"`
|
|
12
|
+
*
|
|
13
|
+
* The LocationUpdate payload shape (from glasses-to-cloud):
|
|
14
|
+
* ```json
|
|
15
|
+
* {
|
|
16
|
+
* "type": "location_update",
|
|
17
|
+
* "lat": number,
|
|
18
|
+
* "lng": number,
|
|
19
|
+
* "accuracy": number,
|
|
20
|
+
* "correlationId": string | undefined
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @module
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Normalised location data delivered to subscriber callbacks.
|
|
28
|
+
*/
|
|
29
|
+
export interface LocationData {
|
|
30
|
+
/** Latitude in decimal degrees. */
|
|
31
|
+
lat: number;
|
|
32
|
+
/** Longitude in decimal degrees. */
|
|
33
|
+
lng: number;
|
|
34
|
+
/** Horizontal accuracy in metres (`undefined` if not available). */
|
|
35
|
+
accuracy?: number;
|
|
36
|
+
/** Unix timestamp (ms) when the location was recorded. */
|
|
37
|
+
timestamp: number;
|
|
38
|
+
/** Correlation ID returned from a one-shot poll (if applicable). */
|
|
39
|
+
correlationId?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Accuracy tier for location stream subscriptions.
|
|
43
|
+
* Maps directly to the v2 `LocationStreamRequest.rate` values.
|
|
44
|
+
*/
|
|
45
|
+
export type LocationAccuracy = "standard" | "high" | "realtime" | "tenMeters" | "hundredMeters" | "kilometer" | "threeKilometers" | "reduced";
|
|
46
|
+
/** Callback signature for location subscribers. */
|
|
47
|
+
export type LocationHandler = (location: LocationData) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Dependencies injected by MentraSession.
|
|
50
|
+
*
|
|
51
|
+
* Structural type — no concrete imports so the manager stays unit-testable
|
|
52
|
+
* with plain stubs.
|
|
53
|
+
*/
|
|
54
|
+
export interface LocationManagerDeps {
|
|
55
|
+
/** DataStreamRouter — register for DATA_STREAM messages by streamType key. */
|
|
56
|
+
router: {
|
|
57
|
+
on(key: string, handler: (streamType: string, data: any, message: any) => void): () => void;
|
|
58
|
+
};
|
|
59
|
+
/** MessageHandlerRegistry — register for top-level message types. */
|
|
60
|
+
messageHandlers: {
|
|
61
|
+
register(type: string, handler: (msg: any) => void): () => void;
|
|
62
|
+
};
|
|
63
|
+
/** Add a subscription string (triggers SUBSCRIPTION_UPDATE to cloud). */
|
|
64
|
+
addSubscription: (stream: string) => void;
|
|
65
|
+
/** Remove a subscription string. */
|
|
66
|
+
removeSubscription: (stream: string) => void;
|
|
67
|
+
/** Send an arbitrary JSON message over the WebSocket. */
|
|
68
|
+
sendMessage: (message: any) => void;
|
|
69
|
+
/** Structured logger. */
|
|
70
|
+
logger: {
|
|
71
|
+
debug(...args: any[]): void;
|
|
72
|
+
info(...args: any[]): void;
|
|
73
|
+
warn(...args: any[]): void;
|
|
74
|
+
error(...args: any[]): void;
|
|
75
|
+
};
|
|
76
|
+
/** Package name for outgoing messages. */
|
|
77
|
+
getPackageName: () => string;
|
|
78
|
+
/** Current session ID. */
|
|
79
|
+
getSessionId: () => string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Manages location subscriptions, caches the latest known position, and
|
|
83
|
+
* supports one-shot location polls.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const session = await mentra.connect();
|
|
88
|
+
*
|
|
89
|
+
* // Subscribe to continuous location updates
|
|
90
|
+
* const stop = session.location.onUpdate((loc) => {
|
|
91
|
+
* console.log(`${loc.lat}, ${loc.lng} (±${loc.accuracy}m)`);
|
|
92
|
+
* });
|
|
93
|
+
*
|
|
94
|
+
* // Read cached values at any time
|
|
95
|
+
* console.log("Last known:", session.location.lat, session.location.lng);
|
|
96
|
+
*
|
|
97
|
+
* // Request a single location update
|
|
98
|
+
* session.location.requestUpdate();
|
|
99
|
+
*
|
|
100
|
+
* // Stop all subscriptions
|
|
101
|
+
* session.location.stop();
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare class LocationManager {
|
|
105
|
+
private readonly deps;
|
|
106
|
+
/**
|
|
107
|
+
* All currently-active registrations. Tracked so that {@link stop}
|
|
108
|
+
* can clean everything up in one shot.
|
|
109
|
+
*/
|
|
110
|
+
private registrations;
|
|
111
|
+
/**
|
|
112
|
+
* Reference count for the location_stream subscription.
|
|
113
|
+
* We only call `removeSubscription` when ref-count drops to zero.
|
|
114
|
+
*/
|
|
115
|
+
private streamRefCount;
|
|
116
|
+
/** Latest latitude, or `null` if no update has been received. */
|
|
117
|
+
private _lat;
|
|
118
|
+
/** Latest longitude, or `null` if no update has been received. */
|
|
119
|
+
private _lng;
|
|
120
|
+
/** Latest horizontal accuracy in metres, or `null` if unknown. */
|
|
121
|
+
private _accuracy;
|
|
122
|
+
/** Timestamp of the latest location update, or `null` if none received. */
|
|
123
|
+
private _timestamp;
|
|
124
|
+
/**
|
|
125
|
+
* Whether the device has location permission.
|
|
126
|
+
* Optimistically `true`, updated to `false` on permission errors.
|
|
127
|
+
*/
|
|
128
|
+
private _hasPermission;
|
|
129
|
+
/** Cleanup for the internal location_update message handler. */
|
|
130
|
+
private locationUpdateCleanup;
|
|
131
|
+
constructor(deps: LocationManagerDeps);
|
|
132
|
+
/**
|
|
133
|
+
* Subscribe to continuous location updates.
|
|
134
|
+
*
|
|
135
|
+
* Registers on the DataStreamRouter for `"location_stream"` events and
|
|
136
|
+
* adds the `"location_stream"` subscription to the cloud. Multiple
|
|
137
|
+
* independent subscriptions are supported — each returns its own
|
|
138
|
+
* cleanup function.
|
|
139
|
+
*
|
|
140
|
+
* @param handler - Called each time a location update arrives.
|
|
141
|
+
* @param accuracy - Desired accuracy tier. Defaults to `"standard"`.
|
|
142
|
+
* @returns A cleanup function that removes this specific subscription.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* const stop = session.location.onUpdate((loc) => {
|
|
147
|
+
* console.log(`${loc.lat}, ${loc.lng}`);
|
|
148
|
+
* });
|
|
149
|
+
*
|
|
150
|
+
* // Later:
|
|
151
|
+
* stop();
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
onUpdate(handler: LocationHandler, accuracy?: LocationAccuracy): () => void;
|
|
155
|
+
/**
|
|
156
|
+
* Request a single location update (one-shot poll).
|
|
157
|
+
*
|
|
158
|
+
* Sends a `location_poll_request` message to the cloud. The response
|
|
159
|
+
* will arrive as a `location_update` DATA_STREAM event and will be
|
|
160
|
+
* delivered to any active `onUpdate()` listeners as well as updating
|
|
161
|
+
* the cached position.
|
|
162
|
+
*
|
|
163
|
+
* @param accuracy - Desired accuracy tier for the poll. Defaults to `"standard"`.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* session.location.requestUpdate();
|
|
168
|
+
* // The next onUpdate() callback will fire with the fresh position.
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
requestUpdate(accuracy?: LocationAccuracy): void;
|
|
172
|
+
/**
|
|
173
|
+
* Stop all location subscriptions and remove every handler.
|
|
174
|
+
*
|
|
175
|
+
* After calling this, no location callbacks will fire until new
|
|
176
|
+
* subscriptions are created via {@link onUpdate}.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* session.location.stop();
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
stop(): void;
|
|
184
|
+
/**
|
|
185
|
+
* Latest known latitude, or `null` if no location update has been received.
|
|
186
|
+
*/
|
|
187
|
+
get lat(): number | null;
|
|
188
|
+
/**
|
|
189
|
+
* Latest known longitude, or `null` if no location update has been received.
|
|
190
|
+
*/
|
|
191
|
+
get lng(): number | null;
|
|
192
|
+
/**
|
|
193
|
+
* Latest horizontal accuracy in metres, or `null` if unknown.
|
|
194
|
+
*/
|
|
195
|
+
get accuracy(): number | null;
|
|
196
|
+
/**
|
|
197
|
+
* Unix timestamp (ms) of the latest location update, or `null` if none received.
|
|
198
|
+
*/
|
|
199
|
+
get timestamp(): number | null;
|
|
200
|
+
/**
|
|
201
|
+
* Whether the device has granted location permission.
|
|
202
|
+
*
|
|
203
|
+
* Optimistically `true` — updated to `false` if a permission error
|
|
204
|
+
* is received from the cloud.
|
|
205
|
+
*/
|
|
206
|
+
get hasPermission(): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Update cached location values from raw incoming data.
|
|
209
|
+
*/
|
|
210
|
+
private cacheLocation;
|
|
211
|
+
/**
|
|
212
|
+
* Called by MentraSession if a permission error for location is received.
|
|
213
|
+
* @internal
|
|
214
|
+
*/
|
|
215
|
+
setPermission(granted: boolean): void;
|
|
216
|
+
/**
|
|
217
|
+
* Clean up all resources.
|
|
218
|
+
*
|
|
219
|
+
* Called by MentraSession during disconnect/cleanup.
|
|
220
|
+
* @internal
|
|
221
|
+
*/
|
|
222
|
+
destroy(): void;
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=LocationManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocationManager.d.ts","sourceRoot":"","sources":["../../../src/session/managers/LocationManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAMH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,MAAM,GACN,UAAU,GACV,WAAW,GACX,eAAe,GACf,WAAW,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