@mentra/bluetooth-sdk 3.4.0-dev.1011 → 3.4.0-dev.1020

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.
@@ -3,9 +3,9 @@ package com.mentra.bluetoothsdk
3
3
  /** Generated by release CI. Do not edit in a release checkout. */
4
4
  internal object GeneratedReleaseMetadata {
5
5
  const val FAMILY_BASE_VERSION: String = "3.4.0"
6
- const val RELEASE_IDENTITY: String = "3.4.0-dev.1011"
7
- const val RELEASE_SET_ID: String = "mentra-3.4.0-dev.1011"
8
- const val SOURCE_COMMIT: String = "ea742f4c08468623c8194b360643a5395301831e"
9
- const val OTA_MANIFEST_URL: String = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.1011.json"
10
- const val OTA_MANIFEST_SHA256: String = "20c657f72d381c3c4af5dfea9a12285595c1cf9297830dd7ae6d44d2505f98cf"
6
+ const val RELEASE_IDENTITY: String = "3.4.0-dev.1020"
7
+ const val RELEASE_SET_ID: String = "mentra-3.4.0-dev.1020"
8
+ const val SOURCE_COMMIT: String = "d8c0511b179bdab6ce7e31abbc2f7d5f52d573ee"
9
+ const val OTA_MANIFEST_URL: String = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.1020.json"
10
+ const val OTA_MANIFEST_SHA256: String = "93bd2738ed89daa7bfb26932276a6eb52b8cd7d655db5f50018d8d38cd4b08eb"
11
11
  }
@@ -4952,6 +4952,16 @@ class MentraLive : SGCManager() {
4952
4952
 
4953
4953
  handleSwitchStatus(switchType, switchValue, switchTimestamp)
4954
4954
  }
