@mentra/bluetooth-sdk 0.1.21-beta.5 → 3.1.0-dev.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +38 -2
  2. package/android/build.gradle +7 -4
  3. package/android/lc3Lib/build.gradle +18 -4
  4. package/android/silero/build.gradle +9 -1
  5. package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +16 -0
  6. package/android/src/main/java/com/mentra/bluetoothsdk/Bridge.kt +39 -3
  7. package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +198 -17
  8. package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +2 -0
  9. package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedReleaseMetadata.kt +11 -0
  10. package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +112 -8
  11. package/android/src/main/java/com/mentra/bluetoothsdk/MentraLocalNetworkModule.kt +93 -12
  12. package/android/src/main/java/com/mentra/bluetoothsdk/OtaManifest.kt +5 -7
  13. package/android/src/main/java/com/mentra/bluetoothsdk/ScopedNetworkReadiness.kt +17 -0
  14. package/android/src/main/java/com/mentra/bluetoothsdk/audio/AudioModels.kt +15 -0
  15. package/android/src/main/java/com/mentra/bluetoothsdk/events/BluetoothEvents.kt +24 -0
  16. package/android/src/main/java/com/mentra/bluetoothsdk/net/LocalIpv4.kt +57 -0
  17. package/android/src/main/java/com/mentra/bluetoothsdk/otaserver/LocalOtaServer.kt +304 -0
  18. package/android/src/main/java/com/mentra/bluetoothsdk/otaserver/MentraOtaServerModule.kt +120 -0
  19. package/android/src/main/java/com/mentra/bluetoothsdk/photoreceiver/MentraPhotoReceiverModule.kt +2 -49
  20. package/android/src/main/java/com/mentra/bluetoothsdk/services/Foreground.kt +61 -30
  21. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.kt +1174 -191
  22. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +8 -0
  23. package/android/src/main/java/com/mentra/bluetoothsdk/status/DeviceStatus.kt +17 -0
  24. package/android/src/main/java/com/mentra/bluetoothsdk/types/DeviceModels.kt +12 -0
  25. package/android/src/main/java/com/mentra/bluetoothsdk/utils/BleJsonCompact.java +74 -79
  26. package/android/src/main/java/com/mentra/bluetoothsdk/utils/K900ProtocolUtils.java +3 -3
  27. package/android/src/test/java/com/mentra/bluetoothsdk/OtaStartResponsePolicyTest.kt +30 -0
  28. package/android/src/test/java/com/mentra/bluetoothsdk/ScopedNetworkReadinessTest.kt +39 -0
  29. package/android/src/test/java/com/mentra/bluetoothsdk/otaserver/LocalOtaServerTest.kt +82 -0
  30. package/android/src/test/java/com/mentra/bluetoothsdk/services/ForegroundServiceTypeTest.kt +69 -0
  31. package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/MentraLiveGattCharacteristicsTest.kt +39 -0
  32. package/android/src/test/java/com/mentra/bluetoothsdk/utils/BleJsonCompactTest.java +148 -7
  33. package/build/BluetoothSdk.types.d.ts +61 -2
  34. package/build/BluetoothSdk.types.d.ts.map +1 -1
  35. package/build/BluetoothSdk.types.js.map +1 -1
  36. package/build/_internal.d.ts +2 -0
  37. package/build/_internal.d.ts.map +1 -1
  38. package/build/_internal.js +2 -0
  39. package/build/_internal.js.map +1 -1
  40. package/build/_private/BluetoothSdkModule.d.ts +4 -1
  41. package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
  42. package/build/_private/BluetoothSdkModule.js +1 -1
  43. package/build/_private/BluetoothSdkModule.js.map +1 -1
  44. package/build/_private/MentraLocalNetworkModule.d.ts +1 -0
  45. package/build/_private/MentraLocalNetworkModule.d.ts.map +1 -1
  46. package/build/_private/MentraLocalNetworkModule.js.map +1 -1
  47. package/build/_private/sdkOtaManifest.d.ts +3 -12
  48. package/build/_private/sdkOtaManifest.d.ts.map +1 -1
  49. package/build/_private/sdkOtaManifest.js +5 -17
  50. package/build/_private/sdkOtaManifest.js.map +1 -1
  51. package/build/generated/releaseMetadata.d.ts +12 -0
  52. package/build/generated/releaseMetadata.d.ts.map +1 -0
  53. package/build/generated/releaseMetadata.js +10 -0
  54. package/build/generated/releaseMetadata.js.map +1 -0
  55. package/build/index.d.ts +1 -1
  56. package/build/index.d.ts.map +1 -1
  57. package/build/index.js +10 -2
  58. package/build/index.js.map +1 -1
  59. package/build/ota-server/MentraOtaServer.types.d.ts +14 -0
  60. package/build/ota-server/MentraOtaServer.types.d.ts.map +1 -0
  61. package/build/ota-server/MentraOtaServer.types.js +2 -0
  62. package/build/ota-server/MentraOtaServer.types.js.map +1 -0
  63. package/build/ota-server/MentraOtaServerModule.d.ts +21 -0
  64. package/build/ota-server/MentraOtaServerModule.d.ts.map +1 -0
  65. package/build/ota-server/MentraOtaServerModule.js +3 -0
  66. package/build/ota-server/MentraOtaServerModule.js.map +1 -0
  67. package/build/ota-server/MentraOtaServerModule.web.d.ts +10 -0
  68. package/build/ota-server/MentraOtaServerModule.web.d.ts.map +1 -0
  69. package/build/ota-server/MentraOtaServerModule.web.js +12 -0
  70. package/build/ota-server/MentraOtaServerModule.web.js.map +1 -0
  71. package/build/ota-server/index.d.ts +3 -0
  72. package/build/ota-server/index.d.ts.map +1 -0
  73. package/build/ota-server/index.js +3 -0
  74. package/build/ota-server/index.js.map +1 -0
  75. package/expo-module.config.json +3 -2
  76. package/ios/BackgroundOtaArtifactDownloader.swift +125 -0
  77. package/ios/BluetoothSdkModule.swift +16 -2
  78. package/ios/LocalIPv4.swift +150 -0
  79. package/ios/LocalOtaServer.swift +309 -0
  80. package/ios/MentraBluetoothSDK.podspec +5 -1
  81. package/ios/MentraOtaServerModule.swift +147 -0
  82. package/ios/MentraPhotoReceiverModule.swift +1 -81
  83. package/ios/Source/BluetoothSdkDefaults.swift +4 -1
  84. package/ios/Source/Bridge.swift +47 -3
  85. package/ios/Source/DeviceManager.swift +135 -10
  86. package/ios/Source/DeviceStore.swift +2 -0
  87. package/ios/Source/GeneratedReleaseMetadata.swift +11 -0
  88. package/ios/Source/MentraBluetoothSDK.swift +74 -6
  89. package/ios/Source/OtaManifest.swift +5 -7
  90. package/ios/Source/audio/AudioModels.swift +17 -0
  91. package/ios/Source/camera/CameraModels.swift +1 -0
  92. package/ios/Source/events/BluetoothEvents.swift +27 -0
  93. package/ios/Source/sgcs/MentraLive.swift +439 -30
  94. package/ios/Source/sgcs/SGCManager.swift +11 -0
  95. package/ios/Source/status/DeviceStatus.swift +23 -0
  96. package/ios/Source/types/DeviceModels.swift +23 -2
  97. package/ios/Source/utils/BleJsonCompact.swift +73 -71
  98. package/package.json +5 -1
  99. package/plugin/build/withIos.d.ts +3 -1
  100. package/plugin/build/withIos.js +22 -10
  101. package/scripts/verify-release-package.mjs +34 -0
  102. package/scripts/write-release-metadata.mjs +154 -0
  103. package/scripts/write-release-metadata.test.mjs +29 -0
  104. package/src/BluetoothSdk.types.ts +72 -3
  105. package/src/_internal.ts +2 -0
  106. package/src/_private/BluetoothSdkModule.ts +5 -5
  107. package/src/_private/MentraLocalNetworkModule.ts +1 -1
  108. package/src/_private/sdkOtaManifest.ts +5 -17
  109. package/src/generated/releaseMetadata.ts +20 -0
  110. package/src/index.ts +19 -2
  111. package/src/ota-server/MentraOtaServer.types.ts +10 -0
  112. package/src/ota-server/MentraOtaServerModule.ts +23 -0
  113. package/src/ota-server/MentraOtaServerModule.web.ts +17 -0
  114. package/src/ota-server/index.ts +2 -0
