@mentra/bluetooth-sdk 3.4.0-beta.1277 → 3.4.0-beta.1281
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/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +5 -2
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedReleaseMetadata.kt +5 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/MentraLocalNetworkModule.kt +57 -196
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/Ipv4Prefix.kt +51 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/NetworkFacts.kt +81 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkError.kt +109 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkReadiness.kt +103 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkRequestSpec.kt +53 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkState.kt +127 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/ScopedSoftApNetwork.kt +604 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/hotspot/SoftApTrace.kt +143 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/otaserver/MentraOtaServerModule.kt +0 -7
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.kt +14 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/streaming/StreamModels.kt +17 -6
- package/android/src/test/java/com/mentra/bluetoothsdk/StreamRequestCaptureAudioTest.kt +23 -4
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/Ipv4PrefixTest.kt +59 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/NetworkFactsTest.kt +59 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/ScopedLocalNetworkPermissionTest.kt +35 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkErrorTest.kt +96 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkLifecycleTest.kt +187 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkReadinessTest.kt +141 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/ScopedNetworkRequestSpecTest.kt +69 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/SoftApTraceTest.kt +97 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/hotspot/UnavailableRetryTest.kt +47 -0
- package/build/BluetoothSdk.types.d.ts +2 -3
- package/build/BluetoothSdk.types.d.ts.map +1 -1
- package/build/BluetoothSdk.types.js.map +1 -1
- package/build/_private/MentraLocalNetworkModule.d.ts +1 -1
- package/build/_private/MentraLocalNetworkModule.d.ts.map +1 -1
- package/build/_private/MentraLocalNetworkModule.js.map +1 -1
- package/build/generated/releaseMetadata.js +5 -5
- package/build/generated/releaseMetadata.js.map +1 -1
- package/build/ota-server/MentraOtaServerModule.d.ts +0 -2
- package/build/ota-server/MentraOtaServerModule.d.ts.map +1 -1
- package/build/ota-server/MentraOtaServerModule.js.map +1 -1
- package/build/ota-server/MentraOtaServerModule.web.d.ts +0 -1
- package/build/ota-server/MentraOtaServerModule.web.d.ts.map +1 -1
- package/build/ota-server/MentraOtaServerModule.web.js +0 -3
- package/build/ota-server/MentraOtaServerModule.web.js.map +1 -1
- package/build/ota-transport/index.d.ts +3 -3
- package/build/ota-transport/index.d.ts.map +1 -1
- package/build/ota-transport/index.js +4 -4
- package/build/ota-transport/index.js.map +1 -1
- package/ios/LocalIPv4.swift +0 -61
- package/ios/MentraOtaServerModule.swift +0 -16
- package/ios/Source/BluetoothSdkDefaults.swift +1 -1
- package/ios/Source/GeneratedReleaseMetadata.swift +5 -5
- package/ios/Source/streaming/StreamModels.swift +15 -6
- package/ios/Tests/StreamRequestTests.swift +18 -0
- package/package.json +2 -2
- package/src/BluetoothSdk.types.ts +2 -3
- package/src/_private/MentraLocalNetworkModule.ts +5 -1
- package/src/generated/releaseMetadata.ts +5 -5
- package/src/ota-server/MentraOtaServerModule.ts +0 -2
- package/src/ota-server/MentraOtaServerModule.web.ts +0 -4
- package/src/ota-transport/index.ts +4 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/ScopedNetworkReadiness.kt +0 -17
- package/android/src/test/java/com/mentra/bluetoothsdk/ScopedNetworkReadinessTest.kt +0 -39
|
@@ -46,7 +46,7 @@ type LocalNetworkEvents = {
|
|
|
46
46
|
};
|
|
47
47
|
declare class MentraLocalNetworkNativeModule extends NativeModule<LocalNetworkEvents> {
|
|
48
48
|
getNetworkDiagnostics(): NetworkDiagnostics;
|
|
49
|
-
connect(ssid: string, password: string): Promise<{
|
|
49
|
+
connect(ssid: string, password: string, incoming: boolean): Promise<{
|
|
50
50
|
connected: boolean;
|
|
51
51
|
ssid: string;
|
|
52
52
|
localAddress?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentraLocalNetworkModule.d.ts","sourceRoot":"","sources":["../../src/_private/MentraLocalNetworkModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAA8B,MAAM,MAAM,CAAA;AAE9D,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,OAAO,CAAA;IACb,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;IACjB,GAAG,EAAE,OAAO,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,OAAO,CAAA;IAEhB,YAAY,EAAE,6BAA6B,GAAG,IAAI,CAAA;CACnD,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,kBAAkB,CAAA;IAEhC,aAAa,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KAAK,IAAI,CAAA;IAC/D,WAAW,EAAE,CAAC,KAAK,EAAE;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,KAAK,IAAI,CAAA;CAC7C,CAAA;AAED,OAAO,OAAO,8BAA+B,SAAQ,YAAY,CAAC,kBAAkB,CAAC;IACnF,qBAAqB,IAAI,kBAAkB;IAC3C,OAAO,CACL,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC;QAAC,SAAS,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IACrE,OAAO,CACL,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,IAAI,EAAE,MAAM,GAAG,IAAI,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,oBAAoB,CAAC;IAChC,QAAQ,CACN,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,mBAAmB,EAAE,MAAM,EAC3B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,0BAA0B,CAAC;IACtC,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IACxC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAC5B;;AAED,wBAAgG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentraLocalNetworkModule.js","sourceRoot":"","sources":["../../src/_private/MentraLocalNetworkModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,2BAA2B,EAAC,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"MentraLocalNetworkModule.js","sourceRoot":"","sources":["../../src/_private/MentraLocalNetworkModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,2BAA2B,EAAC,MAAM,MAAM,CAAA;AAiF9D,eAAe,2BAA2B,CAAiC,oBAAoB,CAAC,CAAA","sourcesContent":["import {NativeModule, requireOptionalNativeModule} from \"expo\"\n\nexport type NetworkCapabilitiesDiagnostic = {\n wifi: boolean\n cellular: boolean\n ethernet: boolean\n vpn: boolean\n internet: boolean\n validated: boolean\n captivePortal: boolean\n}\n\nexport type NetworkObservation = {\n present: boolean\n // A present network with null capabilities has disappeared or cannot be inspected.\n capabilities: NetworkCapabilitiesDiagnostic | null\n}\n\nexport type NetworkDiagnostics = {\n sampledAtMs: number\n processBound: NetworkObservation\n // ConnectivityManager.activeNetwork is the caller's active default, not a privileged global read.\n activeNetwork: NetworkObservation\n glassesLocal: NetworkObservation\n processBoundMatchesActive: boolean\n processBoundMatchesGlassesLocal: boolean\n activeNetworkMatchesGlassesLocal: boolean\n}\n\nexport type LocalNetworkResponse = {\n status: number\n headers: Record<string, string>\n bodyBase64: string\n}\n\nexport type LocalNetworkDownloadResult = {\n statusCode: number\n bytesWritten: number\n headers: Record<string, string>\n}\n\nexport type LocalNetworkDownloadProgress = {\n requestId: string\n bytesWritten: number\n contentLength: number\n statusCode?: number\n headers?: Record<string, string>\n}\n\ntype LocalNetworkEvents = {\n downloadProgress: (event: LocalNetworkDownloadProgress) => void\n networkLost: (event: {ssid: string}) => void\n}\n\ndeclare class MentraLocalNetworkNativeModule extends NativeModule<LocalNetworkEvents> {\n getNetworkDiagnostics(): NetworkDiagnostics\n connect(\n ssid: string,\n password: string,\n incoming: boolean,\n ): Promise<{connected: boolean; ssid: string; localAddress?: string}>\n request(\n requestId: string,\n url: string,\n method: string,\n headers: Record<string, string>,\n body: string | null,\n timeoutMs: number,\n ): Promise<LocalNetworkResponse>\n download(\n requestId: string,\n url: string,\n destination: string,\n headers: Record<string, string>,\n connectionTimeoutMs: number,\n readTimeoutMs: number,\n ): Promise<LocalNetworkDownloadResult>\n cancel(requestId: string): Promise<void>\n disconnect(): Promise<void>\n}\n\nexport default requireOptionalNativeModule<MentraLocalNetworkNativeModule>(\"MentraLocalNetwork\")\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export const BLUETOOTH_SDK_RELEASE_METADATA = Object.freeze({
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"familyBaseVersion": "3.4.0",
|
|
4
|
-
"releaseIdentity": "3.4.0-beta.
|
|
5
|
-
"releaseSetId": "mentra-3.4.0-beta.
|
|
6
|
-
"sourceCommit": "
|
|
7
|
-
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.
|
|
8
|
-
"otaManifestSha256": "
|
|
4
|
+
"releaseIdentity": "3.4.0-beta.1281",
|
|
5
|
+
"releaseSetId": "mentra-3.4.0-beta.1281",
|
|
6
|
+
"sourceCommit": "50035c25e79a62a30a59a22d933c322c9721ef6c",
|
|
7
|
+
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1281.json",
|
|
8
|
+
"otaManifestSha256": "ea381194b394c7ab9ee648323e3a6447a6afbd555002cbb50306bca42fb608d0"
|
|
9
9
|
});
|
|
10
10
|
//# sourceMappingURL=releaseMetadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"releaseMetadata.js","sourceRoot":"","sources":["../../src/generated/releaseMetadata.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,8BAA8B,GAA0C,MAAM,CAAC,MAAM,CAAC;IACjG,eAAe,EAAE,CAAC;IAClB,mBAAmB,EAAE,OAAO;IAC5B,iBAAiB,EAAE,iBAAiB;IACpC,cAAc,EAAE,wBAAwB;IACxC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,mIAAmI;IACrJ,mBAAmB,EAAE,kEAAkE;CACxF,CAAC,CAAA","sourcesContent":["/** Generated by release CI. Do not edit in a release checkout. */\nexport interface BluetoothSdkReleaseMetadata {\n schemaVersion: 1\n familyBaseVersion: string | null\n releaseIdentity: string | null\n releaseSetId: string | null\n sourceCommit: string | null\n otaManifestUrl: string | null\n otaManifestSha256: string | null\n}\n\nexport const BLUETOOTH_SDK_RELEASE_METADATA: Readonly<BluetoothSdkReleaseMetadata> = Object.freeze({\n \"schemaVersion\": 1,\n \"familyBaseVersion\": \"3.4.0\",\n \"releaseIdentity\": \"3.4.0-beta.
|
|
1
|
+
{"version":3,"file":"releaseMetadata.js","sourceRoot":"","sources":["../../src/generated/releaseMetadata.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,8BAA8B,GAA0C,MAAM,CAAC,MAAM,CAAC;IACjG,eAAe,EAAE,CAAC;IAClB,mBAAmB,EAAE,OAAO;IAC5B,iBAAiB,EAAE,iBAAiB;IACpC,cAAc,EAAE,wBAAwB;IACxC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,mIAAmI;IACrJ,mBAAmB,EAAE,kEAAkE;CACxF,CAAC,CAAA","sourcesContent":["/** Generated by release CI. Do not edit in a release checkout. */\nexport interface BluetoothSdkReleaseMetadata {\n schemaVersion: 1\n familyBaseVersion: string | null\n releaseIdentity: string | null\n releaseSetId: string | null\n sourceCommit: string | null\n otaManifestUrl: string | null\n otaManifestSha256: string | null\n}\n\nexport const BLUETOOTH_SDK_RELEASE_METADATA: Readonly<BluetoothSdkReleaseMetadata> = Object.freeze({\n \"schemaVersion\": 1,\n \"familyBaseVersion\": \"3.4.0\",\n \"releaseIdentity\": \"3.4.0-beta.1281\",\n \"releaseSetId\": \"mentra-3.4.0-beta.1281\",\n \"sourceCommit\": \"50035c25e79a62a30a59a22d933c322c9721ef6c\",\n \"otaManifestUrl\": \"https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1281.json\",\n \"otaManifestSha256\": \"ea381194b394c7ab9ee648323e3a6447a6afbd555002cbb50306bca42fb608d0\"\n})\n"]}
|
|
@@ -9,8 +9,6 @@ declare class MentraOtaServerModule extends NativeModule<MentraOtaServerModuleEv
|
|
|
9
9
|
*/
|
|
10
10
|
startOtaServer(manifestJson: string, artifactPaths: Record<string, string>, host?: string | null): Promise<OtaServerResult>;
|
|
11
11
|
stopOtaServer(): Promise<void>;
|
|
12
|
-
/** Wait for iPhone Wi-Fi (`en0`) to acquire an address on the glasses gateway subnet. */
|
|
13
|
-
waitForWifiAddress(gateway: string, timeoutMs: number): Promise<string>;
|
|
14
12
|
downloadArtifact(source: string, destination: string): Promise<{
|
|
15
13
|
statusCode: number;
|
|
16
14
|
bytesWritten: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentraOtaServerModule.d.ts","sourceRoot":"","sources":["../../src/ota-server/MentraOtaServerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAsB,MAAM,MAAM,CAAA;AAEtD,OAAO,KAAK,EAAC,2BAA2B,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAA;AAEzF,OAAO,OAAO,qBAAsB,SAAQ,YAAY,CAAC,2BAA2B,CAAC;IACnF;;;;;OAKG;IACH,cAAc,CACZ,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GACnB,OAAO,CAAC,eAAe,CAAC;IAC3B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAC9B,
|
|
1
|
+
{"version":3,"file":"MentraOtaServerModule.d.ts","sourceRoot":"","sources":["../../src/ota-server/MentraOtaServerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAsB,MAAM,MAAM,CAAA;AAEtD,OAAO,KAAK,EAAC,2BAA2B,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAA;AAEzF,OAAO,OAAO,qBAAsB,SAAQ,YAAY,CAAC,2BAA2B,CAAC;IACnF;;;;;OAKG;IACH,cAAc,CACZ,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GACnB,OAAO,CAAC,eAAe,CAAC;IAC3B,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAC9B,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAC,CAAC;CAC3G;;AAED,wBAA4E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentraOtaServerModule.js","sourceRoot":"","sources":["../../src/ota-server/MentraOtaServerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,mBAAmB,EAAC,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"MentraOtaServerModule.js","sourceRoot":"","sources":["../../src/ota-server/MentraOtaServerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,mBAAmB,EAAC,MAAM,MAAM,CAAA;AAoBtD,eAAe,mBAAmB,CAAwB,iBAAiB,CAAC,CAAA","sourcesContent":["import {NativeModule, requireNativeModule} from \"expo\"\n\nimport type {MentraOtaServerModuleEvents, OtaServerResult} from \"./MentraOtaServer.types\"\n\ndeclare class MentraOtaServerModule extends NativeModule<MentraOtaServerModuleEvents> {\n /**\n * Serve `manifestJson` at /version.json and `artifactPaths` (sha256 -> local file path)\n * at /artifacts/<sha256>. Pass `host` when the caller knows the authoritative local\n * address (e.g. from the scoped hotspot network); omit to fall back to interface\n * scanning. Returns the URLs to hand to the glasses via ota_start.\n */\n startOtaServer(\n manifestJson: string,\n artifactPaths: Record<string, string>,\n host?: string | null,\n ): Promise<OtaServerResult>\n stopOtaServer(): Promise<void>\n downloadArtifact(source: string, destination: string): Promise<{statusCode: number; bytesWritten: number}>\n}\n\nexport default requireNativeModule<MentraOtaServerModule>(\"MentraOtaServer\")\n"]}
|
|
@@ -3,7 +3,6 @@ import type { MentraOtaServerModuleEvents, OtaServerResult } from "./MentraOtaSe
|
|
|
3
3
|
declare class MentraOtaServerModule extends NativeModule<MentraOtaServerModuleEvents> {
|
|
4
4
|
startOtaServer(): Promise<OtaServerResult>;
|
|
5
5
|
stopOtaServer(): Promise<void>;
|
|
6
|
-
waitForWifiAddress(): Promise<string>;
|
|
7
6
|
}
|
|
8
7
|
declare const _default: typeof MentraOtaServerModule;
|
|
9
8
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentraOtaServerModule.web.d.ts","sourceRoot":"","sources":["../../src/ota-server/MentraOtaServerModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAoB,MAAM,MAAM,CAAA;AAEpD,OAAO,KAAK,EAAC,2BAA2B,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAA;AAEzF,cAAM,qBAAsB,SAAQ,YAAY,CAAC,2BAA2B,CAAC;IACrE,cAAc,IAAI,OAAO,CAAC,eAAe,CAAC;IAI1C,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"MentraOtaServerModule.web.d.ts","sourceRoot":"","sources":["../../src/ota-server/MentraOtaServerModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAoB,MAAM,MAAM,CAAA;AAEpD,OAAO,KAAK,EAAC,2BAA2B,EAAE,eAAe,EAAC,MAAM,yBAAyB,CAAA;AAEzF,cAAM,qBAAsB,SAAQ,YAAY,CAAC,2BAA2B,CAAC;IACrE,cAAc,IAAI,OAAO,CAAC,eAAe,CAAC;IAI1C,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CACrC;;AAED,wBAA0E"}
|
|
@@ -4,9 +4,6 @@ class MentraOtaServerModule extends NativeModule {
|
|
|
4
4
|
throw new Error("The OTA server is only available in native apps.");
|
|
5
5
|
}
|
|
6
6
|
async stopOtaServer() { }
|
|
7
|
-
async waitForWifiAddress() {
|
|
8
|
-
throw new Error("The OTA server is only available in native apps.");
|
|
9
|
-
}
|
|
10
7
|
}
|
|
11
8
|
export default registerWebModule(MentraOtaServerModule, "MentraOtaServer");
|
|
12
9
|
//# sourceMappingURL=MentraOtaServerModule.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MentraOtaServerModule.web.js","sourceRoot":"","sources":["../../src/ota-server/MentraOtaServerModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAC,MAAM,MAAM,CAAA;AAIpD,MAAM,qBAAsB,SAAQ,YAAyC;IAC3E,KAAK,CAAC,cAAc;QAClB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;IACrE,CAAC;IAED,KAAK,CAAC,aAAa,KAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"MentraOtaServerModule.web.js","sourceRoot":"","sources":["../../src/ota-server/MentraOtaServerModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAC,MAAM,MAAM,CAAA;AAIpD,MAAM,qBAAsB,SAAQ,YAAyC;IAC3E,KAAK,CAAC,cAAc;QAClB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;IACrE,CAAC;IAED,KAAK,CAAC,aAAa,KAAmB,CAAC;CACxC;AAED,eAAe,iBAAiB,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAA","sourcesContent":["import {NativeModule, registerWebModule} from \"expo\"\n\nimport type {MentraOtaServerModuleEvents, OtaServerResult} from \"./MentraOtaServer.types\"\n\nclass MentraOtaServerModule extends NativeModule<MentraOtaServerModuleEvents> {\n async startOtaServer(): Promise<OtaServerResult> {\n throw new Error(\"The OTA server is only available in native apps.\")\n }\n\n async stopOtaServer(): Promise<void> {}\n}\n\nexport default registerWebModule(MentraOtaServerModule, \"MentraOtaServer\")\n"]}
|
|
@@ -43,13 +43,14 @@ export type OtaServerResult = {
|
|
|
43
43
|
* Scoped networking for traffic that must stay on a Mentra Live hotspot while
|
|
44
44
|
* the phone's default route remains on cellular or another Wi-Fi network.
|
|
45
45
|
*
|
|
46
|
-
* The module is optional because iOS
|
|
46
|
+
* The module is optional because iOS joins through glasses-media's hotspot owner instead.
|
|
47
47
|
*/
|
|
48
48
|
export declare const otaLocalNetwork: Readonly<{
|
|
49
49
|
isAvailable: () => boolean;
|
|
50
50
|
/** Synchronous local observation; no network I/O, route changes or network identities. */
|
|
51
51
|
getNetworkDiagnostics: () => NetworkDiagnostics | null;
|
|
52
|
-
connect
|
|
52
|
+
/** `incoming`: the glasses will connect to a server on this phone (OTA), not only the reverse. */
|
|
53
|
+
connect: (ssid: string, password: string, incoming?: boolean) => Promise<OtaLocalNetworkConnection>;
|
|
53
54
|
request: (requestId: string, url: string, method: string, headers: Record<string, string>, body: string | null, timeoutMs: number) => Promise<OtaLocalNetworkResponse>;
|
|
54
55
|
download: (requestId: string, url: string, destination: string, headers: Record<string, string>, connectionTimeoutMs: number, readTimeoutMs: number) => Promise<OtaLocalNetworkDownloadResult>;
|
|
55
56
|
cancel: (requestId: string) => Promise<void>;
|
|
@@ -61,7 +62,6 @@ export declare const otaLocalNetwork: Readonly<{
|
|
|
61
62
|
export declare const otaServer: Readonly<{
|
|
62
63
|
start: (manifestJson: string, artifactPaths: Record<string, string>, host?: string | null) => Promise<OtaServerResult>;
|
|
63
64
|
stop: () => Promise<void>;
|
|
64
|
-
waitForWifiAddress: (gateway: string, timeoutMs: number) => Promise<string>;
|
|
65
65
|
downloadArtifact: (source: string, destination: string) => Promise<{
|
|
66
66
|
statusCode: number;
|
|
67
67
|
bytesWritten: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["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EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAC,CAAC;2CAErE,CAAC,KAAK,EAAE,2BAA2B,KAAK,IAAI,KAAG,wBAAwB;EAE9G,CAAA"}
|
|
@@ -7,16 +7,17 @@ import MentraOtaServer from "../ota-server";
|
|
|
7
7
|
* Scoped networking for traffic that must stay on a Mentra Live hotspot while
|
|
8
8
|
* the phone's default route remains on cellular or another Wi-Fi network.
|
|
9
9
|
*
|
|
10
|
-
* The module is optional because iOS
|
|
10
|
+
* The module is optional because iOS joins through glasses-media's hotspot owner instead.
|
|
11
11
|
*/
|
|
12
12
|
export const otaLocalNetwork = Object.freeze({
|
|
13
13
|
isAvailable: () => MentraLocalNetwork != null,
|
|
14
14
|
/** Synchronous local observation; no network I/O, route changes or network identities. */
|
|
15
15
|
getNetworkDiagnostics: () => MentraLocalNetwork?.getNetworkDiagnostics() ?? null,
|
|
16
|
-
connect
|
|
16
|
+
/** `incoming`: the glasses will connect to a server on this phone (OTA), not only the reverse. */
|
|
17
|
+
connect: async (ssid, password, incoming = true) => {
|
|
17
18
|
if (!MentraLocalNetwork)
|
|
18
19
|
throw new Error("Scoped local networking is not available in this native build");
|
|
19
|
-
return MentraLocalNetwork.connect(ssid, password);
|
|
20
|
+
return MentraLocalNetwork.connect(ssid, password, incoming);
|
|
20
21
|
},
|
|
21
22
|
request: async (requestId, url, method, headers, body, timeoutMs) => {
|
|
22
23
|
if (!MentraLocalNetwork)
|
|
@@ -53,7 +54,6 @@ export const otaLocalNetwork = Object.freeze({
|
|
|
53
54
|
export const otaServer = Object.freeze({
|
|
54
55
|
start: (manifestJson, artifactPaths, host) => MentraOtaServer.startOtaServer(manifestJson, artifactPaths, host),
|
|
55
56
|
stop: () => MentraOtaServer.stopOtaServer(),
|
|
56
|
-
waitForWifiAddress: (gateway, timeoutMs) => MentraOtaServer.waitForWifiAddress(gateway, timeoutMs),
|
|
57
57
|
downloadArtifact: (source, destination) => MentraOtaServer.downloadArtifact(source, destination),
|
|
58
58
|
onArtifactDownloadProgress: (listener) => MentraOtaServer.addListener("artifactDownloadProgress", listener),
|
|
59
59
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ota-transport/index.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,iDAAiD;AACjD,OAAO,kBAA6C,MAAM,sCAAsC,CAAA;AAChG,iDAAiD;AACjD,OAAO,eAAe,MAAM,eAAe,CAAA;AAoD3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,WAAW,EAAE,GAAY,EAAE,CAAC,kBAAkB,IAAI,IAAI;IACtD,0FAA0F;IAC1F,qBAAqB,EAAE,GAA8B,EAAE,CAAC,kBAAkB,EAAE,qBAAqB,EAAE,IAAI,IAAI;IAC3G,OAAO,EAAE,KAAK,EAAE,IAAY,EAAE,QAAgB,EAAsC,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ota-transport/index.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,iDAAiD;AACjD,OAAO,kBAA6C,MAAM,sCAAsC,CAAA;AAChG,iDAAiD;AACjD,OAAO,eAAe,MAAM,eAAe,CAAA;AAoD3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,WAAW,EAAE,GAAY,EAAE,CAAC,kBAAkB,IAAI,IAAI;IACtD,0FAA0F;IAC1F,qBAAqB,EAAE,GAA8B,EAAE,CAAC,kBAAkB,EAAE,qBAAqB,EAAE,IAAI,IAAI;IAC3G,kGAAkG;IAClG,OAAO,EAAE,KAAK,EAAE,IAAY,EAAE,QAAgB,EAAE,QAAQ,GAAG,IAAI,EAAsC,EAAE;QACrG,IAAI,CAAC,kBAAkB;YAAE,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAA;QACzG,OAAO,kBAAkB,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E,CAAC,QAAmD,EAA4B,EAAE;QAC/F,IAAI,CAAC,kBAAkB;YAAE,OAAO,EAAC,MAAM,KAAI,CAAC,EAAC,CAAA;QAC7C,OAAO,kBAAkB,CAAC,WAAW,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;IAChE,CAAC;CACF,CAAC,CAAA;AAEF,qFAAqF;AACrF,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,CACL,YAAoB,EACpB,aAAqC,EACrC,IAAoB,EACM,EAAE,CAAC,eAAe,CAAC,cAAc,CAAC,YAAY,EAAE,aAAa,EAAE,IAAI,CAAC;IAChG,IAAI,EAAE,GAAkB,EAAE,CAAC,eAAe,CAAC,aAAa,EAAE;IAC1D,gBAAgB,EAAE,CAAC,MAAc,EAAE,WAAmB,EAAuD,EAAE,CAC7G,eAAe,CAAC,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC;IACvD,0BAA0B,EAAE,CAAC,QAAsD,EAA4B,EAAE,CAC/G,eAAe,CAAC,WAAW,CAAC,0BAA0B,EAAE,QAAQ,CAAC;CACpE,CAAC,CAAA","sourcesContent":["// This public adapter is the package-owned boundary over its native implementation.\n// eslint-disable-next-line no-restricted-imports\nimport MentraLocalNetwork, {type NetworkDiagnostics} from \"../_private/MentraLocalNetworkModule\"\n// eslint-disable-next-line no-restricted-imports\nimport MentraOtaServer from \"../ota-server\"\n\n// eslint-disable-next-line no-restricted-imports\nexport type {\n NetworkCapabilitiesDiagnostic,\n NetworkDiagnostics,\n NetworkObservation,\n} from \"../_private/MentraLocalNetworkModule\"\n\nexport type OtaTransportSubscription = {remove(): void}\n\nexport type OtaLocalNetworkConnection = {\n connected: boolean\n ssid: string\n localAddress?: string\n}\n\nexport type OtaLocalNetworkLostEvent = {ssid: string}\n\nexport type OtaLocalNetworkResponse = {\n status: number\n headers: Record<string, string>\n bodyBase64: string\n}\n\nexport type OtaLocalNetworkDownloadResult = {\n statusCode: number\n bytesWritten: number\n headers: Record<string, string>\n}\n\nexport type OtaLocalNetworkDownloadProgress = {\n requestId: string\n bytesWritten: number\n contentLength: number\n statusCode?: number\n headers?: Record<string, string>\n}\n\nexport type OtaArtifactDownloadProgress = {\n destination: string\n bytesWritten: number\n contentLength: number\n}\n\nexport type OtaServerResult = {\n baseUrl: string\n host: string\n manifestUrl: string\n port: number\n}\n\n/**\n * Scoped networking for traffic that must stay on a Mentra Live hotspot while\n * the phone's default route remains on cellular or another Wi-Fi network.\n *\n * The module is optional because iOS joins through glasses-media's hotspot owner instead.\n */\nexport const otaLocalNetwork = Object.freeze({\n isAvailable: (): boolean => MentraLocalNetwork != null,\n /** Synchronous local observation; no network I/O, route changes or network identities. */\n getNetworkDiagnostics: (): NetworkDiagnostics | null => MentraLocalNetwork?.getNetworkDiagnostics() ?? null,\n /** `incoming`: the glasses will connect to a server on this phone (OTA), not only the reverse. */\n connect: async (ssid: string, password: string, incoming = true): Promise<OtaLocalNetworkConnection> => {\n if (!MentraLocalNetwork) throw new Error(\"Scoped local networking is not available in this native build\")\n return MentraLocalNetwork.connect(ssid, password, incoming)\n },\n request: async (\n requestId: string,\n url: string,\n method: string,\n headers: Record<string, string>,\n body: string | null,\n timeoutMs: number,\n ): Promise<OtaLocalNetworkResponse> => {\n if (!MentraLocalNetwork) throw new Error(\"Scoped local networking is not available in this native build\")\n return MentraLocalNetwork.request(requestId, url, method, headers, body, timeoutMs)\n },\n download: async (\n requestId: string,\n url: string,\n destination: string,\n headers: Record<string, string>,\n connectionTimeoutMs: number,\n readTimeoutMs: number,\n ): Promise<OtaLocalNetworkDownloadResult> => {\n if (!MentraLocalNetwork) throw new Error(\"Scoped local networking is not available in this native build\")\n return MentraLocalNetwork.download(requestId, url, destination, headers, connectionTimeoutMs, readTimeoutMs)\n },\n cancel: async (requestId: string): Promise<void> => {\n if (!MentraLocalNetwork) return\n await MentraLocalNetwork.cancel(requestId)\n },\n disconnect: async (): Promise<void> => {\n if (!MentraLocalNetwork) return\n await MentraLocalNetwork.disconnect()\n },\n onDownloadProgress: (listener: (event: OtaLocalNetworkDownloadProgress) => void): OtaTransportSubscription => {\n if (!MentraLocalNetwork) return {remove() {}}\n return MentraLocalNetwork.addListener(\"downloadProgress\", listener)\n },\n onNetworkLost: (listener: (event: OtaLocalNetworkLostEvent) => void): OtaTransportSubscription => {\n if (!MentraLocalNetwork) return {remove() {}}\n return MentraLocalNetwork.addListener(\"networkLost\", listener)\n },\n})\n\n/** Native HTTP server and artifact downloader used by the Engine OTA coordinator. */\nexport const otaServer = Object.freeze({\n start: (\n manifestJson: string,\n artifactPaths: Record<string, string>,\n host?: string | null,\n ): Promise<OtaServerResult> => MentraOtaServer.startOtaServer(manifestJson, artifactPaths, host),\n stop: (): Promise<void> => MentraOtaServer.stopOtaServer(),\n downloadArtifact: (source: string, destination: string): Promise<{statusCode: number; bytesWritten: number}> =>\n MentraOtaServer.downloadArtifact(source, destination),\n onArtifactDownloadProgress: (listener: (event: OtaArtifactDownloadProgress) => void): OtaTransportSubscription =>\n MentraOtaServer.addListener(\"artifactDownloadProgress\", listener),\n})\n"]}
|
package/ios/LocalIPv4.swift
CHANGED
|
@@ -5,54 +5,6 @@ import Foundation
|
|
|
5
5
|
/// (photo upload receiver, hotspot-served OTA). Prefers WiFi-ish interfaces carrying RFC1918
|
|
6
6
|
/// addresses — under a glasses-hotspot session en0 holds the 192.168.43.x client address.
|
|
7
7
|
enum LocalIPv4 {
|
|
8
|
-
/// Return the active Wi-Fi address only when it is on the glasses gateway's /24.
|
|
9
|
-
/// iPhone Wi-Fi is `en0`; accepting AWDL, VPN, cellular, or another private
|
|
10
|
-
/// interface can publish an endpoint that the glasses cannot reach.
|
|
11
|
-
static func wifiIPv4Address(matchingGateway gateway: String) -> String? {
|
|
12
|
-
guard let gatewayPrefix = subnet24Prefix(gateway) else {
|
|
13
|
-
return nil
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
var interfaces: UnsafeMutablePointer<ifaddrs>?
|
|
17
|
-
guard getifaddrs(&interfaces) == 0, let first = interfaces else {
|
|
18
|
-
return nil
|
|
19
|
-
}
|
|
20
|
-
defer { freeifaddrs(interfaces) }
|
|
21
|
-
|
|
22
|
-
var cursor: UnsafeMutablePointer<ifaddrs>? = first
|
|
23
|
-
while let current = cursor {
|
|
24
|
-
defer { cursor = current.pointee.ifa_next }
|
|
25
|
-
let interface = current.pointee
|
|
26
|
-
guard String(cString: interface.ifa_name) == "en0",
|
|
27
|
-
let addressPointer = interface.ifa_addr,
|
|
28
|
-
addressPointer.pointee.sa_family == UInt8(AF_INET),
|
|
29
|
-
(interface.ifa_flags & UInt32(IFF_UP)) != 0
|
|
30
|
-
else {
|
|
31
|
-
continue
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var address = addressPointer.pointee
|
|
35
|
-
var hostname = [CChar](repeating: 0, count: Int(NI_MAXHOST))
|
|
36
|
-
guard getnameinfo(
|
|
37
|
-
&address,
|
|
38
|
-
socklen_t(address.sa_len),
|
|
39
|
-
&hostname,
|
|
40
|
-
socklen_t(hostname.count),
|
|
41
|
-
nil,
|
|
42
|
-
0,
|
|
43
|
-
NI_NUMERICHOST
|
|
44
|
-
) == 0 else {
|
|
45
|
-
continue
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
let ip = String(cString: hostname)
|
|
49
|
-
if subnet24Prefix(ip) == gatewayPrefix {
|
|
50
|
-
return ip
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return nil
|
|
54
|
-
}
|
|
55
|
-
|
|
56
8
|
static func bestLocalIPv4Address() -> String? {
|
|
57
9
|
var interfaces: UnsafeMutablePointer<ifaddrs>?
|
|
58
10
|
guard getifaddrs(&interfaces) == 0, let first = interfaces else {
|
|
@@ -134,17 +86,4 @@ enum LocalIPv4 {
|
|
|
134
86
|
private static func isLinkLocalIPv4(_ ip: String) -> Bool {
|
|
135
87
|
ip.hasPrefix("169.254.")
|
|
136
88
|
}
|
|
137
|
-
|
|
138
|
-
private static func subnet24Prefix(_ ip: String) -> String? {
|
|
139
|
-
let parts = ip.split(separator: ".")
|
|
140
|
-
guard parts.count == 4,
|
|
141
|
-
parts.allSatisfy({ part in
|
|
142
|
-
guard let value = Int(part) else { return false }
|
|
143
|
-
return (0 ... 255).contains(value)
|
|
144
|
-
})
|
|
145
|
-
else {
|
|
146
|
-
return nil
|
|
147
|
-
}
|
|
148
|
-
return parts.prefix(3).joined(separator: ".")
|
|
149
|
-
}
|
|
150
89
|
}
|
|
@@ -31,10 +31,6 @@ public class MentraOtaServerModule: Module {
|
|
|
31
31
|
self.stopOtaServerInternal()
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
AsyncFunction("waitForWifiAddress") { (gateway: String, timeoutMs: Int) -> String in
|
|
35
|
-
try await self.waitForWifiAddress(gateway: gateway, timeoutMs: timeoutMs)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
34
|
AsyncFunction("downloadArtifact") { (source: String, destination: String) in
|
|
39
35
|
try await self.artifactDownloader.download(from: source, to: destination)
|
|
40
36
|
}
|
|
@@ -97,18 +93,6 @@ public class MentraOtaServerModule: Module {
|
|
|
97
93
|
)
|
|
98
94
|
}
|
|
99
95
|
|
|
100
|
-
private func waitForWifiAddress(gateway: String, timeoutMs: Int) async throws -> String {
|
|
101
|
-
let deadline = Date().addingTimeInterval(Double(max(timeoutMs, 0)) / 1000.0)
|
|
102
|
-
repeat {
|
|
103
|
-
if let address = LocalIPv4.wifiIPv4Address(matchingGateway: gateway) {
|
|
104
|
-
return address
|
|
105
|
-
}
|
|
106
|
-
try await Task.sleep(nanoseconds: 250_000_000)
|
|
107
|
-
} while Date() < deadline
|
|
108
|
-
|
|
109
|
-
throw OtaServerModuleError("The iPhone did not join the glasses hotspot subnet.")
|
|
110
|
-
}
|
|
111
|
-
|
|
112
96
|
private func stopOtaServerInternal() {
|
|
113
97
|
serverLock.lock()
|
|
114
98
|
defer { serverLock.unlock() }
|
|
@@ -16,7 +16,7 @@ enum BluetoothSdkDefaults {
|
|
|
16
16
|
/// silently disable it on every pair the app touches.
|
|
17
17
|
static let autoPowerOffEnabled = true
|
|
18
18
|
private static let infoSdkVersionKey = "MentraBluetoothSdkVersion"
|
|
19
|
-
private static let swiftPackageSdkVersion = "3.4.0-beta.
|
|
19
|
+
private static let swiftPackageSdkVersion = "3.4.0-beta.1281"
|
|
20
20
|
private static let swiftPackageSdkVersionPlaceholder = "__MENTRA" + "_BLUETOOTH_SDK_VERSION__"
|
|
21
21
|
|
|
22
22
|
private static func normalizedSdkVersion(_ value: String?) -> String? {
|
|
@@ -3,9 +3,9 @@ import Foundation
|
|
|
3
3
|
/// Generated by release CI. Do not edit in a release checkout.
|
|
4
4
|
enum GeneratedReleaseMetadata {
|
|
5
5
|
static let familyBaseVersion = "3.4.0"
|
|
6
|
-
static let releaseIdentity = "3.4.0-beta.
|
|
7
|
-
static let releaseSetId = "mentra-3.4.0-beta.
|
|
8
|
-
static let sourceCommit = "
|
|
9
|
-
static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.
|
|
10
|
-
static let otaManifestSha256 = "
|
|
6
|
+
static let releaseIdentity = "3.4.0-beta.1281"
|
|
7
|
+
static let releaseSetId = "mentra-3.4.0-beta.1281"
|
|
8
|
+
static let sourceCommit = "50035c25e79a62a30a59a22d933c322c9721ef6c"
|
|
9
|
+
static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1281.json"
|
|
10
|
+
static let otaManifestSha256 = "ea381194b394c7ab9ee648323e3a6447a6afbd555002cbb50306bca42fb608d0"
|
|
11
11
|
}
|
|
@@ -97,10 +97,10 @@ public struct StreamAudioConfig {
|
|
|
97
97
|
public struct StreamIceConfig {
|
|
98
98
|
/// STUN server the glasses use while gathering candidates.
|
|
99
99
|
///
|
|
100
|
-
/// `nil` and empty are different answers
|
|
101
|
-
///
|
|
102
|
-
///
|
|
103
|
-
///
|
|
100
|
+
/// `nil` and empty are different answers. `nil` sends the default Cloudflare STUN server; an
|
|
101
|
+
/// empty string is an explicit request for host-only gathering, which is what a WHIP server on
|
|
102
|
+
/// the glasses' own hotspot needs, since a reflexive candidate there is meaningless and
|
|
103
|
+
/// unreachable.
|
|
104
104
|
public let stun: String?
|
|
105
105
|
|
|
106
106
|
public init(stun: String? = nil) {
|
|
@@ -110,7 +110,7 @@ public struct StreamIceConfig {
|
|
|
110
110
|
var dictionary: [String: Any] {
|
|
111
111
|
var values: [String: Any] = [:]
|
|
112
112
|
// Not filtered on emptiness, unlike the other optional string fields here: "" is the
|
|
113
|
-
// host-only signal, so dropping it would silently
|
|
113
|
+
// host-only signal, so dropping it would silently send the default STUN server.
|
|
114
114
|
if let stun { values["stun"] = stun }
|
|
115
115
|
return values
|
|
116
116
|
}
|
|
@@ -386,6 +386,15 @@ public struct StreamRequest {
|
|
|
386
386
|
)
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
+
/// The glasses read an http(s) URL as WHIP, the only protocol that uses ICE, and have no STUN
|
|
390
|
+
/// server of their own.
|
|
391
|
+
private var iceToSend: StreamIceConfig? {
|
|
392
|
+
if ice?.stun == nil, streamUrl.hasPrefix("https://") || streamUrl.hasPrefix("http://") {
|
|
393
|
+
return StreamIceConfig(stun: "stun:stun.cloudflare.com:3478")
|
|
394
|
+
}
|
|
395
|
+
return ice
|
|
396
|
+
}
|
|
397
|
+
|
|
389
398
|
public var values: [String: Any] {
|
|
390
399
|
var values: [String: Any] = [:]
|
|
391
400
|
values["type"] = "start_stream"
|
|
@@ -404,7 +413,7 @@ public struct StreamRequest {
|
|
|
404
413
|
if !captureAudio {
|
|
405
414
|
values["captureAudio"] = false
|
|
406
415
|
}
|
|
407
|
-
if let iceValues =
|
|
416
|
+
if let iceValues = iceToSend?.dictionary, !iceValues.isEmpty {
|
|
408
417
|
values["ice"] = iceValues
|
|
409
418
|
}
|
|
410
419
|
if let traceId, !traceId.isEmpty {
|
|
@@ -14,6 +14,24 @@ final class StreamRequestTests: XCTestCase {
|
|
|
14
14
|
XCTAssertNil(request.values["tl"])
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
func testWhipWithoutIceSendsTheDefaultStunServer() {
|
|
18
|
+
let request = StreamRequest(streamUrl: "https://example.com/whip", streamId: "s-1")
|
|
19
|
+
let ice = request.values["ice"] as? [String: Any]
|
|
20
|
+
XCTAssertEqual(ice?["stun"] as? String, "stun:stun.cloudflare.com:3478")
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
func testWhipKeepsHostOnlyAndNamedStunServers() {
|
|
24
|
+
let hostOnly = StreamRequest(values: ["streamUrl": "http://192.168.43.79:8080/whip", "ice": ["stun": ""]])
|
|
25
|
+
XCTAssertEqual((hostOnly.values["ice"] as? [String: Any])?["stun"] as? String, "")
|
|
26
|
+
let named = StreamRequest(values: ["streamUrl": "https://example.com/whip", "i": ["s": "stun:stun.example.com:3478"]])
|
|
27
|
+
XCTAssertEqual((named.values["ice"] as? [String: Any])?["stun"] as? String, "stun:stun.example.com:3478")
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
func testRtmpAndSrtSendNoIce() {
|
|
31
|
+
XCTAssertNil(StreamRequest(streamUrl: "rtmp://example.com/live", streamId: "s-1").values["ice"])
|
|
32
|
+
XCTAssertNil(StreamRequest(streamUrl: "srt://example.com:9000", streamId: "s-1").values["ice"])
|
|
33
|
+
}
|
|
34
|
+
|
|
17
35
|
func testInitFromValuesPreservesOmissionWhenKeyAbsent() {
|
|
18
36
|
let request = StreamRequest(values: [
|
|
19
37
|
"streamUrl": "https://example.com/whip",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mentra/bluetooth-sdk",
|
|
3
|
-
"version": "3.4.0-beta.
|
|
3
|
+
"version": "3.4.0-beta.1281",
|
|
4
4
|
"description": "SDK for communicating with smart glasses",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"registry": "https://registry.npmjs.org/"
|
|
116
116
|
},
|
|
117
117
|
"dependencies": {
|
|
118
|
-
"@mentra/cloud-protocol": "3.4.0-beta.
|
|
118
|
+
"@mentra/cloud-protocol": "3.4.0-beta.1281"
|
|
119
119
|
},
|
|
120
120
|
"devDependencies": {
|
|
121
121
|
"@types/node": "^25.9.3",
|
|
@@ -862,11 +862,10 @@ export type StreamIceConfig = {
|
|
|
862
862
|
/**
|
|
863
863
|
* STUN server the glasses should use while gathering candidates.
|
|
864
864
|
*
|
|
865
|
-
* Omit to
|
|
865
|
+
* Omit to send the default Cloudflare STUN server. Pass an empty string to force host-only
|
|
866
866
|
* gathering, which is what SoftAP calling needs: the WHIP server runs on the phone across the
|
|
867
867
|
* glasses' own hotspot, so a server-reflexive candidate is meaningless and there is no route to
|
|
868
|
-
* a STUN server anyway.
|
|
869
|
-
* kept, so a malformed override cannot silently disable ICE.
|
|
868
|
+
* a STUN server anyway. The glasses treat a value that is not a `stun:`/`stuns:` URI as host-only.
|
|
870
869
|
*/
|
|
871
870
|
stun?: string
|
|
872
871
|
}
|
|
@@ -54,7 +54,11 @@ type LocalNetworkEvents = {
|
|
|
54
54
|
|
|
55
55
|
declare class MentraLocalNetworkNativeModule extends NativeModule<LocalNetworkEvents> {
|
|
56
56
|
getNetworkDiagnostics(): NetworkDiagnostics
|
|
57
|
-
connect(
|
|
57
|
+
connect(
|
|
58
|
+
ssid: string,
|
|
59
|
+
password: string,
|
|
60
|
+
incoming: boolean,
|
|
61
|
+
): Promise<{connected: boolean; ssid: string; localAddress?: string}>
|
|
58
62
|
request(
|
|
59
63
|
requestId: string,
|
|
60
64
|
url: string,
|
|
@@ -12,9 +12,9 @@ export interface BluetoothSdkReleaseMetadata {
|
|
|
12
12
|
export const BLUETOOTH_SDK_RELEASE_METADATA: Readonly<BluetoothSdkReleaseMetadata> = Object.freeze({
|
|
13
13
|
"schemaVersion": 1,
|
|
14
14
|
"familyBaseVersion": "3.4.0",
|
|
15
|
-
"releaseIdentity": "3.4.0-beta.
|
|
16
|
-
"releaseSetId": "mentra-3.4.0-beta.
|
|
17
|
-
"sourceCommit": "
|
|
18
|
-
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.
|
|
19
|
-
"otaManifestSha256": "
|
|
15
|
+
"releaseIdentity": "3.4.0-beta.1281",
|
|
16
|
+
"releaseSetId": "mentra-3.4.0-beta.1281",
|
|
17
|
+
"sourceCommit": "50035c25e79a62a30a59a22d933c322c9721ef6c",
|
|
18
|
+
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1281.json",
|
|
19
|
+
"otaManifestSha256": "ea381194b394c7ab9ee648323e3a6447a6afbd555002cbb50306bca42fb608d0"
|
|
20
20
|
})
|
|
@@ -15,8 +15,6 @@ declare class MentraOtaServerModule extends NativeModule<MentraOtaServerModuleEv
|
|
|
15
15
|
host?: string | null,
|
|
16
16
|
): Promise<OtaServerResult>
|
|
17
17
|
stopOtaServer(): Promise<void>
|
|
18
|
-
/** Wait for iPhone Wi-Fi (`en0`) to acquire an address on the glasses gateway subnet. */
|
|
19
|
-
waitForWifiAddress(gateway: string, timeoutMs: number): Promise<string>
|
|
20
18
|
downloadArtifact(source: string, destination: string): Promise<{statusCode: number; bytesWritten: number}>
|
|
21
19
|
}
|
|
22
20
|
|
|
@@ -8,10 +8,6 @@ class MentraOtaServerModule extends NativeModule<MentraOtaServerModuleEvents> {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
async stopOtaServer(): Promise<void> {}
|
|
11
|
-
|
|
12
|
-
async waitForWifiAddress(): Promise<string> {
|
|
13
|
-
throw new Error("The OTA server is only available in native apps.")
|
|
14
|
-
}
|
|
15
11
|
}
|
|
16
12
|
|
|
17
13
|
export default registerWebModule(MentraOtaServerModule, "MentraOtaServer")
|
|
@@ -58,15 +58,16 @@ export type OtaServerResult = {
|
|
|
58
58
|
* Scoped networking for traffic that must stay on a Mentra Live hotspot while
|
|
59
59
|
* the phone's default route remains on cellular or another Wi-Fi network.
|
|
60
60
|
*
|
|
61
|
-
* The module is optional because iOS
|
|
61
|
+
* The module is optional because iOS joins through glasses-media's hotspot owner instead.
|
|
62
62
|
*/
|
|
63
63
|
export const otaLocalNetwork = Object.freeze({
|
|
64
64
|
isAvailable: (): boolean => MentraLocalNetwork != null,
|
|
65
65
|
/** Synchronous local observation; no network I/O, route changes or network identities. */
|
|
66
66
|
getNetworkDiagnostics: (): NetworkDiagnostics | null => MentraLocalNetwork?.getNetworkDiagnostics() ?? null,
|
|
67
|
-
connect
|
|
67
|
+
/** `incoming`: the glasses will connect to a server on this phone (OTA), not only the reverse. */
|
|
68
|
+
connect: async (ssid: string, password: string, incoming = true): Promise<OtaLocalNetworkConnection> => {
|
|
68
69
|
if (!MentraLocalNetwork) throw new Error("Scoped local networking is not available in this native build")
|
|
69
|
-
return MentraLocalNetwork.connect(ssid, password)
|
|
70
|
+
return MentraLocalNetwork.connect(ssid, password, incoming)
|
|
70
71
|
},
|
|
71
72
|
request: async (
|
|
72
73
|
requestId: string,
|
|
@@ -116,8 +117,6 @@ export const otaServer = Object.freeze({
|
|
|
116
117
|
host?: string | null,
|
|
117
118
|
): Promise<OtaServerResult> => MentraOtaServer.startOtaServer(manifestJson, artifactPaths, host),
|
|
118
119
|
stop: (): Promise<void> => MentraOtaServer.stopOtaServer(),
|
|
119
|
-
waitForWifiAddress: (gateway: string, timeoutMs: number): Promise<string> =>
|
|
120
|
-
MentraOtaServer.waitForWifiAddress(gateway, timeoutMs),
|
|
121
120
|
downloadArtifact: (source: string, destination: string): Promise<{statusCode: number; bytesWritten: number}> =>
|
|
122
121
|
MentraOtaServer.downloadArtifact(source, destination),
|
|
123
122
|
onArtifactDownloadProgress: (listener: (event: OtaArtifactDownloadProgress) => void): OtaTransportSubscription =>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
package com.mentra.bluetoothsdk
|
|
2
|
-
|
|
3
|
-
internal class ScopedNetworkReadiness<T> {
|
|
4
|
-
private var candidate: T? = null
|
|
5
|
-
|
|
6
|
-
fun onAvailable(network: T) {
|
|
7
|
-
candidate = network
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
fun isReady(network: T, isForeground: Boolean): Boolean = candidate == network && isForeground
|
|
11
|
-
|
|
12
|
-
fun contains(network: T): Boolean = candidate == network
|
|
13
|
-
|
|
14
|
-
fun clear() {
|
|
15
|
-
candidate = null
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
package com.mentra.bluetoothsdk
|
|
2
|
-
|
|
3
|
-
import org.junit.Assert.assertFalse
|
|
4
|
-
import org.junit.Assert.assertTrue
|
|
5
|
-
import org.junit.Test
|
|
6
|
-
|
|
7
|
-
class ScopedNetworkReadinessTest {
|
|
8
|
-
@Test
|
|
9
|
-
fun `waits for the available network to become foreground`() {
|
|
10
|
-
val readiness = ScopedNetworkReadiness<String>()
|
|
11
|
-
|
|
12
|
-
readiness.onAvailable("glasses")
|
|
13
|
-
|
|
14
|
-
assertFalse(readiness.isReady("glasses", isForeground = false))
|
|
15
|
-
assertTrue(readiness.isReady("glasses", isForeground = true))
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@Test
|
|
19
|
-
fun `rejects capabilities from a stale network`() {
|
|
20
|
-
val readiness = ScopedNetworkReadiness<String>()
|
|
21
|
-
|
|
22
|
-
readiness.onAvailable("old")
|
|
23
|
-
readiness.onAvailable("current")
|
|
24
|
-
|
|
25
|
-
assertFalse(readiness.isReady("old", isForeground = true))
|
|
26
|
-
assertTrue(readiness.isReady("current", isForeground = true))
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@Test
|
|
30
|
-
fun `clears the candidate when the request ends`() {
|
|
31
|
-
val readiness = ScopedNetworkReadiness<String>()
|
|
32
|
-
readiness.onAvailable("glasses")
|
|
33
|
-
|
|
34
|
-
readiness.clear()
|
|
35
|
-
|
|
36
|
-
assertFalse(readiness.contains("glasses"))
|
|
37
|
-
assertFalse(readiness.isReady("glasses", isForeground = true))
|
|
38
|
-
}
|
|
39
|
-
}
|