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

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,21 +1,19 @@
1
1
  import Foundation
2
2
 
3
3
  enum OtaManifestDefaults {
4
- private static let sdkOtaReleaseBaseUrl = "https://github.com/Mentra-Community/MentraOS/releases/download/bluetooth-sdk-ota"
5
4
  // ASG builds before 39 ignore ota_start.ota_version_url, so SDK checks must
6
5
  // use the same legacy production manifest those glasses will install from.
7
6
  static let legacyProdOtaVersionUrl = "https://ota.mentraglass.com/prod_live_version.json"
8
7
 
9
8
  static func defaultOtaVersionUrl() throws -> String {
10
- guard let sdkVersion = BluetoothSdkDefaults.sdkVersion,
11
- !sdkVersion.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
12
- else {
9
+ let manifestUrl = GeneratedReleaseMetadata.otaManifestUrl.trimmingCharacters(in: .whitespacesAndNewlines)
10
+ guard !manifestUrl.isEmpty else {
13
11
  throw BluetoothSdkError(
14
- code: "missing_sdk_version",
15
- message: "Cannot determine Bluetooth SDK version for the default OTA manifest URL."
12
+ code: "ota_manifest_unconfigured",
13
+ message: "This source-built Bluetooth SDK has no embedded OTA manifest. Configure one with the debug API."
16
14
  )
17
15
  }
18
- return "\(sdkOtaReleaseBaseUrl)/bluetooth-sdk-\(sdkVersion)-version.json"
16
+ return manifestUrl
19
17
  }
20
18
  }
21
19
 
@@ -7,6 +7,23 @@ public enum MicPreference: String {
7
7
  case bluetooth
8
8
  }
9
9
 
10
+ struct MicHealth {
11
+ let sequenceGapEvents: Int64
12
+ let decodeFailures: Int64
13
+ let lastLc3ReceivedAt: Int64?
14
+ let lastPcmProducedAt: Int64?
15
+
16
+ var dictionary: [String: Any] {
17
+ var values: [String: Any] = [
18
+ "sequenceGapEvents": sequenceGapEvents,
19
+ "decodeFailures": decodeFailures,
20
+ ]
21
+ if let lastLc3ReceivedAt { values["lastLc3ReceivedAt"] = lastLc3ReceivedAt }
22
+ if let lastPcmProducedAt { values["lastPcmProducedAt"] = lastPcmProducedAt }
23
+ return values
24
+ }
25
+ }
26
+
10
27
  public struct LocalTranscriptionEvent: CustomStringConvertible {
11
28
  public let text: String
12
29
  public let isFinal: Bool
@@ -863,3 +863,4 @@ public struct GalleryStatusEvent: CustomStringConvertible {
863
863
  "GalleryStatusEvent(total: \(total), photos: \(photos), videos: \(videos))"
864
864
  }
865
865
  }
866
+
@@ -73,6 +73,30 @@ public struct SpeakingStatusEvent: CustomStringConvertible {
73
73
  }
74
74
  }
75
75
 
76
+ public struct MicHealthEvent: CustomStringConvertible {
77
+ public let reason: String
78
+ public let sequenceGapEvents: Int
79
+ public let decodeFailures: Int
80
+ public let lastLc3ReceivedAt: Int?
81
+ public let lastPcmProducedAt: Int?
82
+ public let timestamp: Int
83
+ public let values: [String: Any]
84
+
85
+ public init(values: [String: Any]) {
86
+ reason = stringValue(values, "reason") ?? ""
87
+ sequenceGapEvents = intValue(values["sequenceGapEvents"]) ?? 0
88
+ decodeFailures = intValue(values["decodeFailures"]) ?? 0
89
+ lastLc3ReceivedAt = intValue(values["lastLc3ReceivedAt"])
90
+ lastPcmProducedAt = intValue(values["lastPcmProducedAt"])
91
+ timestamp = intValue(values["timestamp"]) ?? Int(Date().timeIntervalSince1970 * 1000)
92
+ self.values = values
93
+ }
94
+
95
+ public var description: String {
96
+ "MicHealthEvent(reason: \(reason), sequenceGapEvents: \(sequenceGapEvents), decodeFailures: \(decodeFailures))"
97
+ }
98
+ }
99
+
76
100
  public struct OtaStartAckEvent: CustomStringConvertible {
77
101
  public let timestamp: Int?
78
102
  public let values: [String: Any]
@@ -216,6 +240,7 @@ public enum BluetoothEvent: CustomStringConvertible {
216
240
  case touch(TouchEvent)
217
241
  case voiceActivityDetectionStatus(VoiceActivityDetectionStatusEvent)
218
242
  case speakingStatus(SpeakingStatusEvent)
243
+ case micHealth(MicHealthEvent)
219
244
  case wifiStatus(WifiStatusEvent)
220
245
  case hotspotStatus(HotspotStatusEvent)
221
246
  case hotspotError(HotspotErrorEvent)
@@ -244,6 +269,8 @@ public enum BluetoothEvent: CustomStringConvertible {
244
269
  event.description
245
270
  case let .speakingStatus(event):
246
271
  event.description
272
+ case let .micHealth(event):
273
+ event.description
247
274
  case let .wifiStatus(event):
248
275
  event.description
249
276
  case let .hotspotStatus(event):