@mentra/bluetooth-sdk 0.1.12 → 0.1.14

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 (69) hide show
  1. package/README.md +30 -11
  2. package/android/src/main/java/com/mentra/bluetoothsdk/BluetoothSdkModule.kt +47 -12
  3. package/android/src/main/java/com/mentra/bluetoothsdk/DeviceManager.kt +75 -29
  4. package/android/src/main/java/com/mentra/bluetoothsdk/DeviceStore.kt +1 -5
  5. package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdk.kt +208 -45
  6. package/android/src/main/java/com/mentra/bluetoothsdk/MentraBluetoothSdkDebug.kt +14 -0
  7. package/android/src/main/java/com/mentra/bluetoothsdk/ObservableStore.kt +20 -0
  8. package/android/src/main/java/com/mentra/bluetoothsdk/OtaManifest.kt +153 -0
  9. package/android/src/main/java/com/mentra/bluetoothsdk/camera/CameraModels.kt +80 -14
  10. package/android/src/main/java/com/mentra/bluetoothsdk/controllers/ControllerManager.kt +4 -16
  11. package/android/src/main/java/com/mentra/bluetoothsdk/controllers/R1.kt +4 -8
  12. package/android/src/main/java/com/mentra/bluetoothsdk/services/PhoneMic.kt +90 -4
  13. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G1.kt +3831 -0
  14. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G2.kt +20 -28
  15. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/{Mach1.java → Mach1.kt} +514 -561
  16. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.kt +8674 -0
  17. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraNex.kt +12 -3
  18. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/SGCManager.kt +5 -17
  19. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Simulated.kt +9 -20
  20. package/android/src/main/java/com/mentra/bluetoothsdk/status/DeviceStatus.kt +0 -6
  21. package/android/src/main/java/com/mentra/bluetoothsdk/streaming/StreamModels.kt +16 -33
  22. package/build/BluetoothSdk.types.d.ts +48 -17
  23. package/build/BluetoothSdk.types.d.ts.map +1 -1
  24. package/build/BluetoothSdk.types.js.map +1 -1
  25. package/build/_private/BluetoothSdkModule.d.ts +9 -9
  26. package/build/_private/BluetoothSdkModule.d.ts.map +1 -1
  27. package/build/_private/BluetoothSdkModule.js +0 -6
  28. package/build/_private/BluetoothSdkModule.js.map +1 -1
  29. package/build/_private/photoRequestPayload.d.ts +3 -1
  30. package/build/_private/photoRequestPayload.d.ts.map +1 -1
  31. package/build/_private/photoRequestPayload.js +46 -2
  32. package/build/_private/photoRequestPayload.js.map +1 -1
  33. package/build/debug.d.ts +3 -0
  34. package/build/debug.d.ts.map +1 -0
  35. package/build/debug.js +8 -0
  36. package/build/debug.js.map +1 -0
  37. package/build/index.d.ts +1 -1
  38. package/build/index.d.ts.map +1 -1
  39. package/build/index.js +8 -8
  40. package/build/index.js.map +1 -1
  41. package/ios/BluetoothSdkModule.swift +44 -68
  42. package/ios/Source/BluetoothSdkDefaults.swift +23 -3
  43. package/ios/Source/DeviceManager.swift +38 -33
  44. package/ios/Source/DeviceStore.swift +5 -5
  45. package/ios/Source/MentraBluetoothSDK.swift +217 -50
  46. package/ios/Source/MentraBluetoothSDKDebug.swift +12 -0
  47. package/ios/Source/ObservableStore.swift +11 -0
  48. package/ios/Source/OtaManifest.swift +170 -0
  49. package/ios/Source/camera/CameraModels.swift +219 -13
  50. package/ios/Source/controllers/ControllerManager.swift +3 -7
  51. package/ios/Source/controllers/R1.swift +3 -7
  52. package/ios/Source/sgcs/Frame.swift +0 -2
  53. package/ios/Source/sgcs/G1.swift +7 -8
  54. package/ios/Source/sgcs/G2.swift +21 -20
  55. package/ios/Source/sgcs/Mach1.swift +7 -8
  56. package/ios/Source/sgcs/MentraLive.swift +132 -63
  57. package/ios/Source/sgcs/MentraNex.swift +7 -8
  58. package/ios/Source/sgcs/SGCManager.swift +7 -10
  59. package/ios/Source/sgcs/Simulated.swift +8 -8
  60. package/ios/Source/status/DeviceStatus.swift +1 -9
  61. package/ios/Source/streaming/StreamModels.swift +7 -32
  62. package/package.json +6 -1
  63. package/src/BluetoothSdk.types.ts +49 -17
  64. package/src/_private/BluetoothSdkModule.ts +9 -17
  65. package/src/_private/photoRequestPayload.ts +48 -3
  66. package/src/debug.ts +9 -0
  67. package/src/index.ts +19 -10
  68. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/G1.java +0 -3974
  69. package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.java +0 -7434
@@ -1,5 +1,6 @@
1
1
  package com.mentra.bluetoothsdk.sgcs
