@mentra/bluetooth-sdk 3.4.0-dev.1008 → 3.4.0-dev.1011
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedChangelogCatalog.kt +1 -1
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedReleaseMetadata.kt +5 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/MentraLive.kt +45 -2
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/MentraLiveGlassesReadyBurstTest.kt +141 -0
- package/build/generated/changelogCatalog.d.ts +1 -1
- package/build/generated/changelogCatalog.js +1 -1
- package/build/generated/changelogCatalog.js.map +1 -1
- package/build/generated/releaseMetadata.js +5 -5
- package/build/generated/releaseMetadata.js.map +1 -1
- package/ios/Source/BluetoothSdkDefaults.swift +1 -1
- package/ios/Source/GeneratedChangelogCatalog.swift +1 -1
- package/ios/Source/GeneratedReleaseMetadata.swift +5 -5
- package/ios/Source/sgcs/MentraLive.swift +73 -23
- package/ios/Tests/MentraLiveCommandQueueTests.swift +35 -0
- package/ios/Tests/MentraLiveSessionReadinessTests.swift +129 -0
- package/package.json +2 -2
- package/src/generated/changelogCatalog.ts +1 -1
- package/src/generated/releaseMetadata.ts +5 -5
|
@@ -4,7 +4,7 @@ package com.mentra.bluetoothsdk
|
|
|
4
4
|
internal val GENERATED_RELEASE_CHANGELOGS: List<ReleaseChangelog> =
|
|
5
5
|
listOf(
|
|
6
6
|
ReleaseChangelog(version = "3.4.0", markdown = "This release is under active development. User-facing changes will be documented as they land."),
|
|
7
|
-
ReleaseChangelog(version = "3.3.0", markdown = "
|
|
7
|
+
ReleaseChangelog(version = "3.3.0", markdown = "- **Mentra Call:** Now available on iPhone, with a redesigned call screen and photo sharing during calls.\n- **Microphone:** Improved glasses microphone reliability, including after phone calls.\n- **Photos and gallery:** More reliable photo capture and gallery syncing.\n- **Glasses updates:** More reliable glasses updates, with clearer progress.\n- **Miniapps:** Miniapps now update automatically. Fixed miniapps getting stuck on loading screens.\n- **Mentra AI:** Reliability improvements and bug fixes.\n- **Notes:** Take photos with the glasses camera button, and add meeting and location details to your notes.\n- **Pairing and connections:** Improved glasses audio reconnection on Android.\n- **G1 and NIMO:** Improved text display, including accented letters.\n- **Android tablets:** The Mentra App now rotates to landscape."),
|
|
8
8
|
ReleaseChangelog(version = "3.2.1", markdown = "- **Livestreamer:** \"Stream Here\" now works without a Wi-Fi network. Improved stream startup and connection reliability.\n- **Photos and gallery:** More reliable photo capture and gallery syncing.\n- **Mentra AI:** Reliability improvements and bug fixes.\n- **Miniapps:** Smoother transitions, with back buttons and gestures that take you to the previous screen inside a miniapp.\n- **Pairing and connections:** Improved G1 pairing and G2 background reconnection.\n- **Glasses updates:** Fixed repeated update checks and improved recovery after interrupted updates.\n- **Mentra Maps:** Bug fixes.\n- **NIMO:** Improved text and map layouts.\n- **Self-hosting:** Connect the Mentra App to your own self-hosted Mentra backend."),
|
|
9
9
|
ReleaseChangelog(version = "3.2.0", markdown = "- Improved glasses connectivity and Wi-Fi setup.\n\n- Breaking Bluetooth SDK change: `forgetWifiNetwork(ssid)` now returns `WifiForgetResult` instead of `WifiStatusChangeEvent`. Migrate status-only consumers to the semantic `outcome`; the requested network remains `ssid`, while optional post-command connectivity is reported by `connected`, `currentSsid`, and `localIp`."),
|
|
10
10
|
ReleaseChangelog(version = "3.1.1", markdown = "- Improved Google login on iOS.\n- Pairing no longer requires phone microphone access."),
|
|
@@ -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.
|
|
7
|
-
const val RELEASE_SET_ID: String = "mentra-3.4.0-dev.
|
|
8
|
-
const val SOURCE_COMMIT: String = "
|
|
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.
|
|
10
|
-
const val OTA_MANIFEST_SHA256: String = "
|
|
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"
|
|
11
11
|
}
|
|
@@ -579,6 +579,13 @@ class MentraLive : SGCManager() {
|
|
|
579
579
|
// the physical connection (never on heartbeat readiness flaps), so a first-seen sid
|
|
580
580
|
// after an upgrade OTA is always detected as a restart.
|
|
581
581
|
private var readinessCompletedThisBleSession = false
|
|
582
|
+
// Readiness exchange the phone is waiting on. Every phone_ready carries it until the
|
|
583
|
+
// matching glasses_ready arrives, so retries and the copies the BES buffers while the
|
|
584
|
+
// glasses boot are one exchange: the glasses reset their transport once for it and answer
|
|
585
|
+
// later copies without resetting. Both exchange fields are scoped to the BLE session.
|
|
586
|
+
private var pendingReadyId: String? = null
|
|
587
|
+
// `sid` of the glasses process whose glasses_ready this BLE session last handled.
|
|
588
|
+
private var readyGlassesSessionId: String? = null
|
|
582
589
|
// Note: appVersion, buildNumber, deviceModel, androidVersion
|
|
583
590
|
// are inherited from SGCManager parent class
|
|
584
591
|
|
|
@@ -1241,6 +1248,7 @@ class MentraLive : SGCManager() {
|
|
|
1241
1248
|
if (state == ConnTypes.DISCONNECTED) {
|
|
1242
1249
|
resetWireNegotiationState()
|
|
1243
1250
|
resetPendingAckState()
|
|
1251
|
+
resetReadinessExchange()
|
|
1244
1252
|
// Queued writes are session-bound: transmitting them into the NEXT session
|
|
1245
1253
|
// (e.g. a stale handshake whose reply activates v2 before the new session
|
|
1246
1254
|
// negotiated) is the bug class this clear removes. Higher layers re-send
|
|
@@ -1306,6 +1314,7 @@ class MentraLive : SGCManager() {
|
|
|
1306
1314
|
DeviceStore.apply("glasses", "signalStrengthUpdatedAt", 0L)
|
|
1307
1315
|
resetWireNegotiationState()
|
|
1308
1316
|
resetPendingAckState()
|
|
1317
|
+
resetReadinessExchange()
|
|
1309
1318
|
// The glasses reset mic and wear tuning on BLE disconnect, so the
|
|
1310
1319
|
// next link must be allowed to send them again.
|
|
1311
1320
|
lastSentMicTuningBody = null
|
|
@@ -4953,6 +4962,19 @@ class MentraLive : SGCManager() {
|
|
|
4953
4962
|
Bridge.log("LIVE: Ignoring stale glasses_ready without a link")
|
|
4954
4963
|
return
|
|
4955
4964
|
}
|
|
4965
|
+
val sid = json.optString("sid", "").takeIf { it.isNotEmpty() }
|
|
4966
|
+
val readyId = json.optString("readyId", "").takeIf { it.isNotEmpty() }
|
|
4967
|
+
if (readyId != null && isRepeatedGlassesReady(readyId, sid)) {
|
|
4968
|
+
Bridge.log(
|
|
4969
|
+
"LIVE: Ignoring repeated glasses_ready for readiness exchange $readyId - " +
|
|
4970
|
+
"the glasses did not reset for it"
|
|
4971
|
+
)
|
|
4972
|
+
return
|
|
4973
|
+
}
|
|
4974
|
+
if (readyId != null && readyId == pendingReadyId) {
|
|
4975
|
+
pendingReadyId = null
|
|
4976
|
+
}
|
|
4977
|
+
readyGlassesSessionId = sid
|
|
4956
4978
|
Bridge.log("LIVE: 🎉 Received glasses_ready message - SOC is booted and ready!")
|
|
4957
4979
|
markPairingTiming(
|
|
4958
4980
|
"glasses_ready",
|
|
@@ -4970,7 +4992,7 @@ class MentraLive : SGCManager() {
|
|
|
4970
4992
|
// Record the session id BEFORE marking ready: an unsolicited glasses_ready
|
|
4971
4993
|
// already runs this full remote-reset flow, so recording (not re-triggering)
|
|
4972
4994
|
// is correct here; version_info detection covers the restart case.
|
|
4973
|
-
glassesSessionId =
|
|
4995
|
+
glassesSessionId = sid
|
|
4974
4996
|
streamControlVersion = json.optInt("streamControlVersion", 0)
|
|
4975
4997
|
Bridge.sendTypedMessage(
|
|
4976
4998
|
"wifi_protocol_session_ready",
|
|
@@ -9772,13 +9794,34 @@ class MentraLive : SGCManager() {
|
|
|
9772
9794
|
wireHandshakeSentGeneration = -1
|
|
9773
9795
|
}
|
|
9774
9796
|
|
|
9797
|
+
/**
|
|
9798
|
+
* A glasses_ready that echoes a readyId answers a phone_ready exchange. The answer to the
|
|
9799
|
+
* exchange the phone is waiting on, and any answer from a glasses process other than the one
|
|
9800
|
+
* this link last handled (an asg restart resets for every exchange it first sees), followed a
|
|
9801
|
+
* transport reset. Any other answer repeats an exchange that process already reset for, or one
|
|
9802
|
+
* superseded by the pending exchange, whose answer is still to come.
|
|
9803
|
+
*/
|
|
9804
|
+
private fun isRepeatedGlassesReady(readyId: String, sid: String?): Boolean =
|
|
9805
|
+
readyId != pendingReadyId && sid == readyGlassesSessionId
|
|
9806
|
+
|
|
9807
|
+
private fun resetReadinessExchange() {
|
|
9808
|
+
pendingReadyId = null
|
|
9809
|
+
readyGlassesSessionId = null
|
|
9810
|
+
}
|
|
9811
|
+
|
|
9775
9812
|
/** Sends phone_ready to (re)start the glasses-driven readiness flow. */
|
|
9776
9813
|
private fun sendPhoneReady(reason: String) {
|
|
9777
|
-
|
|
9814
|
+
val readyId = pendingReadyId ?: UUID.randomUUID().toString()
|
|
9815
|
+
pendingReadyId = readyId
|
|
9816
|
+
Bridge.log(
|
|
9817
|
+
"LIVE: 📱 Sending phone_ready to glasses ($reason, exchange $readyId) - " +
|
|
9818
|
+
"waiting for glasses_ready response"
|
|
9819
|
+
)
|
|
9778
9820
|
markPairingTiming("phone_ready_sent", "reason=$reason queueSize=${sendQueue.size}")
|
|
9779
9821
|
val readyMsg = JSONObject()
|
|
9780
9822
|
readyMsg.put("type", "phone_ready")
|
|
9781
9823
|
readyMsg.put("timestamp", System.currentTimeMillis())
|
|
9824
|
+
readyMsg.put("readyId", readyId)
|
|
9782
9825
|
sendJson(readyMsg, true)
|
|
9783
9826
|
}
|
|
9784
9827
|
|
|
@@ -0,0 +1,141 @@
|
|
|
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 com.mentra.bluetoothsdk.utils.ConnTypes
|
|
7
|
+
import java.time.Duration
|
|
8
|
+
import org.json.JSONObject
|
|
9
|
+
import org.junit.Assert.assertEquals
|
|
10
|
+
import org.junit.Assert.assertNotEquals
|
|
11
|
+
import org.junit.Assert.assertNotNull
|
|
12
|
+
import org.junit.Test
|
|
13
|
+
import org.junit.runner.RunWith
|
|
14
|
+
import org.robolectric.RobolectricTestRunner
|
|
15
|
+
import org.robolectric.Shadows.shadowOf
|
|
16
|
+
import org.robolectric.annotation.Config
|
|
17
|
+
import org.robolectric.annotation.LooperMode
|
|
18
|
+
|
|
19
|
+
@RunWith(RobolectricTestRunner::class)
|
|
20
|
+
@Config(sdk = [33], shadows = [G1PairingTest.ShadowLc3Cpp::class], instrumentedPackages = ["com.mentra.lc3Lib"])
|
|
21
|
+
@LooperMode(LooperMode.Mode.PAUSED)
|
|
22
|
+
class MentraLiveGlassesReadyBurstTest {
|
|
23
|
+
@Test fun `buffered phone_ready copies are one exchange with one init`() = withLive { live, inits ->
|
|
24
|
+
// Two SOC-ready heartbeats while the glasses boot: one exchange, sent twice.
|
|
25
|
+
receive(live, socReady())
|
|
26
|
+
val readyId = pendingReadyId(live)
|
|
27
|
+
receive(live, socReady())
|
|
28
|
+
assertEquals(readyId, pendingReadyId(live))
|
|
29
|
+
|
|
30
|
+
// The glasses answer every buffered copy; only the first followed a reset.
|
|
31
|
+
repeat(7) { receive(live, glassesReady("booted", readyId)) }
|
|
32
|
+
assertEquals(1, inits())
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@Test fun `answers to a superseded exchange are ignored until the pending one arrives`() = withLive { live, inits ->
|
|
36
|
+
receive(live, socReady())
|
|
37
|
+
val first = pendingReadyId(live)
|
|
38
|
+
receive(live, glassesReady("booted", first))
|
|
39
|
+
invoke(live, "sendPhoneReady", "readiness re-run")
|
|
40
|
+
val second = pendingReadyId(live)
|
|
41
|
+
|
|
42
|
+
// The same process already reset for the first exchange; the pending one is still to come.
|
|
43
|
+
receive(live, glassesReady("booted", first))
|
|
44
|
+
assertEquals(1, inits())
|
|
45
|
+
receive(live, glassesReady("booted", second))
|
|
46
|
+
assertEquals(2, inits())
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Test fun `an answer from another glasses process is handled with no exchange pending`() = withLive { live, inits ->
|
|
50
|
+
receive(live, socReady())
|
|
51
|
+
val readyId = pendingReadyId(live)
|
|
52
|
+
receive(live, glassesReady("booted", readyId))
|
|
53
|
+
|
|
54
|
+
// A restarted process reset its transport for this copy, so it is not a repeat.
|
|
55
|
+
receive(live, glassesReady("restarted", readyId))
|
|
56
|
+
assertEquals(2, inits())
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Test fun `a restarted process answering an older copy is handled and the pending exchange still counts`() = withLive { live, inits ->
|
|
60
|
+
receive(live, socReady())
|
|
61
|
+
val first = pendingReadyId(live)
|
|
62
|
+
receive(live, glassesReady("booted", first))
|
|
63
|
+
invoke(live, "sendPhoneReady", "glasses session changed")
|
|
64
|
+
val second = pendingReadyId(live)
|
|
65
|
+
|
|
66
|
+
// The restarted process reset for a buffered copy of the old exchange, then resets
|
|
67
|
+
// again for the pending one: both answers follow a reset.
|
|
68
|
+
receive(live, glassesReady("restarted", first))
|
|
69
|
+
assertEquals(2, inits())
|
|
70
|
+
receive(live, glassesReady("restarted", second))
|
|
71
|
+
assertEquals(3, inits())
|
|
72
|
+
receive(live, glassesReady("restarted", second))
|
|
73
|
+
assertEquals(3, inits())
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@Test fun `the readiness exchange ends with the BLE session`() = withLive { live, _ ->
|
|
77
|
+
receive(live, socReady())
|
|
78
|
+
val first = pendingReadyId(live)
|
|
79
|
+
invoke(live, "updateConnectionState", ConnTypes.DISCONNECTED)
|
|
80
|
+
|
|
81
|
+
receive(live, socReady())
|
|
82
|
+
assertNotEquals(first, pendingReadyId(live))
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@Test fun `glasses without readyId keep initializing on every answer`() = withLive { live, inits ->
|
|
86
|
+
receive(live, glassesReady("legacy", null))
|
|
87
|
+
receive(live, glassesReady("legacy", null))
|
|
88
|
+
assertEquals(2, inits())
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Runs `body` on a fresh MentraLive with a live link, counting SOC inits (one version
|
|
93
|
+
* request each). glasses_ready is only accepted on a live link.
|
|
94
|
+
*/
|
|
95
|
+
private fun withLive(body: (MentraLive, () -> Int) -> Unit) {
|
|
96
|
+
Bridge.initialize(ApplicationProvider.getApplicationContext())
|
|
97
|
+
val live = MentraLive()
|
|
98
|
+
MentraLive::class.java.getDeclaredField("isConnected").apply { isAccessible = true }.set(live, true)
|
|
99
|
+
var inits = 0
|
|
100
|
+
val sink = Bridge.addEventSink { type, event ->
|
|
101
|
+
if (type == "log" && event["message"].toString().contains("Requesting version info from ASG client")) {
|
|
102
|
+
inits++
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
body(live) { inits }
|
|
107
|
+
} finally {
|
|
108
|
+
Bridge.removeEventSink(sink)
|
|
109
|
+
live.destroy()
|
|
110
|
+
shadowOf(Looper.getMainLooper()).idleFor(Duration.ofSeconds(2))
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private fun socReady() = JSONObject().put("C", "sr_hrt").put("B", JSONObject().put("ready", 1))
|
|
115
|
+
|
|
116
|
+
private fun glassesReady(sid: String, readyId: String?) = JSONObject().apply {
|
|
117
|
+
put("type", "glasses_ready")
|
|
118
|
+
put("sid", sid)
|
|
119
|
+
if (readyId != null) put("readyId", readyId)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private fun pendingReadyId(live: MentraLive): String {
|
|
123
|
+
val readyId = MentraLive::class.java.getDeclaredField("pendingReadyId")
|
|
124
|
+
.apply { isAccessible = true }
|
|
125
|
+
.get(live) as String?
|
|
126
|
+
assertNotNull("SOC ready should start a readiness exchange", readyId)
|
|
127
|
+
return readyId!!
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
private fun receive(live: MentraLive, json: JSONObject) {
|
|
131
|
+
MentraLive::class.java.getDeclaredMethod("processJsonMessage", JSONObject::class.java)
|
|
132
|
+
.apply { isAccessible = true }
|
|
133
|
+
.invoke(live, json)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private fun invoke(live: MentraLive, name: String, argument: String) {
|
|
137
|
+
MentraLive::class.java.getDeclaredMethod(name, String::class.java)
|
|
138
|
+
.apply { isAccessible = true }
|
|
139
|
+
.invoke(live, argument)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -4,7 +4,7 @@ export declare const GENERATED_RELEASE_CHANGELOGS: readonly [{
|
|
|
4
4
|
readonly markdown: "This release is under active development. User-facing changes will be documented as they land.";
|
|
5
5
|
}, {
|
|
6
6
|
readonly version: "3.3.0";
|
|
7
|
-
readonly markdown: "
|
|
7
|
+
readonly markdown: "- **Mentra Call:** Now available on iPhone, with a redesigned call screen and photo sharing during calls.\n- **Microphone:** Improved glasses microphone reliability, including after phone calls.\n- **Photos and gallery:** More reliable photo capture and gallery syncing.\n- **Glasses updates:** More reliable glasses updates, with clearer progress.\n- **Miniapps:** Miniapps now update automatically. Fixed miniapps getting stuck on loading screens.\n- **Mentra AI:** Reliability improvements and bug fixes.\n- **Notes:** Take photos with the glasses camera button, and add meeting and location details to your notes.\n- **Pairing and connections:** Improved glasses audio reconnection on Android.\n- **G1 and NIMO:** Improved text display, including accented letters.\n- **Android tablets:** The Mentra App now rotates to landscape.";
|
|
8
8
|
}, {
|
|
9
9
|
readonly version: "3.2.1";
|
|
10
10
|
readonly markdown: "- **Livestreamer:** \"Stream Here\" now works without a Wi-Fi network. Improved stream startup and connection reliability.\n- **Photos and gallery:** More reliable photo capture and gallery syncing.\n- **Mentra AI:** Reliability improvements and bug fixes.\n- **Miniapps:** Smoother transitions, with back buttons and gestures that take you to the previous screen inside a miniapp.\n- **Pairing and connections:** Improved G1 pairing and G2 background reconnection.\n- **Glasses updates:** Fixed repeated update checks and improved recovery after interrupted updates.\n- **Mentra Maps:** Bug fixes.\n- **NIMO:** Improved text and map layouts.\n- **Self-hosting:** Connect the Mentra App to your own self-hosted Mentra backend.";
|
|
@@ -6,7 +6,7 @@ export const GENERATED_RELEASE_CHANGELOGS = Object.freeze([
|
|
|
6
6
|
},
|
|
7
7
|
{
|
|
8
8
|
"version": "3.3.0",
|
|
9
|
-
"markdown": "
|
|
9
|
+
"markdown": "- **Mentra Call:** Now available on iPhone, with a redesigned call screen and photo sharing during calls.\n- **Microphone:** Improved glasses microphone reliability, including after phone calls.\n- **Photos and gallery:** More reliable photo capture and gallery syncing.\n- **Glasses updates:** More reliable glasses updates, with clearer progress.\n- **Miniapps:** Miniapps now update automatically. Fixed miniapps getting stuck on loading screens.\n- **Mentra AI:** Reliability improvements and bug fixes.\n- **Notes:** Take photos with the glasses camera button, and add meeting and location details to your notes.\n- **Pairing and connections:** Improved glasses audio reconnection on Android.\n- **G1 and NIMO:** Improved text display, including accented letters.\n- **Android tablets:** The Mentra App now rotates to landscape."
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
"version": "3.2.1",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changelogCatalog.js","sourceRoot":"","sources":["../../src/generated/changelogCatalog.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,MAAM,CACzD;IACE;QACE,SAAS,EAAE,OAAO;QAClB,UAAU,EAAE,gGAAgG;KAC7G;IACD;QACE,SAAS,EAAE,OAAO;QAClB,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"changelogCatalog.js","sourceRoot":"","sources":["../../src/generated/changelogCatalog.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,CAAC,MAAM,4BAA4B,GAAG,MAAM,CAAC,MAAM,CACzD;IACE;QACE,SAAS,EAAE,OAAO;QAClB,UAAU,EAAE,gGAAgG;KAC7G;IACD;QACE,SAAS,EAAE,OAAO;QAClB,UAAU,EAAE,m0BAAm0B;KACh1B;IACD;QACE,SAAS,EAAE,OAAO;QAClB,UAAU,EAAE,wtBAAwtB;KACruB;IACD;QACE,SAAS,EAAE,OAAO;QAClB,UAAU,EAAE,qXAAqX;KAClY;IACD;QACE,SAAS,EAAE,OAAO;QAClB,UAAU,EAAE,wFAAwF;KACrG;IACD;QACE,SAAS,EAAE,OAAO;QAClB,UAAU,EAAE,mrCAAmrC;KAChsC;CACO,CACT,CAAA","sourcesContent":["/** Generated from /changelogs. Do not edit directly. */\nexport const GENERATED_RELEASE_CHANGELOGS = Object.freeze(\n[\n {\n \"version\": \"3.4.0\",\n \"markdown\": \"This release is under active development. User-facing changes will be documented as they land.\"\n },\n {\n \"version\": \"3.3.0\",\n \"markdown\": \"- **Mentra Call:** Now available on iPhone, with a redesigned call screen and photo sharing during calls.\\n- **Microphone:** Improved glasses microphone reliability, including after phone calls.\\n- **Photos and gallery:** More reliable photo capture and gallery syncing.\\n- **Glasses updates:** More reliable glasses updates, with clearer progress.\\n- **Miniapps:** Miniapps now update automatically. Fixed miniapps getting stuck on loading screens.\\n- **Mentra AI:** Reliability improvements and bug fixes.\\n- **Notes:** Take photos with the glasses camera button, and add meeting and location details to your notes.\\n- **Pairing and connections:** Improved glasses audio reconnection on Android.\\n- **G1 and NIMO:** Improved text display, including accented letters.\\n- **Android tablets:** The Mentra App now rotates to landscape.\"\n },\n {\n \"version\": \"3.2.1\",\n \"markdown\": \"- **Livestreamer:** \\\"Stream Here\\\" now works without a Wi-Fi network. Improved stream startup and connection reliability.\\n- **Photos and gallery:** More reliable photo capture and gallery syncing.\\n- **Mentra AI:** Reliability improvements and bug fixes.\\n- **Miniapps:** Smoother transitions, with back buttons and gestures that take you to the previous screen inside a miniapp.\\n- **Pairing and connections:** Improved G1 pairing and G2 background reconnection.\\n- **Glasses updates:** Fixed repeated update checks and improved recovery after interrupted updates.\\n- **Mentra Maps:** Bug fixes.\\n- **NIMO:** Improved text and map layouts.\\n- **Self-hosting:** Connect the Mentra App to your own self-hosted Mentra backend.\"\n },\n {\n \"version\": \"3.2.0\",\n \"markdown\": \"- Improved glasses connectivity and Wi-Fi setup.\\n\\n- Breaking Bluetooth SDK change: `forgetWifiNetwork(ssid)` now returns `WifiForgetResult` instead of `WifiStatusChangeEvent`. Migrate status-only consumers to the semantic `outcome`; the requested network remains `ssid`, while optional post-command connectivity is reported by `connected`, `currentSsid`, and `localIp`.\"\n },\n {\n \"version\": \"3.1.1\",\n \"markdown\": \"- Improved Google login on iOS.\\n- Pairing no longer requires phone microphone access.\"\n },\n {\n \"version\": \"3.1.0\",\n \"markdown\": \"**Mentra App and glasses**\\n\\n- Improved glasses pairing and reconnection, including on iPad.\\n- Improved Android background reliability for captions and miniapps.\\n- Added Xingyi AR99 support.\\n- More reliable photo and video capture, with improved shutter sounds and privacy-light timing. Taking photos no longer interrupts your running miniapp.\\n- Added video thumbnails and smoother gallery browsing.\\n- Easier Mentra Live updates through your phone, with clearer progress and better recovery from interruptions.\\n\\n**Miniapp updates**\\n\\n- **Mentra AI:** Control whether photos are included with questions. Improved visual answers and connected-app follow-ups.\\n- **Captions:** Added offline transcription settings and top/bottom positioning on supported displays.\\n- **Translation:** Restored all 60 languages.\\n- **Mentra Maps:** Clearer directions on G1/G2, less display flickering, and improved Android offline routing.\\n- **Livestreamer:** More video-quality controls and custom streaming options, plus improved startup and sharing.\\n- **Merge:** Tap to expand an insight; swipe down or back to dismiss it.\\n- **Mentra Notes:** Smoother back navigation.\\n- **Recorder:** Fixed audio sharing.\"\n }\n] as const,\n)\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export const BLUETOOTH_SDK_RELEASE_METADATA = Object.freeze({
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"familyBaseVersion": "3.4.0",
|
|
4
|
-
"releaseIdentity": "3.4.0-dev.
|
|
5
|
-
"releaseSetId": "mentra-3.4.0-dev.
|
|
6
|
-
"sourceCommit": "
|
|
7
|
-
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.
|
|
8
|
-
"otaManifestSha256": "
|
|
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"
|
|
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.
|
|
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"]}
|
|
@@ -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.
|
|
19
|
+
private static let swiftPackageSdkVersion = "3.4.0-dev.1011"
|
|
20
20
|
private static let swiftPackageSdkVersionPlaceholder = "__MENTRA" + "_BLUETOOTH_SDK_VERSION__"
|
|
21
21
|
|
|
22
22
|
private static func normalizedSdkVersion(_ value: String?) -> String? {
|
|
@@ -3,7 +3,7 @@ import Foundation
|
|
|
3
3
|
/// Generated from /changelogs. Do not edit directly.
|
|
4
4
|
let generatedReleaseChangelogs: [ReleaseChangelog] = [
|
|
5
5
|
ReleaseChangelog(version: "3.4.0", markdown: "This release is under active development. User-facing changes will be documented as they land."),
|
|
6
|
-
ReleaseChangelog(version: "3.3.0", markdown: "
|
|
6
|
+
ReleaseChangelog(version: "3.3.0", markdown: "- **Mentra Call:** Now available on iPhone, with a redesigned call screen and photo sharing during calls.\n- **Microphone:** Improved glasses microphone reliability, including after phone calls.\n- **Photos and gallery:** More reliable photo capture and gallery syncing.\n- **Glasses updates:** More reliable glasses updates, with clearer progress.\n- **Miniapps:** Miniapps now update automatically. Fixed miniapps getting stuck on loading screens.\n- **Mentra AI:** Reliability improvements and bug fixes.\n- **Notes:** Take photos with the glasses camera button, and add meeting and location details to your notes.\n- **Pairing and connections:** Improved glasses audio reconnection on Android.\n- **G1 and NIMO:** Improved text display, including accented letters.\n- **Android tablets:** The Mentra App now rotates to landscape."),
|
|
7
7
|
ReleaseChangelog(version: "3.2.1", markdown: "- **Livestreamer:** \"Stream Here\" now works without a Wi-Fi network. Improved stream startup and connection reliability.\n- **Photos and gallery:** More reliable photo capture and gallery syncing.\n- **Mentra AI:** Reliability improvements and bug fixes.\n- **Miniapps:** Smoother transitions, with back buttons and gestures that take you to the previous screen inside a miniapp.\n- **Pairing and connections:** Improved G1 pairing and G2 background reconnection.\n- **Glasses updates:** Fixed repeated update checks and improved recovery after interrupted updates.\n- **Mentra Maps:** Bug fixes.\n- **NIMO:** Improved text and map layouts.\n- **Self-hosting:** Connect the Mentra App to your own self-hosted Mentra backend."),
|
|
8
8
|
ReleaseChangelog(version: "3.2.0", markdown: "- Improved glasses connectivity and Wi-Fi setup.\n\n- Breaking Bluetooth SDK change: `forgetWifiNetwork(ssid)` now returns `WifiForgetResult` instead of `WifiStatusChangeEvent`. Migrate status-only consumers to the semantic `outcome`; the requested network remains `ssid`, while optional post-command connectivity is reported by `connected`, `currentSsid`, and `localIp`."),
|
|
9
9
|
ReleaseChangelog(version: "3.1.1", markdown: "- Improved Google login on iOS.\n- Pairing no longer requires phone microphone access."),
|
|
@@ -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.
|
|
7
|
-
static let releaseSetId = "mentra-3.4.0-dev.
|
|
8
|
-
static let sourceCommit = "
|
|
9
|
-
static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.
|
|
10
|
-
static let otaManifestSha256 = "
|
|
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"
|
|
11
11
|
}
|
|
@@ -1504,6 +1504,7 @@ class MentraLive: NSObject, SGCManager {
|
|
|
1504
1504
|
if state == ConnTypes.DISCONNECTED {
|
|
1505
1505
|
resetPendingAckState(reason: "BLE session ended")
|
|
1506
1506
|
resetWireNegotiationState()
|
|
1507
|
+
resetReadinessExchange()
|
|
1507
1508
|
resetAncsRelayState()
|
|
1508
1509
|
// Queued writes are session-bound: transmitting them into the NEXT session
|
|
1509
1510
|
// (e.g. a stale handshake whose reply activates v2 before the new session
|
|
@@ -1811,6 +1812,13 @@ class MentraLive: NSObject, SGCManager {
|
|
|
1811
1812
|
// the physical connection — so a first-seen sid after an upgrade OTA cannot be
|
|
1812
1813
|
// mistaken for a fresh pairing just because a not-ready heartbeat slipped in first.
|
|
1813
1814
|
private var readinessCompletedThisBleSession = false
|
|
1815
|
+
/// Readiness exchange the phone is waiting on. Every phone_ready carries it until the
|
|
1816
|
+
/// matching glasses_ready arrives, so retries and the copies the BES buffers while the
|
|
1817
|
+
/// glasses boot are one exchange: the glasses reset their transport once for it and answer
|
|
1818
|
+
/// later copies without resetting. Both exchange fields are scoped to the BLE session.
|
|
1819
|
+
private var pendingReadyId: String?
|
|
1820
|
+
/// `sid` of the glasses process whose glasses_ready this BLE session last handled.
|
|
1821
|
+
private var readyGlassesSessionId: String?
|
|
1814
1822
|
private var globalMessageId = 0
|
|
1815
1823
|
private var lastReceivedMessageId = 0
|
|
1816
1824
|
private var bleWriteTraceSequence = 0
|
|
@@ -2756,6 +2764,18 @@ class MentraLive: NSObject, SGCManager {
|
|
|
2756
2764
|
}
|
|
2757
2765
|
|
|
2758
2766
|
var count: Int { commands.count }
|
|
2767
|
+
|
|
2768
|
+
/// Discards the run of writes from earlier wire-session generations at the head of
|
|
2769
|
+
/// the queue in one pass and dequeues the first current one. Stale writes are never
|
|
2770
|
+
/// sent, so they must not each cost a drain tick: a burst of epoch resets would
|
|
2771
|
+
/// otherwise park every current write behind seconds of dead entries.
|
|
2772
|
+
func dequeue(currentGeneration: Int) -> (command: PendingMessage?, staleIds: [String]) {
|
|
2773
|
+
let firstCurrent = commands.firstIndex { $0.generation == currentGeneration } ?? commands.endIndex
|
|
2774
|
+
let staleIds = commands[..<firstCurrent].map(\.id)
|
|
2775
|
+
commands.removeSubrange(..<firstCurrent)
|
|
2776
|
+
return (commands.isEmpty ? nil : commands.removeFirst(), staleIds)
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2759
2779
|
func removeAll() {
|
|
2760
2780
|
commands.removeAll()
|
|
2761
2781
|
}
|
|
@@ -2768,21 +2788,25 @@ class MentraLive: NSObject, SGCManager {
|
|
|
2768
2788
|
guard let self else { return }
|
|
2769
2789
|
while true {
|
|
2770
2790
|
let pendingIsNil = await MainActor.run { self.pending == nil }
|
|
2771
|
-
if pendingIsNil {
|
|
2772
|
-
|
|
2773
|
-
let currentGeneration = await MainActor.run { self.wireSessionGeneration }
|
|
2774
|
-
if command.generation != currentGeneration {
|
|
2775
|
-
Bridge.log("LIVE: Dropping stale queued write from a previous session epoch (id: \(command.id))")
|
|
2776
|
-
} else {
|
|
2777
|
-
await self.processSendQueue(command)
|
|
2778
|
-
}
|
|
2779
|
-
}
|
|
2791
|
+
if pendingIsNil, let command = await self.dequeueCurrentGenerationWrite() {
|
|
2792
|
+
await self.processSendQueue(command)
|
|
2780
2793
|
}
|
|
2781
2794
|
try? await Task.sleep(nanoseconds: 100_000_000) // 100ms
|
|
2782
2795
|
}
|
|
2783
2796
|
}
|
|
2784
2797
|
}
|
|
2785
2798
|
|
|
2799
|
+
private func dequeueCurrentGenerationWrite() -> PendingMessage? {
|
|
2800
|
+
let next = commandQueue.dequeue(currentGeneration: wireSessionGeneration)
|
|
2801
|
+
if !next.staleIds.isEmpty {
|
|
2802
|
+
Bridge.log(
|
|
2803
|
+
"LIVE: Dropping \(next.staleIds.count) stale queued write(s) from a previous session epoch " +
|
|
2804
|
+
"(ids: \(next.staleIds.joined(separator: ", ")))"
|
|
2805
|
+
)
|
|
2806
|
+
}
|
|
2807
|
+
return next.command
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2786
2810
|
private func processSendQueue(_ message: PendingMessage) async {
|
|
2787
2811
|
guard let peripheral = connectedPeripheral,
|
|
2788
2812
|
let txChar = txCharacteristic
|
|
@@ -3383,6 +3407,16 @@ class MentraLive: NSObject, SGCManager {
|
|
|
3383
3407
|
Bridge.log("LIVE: Ignoring stale glasses_ready during pairing pause")
|
|
3384
3408
|
return
|
|
3385
3409
|
}
|
|
3410
|
+
let sid = (json["sid"] as? String).flatMap { $0.isEmpty ? nil : $0 }
|
|
3411
|
+
let readyId = (json["readyId"] as? String).flatMap { $0.isEmpty ? nil : $0 }
|
|
3412
|
+
if let readyId, isRepeatedGlassesReady(readyId: readyId, sid: sid) {
|
|
3413
|
+
Bridge.log("LIVE: Ignoring repeated glasses_ready for readiness exchange \(readyId) - the glasses did not reset for it")
|
|
3414
|
+
return
|
|
3415
|
+
}
|
|
3416
|
+
if readyId != nil, readyId == pendingReadyId {
|
|
3417
|
+
pendingReadyId = nil
|
|
3418
|
+
}
|
|
3419
|
+
readyGlassesSessionId = sid
|
|
3386
3420
|
// glasses_ready is a REMOTE wire-session reset: the glasses ran
|
|
3387
3421
|
// onTransportReset() before sending it, so their side is back on legacy
|
|
3388
3422
|
// framing regardless of what this side negotiated earlier. Start a fresh
|
|
@@ -3394,7 +3428,7 @@ class MentraLive: NSObject, SGCManager {
|
|
|
3394
3428
|
// Record the session id BEFORE marking ready: an unsolicited glasses_ready
|
|
3395
3429
|
// already runs this full remote-reset flow, so recording (not re-triggering)
|
|
3396
3430
|
// is correct here; version_info detection covers the restart case.
|
|
3397
|
-
glassesSessionId =
|
|
3431
|
+
glassesSessionId = sid
|
|
3398
3432
|
streamControlVersion = json["streamControlVersion"] as? Int ?? 0
|
|
3399
3433
|
Bridge.sendTypedMessage(
|
|
3400
3434
|
"wifi_protocol_session_ready",
|
|
@@ -4054,12 +4088,7 @@ class MentraLive: NSObject, SGCManager {
|
|
|
4054
4088
|
// This prevents re-initialization on every heartbeat after initial connection
|
|
4055
4089
|
// The ready flag is reset on disconnect/reconnect, so this won't prevent proper reconnection
|
|
4056
4090
|
if !fullyBooted {
|
|
4057
|
-
|
|
4058
|
-
"type": "phone_ready",
|
|
4059
|
-
"timestamp": Int64(Date().timeIntervalSince1970 * 1000),
|
|
4060
|
-
]
|
|
4061
|
-
// Send it through our data channel
|
|
4062
|
-
sendJson(readyMsg, wakeUp: true)
|
|
4091
|
+
sendPhoneReady(reason: "SOC ready")
|
|
4063
4092
|
}
|
|
4064
4093
|
}
|
|
4065
4094
|
}
|
|
@@ -4670,6 +4699,20 @@ class MentraLive: NSObject, SGCManager {
|
|
|
4670
4699
|
|
|
4671
4700
|
// MARK: - Message Handlers
|
|
4672
4701
|
|
|
4702
|
+
/// A glasses_ready that echoes a readyId answers a phone_ready exchange. The answer to the
|
|
4703
|
+
/// exchange the phone is waiting on, and any answer from a glasses process other than the
|
|
4704
|
+
/// one this link last handled (an asg restart resets for every exchange it first sees),
|
|
4705
|
+
/// followed a transport reset. Any other answer repeats an exchange that process already
|
|
4706
|
+
/// reset for, or one superseded by the pending exchange, whose answer is still to come.
|
|
4707
|
+
private func isRepeatedGlassesReady(readyId: String, sid: String?) -> Bool {
|
|
4708
|
+
readyId != pendingReadyId && sid == readyGlassesSessionId
|
|
4709
|
+
}
|
|
4710
|
+
|
|
4711
|
+
private func resetReadinessExchange() {
|
|
4712
|
+
pendingReadyId = nil
|
|
4713
|
+
readyGlassesSessionId = nil
|
|
4714
|
+
}
|
|
4715
|
+
|
|
4673
4716
|
private func handleGlassesReady() {
|
|
4674
4717
|
pairFlow(
|
|
4675
4718
|
"glasses_ready",
|
|
@@ -6674,12 +6717,13 @@ class MentraLive: NSObject, SGCManager {
|
|
|
6674
6717
|
)
|
|
6675
6718
|
// requestReadyK900()
|
|
6676
6719
|
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
]
|
|
6681
|
-
|
|
6682
|
-
|
|
6720
|
+
// The timer fires on bluetoothQueue; the pending readiness exchange is main-actor state.
|
|
6721
|
+
// A tick queued just before glasses_ready stopped the loop must not start a new exchange.
|
|
6722
|
+
let check = self.readinessCheckCounter
|
|
6723
|
+
DispatchQueue.main.async { [weak self] in
|
|
6724
|
+
guard let self, self.readinessCheckDispatchTimer != nil else { return }
|
|
6725
|
+
self.sendPhoneReady(reason: "readiness check #\(check)")
|
|
6726
|
+
}
|
|
6683
6727
|
}
|
|
6684
6728
|
|
|
6685
6729
|
readinessCheckDispatchTimer!.resume()
|
|
@@ -6959,6 +7003,7 @@ class MentraLive: NSObject, SGCManager {
|
|
|
6959
7003
|
// Stop all timers
|
|
6960
7004
|
stopAllTimers()
|
|
6961
7005
|
resetWireNegotiationState()
|
|
7006
|
+
resetReadinessExchange()
|
|
6962
7007
|
commandQueue.removeAll() // stale writes die with the session
|
|
6963
7008
|
closeL2capFileChannel()
|
|
6964
7009
|
|
|
@@ -7174,11 +7219,16 @@ extension MentraLive {
|
|
|
7174
7219
|
|
|
7175
7220
|
/// Sends phone_ready to (re)start the glasses-driven readiness flow.
|
|
7176
7221
|
private func sendPhoneReady(reason: String) {
|
|
7222
|
+
let readyId = pendingReadyId ?? UUID().uuidString
|
|
7223
|
+
pendingReadyId = readyId
|
|
7177
7224
|
pairFlow("phone_ready", "reason=\(reason) gatt=\(txCharacteristic != nil) id=\(connectedPeripheral?.identifier.uuidString ?? "-")")
|
|
7178
|
-
Bridge.log(
|
|
7225
|
+
Bridge.log(
|
|
7226
|
+
"LIVE: 📱 Sending phone_ready to glasses (\(reason), exchange \(readyId)) - waiting for glasses_ready response"
|
|
7227
|
+
)
|
|
7179
7228
|
let readyMsg: [String: Any] = [
|
|
7180
7229
|
"type": "phone_ready",
|
|
7181
7230
|
"timestamp": Int64(Date().timeIntervalSince1970 * 1000),
|
|
7231
|
+
"readyId": readyId,
|
|
7182
7232
|
]
|
|
7183
7233
|
sendJson(readyMsg, wakeUp: true)
|
|
7184
7234
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@testable import MentraBluetoothSDK
|
|
2
|
+
import XCTest
|
|
3
|
+
|
|
4
|
+
@MainActor
|
|
5
|
+
final class MentraLiveCommandQueueTests: XCTestCase {
|
|
6
|
+
func testStaleGenerationRunIsDiscardedInOnePassAheadOfTheCurrentWrite() {
|
|
7
|
+
let queue = MentraLive.CommandQueue()
|
|
8
|
+
for (id, generation) in [("1", 1), ("2", 1), ("3", 2), ("4", 3), ("5", 3)] {
|
|
9
|
+
_ = queue.enqueue(write(id, generation: generation))
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let next = queue.dequeue(currentGeneration: 3)
|
|
13
|
+
XCTAssertEqual(next.command?.id, "4")
|
|
14
|
+
XCTAssertEqual(next.staleIds, ["1", "2", "3"])
|
|
15
|
+
|
|
16
|
+
let following = queue.dequeue(currentGeneration: 3)
|
|
17
|
+
XCTAssertEqual(following.command?.id, "5")
|
|
18
|
+
XCTAssertEqual(following.staleIds, [])
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
func testQueueOfOnlyStaleWritesDrainsToEmpty() {
|
|
22
|
+
let queue = MentraLive.CommandQueue()
|
|
23
|
+
_ = queue.enqueue(write("1", generation: 1))
|
|
24
|
+
_ = queue.enqueue(write("2", generation: 2))
|
|
25
|
+
|
|
26
|
+
let next = queue.dequeue(currentGeneration: 3)
|
|
27
|
+
XCTAssertNil(next.command)
|
|
28
|
+
XCTAssertEqual(next.staleIds, ["1", "2"])
|
|
29
|
+
XCTAssertNil(queue.dequeue())
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private func write(_ id: String, generation: Int) -> MentraLive.PendingMessage {
|
|
33
|
+
MentraLive.PendingMessage(data: Data([1]), id: id, retries: 0, generation: generation)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -9,6 +9,10 @@ private final class SessionReadinessTransport: MentraLive {
|
|
|
9
9
|
override func sendJson(_ jsonOriginal: [String: Any], wakeUp: Bool, requireAck: Bool) {
|
|
10
10
|
commands.append(jsonOriginal)
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
func phoneReadyIds() -> [String] {
|
|
14
|
+
commands.filter { $0["type"] as? String == "phone_ready" }.compactMap { $0["readyId"] as? String }
|
|
15
|
+
}
|
|
12
16
|
}
|
|
13
17
|
|
|
14
18
|
@MainActor
|
|
@@ -449,6 +453,131 @@ final class MentraLiveSessionReadinessTests: XCTestCase {
|
|
|
449
453
|
}
|
|
450
454
|
}
|
|
451
455
|
|
|
456
|
+
func testBufferedPhoneReadyCopiesAreOneExchangeWithOneInit() throws {
|
|
457
|
+
try withReadinessTransport { transport, receive, versionRequests in
|
|
458
|
+
// Two SOC-ready heartbeats while the glasses boot: one exchange, sent twice.
|
|
459
|
+
try receive(["C": "sr_hrt", "B": ["ready": 1]])
|
|
460
|
+
try receive(["C": "sr_hrt", "B": ["ready": 1]])
|
|
461
|
+
let readyIds = transport.phoneReadyIds()
|
|
462
|
+
XCTAssertEqual(readyIds.count, 2)
|
|
463
|
+
XCTAssertEqual(Set(readyIds).count, 1)
|
|
464
|
+
let readyId = try XCTUnwrap(readyIds.first)
|
|
465
|
+
|
|
466
|
+
// The glasses answer every buffered copy; only the first followed a reset.
|
|
467
|
+
for _ in 0 ..< 7 {
|
|
468
|
+
try receive(["type": "glasses_ready", "sid": "booted", "readyId": readyId])
|
|
469
|
+
}
|
|
470
|
+
XCTAssertEqual(versionRequests(), 1)
|
|
471
|
+
XCTAssertEqual(DeviceStore.shared.store.get("glasses", "fullyBooted") as? Bool, true)
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
func testRestartedGlassesProcessStartsANewExchangeAndIgnoresStaleAnswers() throws {
|
|
476
|
+
try withReadinessTransport { transport, receive, versionRequests in
|
|
477
|
+
try receive(["C": "sr_hrt", "B": ["ready": 1]])
|
|
478
|
+
let first = try XCTUnwrap(transport.phoneReadyIds().last)
|
|
479
|
+
try receive(["type": "glasses_ready", "sid": "booted", "readyId": first])
|
|
480
|
+
|
|
481
|
+
// asg restarted under the live link: a new exchange, and the old one's answers no
|
|
482
|
+
// longer count even though the new process will reset for its own.
|
|
483
|
+
try receive(["type": "version_info_1", "sid": "restarted", "build_number": "302010073"])
|
|
484
|
+
let second = try XCTUnwrap(transport.phoneReadyIds().last)
|
|
485
|
+
XCTAssertNotEqual(second, first)
|
|
486
|
+
try receive(["type": "glasses_ready", "sid": "booted", "readyId": first])
|
|
487
|
+
XCTAssertEqual(versionRequests(), 1)
|
|
488
|
+
|
|
489
|
+
try receive(["type": "glasses_ready", "sid": "restarted", "readyId": second])
|
|
490
|
+
XCTAssertEqual(versionRequests(), 2)
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
func testAnswerFromAnotherGlassesProcessIsHandledWithNoExchangePending() throws {
|
|
495
|
+
try withReadinessTransport { transport, receive, versionRequests in
|
|
496
|
+
try receive(["C": "sr_hrt", "B": ["ready": 1]])
|
|
497
|
+
let readyId = try XCTUnwrap(transport.phoneReadyIds().last)
|
|
498
|
+
try receive(["type": "glasses_ready", "sid": "booted", "readyId": readyId])
|
|
499
|
+
|
|
500
|
+
// A different process reset its transport for this copy, so it is not a repeat.
|
|
501
|
+
try receive(["type": "glasses_ready", "sid": "restarted", "readyId": readyId])
|
|
502
|
+
XCTAssertEqual(versionRequests(), 2)
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
func testRestartedProcessAnsweringAnOlderCopyIsHandledAndThePendingExchangeStillCounts() throws {
|
|
507
|
+
try withReadinessTransport { transport, receive, versionRequests in
|
|
508
|
+
try receive(["C": "sr_hrt", "B": ["ready": 1]])
|
|
509
|
+
let first = try XCTUnwrap(transport.phoneReadyIds().last)
|
|
510
|
+
try receive(["type": "glasses_ready", "sid": "booted", "readyId": first])
|
|
511
|
+
try receive(["type": "version_info_1", "sid": "restarted", "build_number": "302010073"])
|
|
512
|
+
let second = try XCTUnwrap(transport.phoneReadyIds().last)
|
|
513
|
+
|
|
514
|
+
// The restarted process reset for a buffered copy of the old exchange, then resets
|
|
515
|
+
// again for the pending one: both answers follow a reset.
|
|
516
|
+
try receive(["type": "glasses_ready", "sid": "restarted", "readyId": first])
|
|
517
|
+
XCTAssertEqual(versionRequests(), 2)
|
|
518
|
+
try receive(["type": "glasses_ready", "sid": "restarted", "readyId": second])
|
|
519
|
+
XCTAssertEqual(versionRequests(), 3)
|
|
520
|
+
try receive(["type": "glasses_ready", "sid": "restarted", "readyId": second])
|
|
521
|
+
XCTAssertEqual(versionRequests(), 3)
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
func testReadinessExchangeEndsWithTheBleSession() throws {
|
|
526
|
+
try withReadinessTransport { transport, receive, _ in
|
|
527
|
+
try receive(["C": "sr_hrt", "B": ["ready": 1]])
|
|
528
|
+
let first = try XCTUnwrap(transport.phoneReadyIds().last)
|
|
529
|
+
transport.cleanup()
|
|
530
|
+
DeviceStore.shared.store.set("glasses", "fullyBooted", false)
|
|
531
|
+
|
|
532
|
+
try receive(["C": "sr_hrt", "B": ["ready": 1]])
|
|
533
|
+
XCTAssertNotEqual(try XCTUnwrap(transport.phoneReadyIds().last), first)
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
func testGlassesWithoutReadyIdKeepInitializingOnEveryAnswer() throws {
|
|
538
|
+
try withReadinessTransport { _, receive, versionRequests in
|
|
539
|
+
try receive(["type": "glasses_ready", "sid": "legacy"])
|
|
540
|
+
try receive(["type": "glasses_ready", "sid": "legacy"])
|
|
541
|
+
XCTAssertEqual(versionRequests(), 2)
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/// Runs `body` on a fresh transport whose glasses have not reported readiness yet.
|
|
546
|
+
private func withReadinessTransport(
|
|
547
|
+
_ body: (
|
|
548
|
+
SessionReadinessTransport,
|
|
549
|
+
([String: Any]) throws -> Void,
|
|
550
|
+
() -> Int
|
|
551
|
+
) throws -> Void
|
|
552
|
+
) throws {
|
|
553
|
+
let store = DeviceStore.shared.store
|
|
554
|
+
let saved = ["bluetooth", "glasses"].map { ($0, store.getCategory($0)) }
|
|
555
|
+
let previous = DeviceManager.shared.sgc
|
|
556
|
+
let transport = SessionReadinessTransport()
|
|
557
|
+
DeviceManager.shared.sgc = transport
|
|
558
|
+
defer {
|
|
559
|
+
transport.cleanup()
|
|
560
|
+
DeviceManager.shared.sgc = previous
|
|
561
|
+
for (category, values) in saved {
|
|
562
|
+
for key in store.getCategory(category).keys where values[key] == nil {
|
|
563
|
+
store.remove(category, key)
|
|
564
|
+
}
|
|
565
|
+
for (key, value) in values {
|
|
566
|
+
store.set(category, key, value)
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
store.set("glasses", "fullyBooted", false)
|
|
571
|
+
|
|
572
|
+
func receive(_ value: [String: Any]) throws {
|
|
573
|
+
try transport.processReceivedData(JSONSerialization.data(withJSONObject: value))
|
|
574
|
+
}
|
|
575
|
+
func versionRequests() -> Int {
|
|
576
|
+
transport.commands.filter { $0["type"] as? String == "request_version" }.count
|
|
577
|
+
}
|
|
578
|
+
try body(transport, receive, versionRequests)
|
|
579
|
+
}
|
|
580
|
+
|
|
452
581
|
func testInitialVersionChunkDoesNotStartAnExtraReadinessExchange() throws {
|
|
453
582
|
let store = DeviceStore.shared.store
|
|
454
583
|
let saved = store.getCategory("glasses")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mentra/bluetooth-sdk",
|
|
3
|
-
"version": "3.4.0-dev.
|
|
3
|
+
"version": "3.4.0-dev.1011",
|
|
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.
|
|
118
|
+
"@mentra/cloud-protocol": "3.4.0-dev.1011"
|
|
119
119
|
},
|
|
120
120
|
"devDependencies": {
|
|
121
121
|
"@types/node": "^25.9.3",
|
|
@@ -7,7 +7,7 @@ export const GENERATED_RELEASE_CHANGELOGS = Object.freeze(
|
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
9
|
"version": "3.3.0",
|
|
10
|
-
"markdown": "
|
|
10
|
+
"markdown": "- **Mentra Call:** Now available on iPhone, with a redesigned call screen and photo sharing during calls.\n- **Microphone:** Improved glasses microphone reliability, including after phone calls.\n- **Photos and gallery:** More reliable photo capture and gallery syncing.\n- **Glasses updates:** More reliable glasses updates, with clearer progress.\n- **Miniapps:** Miniapps now update automatically. Fixed miniapps getting stuck on loading screens.\n- **Mentra AI:** Reliability improvements and bug fixes.\n- **Notes:** Take photos with the glasses camera button, and add meeting and location details to your notes.\n- **Pairing and connections:** Improved glasses audio reconnection on Android.\n- **G1 and NIMO:** Improved text display, including accented letters.\n- **Android tablets:** The Mentra App now rotates to landscape."
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
"version": "3.2.1",
|
|
@@ -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.
|
|
16
|
-
"releaseSetId": "mentra-3.4.0-dev.
|
|
17
|
-
"sourceCommit": "
|
|
18
|
-
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-dev.
|
|
19
|
-
"otaManifestSha256": "
|
|
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"
|
|
20
20
|
})
|