4955
+ "rgb_led_control_response" -> {
4956
+ // Settles the sendRgbLedControl request this reply echoes (matches iOS).
4957
+ val requestId = json.optString("requestId", "")
4958
+ val success =
4959
+ json.optString("state", "") == "success" ||
4960
+ json.optBoolean("success", false)
4961
+ val error =
4962
+ json.optString("errorCode", "").ifEmpty { json.optString("error", "") }
4963
+ Bridge.sendRgbLedControlResponse(requestId, success, error.ifEmpty { null })
4964
+ }
4955
4965
  "sensor_data" -> {
4956
4966
  // Process sensor data
4957
4967
  // ...
@@ -0,0 +1,76 @@
1
+ package com.mentra.bluetoothsdk.sgcs
2
+
3
+ import android.os.Looper
4
+ import androidx.test.core.app.ApplicationProvider
5
+ import com.mentra.bluetoothsdk.Bridge
6
+ import java.time.Duration
7
+ import org.json.JSONObject
8
+ import org.junit.Assert.assertEquals
9
+ import org.junit.Assert.assertTrue
10
+ import org.junit.Test
11
+ import org.junit.runner.RunWith
12
+ import org.robolectric.RobolectricTestRunner
13
+ import org.robolectric.Shadows.shadowOf
14
+ import org.robolectric.annotation.Config
15
+ import org.robolectric.annotation.LooperMode
16
+
17
+ /**
18
+ * The glasses answer every RGB LED command with `rgb_led_control_response` echoing the command's
19
+ * requestId. MentraLive must forward that reply so the pending SDK request settles instead of
20
+ * timing out.
21
+ */
22
+ @RunWith(RobolectricTestRunner::class)
23
+ @Config(sdk = [33], shadows = [G1PairingTest.ShadowLc3Cpp::class], instrumentedPackages = ["com.mentra.lc3Lib"])
24
+ @LooperMode(LooperMode.Mode.PAUSED)
25
+ class MentraLiveRgbLedResponseTest {
26
+ @Test fun `success reply settles the request it echoes`() {
27
+ val replies = forwardedReplies(
28
+ JSONObject().put("type", "rgb_led_control_response").put("requestId", "led-1")
29
+ .put("state", "success").put("success", true),
30
+ )
31
+
32
+ assertEquals(1, replies.size)
33
+ assertEquals("led-1", replies[0]["requestId"])
34
+ assertEquals("success", replies[0]["state"])
35
+ }
36
+
37
+ @Test fun `error reply carries the glasses error code`() {
38
+ val replies = forwardedReplies(
39
+ JSONObject().put("type", "rgb_led_control_response").put("requestId", "led-2")
40
+ .put("state", "error").put("success", false)
41
+ .put("errorCode", "device_not_supported").put("error", "RGB LED not supported"),
42
+ )
43
+
44
+ assertEquals(1, replies.size)
45
+ assertEquals("error", replies[0]["state"])
46
+ assertEquals("device_not_supported", replies[0]["errorCode"])
47
+ }
48
+
49
+ @Test fun `reply without a requestId is not forwarded`() {
50
+ val replies = forwardedReplies(
51
+ JSONObject().put("type", "rgb_led_control_response").put("state", "success"),
52
+ )
53
+
54
+ assertTrue(replies.isEmpty())
55
+ }
56
+
57
+ private fun forwardedReplies(reply: JSONObject): List<Map<String, Any?>> {
58
+ Bridge.initialize(ApplicationProvider.getApplicationContext())
59
+ val live = MentraLive()
60
+ val replies = mutableListOf<Map<String, Any?>>()
61
+ val sink = Bridge.addEventSink { type, body ->
62
+ if (type == "rgb_led_control_response") replies.add(body.toMap())
63
+ }
64
+ try {
65
+ MentraLive::class.java.getDeclaredMethod("processJsonMessage", JSONObject::class.java)
66
+ .apply { isAccessible = true }
67
+ .invoke(live, reply)
68
+ shadowOf(Looper.getMainLooper()).idle()
69
+ } finally {
70
+ Bridge.removeEventSink(sink)
71
+ live.destroy()
72
+ shadowOf(Looper.getMainLooper()).idleFor(Duration.ofSeconds(2))
73
+ }
74
+ return replies
75
+ }
76
+ }
@@ -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-dev.1011",
5
- "releaseSetId": "mentra-3.4.0-dev.1011",
6
- "sourceCommit": "ea742f4c08468623c8194b360643a5395301831e",
7
- "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.1011.json",
8
- "otaManifestSha256": "20c657f72d381c3c4af5dfea9a12285595c1cf9297830dd7ae6d44d2505f98cf"
4
+ "releaseIdentity": "3.4.0-dev.1020",
5
+ "releaseSetId": "mentra-3.4.0-dev.1020",
6
+ "sourceCommit": "d8c0511b179bdab6ce7e31abbc2f7d5f52d573ee",
7
+ "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.1020.json",
8
+ "otaManifestSha256": "93bd2738ed89daa7bfb26932276a6eb52b8cd7d655db5f50018d8d38cd4b08eb"
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,gBAAgB;IACnC,cAAc,EAAE,uBAAuB;IACvC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,kIAAkI;IACpJ,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-dev.1011\",\n \"releaseSetId\": \"mentra-3.4.0-dev.1011\",\n \"sourceCommit\": \"ea742f4c08468623c8194b360643a5395301831e\",\n \"otaManifestUrl\": \"https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.1011.json\",\n \"otaManifestSha256\": \"20c657f72d381c3c4af5dfea9a12285595c1cf9297830dd7ae6d44d2505f98cf\"\n})\n"]}
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,gBAAgB;IACnC,cAAc,EAAE,uBAAuB;IACvC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,kIAAkI;IACpJ,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-dev.1020\",\n \"releaseSetId\": \"mentra-3.4.0-dev.1020\",\n \"sourceCommit\": \"d8c0511b179bdab6ce7e31abbc2f7d5f52d573ee\",\n \"otaManifestUrl\": \"https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.1020.json\",\n \"otaManifestSha256\": \"93bd2738ed89daa7bfb26932276a6eb52b8cd7d655db5f50018d8d38cd4b08eb\"\n})\n"]}
@@ -16,7 +16,7 @@ enum BluetoothSdkDefaults {
16
16
  /// silently disable it on every pair the app touches.
17
17
  static let autoPowerOffEnabled = false
18
18
  private static let infoSdkVersionKey = "MentraBluetoothSdkVersion"
19
- private static let swiftPackageSdkVersion = "3.4.0-dev.1011"
19
+ private static let swiftPackageSdkVersion = "3.4.0-dev.1020"
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-dev.1011"
7
- static let releaseSetId = "mentra-3.4.0-dev.1011"
8
- static let sourceCommit = "ea742f4c08468623c8194b360643a5395301831e"
9
- static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.1011.json"
10
- static let otaManifestSha256 = "20c657f72d381c3c4af5dfea9a12285595c1cf9297830dd7ae6d44d2505f98cf"
6
+ static let releaseIdentity = "3.4.0-dev.1020"
7
+ static let releaseSetId = "mentra-3.4.0-dev.1020"
8
+ static let sourceCommit = "d8c0511b179bdab6ce7e31abbc2f7d5f52d573ee"
9
+ static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.1020.json"
10
+ static let otaManifestSha256 = "93bd2738ed89daa7bfb26932276a6eb52b8cd7d655db5f50018d8d38cd4b08eb"
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentra/bluetooth-sdk",
3
- "version": "3.4.0-dev.1011",
3
+ "version": "3.4.0-dev.1020",
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-dev.1011"
118
+ "@mentra/cloud-protocol": "3.4.0-dev.1020"
119
119
  },
120
120
  "devDependencies": {
121
121
  "@types/node": "^25.9.3",
@@ -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-dev.1011",
16
- "releaseSetId": "mentra-3.4.0-dev.1011",
17
- "sourceCommit": "ea742f4c08468623c8194b360643a5395301831e",
18
- "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.1011.json",
19
- "otaManifestSha256": "20c657f72d381c3c4af5dfea9a12285595c1cf9297830dd7ae6d44d2505f98cf"
15
+ "releaseIdentity": "3.4.0-dev.1020",
16
+ "releaseSetId": "mentra-3.4.0-dev.1020",
17
+ "sourceCommit": "d8c0511b179bdab6ce7e31abbc2f7d5f52d573ee",
18
+ "otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.1020.json",
19
+ "otaManifestSha256": "93bd2738ed89daa7bfb26932276a6eb52b8cd7d655db5f50018d8d38cd4b08eb"
20
20
  })