2
2
 
3
+ import com.mentra.bluetoothsdk.PhotoRequest
3
4
  import android.bluetooth.BluetoothAdapter
4
5
  import android.bluetooth.BluetoothGatt
5
6
  import android.bluetooth.BluetoothGattCallback
@@ -1838,10 +1839,18 @@ class G2 : SGCManager() {
1838
1839
 
1839
1840
  // ---------- SGCManager: Display Control ----------
1840
1841
 
1842
+ override fun sendText(text: String) {
1843
+ displayScope.launch {
1844
+ displayMutex.withLock {
1845
+ sendText2(text)
1846
+ }
1847
+ }
1848
+ }
1849
+
1841
1850
  override fun sendTextWall(text: String) {
1842
1851
  displayScope.launch {
1843
1852
  displayMutex.withLock {
1844
- sendText(
1853
+ sendText2(
1845
1854
  text,
1846
1855
  x = defaultTextX,
1847
1856
  y = defaultTextY,
@@ -1856,7 +1865,7 @@ class G2 : SGCManager() {
1856
1865
  }
1857
1866
  }
1858
1867
 
1859
- private suspend fun sendText(
1868
+ private suspend fun sendText2(
1860
1869
  text: String,
1861
1870
  x: Int? = null,
1862
1871
  y: Int? = null,
@@ -1917,7 +1926,7 @@ class G2 : SGCManager() {
1917
1926
  contentLength = container.content.toByteArray(Charsets.UTF_8).size,
1918
1927
  content = container.content
1919
1928
  )
1920
- sendEvenHubCommand(msg)
1929
+ queueEvenHubCommand(msg)
1921
1930
  return
1922
1931
  }
1923
1932
  container =
@@ -1955,13 +1964,7 @@ class G2 : SGCManager() {
1955
1964
  imageContainers[i].bmpData = ByteArray(0)
1956
1965
  }
1957
1966
  // shutdown the page and then recreate the containers without the content.
1958
- // Reset pageCreated so the recreate below issues a fresh createPageMessage rather
1959
- // than a rebuildPageMessage that no longer matches the torn-down page.
1960
- val msg = EvenHubProto.shutdownMessage()
1961
- sendEvenHubCommand(msg)
1962
- pageCreated = false
1963
- createPageWithContainers()
1964
- restartMicIfAlreadyEnabled()
1967
+ rebuildPage()
1965
1968
  }
1966
1969
  }
1967
1970
  }
@@ -2145,6 +2148,9 @@ class G2 : SGCManager() {
2145
2148
  // sendEvenHubCommand(textMsg)
2146
2149
  // delay(100)
2147
2150
  // }
2151
+
2152
+ delay(300) // 300ms to settle
2153
+ restartMicIfAlreadyEnabled()
2148
2154
  }
2149
2155
 
2150
2156
  /**
@@ -2635,19 +2641,7 @@ class G2 : SGCManager() {
2635
2641
  }
2636
2642
 
2637
2643
  // Camera & Media - G2 has no camera
2638
- override fun requestPhoto(
2639
- requestId: String,
2640
- appId: String,
2641
- size: String,
2642
- webhookUrl: String?,
2643
- authToken: String?,
2644
- compress: String?,
2645
- flash: Boolean,
2646
- save: Boolean,
2647
- sound: Boolean,
2648
- exposureTimeNs: Long?,
2649
- iso: Int?,
2650
- ) {
2644
+ override fun requestPhoto(request: PhotoRequest) {
2651
2645
  Bridge.log("G2: requestPhoto - not supported (no camera)")
2652
2646
  }
2653
2647
 
@@ -2666,7 +2660,6 @@ class G2 : SGCManager() {
2666
2660
  override fun startVideoRecording(
2667
2661
  requestId: String,
2668
2662
  save: Boolean,
2669
- flash: Boolean,
2670
2663
  sound: Boolean
2671
2664
  ) {
2672
2665
  Bridge.log("G2: startVideoRecording - not supported")
@@ -2689,10 +2682,6 @@ class G2 : SGCManager() {
2689
2682
  Bridge.log("G2: sendButtonMaxRecordingTime")
2690
2683
  }
2691
2684
 
2692
- override fun sendButtonCameraLedSetting() {
2693
- Bridge.log("G2: sendButtonCameraLedSetting")
2694
- }
2695
-
2696
2685
  override fun sendCameraFovSetting() {
2697
2686
  Bridge.log("G2: sendCameraFovSetting")
2698
2687
  }
@@ -3552,6 +3541,9 @@ class G2 : SGCManager() {
3552
3541
  val reader = ProtobufReader(payload)
3553
3542
  val fields = reader.parseFields()
3554
3543
 
3544
+ // print raw payload:
3545
+ Bridge.log("G2: EvenHub response payload: ${payload.joinToString("") { String.format("%02X", it) }}")
3546
+
3555
3547
  val cmdValue =
3556
3548
  fields[1] as? Int
3557
3549
  ?: run {