@@ -1 +1 @@
1
- {"version":3,"file":"sdkOtaManifest.d.ts","sourceRoot":"","sources":["../../src/_private/sdkOtaManifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB,EAAE,MAA2C,CAAA;AAE/E;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAKvD"}
1
+ {"version":3,"file":"sdkOtaManifest.d.ts","sourceRoot":"","sources":["../../src/_private/sdkOtaManifest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB,EAAE,MAA2C,CAAA;AAE/E;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,IAAI,CAEvD"}
@@ -1,28 +1,16 @@
1
1
  /**
2
- * SDK-pinned OTA manifest URL derivation.
3
- *
4
- * Each Bluetooth SDK release publishes an immutable manifest
5
- * (`bluetooth-sdk-<version>-version.json`) pinning the exact ASG artifact paired with that SDK
6
- * version. The URL is derived from this package's own version — the version is frozen into the
7
- * published artifact, so this is equivalent to baking the URL at release time while keeping the
8
- * manifest itself replaceable as an operational escape hatch (asset moves, CDN migration).
9
- *
10
- * Mirrors the native derivation in `OtaManifestDefaults.defaultOtaVersionUrl()` (Kotlin) /
11
- * `BluetoothSdkDefaults` (Swift).
2
+ * Release CI embeds one immutable OTA manifest URL into every SDK distribution.
3
+ * Source builds remain unpinned and must opt in through the debug configuration API.
12
4
  */
13
- const SDK_OTA_RELEASE_BASE_URL = "https://github.com/Mentra-Community/MentraOS/releases/download/bluetooth-sdk-ota";
5
+ import { BLUETOOTH_SDK_RELEASE_METADATA } from "../generated/releaseMetadata";
14
6
  // eslint-disable-next-line @typescript-eslint/no-var-requires
15
7
  const packageJson = require("../../package.json");
16
8
  /** This Bluetooth SDK package's own version, as published. */
17
9
  export const BLUETOOTH_SDK_VERSION = (packageJson.version ?? "").trim();
18
10
  /**
19
- * The immutable manifest URL pinning the ASG artifact paired with this SDK version, or null when
20
- * the package version is unavailable (malformed workspace state).
11
+ * The immutable manifest URL embedded by release CI, or null for an unpinned source build.
21
12
  */
22
13
  export function sdkPinnedOtaManifestUrl() {
23
- if (!BLUETOOTH_SDK_VERSION) {
24
- return null;
25
- }
26
- return `${SDK_OTA_RELEASE_BASE_URL}/bluetooth-sdk-${BLUETOOTH_SDK_VERSION}-version.json`;
14
+ return BLUETOOTH_SDK_RELEASE_METADATA.otaManifestUrl;
27
15
  }
28
16
  //# sourceMappingURL=sdkOtaManifest.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sdkOtaManifest.js","sourceRoot":"","sources":["../../src/_private/sdkOtaManifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,wBAAwB,GAAG,kFAAkF,CAAA;AAEnH,8DAA8D;AAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAuB,CAAA;AAEvE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,qBAAqB,GAAW,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;AAE/E;;;GAGG;AACH,MAAM,UAAU,uBAAuB;IACrC,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,GAAG,wBAAwB,kBAAkB,qBAAqB,eAAe,CAAA;AAC1F,CAAC","sourcesContent":["/**\n * SDK-pinned OTA manifest URL derivation.\n *\n * Each Bluetooth SDK release publishes an immutable manifest\n * (`bluetooth-sdk-<version>-version.json`) pinning the exact ASG artifact paired with that SDK\n * version. The URL is derived from this package's own version — the version is frozen into the\n * published artifact, so this is equivalent to baking the URL at release time while keeping the\n * manifest itself replaceable as an operational escape hatch (asset moves, CDN migration).\n *\n * Mirrors the native derivation in `OtaManifestDefaults.defaultOtaVersionUrl()` (Kotlin) /\n * `BluetoothSdkDefaults` (Swift).\n */\n\nconst SDK_OTA_RELEASE_BASE_URL = \"https://github.com/Mentra-Community/MentraOS/releases/download/bluetooth-sdk-ota\"\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst packageJson = require(\"../../package.json\") as {version?: string}\n\n/** This Bluetooth SDK package's own version, as published. */\nexport const BLUETOOTH_SDK_VERSION: string = (packageJson.version ?? \"\").trim()\n\n/**\n * The immutable manifest URL pinning the ASG artifact paired with this SDK version, or null when\n * the package version is unavailable (malformed workspace state).\n */\nexport function sdkPinnedOtaManifestUrl(): string | null {\n if (!BLUETOOTH_SDK_VERSION) {\n return null\n }\n return `${SDK_OTA_RELEASE_BASE_URL}/bluetooth-sdk-${BLUETOOTH_SDK_VERSION}-version.json`\n}\n"]}
1
+ {"version":3,"file":"sdkOtaManifest.js","sourceRoot":"","sources":["../../src/_private/sdkOtaManifest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,8BAA8B,EAAC,MAAM,8BAA8B,CAAA;AAE3E,8DAA8D;AAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAuB,CAAA;AAEvE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,qBAAqB,GAAW,CAAC,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;AAE/E;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,8BAA8B,CAAC,cAAc,CAAA;AACtD,CAAC","sourcesContent":["/**\n * Release CI embeds one immutable OTA manifest URL into every SDK distribution.\n * Source builds remain unpinned and must opt in through the debug configuration API.\n */\n\nimport {BLUETOOTH_SDK_RELEASE_METADATA} from \"../generated/releaseMetadata\"\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst packageJson = require(\"../../package.json\") as {version?: string}\n\n/** This Bluetooth SDK package's own version, as published. */\nexport const BLUETOOTH_SDK_VERSION: string = (packageJson.version ?? \"\").trim()\n\n/**\n * The immutable manifest URL embedded by release CI, or null for an unpinned source build.\n */\nexport function sdkPinnedOtaManifestUrl(): string | null {\n return BLUETOOTH_SDK_RELEASE_METADATA.otaManifestUrl\n}\n"]}
@@ -0,0 +1,12 @@
1
+ /** Generated by release CI. Do not edit in a release checkout. */
2
+ export interface BluetoothSdkReleaseMetadata {
3
+ schemaVersion: 1;
4
+ familyBaseVersion: string | null;
5
+ releaseIdentity: string | null;
6
+ releaseSetId: string | null;
7
+ sourceCommit: string | null;
8
+ otaManifestUrl: string | null;
9
+ otaManifestSha256: string | null;
10
+ }
11
+ export declare const BLUETOOTH_SDK_RELEASE_METADATA: Readonly<BluetoothSdkReleaseMetadata>;
12
+ //# sourceMappingURL=releaseMetadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"releaseMetadata.d.ts","sourceRoot":"","sources":["../../src/generated/releaseMetadata.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,CAAC,CAAA;IAChB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC;AAED,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,2BAA2B,CAQ/E,CAAA"}
@@ -0,0 +1,10 @@
1
+ export const BLUETOOTH_SDK_RELEASE_METADATA = Object.freeze({
2
+ "schemaVersion": 1,
3
+ "familyBaseVersion": "3.1.0",
4
+ "releaseIdentity": "3.1.0-dev.7",
5
+ "releaseSetId": "mentra-3.1.0-dev.7",
6
+ "sourceCommit": "872697a6395c31d30ec75d64f039eaa763dcbb51",
7
+ "otaManifestUrl": "https://github.com/Mentra-Community/MentraOS/releases/download/mentra-v3.1.0-dev.7/mentra-live-ota-3.1.0-dev.7.json",
8
+ "otaManifestSha256": "8fbea7589345658dc5dffcb394229ffc5c52fbe75352acb8f6827d83290ce750"
9
+ });
10
+ //# sourceMappingURL=releaseMetadata.js.map
@@ -0,0 +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,aAAa;IAChC,cAAc,EAAE,oBAAoB;IACpC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,qHAAqH;IACvI,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.1.0\",\n \"releaseIdentity\": \"3.1.0-dev.7\",\n \"releaseSetId\": \"mentra-3.1.0-dev.7\",\n \"sourceCommit\": \"872697a6395c31d30ec75d64f039eaa763dcbb51\",\n \"otaManifestUrl\": \"https://github.com/Mentra-Community/MentraOS/releases/download/mentra-v3.1.0-dev.7/mentra-live-ota-3.1.0-dev.7.json\",\n \"otaManifestSha256\": \"8fbea7589345658dc5dffcb394229ffc5c52fbe75352acb8f6827d83290ce750\"\n})\n"]}
package/build/index.d.ts CHANGED
@@ -2,5 +2,5 @@ import type { BluetoothSdkPublicModule } from "./BluetoothSdk.types";
2
2
  export declare const BluetoothSdk: BluetoothSdkPublicModule;
3
3
  export default BluetoothSdk;
4
4
  export { CAMERA_FOV_DEFAULT, CAMERA_FOV_MAX, CAMERA_FOV_MIN, DeviceModels, isBusyGlassesConnectionStatus, isConnectedGlassesConnectionStatus, isConnectedWifiStatus, isEnabledHotspotStatus, isReadyGlassesConnectionStatus, } from "./BluetoothSdk.types";
5
- export type { AccelEvent, Ar99OtaStatusEvent, AudioConnectedEvent, AudioDisconnectedEvent, AudioPairingNeededEvent, BatteryStatusEvent, BluetoothSdkEvent, BluetoothSdkEventListener, BluetoothSdkEventMap, BluetoothSdkEventName, BluetoothSdkPublicModule as BluetoothSdkModule, BluetoothSdkSubscription, ButtonPhotoSize, PhotoCaptureDefaults, ButtonPressEvent, CameraFovPreset, CameraFovRequest, CameraFovResult, CameraRoiPosition, CompatibleGlassesSearchStopEvent, ConnectOptions, ConnectedGlassesConnectionStatus, ConnectedWifiStatus, Device, DeviceModel, EnabledHotspotStatus, GalleryStatusEvent, GlassesConnectionStatus, GlassesMediaVolumeGetResult, GlassesMediaVolumeSetResult, GlassesNotReadyEvent, HeadUpEvent, HotspotErrorEvent, HotspotStatus, HotspotStatusChangeEvent, LocalTranscriptionEvent, LogEvent, MicLc3Event, MicMode, MicPcmEvent, MicPreference, OtaStartAckEvent, OtaStatus, OtaStatusEvent, OtaQueryResult, PairFailureEvent, PhotoCaptureMetadata, PhotoResolvedConfig, PhotoCompression, PhotoFpsRange, PhotoMeteredPreview, PhotoMode, PhotoTransferMethod, PhotoResponseEvent, PhotoRequestedCaptureConfig, PhotoRequestParams, PhotoSize, PhotoStatusEvent, PhotoStatusState, PhotoSuccessResponseEvent, RgbLedAction, RgbLedColor, RgbLedControlResponseEvent, RgbLedControlSuccessResponseEvent, ScanModelOptions, ScanOptions, ScanResultsCallback, SpeakingStatusEvent, SettingsAckEvent, SettingsAckSetting, SettingsAckSuccessEvent, SettingsAckSuccessStatus, SettingsAckStatus, StreamAudioConfig, StreamResolvedConfig, StreamStartRequest, StreamStatusEvent, StreamStatusLifecycleState, StreamStatusReconnectState, StreamStatusState, StreamVideoConfig, SwipeVolumeStatusEvent, SwitchStatusEvent, TouchEvent, VideoRecordingDefaults, VideoRecordingStartedStatusEvent, VideoRecordingStatusEvent, VideoRecordingStatusState, VideoRecordingStoppedStatusEvent, VideoRecordingSuccessStatusEvent, VersionInfoEvent, VersionInfoResult, WifiScanResultEvent, VoiceActivityDetectionStatusEvent, WifiSearchResult, WifiStatus, WifiStatusChangeEvent, } from "./BluetoothSdk.types";
5
+ export type { AccelEvent, Ar99OtaStatusEvent, AudioConnectedEvent, AudioDisconnectedEvent, AudioPairingNeededEvent, BatteryStatusEvent, BluetoothSdkEvent, BluetoothSdkEventListener, BluetoothSdkEventMap, BluetoothSdkEventName, BluetoothSdkPublicModule as BluetoothSdkModule, BluetoothSdkSubscription, ButtonPhotoSize, PhotoCaptureDefaults, ButtonPressEvent, CameraFovPreset, CameraFovRequest, CameraFovResult, CameraRoiPosition, CompatibleGlassesSearchStopEvent, ConnectOptions, ConnectedGlassesConnectionStatus, ConnectedWifiStatus, Device, DeviceModel, EnabledHotspotStatus, GalleryStatusEvent, GlassesConnectionStatus, GlassesMediaVolumeGetResult, GlassesMediaVolumeSetResult, GlassesNotReadyEvent, HeadUpEvent, HotspotErrorEvent, HotspotStatus, HotspotStatusChangeEvent, KeepAliveAckEvent, LocalTranscriptionEvent, LogEvent, MicLc3Event, MicHealthEvent, MicMode, MicPcmEvent, MicPreference, OtaStartAckEvent, OtaProgress, OtaProgressStatus, OtaStage, OtaStatus, OtaStatusEvent, OtaQueryResult, OtaUpdateInfo, PairFailureEvent, PairingInfoEvent, EnteringPairingModeEvent, OwnerReplacedEvent, PhotoCaptureMetadata, PhotoResolvedConfig, PhotoCompression, PhotoFpsRange, PhotoMeteredPreview, PhotoMode, PhotoTransferMethod, PhotoResponseEvent, PhotoRequestedCaptureConfig, PhotoRequestParams, PhotoSize, PhotoStatusEvent, PhotoStatusState, PhotoSuccessResponseEvent, RgbLedAction, RgbLedColor, RgbLedControlResponseEvent, RgbLedControlSuccessResponseEvent, ScanModelOptions, ScanOptions, ScanResultsCallback, SpeakingStatusEvent, SettingsAckEvent, SettingsAckSetting, SettingsAckSuccessEvent, SettingsAckSuccessStatus, SettingsAckStatus, StreamAudioConfig, StreamResolvedConfig, StreamStartRequest, StreamStatusEvent, StreamStatusLifecycleState, StreamStatusReconnectState, StreamStatusState, StreamVideoConfig, SwipeVolumeStatusEvent, SwitchStatusEvent, TouchEvent, VideoRecordingDefaults, VideoRecordingStartedStatusEvent, VideoRecordingStatusEvent, VideoRecordingStatusState, VideoRecordingStoppedStatusEvent, VideoRecordingSuccessStatusEvent, VersionInfoEvent, VersionInfoResult, WifiScanResultEvent, VoiceActivityDetectionStatusEvent, WifiSearchResult, WifiStatus, WifiStatusChangeEvent, } from "./BluetoothSdk.types";
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,wBAAwB,EAEzB,MAAM,sBAAsB,CAAA;AAmE7B,eAAO,MAAM,YAAY,EAAE,wBAiFzB,CAAA;AAEF,eAAe,YAAY,CAAA;AAE3B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,6BAA6B,EAC7B,kCAAkC,EAClC,qBAAqB,EACrB,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAA;AAE7B,YAAY,EACV,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,IAAI,kBAAkB,EAC9C,wBAAwB,EACxB,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gCAAgC,EAChC,cAAc,EACd,gCAAgC,EAChC,mBAAmB,EACnB,MAAM,EACN,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,QAAQ,EACR,WAAW,EACX,OAAO,EACP,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,kBAAkB,EAClB,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,yBAAyB,EACzB,YAAY,EACZ,WAAW,EACX,0BAA0B,EAC1B,iCAAiC,EACjC,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,EAC1B,0BAA0B,EAC1B,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,UAAU,EACV,sBAAsB,EACtB,gCAAgC,EAChC,yBAAyB,EACzB,yBAAyB,EACzB,gCAAgC,EAChC,gCAAgC,EAChC,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,iCAAiC,EACjC,gBAAgB,EAChB,UAAU,EACV,qBAAqB,GACtB,MAAM,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,wBAAwB,EAEzB,MAAM,sBAAsB,CAAA;AAuE7B,eAAO,MAAM,YAAY,EAAE,wBAqFzB,CAAA;AAEF,eAAe,YAAY,CAAA;AAE3B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,6BAA6B,EAC7B,kCAAkC,EAClC,qBAAqB,EACrB,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAA;AAE7B,YAAY,EACV,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,IAAI,kBAAkB,EAC9C,wBAA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ACjC,gBAAgB,EAChB,UAAU,EACV,qBAAqB,GACtB,MAAM,sBAAsB,CAAA"}
package/build/index.js CHANGED
@@ -29,11 +29,15 @@ const PUBLIC_EVENT_NAMES = new Set([
29
29
  "rgb_led_control_response",
30
30
  "settings_ack",
31
31
  "pair_failure",
32
+ "pairing_info",
33
+ "entering_pairing_mode",
34
+ "owner_replaced",
32
35
  "audio_pairing_needed",
33
36
  "audio_connected",
34
37
  "audio_disconnected",
35
38
  "mic_pcm",
36
39
  "mic_lc3",
40
+ "mic_health",
37
41
  "stream_status",
38
42
  "ota_start_ack",
39
43
  "ota_status",
@@ -47,8 +51,8 @@ const addListener = (eventName, listener) => {
47
51
  }
48
52
  return PrivateBluetoothSdkModule.addListener(eventName, listener);
49
53
  };
50
- const startOtaUpdate = () => {
51
- return PrivateBluetoothSdkModule.startOtaUpdate();
54
+ const startOtaUpdate = (otaVersionUrl) => {
55
+ return PrivateBluetoothSdkModule.startOtaUpdate(otaVersionUrl);
52
56
  };
53
57
  const bindPublicMethod = (name) => {
54
58
  const method = PrivateBluetoothSdkModule[name];
@@ -83,6 +87,7 @@ export const BluetoothSdk = Object.freeze({
83
87
  sendWifiCredentials: bindPublicMethod("sendWifiCredentials"),
84
88
  forgetWifiNetwork: bindPublicMethod("forgetWifiNetwork"),
85
89
  setHotspotState: bindPublicMethod("setHotspotState"),
90
+ setWifiAdbState: bindPublicMethod("setWifiAdbState"),
86
91
  setGalleryModeEnabled: bindPublicMethod("setGalleryModeEnabled"),
87
92
  setVoiceActivityDetectionEnabled: bindPublicMethod("setVoiceActivityDetectionEnabled"),
88
93
  setLoudnessGateEnabled: bindPublicMethod("setLoudnessGateEnabled"),
@@ -111,6 +116,7 @@ export const BluetoothSdk = Object.freeze({
111
116
  stopCameraWarmUp: bindPublicMethod("stopCameraWarmUp"),
112
117
  startVideoRecording: bindPublicMethod("startVideoRecording"),
113
118
  stopVideoRecording: bindPublicMethod("stopVideoRecording"),
119
+ queryVideoRecordingStatus: bindPublicMethod("queryVideoRecordingStatus"),
114
120
  startStream: bindPublicMethod("startStream"),
115
121
  stopStream: bindPublicMethod("stopStream"),
116
122
  setMicState: bindPublicMethod("setMicState"),
@@ -120,6 +126,8 @@ export const BluetoothSdk = Object.freeze({
120
126
  setGlassesMediaVolume: bindPublicMethod("setGlassesMediaVolume"),
121
127
  rgbLedControl: bindPublicMethod("rgbLedControl"),
122
128
  requestVersionInfo: bindPublicMethod("requestVersionInfo"),
129
+ setOtaVersionUrl: bindPublicMethod("setOtaVersionUrl"),
130
+ getOtaVersionUrl: bindPublicMethod("getOtaVersionUrl"),
123
131
  checkForOtaUpdate: bindPublicMethod("checkForOtaUpdate"),
124
132
  startOtaUpdate,
125
133
  startAr99OtaFromFile: bindPublicMethod("startAr99OtaFromFile"),
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,MAAM,+BAA+B,CAAA;AAQrE,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAwB;IACxD,KAAK;IACL,mBAAmB;IACnB,wBAAwB;IACxB,mBAAmB;IACnB,cAAc;IACd,aAAa;IACb,aAAa;IACb,SAAS;IACT,iCAAiC;IACjC,iBAAiB;IACjB,gBAAgB;IAChB,qBAAqB;IACrB,oBAAoB;IACpB,kBAAkB;IAClB,uBAAuB;IACvB,eAAe;IACf,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,wBAAwB;IACxB,eAAe;IACf,aAAa;IACb,gBAAgB;IAChB,gCAAgC;IAChC,qBAAqB;IACrB,eAAe;IACf,0BAA0B;IAC1B,cAAc;IACd,cAAc;IACd,sBAAsB;IACtB,iBAAiB;IACjB,oBAAoB;IACpB,SAAS;IACT,SAAS;IACT,eAAe;IACf,eAAe;IACf,YAAY;IACZ,iBAAiB;IACjB,cAAc;IACd,qBAAqB;CACtB,CAAC,CAAA;AAEF,MAAM,WAAW,GAA4C,CAAC,SAAS,EAAE,QAAQ,EAA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E,kBAAkB,EAAE,gBAAgB,CAAC,oBAAoB,CAAC;IAC1D,eAAe,EAAE,gBAAgB,CAAC,iBAAiB,CAAC;IACpD,sBAAsB,EAAE,gBAAgB,CAAC,wBAAwB,CAAC;IAClE,gBAAgB,EAAE,gBAAgB,CAAC,kBAAkB,CAAC;IACtD,aAAa,EAAE,gBAAgB,CAAC,eAAe,CAAC;IAChD,kBAAkB,EAAE,gBAAgB,CAAC,oBAAoB,CAAC;IAC1D,kBAAkB,EAAE,gBAAgB,CAAC,oBAAoB,CAAC;IAC1D,eAAe,EAAE,gBAAgB,CAAC,iBAAiB,CAAC;IACpD,mBAAmB,EAAE,gBAAgB,CAAC,qBAAqB,CAAC;IAC5D,sBAAsB,EAAE,gBAAgB,CAAC,wBAAwB,CAAC;IAClE,gBAAgB,EAAE,gBAAgB,CAAC,kBAAkB,CAAC;IACtD,gBAAgB,EAAE,gBAAgB,CAAC,kBAAkB,CAAC;CACvD,CAAC,CAAA;AAEF,eAAe,YAAY,CAAA;AAE3B,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,6BAA6B,EAC7B,kCAAkC,EAClC,qBAAqB,EACrB,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAA","sourcesContent":["import PrivateBluetoothSdkModule from \"./_private/BluetoothSdkModule\"\nimport type {\n BluetoothSdkEventListener,\n BluetoothSdkEventName,\n BluetoothSdkPublicModule,\n VideoRecordingDefaults,\n} from \"./BluetoothSdk.types\"\n\nconst PUBLIC_EVENT_NAMES = new Set<BluetoothSdkEventName>([\n \"log\",\n \"device_discovered\",\n \"default_device_changed\",\n \"glasses_not_ready\",\n \"button_press\",\n \"touch_event\",\n \"accel_event\",\n \"head_up\",\n \"voice_activity_detection_status\",\n \"speaking_status\",\n \"battery_status\",\n \"local_transcription\",\n \"wifi_status_change\",\n \"wifi_scan_result\",\n \"hotspot_status_change\",\n \"hotspot_error\",\n \"photo_response\",\n \"photo_status\",\n \"camera_status\",\n \"video_recording_status\",\n \"media_success\",\n \"media_error\",\n \"gallery_status\",\n \"compatible_glasses_search_stop\",\n \"swipe_volume_status\",\n \"switch_status\",\n \"rgb_led_control_response\",\n \"settings_ack\",\n \"pair_failure\",\n \"audio_pairing_needed\",\n \"audio_connected\",\n \"audio_disconnected\",\n \"mic_pcm\",\n \"mic_lc3\",\n \"stream_status\",\n \"ota_start_ack\",\n \"ota_status\",\n \"ar99_ota_status\",\n \"version_info\",\n \"extraction_progress\",\n])\n\nconst addListener: BluetoothSdkPublicModule[\"addListener\"] = (eventName, listener) => {\n if (!PUBLIC_EVENT_NAMES.has(eventName)) {\n throw new Error(`Unsupported BluetoothSdk event \"${eventName}\". Use @mentra/bluetooth-sdk/react for status state.`)\n }\n return PrivateBluetoothSdkModule.addListener(eventName, listener as BluetoothSdkEventListener<BluetoothSdkEventName>)\n}\n\nconst startOtaUpdate: BluetoothSdkPublicModule[\"startOtaUpdate\"] = () => {\n return PrivateBluetoothSdkModule.startOtaUpdate()\n}\n\nconst bindPublicMethod = <K extends keyof BluetoothSdkPublicModule>(name: K): BluetoothSdkPublicModule[K] => {\n const method = (PrivateBluetoothSdkModule as unknown as Record<string, unknown>)[name]\n if (typeof method === \"function\") {\n return method.bind(PrivateBluetoothSdkModule) as BluetoothSdkPublicModule[K]\n }\n\n return (async () => {\n throw new Error(`BluetoothSdk.${String(name)} is not available in this native build. Rebuild the app.`)\n }) as unknown as BluetoothSdkPublicModule[K]\n}\n\nexport const BluetoothSdk: BluetoothSdkPublicModule = Object.freeze({\n addListener,\n getDefaultDevice: bindPublicMethod(\"getDefaultDevice\"),\n setDefaultDevice: bindPublicMethod(\"setDefaultDevice\"),\n clearDefaultDevice: bindPublicMethod(\"clearDefaultDevice\"),\n startScan: bindPublicMethod(\"startScan\"),\n stopScan: bindPublicMethod(\"stopScan\"),\n scan: bindPublicMethod(\"scan\") as BluetoothSdkPublicModule[\"scan\"],\n connect: bindPublicMethod(\"connect\"),\n connectDefault: bindPublicMethod(\"connectDefault\"),\n cancelConnectionAttempt: bindPublicMethod(\"cancelConnectionAttempt\"),\n disconnect: bindPublicMethod(\"disconnect\"),\n forget: bindPublicMethod(\"forget\"),\n displayText: bindPublicMethod(\"displayText\"),\n clearDisplay: bindPublicMethod(\"clearDisplay\"),\n showDashboard: bindPublicMethod(\"showDashboard\"),\n setDashboardPosition: bindPublicMethod(\"setDashboardPosition\"),\n setHeadUpAngle: bindPublicMethod(\"setHeadUpAngle\"),\n setImuEnabled: bindPublicMethod(\"setImuEnabled\"),\n setScreenDisabled: bindPublicMethod(\"setScreenDisabled\"),\n requestWifiScan: bindPublicMethod(\"requestWifiScan\"),\n sendWifiCredentials: bindPublicMethod(\"sendWifiCredentials\"),\n forgetWifiNetwork: bindPublicMethod(\"forgetWifiNetwork\"),\n setHotspotState: bindPublicMethod(\"setHotspotState\"),\n setGalleryModeEnabled: bindPublicMethod(\"setGalleryModeEnabled\"),\n setVoiceActivityDetectionEnabled: bindPublicMethod(\"setVoiceActivityDetectionEnabled\"),\n setLoudnessGateEnabled: bindPublicMethod(\"setLoudnessGateEnabled\"),\n /**\n * @deprecated Sticky action-button photo presets are deprecated. Prefer per-request\n * `requestPhoto(...)` options (e.g. `mode: \"text\"` for text sensor size/crop, or explicit per-shot\n * fields). Still functional until removed in a future release.\n */\n setPhotoCaptureDefaults: bindPublicMethod(\"setPhotoCaptureDefaults\"),\n setVideoRecordingDefaults: ({width, height, fps}: VideoRecordingDefaults) => {\n const method = (PrivateBluetoothSdkModule as unknown as Record<string, unknown>).setVideoRecordingDefaults\n if (typeof method !== \"function\") {\n return Promise.reject(\n new Error(\"BluetoothSdk.setVideoRecordingDefaults is not available in this native build. Rebuild the app.\"),\n )\n }\n return PrivateBluetoothSdkModule.setVideoRecordingDefaults(width, height, fps)\n },\n setMaxVideoRecordingDuration: bindPublicMethod(\"setMaxVideoRecordingDuration\"),\n setCameraFov: bindPublicMethod(\"setCameraFov\"),\n setLegacyCameraFov: bindPublicMethod(\"setLegacyCameraFov\"),\n setCameraFovOverride: bindPublicMethod(\"setCameraFovOverride\"),\n releaseCameraFovOverride: bindPublicMethod(\"releaseCameraFovOverride\"),\n setCameraTuningConfig: bindPublicMethod(\"setCameraTuningConfig\"),\n queryGalleryStatus: bindPublicMethod(\"queryGalleryStatus\"),\n requestPhoto: bindPublicMethod(\"requestPhoto\"),\n warmUpCamera: bindPublicMethod(\"warmUpCamera\"),\n stopCameraWarmUp: bindPublicMethod(\"stopCameraWarmUp\"),\n startVideoRecording: bindPublicMethod(\"startVideoRecording\"),\n stopVideoRecording: bindPublicMethod(\"stopVideoRecording\"),\n startStream: bindPublicMethod(\"startStream\"),\n stopStream: bindPublicMethod(\"stopStream\"),\n setMicState: bindPublicMethod(\"setMicState\"),\n setPreferredMic: bindPublicMethod(\"setPreferredMic\"),\n setOwnAppAudioPlaying: bindPublicMethod(\"setOwnAppAudioPlaying\"),\n getGlassesMediaVolume: bindPublicMethod(\"getGlassesMediaVolume\"),\n setGlassesMediaVolume: bindPublicMethod(\"setGlassesMediaVolume\"),\n rgbLedControl: bindPublicMethod(\"rgbLedControl\"),\n requestVersionInfo: bindPublicMethod(\"requestVersionInfo\"),\n checkForOtaUpdate: bindPublicMethod(\"checkForOtaUpdate\"),\n startOtaUpdate,\n startAr99OtaFromFile: bindPublicMethod(\"startAr99OtaFromFile\"),\n cancelAr99Ota: bindPublicMethod(\"cancelAr99Ota\"),\n sendAr99FactoryReset: bindPublicMethod(\"sendAr99FactoryReset\"),\n buildAr99OtaSignature: bindPublicMethod(\"buildAr99OtaSignature\"),\n setSttModelDetails: bindPublicMethod(\"setSttModelDetails\"),\n getSttModelPath: bindPublicMethod(\"getSttModelPath\"),\n checkSttModelAvailable: bindPublicMethod(\"checkSttModelAvailable\"),\n validateSttModel: bindPublicMethod(\"validateSttModel\"),\n extractTarBz2: bindPublicMethod(\"extractTarBz2\"),\n restartTranscriber: bindPublicMethod(\"restartTranscriber\"),\n setTtsModelDetails: bindPublicMethod(\"setTtsModelDetails\"),\n getTtsModelPath: bindPublicMethod(\"getTtsModelPath\"),\n getTtsModelLanguage: bindPublicMethod(\"getTtsModelLanguage\"),\n checkTtsModelAvailable: bindPublicMethod(\"checkTtsModelAvailable\"),\n validateTtsModel: bindPublicMethod(\"validateTtsModel\"),\n generateTtsAudio: bindPublicMethod(\"generateTtsAudio\"),\n})\n\nexport default BluetoothSdk\n\nexport {\n CAMERA_FOV_DEFAULT,\n CAMERA_FOV_MAX,\n CAMERA_FOV_MIN,\n DeviceModels,\n isBusyGlassesConnectionStatus,\n isConnectedGlassesConnectionStatus,\n isConnectedWifiStatus,\n isEnabledHotspotStatus,\n isReadyGlassesConnectionStatus,\n} from \"./BluetoothSdk.types\"\n\nexport type {\n AccelEvent,\n Ar99OtaStatusEvent,\n AudioConnectedEvent,\n AudioDisconnectedEvent,\n AudioPairingNeededEvent,\n BatteryStatusEvent,\n BluetoothSdkEvent,\n BluetoothSdkEventListener,\n BluetoothSdkEventMap,\n BluetoothSdkEventName,\n BluetoothSdkPublicModule as BluetoothSdkModule,\n BluetoothSdkSubscription,\n ButtonPhotoSize,\n PhotoCaptureDefaults,\n ButtonPressEvent,\n CameraFovPreset,\n CameraFovRequest,\n CameraFovResult,\n CameraRoiPosition,\n CompatibleGlassesSearchStopEvent,\n ConnectOptions,\n ConnectedGlassesConnectionStatus,\n ConnectedWifiStatus,\n Device,\n DeviceModel,\n EnabledHotspotStatus,\n GalleryStatusEvent,\n GlassesConnectionStatus,\n GlassesMediaVolumeGetResult,\n GlassesMediaVolumeSetResult,\n GlassesNotReadyEvent,\n HeadUpEvent,\n HotspotErrorEvent,\n HotspotStatus,\n HotspotStatusChangeEvent,\n LocalTranscriptionEvent,\n LogEvent,\n MicLc3Event,\n MicMode,\n MicPcmEvent,\n MicPreference,\n OtaStartAckEvent,\n OtaStatus,\n OtaStatusEvent,\n OtaQueryResult,\n PairFailureEvent,\n PhotoCaptureMetadata,\n PhotoResolvedConfig,\n PhotoCompression,\n PhotoFpsRange,\n PhotoMeteredPreview,\n PhotoMode,\n PhotoTransferMethod,\n PhotoResponseEvent,\n PhotoRequestedCaptureConfig,\n PhotoRequestParams,\n PhotoSize,\n PhotoStatusEvent,\n PhotoStatusState,\n PhotoSuccessResponseEvent,\n RgbLedAction,\n RgbLedColor,\n RgbLedControlResponseEvent,\n RgbLedControlSuccessResponseEvent,\n ScanModelOptions,\n ScanOptions,\n ScanResultsCallback,\n SpeakingStatusEvent,\n SettingsAckEvent,\n SettingsAckSetting,\n SettingsAckSuccessEvent,\n SettingsAckSuccessStatus,\n SettingsAckStatus,\n StreamAudioConfig,\n StreamResolvedConfig,\n StreamStartRequest,\n StreamStatusEvent,\n StreamStatusLifecycleState,\n StreamStatusReconnectState,\n StreamStatusState,\n StreamVideoConfig,\n SwipeVolumeStatusEvent,\n SwitchStatusEvent,\n TouchEvent,\n VideoRecordingDefaults,\n VideoRecordingStartedStatusEvent,\n VideoRecordingStatusEvent,\n VideoRecordingStatusState,\n VideoRecordingStoppedStatusEvent,\n VideoRecordingSuccessStatusEvent,\n VersionInfoEvent,\n VersionInfoResult,\n WifiScanResultEvent,\n VoiceActivityDetectionStatusEvent,\n WifiSearchResult,\n WifiStatus,\n WifiStatusChangeEvent,\n} from \"./BluetoothSdk.types\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,MAAM,+BAA+B,CAAA;AAQrE,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAwB;IACxD,KAAK;IACL,mBAAmB;IACnB,wBAAwB;IACxB,mBAAmB;IACnB,cAAc;IACd,aAAa;IACb,aAAa;IACb,SAAS;IACT,iCAAiC;IACjC,iBAAiB;IACjB,gBAAgB;IAChB,qBAAqB;IACrB,oBAAoB;IACpB,kBAAkB;IAClB,uBAAuB;IACvB,eAAe;IACf,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,wBAAwB;IACxB,eAAe;IACf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AClB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,6BAA6B,EAC7B,kCAAkC,EAClC,qBAAqB,EACrB,sBAAsB,EACtB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAA","sourcesContent":["import PrivateBluetoothSdkModule from \"./_private/BluetoothSdkModule\"\nimport type {\n BluetoothSdkEventListener,\n BluetoothSdkEventName,\n BluetoothSdkPublicModule,\n VideoRecordingDefaults,\n} from \"./BluetoothSdk.types\"\n\nconst PUBLIC_EVENT_NAMES = new Set<BluetoothSdkEventName>([\n \"log\",\n \"device_discovered\",\n \"default_device_changed\",\n \"glasses_not_ready\",\n \"button_press\",\n \"touch_event\",\n \"accel_event\",\n \"head_up\",\n \"voice_activity_detection_status\",\n \"speaking_status\",\n \"battery_status\",\n \"local_transcription\",\n \"wifi_status_change\",\n \"wifi_scan_result\",\n \"hotspot_status_change\",\n \"hotspot_error\",\n \"photo_response\",\n \"photo_status\",\n \"camera_status\",\n \"video_recording_status\",\n \"media_success\",\n \"media_error\",\n \"gallery_status\",\n \"compatible_glasses_search_stop\",\n \"swipe_volume_status\",\n \"switch_status\",\n \"rgb_led_control_response\",\n \"settings_ack\",\n \"pair_failure\",\n \"pairing_info\",\n \"entering_pairing_mode\",\n \"owner_replaced\",\n \"audio_pairing_needed\",\n \"audio_connected\",\n \"audio_disconnected\",\n \"mic_pcm\",\n \"mic_lc3\",\n \"mic_health\",\n \"stream_status\",\n \"ota_start_ack\",\n \"ota_status\",\n \"ar99_ota_status\",\n \"version_info\",\n \"extraction_progress\",\n])\n\nconst addListener: BluetoothSdkPublicModule[\"addListener\"] = (eventName, listener) => {\n if (!PUBLIC_EVENT_NAMES.has(eventName)) {\n throw new Error(`Unsupported BluetoothSdk event \"${eventName}\". Use @mentra/bluetooth-sdk/react for status state.`)\n }\n return PrivateBluetoothSdkModule.addListener(eventName, listener as BluetoothSdkEventListener<BluetoothSdkEventName>)\n}\n\nconst startOtaUpdate: BluetoothSdkPublicModule[\"startOtaUpdate\"] = (otaVersionUrl) => {\n return PrivateBluetoothSdkModule.startOtaUpdate(otaVersionUrl)\n}\n\nconst bindPublicMethod = <K extends keyof BluetoothSdkPublicModule>(name: K): BluetoothSdkPublicModule[K] => {\n const method = (PrivateBluetoothSdkModule as unknown as Record<string, unknown>)[name]\n if (typeof method === \"function\") {\n return method.bind(PrivateBluetoothSdkModule) as BluetoothSdkPublicModule[K]\n }\n\n return (async () => {\n throw new Error(`BluetoothSdk.${String(name)} is not available in this native build. Rebuild the app.`)\n }) as unknown as BluetoothSdkPublicModule[K]\n}\n\nexport const BluetoothSdk: BluetoothSdkPublicModule = Object.freeze({\n addListener,\n getDefaultDevice: bindPublicMethod(\"getDefaultDevice\"),\n setDefaultDevice: bindPublicMethod(\"setDefaultDevice\"),\n clearDefaultDevice: bindPublicMethod(\"clearDefaultDevice\"),\n startScan: bindPublicMethod(\"startScan\"),\n stopScan: bindPublicMethod(\"stopScan\"),\n scan: bindPublicMethod(\"scan\") as BluetoothSdkPublicModule[\"scan\"],\n connect: bindPublicMethod(\"connect\"),\n connectDefault: bindPublicMethod(\"connectDefault\"),\n cancelConnectionAttempt: bindPublicMethod(\"cancelConnectionAttempt\"),\n disconnect: bindPublicMethod(\"disconnect\"),\n forget: bindPublicMethod(\"forget\"),\n displayText: bindPublicMethod(\"displayText\"),\n clearDisplay: bindPublicMethod(\"clearDisplay\"),\n showDashboard: bindPublicMethod(\"showDashboard\"),\n setDashboardPosition: bindPublicMethod(\"setDashboardPosition\"),\n setHeadUpAngle: bindPublicMethod(\"setHeadUpAngle\"),\n setImuEnabled: bindPublicMethod(\"setImuEnabled\"),\n setScreenDisabled: bindPublicMethod(\"setScreenDisabled\"),\n requestWifiScan: bindPublicMethod(\"requestWifiScan\"),\n sendWifiCredentials: bindPublicMethod(\"sendWifiCredentials\"),\n forgetWifiNetwork: bindPublicMethod(\"forgetWifiNetwork\"),\n setHotspotState: bindPublicMethod(\"setHotspotState\"),\n setWifiAdbState: bindPublicMethod(\"setWifiAdbState\"),\n setGalleryModeEnabled: bindPublicMethod(\"setGalleryModeEnabled\"),\n setVoiceActivityDetectionEnabled: bindPublicMethod(\"setVoiceActivityDetectionEnabled\"),\n setLoudnessGateEnabled: bindPublicMethod(\"setLoudnessGateEnabled\"),\n /**\n * @deprecated Sticky action-button photo presets are deprecated. Prefer per-request\n * `requestPhoto(...)` options (e.g. `mode: \"text\"` for text sensor size/crop, or explicit per-shot\n * fields). Still functional until removed in a future release.\n */\n setPhotoCaptureDefaults: bindPublicMethod(\"setPhotoCaptureDefaults\"),\n setVideoRecordingDefaults: ({width, height, fps}: VideoRecordingDefaults) => {\n const method = (PrivateBluetoothSdkModule as unknown as Record<string, unknown>).setVideoRecordingDefaults\n if (typeof method !== \"function\") {\n return Promise.reject(\n new Error(\"BluetoothSdk.setVideoRecordingDefaults is not available in this native build. Rebuild the app.\"),\n )\n }\n return PrivateBluetoothSdkModule.setVideoRecordingDefaults(width, height, fps)\n },\n setMaxVideoRecordingDuration: bindPublicMethod(\"setMaxVideoRecordingDuration\"),\n setCameraFov: bindPublicMethod(\"setCameraFov\"),\n setLegacyCameraFov: bindPublicMethod(\"setLegacyCameraFov\"),\n setCameraFovOverride: bindPublicMethod(\"setCameraFovOverride\"),\n releaseCameraFovOverride: bindPublicMethod(\"releaseCameraFovOverride\"),\n setCameraTuningConfig: bindPublicMethod(\"setCameraTuningConfig\"),\n queryGalleryStatus: bindPublicMethod(\"queryGalleryStatus\"),\n requestPhoto: bindPublicMethod(\"requestPhoto\"),\n warmUpCamera: bindPublicMethod(\"warmUpCamera\"),\n stopCameraWarmUp: bindPublicMethod(\"stopCameraWarmUp\"),\n startVideoRecording: bindPublicMethod(\"startVideoRecording\"),\n stopVideoRecording: bindPublicMethod(\"stopVideoRecording\"),\n queryVideoRecordingStatus: bindPublicMethod(\"queryVideoRecordingStatus\"),\n startStream: bindPublicMethod(\"startStream\"),\n stopStream: bindPublicMethod(\"stopStream\"),\n setMicState: bindPublicMethod(\"setMicState\"),\n setPreferredMic: bindPublicMethod(\"setPreferredMic\"),\n setOwnAppAudioPlaying: bindPublicMethod(\"setOwnAppAudioPlaying\"),\n getGlassesMediaVolume: bindPublicMethod(\"getGlassesMediaVolume\"),\n setGlassesMediaVolume: bindPublicMethod(\"setGlassesMediaVolume\"),\n rgbLedControl: bindPublicMethod(\"rgbLedControl\"),\n requestVersionInfo: bindPublicMethod(\"requestVersionInfo\"),\n setOtaVersionUrl: bindPublicMethod(\"setOtaVersionUrl\"),\n getOtaVersionUrl: bindPublicMethod(\"getOtaVersionUrl\"),\n checkForOtaUpdate: bindPublicMethod(\"checkForOtaUpdate\"),\n startOtaUpdate,\n startAr99OtaFromFile: bindPublicMethod(\"startAr99OtaFromFile\"),\n cancelAr99Ota: bindPublicMethod(\"cancelAr99Ota\"),\n sendAr99FactoryReset: bindPublicMethod(\"sendAr99FactoryReset\"),\n buildAr99OtaSignature: bindPublicMethod(\"buildAr99OtaSignature\"),\n setSttModelDetails: bindPublicMethod(\"setSttModelDetails\"),\n getSttModelPath: bindPublicMethod(\"getSttModelPath\"),\n checkSttModelAvailable: bindPublicMethod(\"checkSttModelAvailable\"),\n validateSttModel: bindPublicMethod(\"validateSttModel\"),\n extractTarBz2: bindPublicMethod(\"extractTarBz2\"),\n restartTranscriber: bindPublicMethod(\"restartTranscriber\"),\n setTtsModelDetails: bindPublicMethod(\"setTtsModelDetails\"),\n getTtsModelPath: bindPublicMethod(\"getTtsModelPath\"),\n getTtsModelLanguage: bindPublicMethod(\"getTtsModelLanguage\"),\n checkTtsModelAvailable: bindPublicMethod(\"checkTtsModelAvailable\"),\n validateTtsModel: bindPublicMethod(\"validateTtsModel\"),\n generateTtsAudio: bindPublicMethod(\"generateTtsAudio\"),\n})\n\nexport default BluetoothSdk\n\nexport {\n CAMERA_FOV_DEFAULT,\n CAMERA_FOV_MAX,\n CAMERA_FOV_MIN,\n DeviceModels,\n isBusyGlassesConnectionStatus,\n isConnectedGlassesConnectionStatus,\n isConnectedWifiStatus,\n isEnabledHotspotStatus,\n isReadyGlassesConnectionStatus,\n} from \"./BluetoothSdk.types\"\n\nexport type {\n AccelEvent,\n Ar99OtaStatusEvent,\n AudioConnectedEvent,\n AudioDisconnectedEvent,\n AudioPairingNeededEvent,\n BatteryStatusEvent,\n BluetoothSdkEvent,\n BluetoothSdkEventListener,\n BluetoothSdkEventMap,\n BluetoothSdkEventName,\n BluetoothSdkPublicModule as BluetoothSdkModule,\n BluetoothSdkSubscription,\n ButtonPhotoSize,\n PhotoCaptureDefaults,\n ButtonPressEvent,\n CameraFovPreset,\n CameraFovRequest,\n CameraFovResult,\n CameraRoiPosition,\n CompatibleGlassesSearchStopEvent,\n ConnectOptions,\n ConnectedGlassesConnectionStatus,\n ConnectedWifiStatus,\n Device,\n DeviceModel,\n EnabledHotspotStatus,\n GalleryStatusEvent,\n GlassesConnectionStatus,\n GlassesMediaVolumeGetResult,\n GlassesMediaVolumeSetResult,\n GlassesNotReadyEvent,\n HeadUpEvent,\n HotspotErrorEvent,\n HotspotStatus,\n HotspotStatusChangeEvent,\n KeepAliveAckEvent,\n LocalTranscriptionEvent,\n LogEvent,\n MicLc3Event,\n MicHealthEvent,\n MicMode,\n MicPcmEvent,\n MicPreference,\n OtaStartAckEvent,\n OtaProgress,\n OtaProgressStatus,\n OtaStage,\n OtaStatus,\n OtaStatusEvent,\n OtaQueryResult,\n OtaUpdateInfo,\n PairFailureEvent,\n PairingInfoEvent,\n EnteringPairingModeEvent,\n OwnerReplacedEvent,\n PhotoCaptureMetadata,\n PhotoResolvedConfig,\n PhotoCompression,\n PhotoFpsRange,\n PhotoMeteredPreview,\n PhotoMode,\n PhotoTransferMethod,\n PhotoResponseEvent,\n PhotoRequestedCaptureConfig,\n PhotoRequestParams,\n PhotoSize,\n PhotoStatusEvent,\n PhotoStatusState,\n PhotoSuccessResponseEvent,\n RgbLedAction,\n RgbLedColor,\n RgbLedControlResponseEvent,\n RgbLedControlSuccessResponseEvent,\n ScanModelOptions,\n ScanOptions,\n ScanResultsCallback,\n SpeakingStatusEvent,\n SettingsAckEvent,\n SettingsAckSetting,\n SettingsAckSuccessEvent,\n SettingsAckSuccessStatus,\n SettingsAckStatus,\n StreamAudioConfig,\n StreamResolvedConfig,\n StreamStartRequest,\n StreamStatusEvent,\n StreamStatusLifecycleState,\n StreamStatusReconnectState,\n StreamStatusState,\n StreamVideoConfig,\n SwipeVolumeStatusEvent,\n SwitchStatusEvent,\n TouchEvent,\n VideoRecordingDefaults,\n VideoRecordingStartedStatusEvent,\n VideoRecordingStatusEvent,\n VideoRecordingStatusState,\n VideoRecordingStoppedStatusEvent,\n VideoRecordingSuccessStatusEvent,\n VersionInfoEvent,\n VersionInfoResult,\n WifiScanResultEvent,\n VoiceActivityDetectionStatusEvent,\n WifiSearchResult,\n WifiStatus,\n WifiStatusChangeEvent,\n} from \"./BluetoothSdk.types\"\n"]}
@@ -0,0 +1,14 @@
1
+ export type OtaServerResult = {
2
+ baseUrl: string;
3
+ host: string;
4
+ manifestUrl: string;
5
+ port: number;
6
+ };
7
+ export type MentraOtaServerModuleEvents = {
8
+ artifactDownloadProgress: (event: {
9
+ destination: string;
10
+ bytesWritten: number;
11
+ contentLength: number;
12
+ }) => void;
13
+ };
14
+ //# sourceMappingURL=MentraOtaServer.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MentraOtaServer.types.d.ts","sourceRoot":"","sources":["../../src/ota-server/MentraOtaServer.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,wBAAwB,EAAE,CAAC,KAAK,EAAE;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAC,KAAK,IAAI,CAAA;CAC9G,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=MentraOtaServer.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MentraOtaServer.types.js","sourceRoot":"","sources":["../../src/ota-server/MentraOtaServer.types.ts"],"names":[],"mappings":"","sourcesContent":["export type OtaServerResult = {\n baseUrl: string\n host: string\n manifestUrl: string\n port: number\n}\n\nexport type MentraOtaServerModuleEvents = {\n artifactDownloadProgress: (event: {destination: string; bytesWritten: number; contentLength: number}) => void\n}\n"]}
@@ -0,0 +1,21 @@
1
+ import { NativeModule } from "expo";
2
+ import type { MentraOtaServerModuleEvents, OtaServerResult } from "./MentraOtaServer.types";
3
+ declare class MentraOtaServerModule extends NativeModule<MentraOtaServerModuleEvents> {
4
+ /**
5
+ * Serve `manifestJson` at /version.json and `artifactPaths` (sha256 -> local file path)
6
+ * at /artifacts/<sha256>. Pass `host` when the caller knows the authoritative local
7
+ * address (e.g. from the scoped hotspot network); omit to fall back to interface
8
+ * scanning. Returns the URLs to hand to the glasses via ota_start.
9
+ */
10
+ startOtaServer(manifestJson: string, artifactPaths: Record<string, string>, host?: string | null): Promise<OtaServerResult>;
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
+ downloadArtifact(source: string, destination: string): Promise<{
15
+ statusCode: number;
16
+ bytesWritten: number;
17
+ }>;
18
+ }
19
+ declare const _default: MentraOtaServerModule;
20
+ export default _default;
21
+ //# sourceMappingURL=MentraOtaServerModule.d.ts.map
@@ -0,0 +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,yFAAyF;IACzF,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IACvE,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"}
@@ -0,0 +1,3 @@
1
+ import { requireNativeModule } from "expo";
2
+ export default requireNativeModule("MentraOtaServer");
3
+ //# sourceMappingURL=MentraOtaServerModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MentraOtaServerModule.js","sourceRoot":"","sources":["../../src/ota-server/MentraOtaServerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,mBAAmB,EAAC,MAAM,MAAM,CAAA;AAsBtD,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 /** Wait for iPhone Wi-Fi (`en0`) to acquire an address on the glasses gateway subnet. */\n waitForWifiAddress(gateway: string, timeoutMs: number): Promise<string>\n downloadArtifact(source: string, destination: string): Promise<{statusCode: number; bytesWritten: number}>\n}\n\nexport default requireNativeModule<MentraOtaServerModule>(\"MentraOtaServer\")\n"]}
@@ -0,0 +1,10 @@
1
+ import { NativeModule } from "expo";
2
+ import type { MentraOtaServerModuleEvents, OtaServerResult } from "./MentraOtaServer.types";
3
+ declare class MentraOtaServerModule extends NativeModule<MentraOtaServerModuleEvents> {
4
+ startOtaServer(): Promise<OtaServerResult>;
5
+ stopOtaServer(): Promise<void>;
6
+ waitForWifiAddress(): Promise<string>;
7
+ }
8
+ declare const _default: typeof MentraOtaServerModule;
9
+ export default _default;
10
+ //# sourceMappingURL=MentraOtaServerModule.web.d.ts.map
@@ -0,0 +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;IAE9B,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;CAG5C;;AAED,wBAA0E"}
@@ -0,0 +1,12 @@
1
+ import { NativeModule, registerWebModule } from "expo";
2
+ class MentraOtaServerModule extends NativeModule {
3
+ async startOtaServer() {
4
+ throw new Error("The OTA server is only available in native apps.");
5
+ }
6
+ async stopOtaServer() { }
7
+ async waitForWifiAddress() {
8
+ throw new Error("The OTA server is only available in native apps.");
9
+ }
10
+ }
11
+ export default registerWebModule(MentraOtaServerModule, "MentraOtaServer");
12
+ //# sourceMappingURL=MentraOtaServerModule.web.js.map
@@ -0,0 +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;IAEvC,KAAK,CAAC,kBAAkB;QACtB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;IACrE,CAAC;CACF;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 async waitForWifiAddress(): Promise<string> {\n throw new Error(\"The OTA server is only available in native apps.\")\n }\n}\n\nexport default registerWebModule(MentraOtaServerModule, \"MentraOtaServer\")\n"]}
@@ -0,0 +1,3 @@
1
+ export { default } from "./MentraOtaServerModule";
2
+ export * from "./MentraOtaServer.types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ota-server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,yBAAyB,CAAA;AAC/C,cAAc,yBAAyB,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { default } from "./MentraOtaServerModule";
2
+ export * from "./MentraOtaServer.types";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ota-server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,yBAAyB,CAAA;AAC/C,cAAc,yBAAyB,CAAA","sourcesContent":["export {default} from \"./MentraOtaServerModule\"\nexport * from \"./MentraOtaServer.types\"\n"]}
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "platforms": ["apple", "android"],
3
3
  "apple": {
4
- "modules": ["BluetoothSdkModule", "MentraPhotoReceiverModule"]
4
+ "modules": ["BluetoothSdkModule", "MentraPhotoReceiverModule", "MentraOtaServerModule"]
5
5
  },
6
6
  "android": {
7
7
  "modules": [
8
8
  "com.mentra.bluetoothsdk.BluetoothSdkModule",
9
9
  "com.mentra.bluetoothsdk.MentraLocalNetworkModule",
10
- "com.mentra.bluetoothsdk.photoreceiver.MentraPhotoReceiverModule"
10
+ "com.mentra.bluetoothsdk.photoreceiver.MentraPhotoReceiverModule",
11
+ "com.mentra.bluetoothsdk.otaserver.MentraOtaServerModule"
11
12
  ]
12
13
  }
13
14
  }
@@ -0,0 +1,125 @@
1
+ import Foundation
2
+
3
+ /// Background-capable, native artifact staging for hotspot OTA.
4
+ final class BackgroundOtaArtifactDownloader: NSObject, URLSessionDownloadDelegate, URLSessionTaskDelegate {
5
+ typealias ProgressHandler = (_ destination: String, _ written: Int64, _ total: Int64) -> Void
6
+
7
+ private struct Pending {
8
+ let continuation: CheckedContinuation<[String: Any], Error>
9
+ }
10
+
11
+ private let lock = NSLock()
12
+ private let onProgress: ProgressHandler
13
+ private var pending: [Int: Pending] = [:]
14
+ private lazy var session: URLSession = {
15
+ let configuration = URLSessionConfiguration.background(
16
+ withIdentifier: "com.mentra.bluetooth-sdk.hotspot-ota-artifacts"
17
+ )
18
+ configuration.sessionSendsLaunchEvents = true
19
+ configuration.isDiscretionary = false
20
+ configuration.waitsForConnectivity = true
21
+ return URLSession(configuration: configuration, delegate: self, delegateQueue: nil)
22
+ }()
23
+
24
+ init(onProgress: @escaping ProgressHandler) {
25
+ self.onProgress = onProgress
26
+ super.init()
27
+ }
28
+
29
+ func download(from source: String, to destination: String) async throws -> [String: Any] {
30
+ guard let sourceUrl = URL(string: source),
31
+ sourceUrl.scheme == "https" || sourceUrl.scheme == "http"
32
+ else {
33
+ throw OtaServerError("Invalid artifact URL")
34
+ }
35
+
36
+ if FileManager.default.fileExists(atPath: destination) {
37
+ let size = fileSize(atPath: destination)
38
+ return ["statusCode": 200, "bytesWritten": size]
39
+ }
40
+
41
+ try FileManager.default.createDirectory(
42
+ at: URL(fileURLWithPath: destination).deletingLastPathComponent(),
43
+ withIntermediateDirectories: true
44
+ )
45
+
46
+ return try await withCheckedThrowingContinuation { continuation in
47
+ let task = session.downloadTask(with: sourceUrl)
48
+ task.taskDescription = destination
49
+ lock.lock()
50
+ pending[task.taskIdentifier] = Pending(continuation: continuation)
51
+ lock.unlock()
52
+ task.resume()
53
+ }
54
+ }
55
+
56
+ func urlSession(
57
+ _: URLSession,
58
+ downloadTask: URLSessionDownloadTask,
59
+ didWriteData _: Int64,
60
+ totalBytesWritten: Int64,
61
+ totalBytesExpectedToWrite: Int64
62
+ ) {
63
+ guard let destination = downloadTask.taskDescription else { return }
64
+ onProgress(destination, totalBytesWritten, totalBytesExpectedToWrite)
65
+ }
66
+
67
+ func urlSession(
68
+ _: URLSession,
69
+ downloadTask: URLSessionDownloadTask,
70
+ didFinishDownloadingTo location: URL
71
+ ) {
72
+ guard let destination = downloadTask.taskDescription else { return }
73
+ guard let response = downloadTask.response as? HTTPURLResponse,
74
+ (200 ... 299).contains(response.statusCode)
75
+ else {
76
+ let status = (downloadTask.response as? HTTPURLResponse)?.statusCode ?? 0
77
+ reject(
78
+ taskId: downloadTask.taskIdentifier,
79
+ error: OtaServerError("Artifact download failed with HTTP \(status)")
80
+ )
81
+ return
82
+ }
83
+ let destinationUrl = URL(fileURLWithPath: destination)
84
+ do {
85
+ try? FileManager.default.removeItem(at: destinationUrl)
86
+ try FileManager.default.moveItem(at: location, to: destinationUrl)
87
+ let size = fileSize(atPath: destination)
88
+ resolve(
89
+ taskId: downloadTask.taskIdentifier,
90
+ result: ["statusCode": response.statusCode, "bytesWritten": size]
91
+ )
92
+ } catch {
93
+ reject(taskId: downloadTask.taskIdentifier, error: error)
94
+ }
95
+ }
96
+
97
+ func urlSession(_: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
98
+ if let error {
99
+ reject(taskId: task.taskIdentifier, error: error)
100
+ }
101
+ }
102
+
103
+ private func resolve(taskId: Int, result: [String: Any]) {
104
+ lock.lock()
105
+ let item = pending.removeValue(forKey: taskId)
106
+ lock.unlock()
107
+ item?.continuation.resume(returning: result)
108
+ }
109
+
110
+ private func reject(taskId: Int, error: Error) {
111
+ lock.lock()
112
+ let item = pending.removeValue(forKey: taskId)
113
+ lock.unlock()
114
+ item?.continuation.resume(throwing: error)
115
+ }
116
+
117
+ private func fileSize(atPath path: String) -> Int64 {
118
+ guard let value = try? FileManager.default.attributesOfItem(atPath: path)[.size],
119
+ let number = value as? NSNumber
120
+ else {
121
+ return 0
122
+ }
123
+ return number.int64Value
124
+ }
125
+ }
@@ -46,6 +46,9 @@ public class BluetoothSdkModule: Module, MentraBluetoothSDKDelegate {
46
46
  "settings_ack",
47
47
  "version_info",
48
48
  "pair_failure",
49
+ "pairing_info",
50
+ "entering_pairing_mode",
51
+ "owner_replaced",
49
52
  "audio_pairing_needed",
50
53
  "audio_connected",
51
54
  "audio_disconnected",
@@ -57,6 +60,7 @@ public class BluetoothSdkModule: Module, MentraBluetoothSDKDelegate {
57
60
  "ws_bin",
58
61
  "mic_pcm",
59
62
  "mic_lc3",
63
+ "mic_health",
60
64
  "stream_status",
61
65
  "keep_alive_ack",
62
66
  "mtk_update_complete",
@@ -303,6 +307,11 @@ public class BluetoothSdkModule: Module, MentraBluetoothSDKDelegate {
303
307
  return try await sdk.setHotspotState(enabled: enabled).values
304
308
  }
305
309
 
310
+ AsyncFunction("setWifiAdbState") { (enabled: Bool) in
311
+ let sdk = await MainActor.run { self.bluetoothSdk() }
312
+ try await sdk.setWifiAdbState(enabled: enabled)
313
+ }
314
+
306
315
  AsyncFunction("setSystemTime") { (timestampMs: Double) in
307
316
  let maxTimestamp = Double(Int64.max).nextDown
308
317
  guard timestampMs.isFinite,
@@ -562,6 +571,11 @@ public class BluetoothSdkModule: Module, MentraBluetoothSDKDelegate {
562
571
  ).values
563
572
  }
564
573
 
574
+ AsyncFunction("queryVideoRecordingStatus") { (requestId: String) in
575
+ let sdk = await MainActor.run { self.bluetoothSdk() }
576
+ return try await sdk.queryVideoRecordingStatus(requestId: requestId).values
577
+ }
578
+
565
579
  // MARK: - Stream Commands
566
580
 
567
581
  AsyncFunction("startStream") { (params: [String: Any]) in
@@ -812,6 +826,8 @@ public class BluetoothSdkModule: Module, MentraBluetoothSDKDelegate {
812
826
  sendEvent("voice_activity_detection_status", status.values)
813
827
  case let .speakingStatus(status):
814
828
  sendEvent("speaking_status", status.values)
829
+ case let .micHealth(health):
830
+ sendEvent("mic_health", health.values)
815
831
  case let .wifiStatus(status):
816
832
  sendEvent("wifi_status_change", status.values)
817
833
  case let .hotspotStatus(status):
@@ -921,5 +937,3 @@ private extension ConnectOptions {
921
937
 
922
938
 
923
939
 
924
-
925
-