@mentra/bluetooth-sdk 3.4.0-beta.1345 → 3.4.0-beta.1347
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/assets/nimo/nimo-firmware-0.1.1.1-537cf1.bin +0 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/GeneratedReleaseMetadata.kt +5 -5
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/Nimo.kt +198 -10
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/NimoFirmwareUpdater.kt +213 -0
- package/android/src/main/java/com/mentra/bluetoothsdk/sgcs/NimoOtaProtocol.kt +112 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/NimoFirmwareTargetTest.kt +15 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/NimoFirmwareUpdaterTest.kt +76 -0
- package/android/src/test/java/com/mentra/bluetoothsdk/sgcs/NimoOtaProtocolTest.kt +77 -0
- package/android/src/testDebug/java/com/mentra/bluetoothsdk/sgcs/NimoReadinessDriverTest.kt +31 -1
- package/build/generated/releaseMetadata.js +5 -5
- package/build/generated/releaseMetadata.js.map +1 -1
- package/ios/MentraBluetoothSDK.podspec +3 -1
- package/ios/Resources/NimoFirmware/nimo-firmware-0.1.1.1-537cf1.bin +0 -0
- package/ios/Source/BluetoothSdkDefaults.swift +1 -1
- package/ios/Source/GeneratedReleaseMetadata.swift +5 -5
- package/ios/Source/sgcs/Nimo.swift +211 -5
- package/ios/Source/sgcs/NimoFirmwareUpdater.swift +260 -0
- package/ios/Source/sgcs/NimoOtaProtocol.swift +159 -0
- package/ios/Tests/NimoOtaProtocolTests.swift +78 -0
- package/package.json +2 -2
- package/src/generated/releaseMetadata.ts +5 -5
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
package com.mentra.bluetoothsdk.sgcs
|
|
2
|
+
|
|
3
|
+
import java.util.zip.CRC32
|
|
4
|
+
|
|
5
|
+
/** NIMO's OTA channel (7033/2001/2002), distinct from the normal 0xBF command channel. */
|
|
6
|
+
internal object NimoOtaProtocol {
|
|
7
|
+
const val INFO = 0x02
|
|
8
|
+
const val RESET = 0x03
|
|
9
|
+
const val FILE_OFFSET = 0xE1
|
|
10
|
+
const val CAN_UPDATE = 0xE2
|
|
11
|
+
const val ENTER = 0xE3
|
|
12
|
+
const val BLOCK = 0xE5
|
|
13
|
+
const val VALIDATE = 0xE6
|
|
14
|
+
const val SYNC = 0xE8
|
|
15
|
+
private val header = byteArrayOf(0x70, 0x07, 0x6E)
|
|
16
|
+
|
|
17
|
+
data class Response(val command: Int, val sequence: Int, val status: Int, val body: ByteArray)
|
|
18
|
+
data class Slice(val offset: Long, val length: Int)
|
|
19
|
+
data class EnterResult(val slice: Slice, val crc: Boolean)
|
|
20
|
+
data class BlockResult(val slice: Slice, val delayMs: Int)
|
|
21
|
+
|
|
22
|
+
fun request(command: Int, sequence: Int, params: ByteArray = byteArrayOf()): ByteArray {
|
|
23
|
+
require(command in 0..255 && sequence in 0..255 && params.size <= 65534) { "Invalid OTA request" }
|
|
24
|
+
val length = params.size + 1
|
|
25
|
+
return header + byteArrayOf(0xC0.toByte(), command.toByte(), (length shr 8).toByte(), length.toByte(), sequence.toByte()) + params + 0x33.toByte()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Bounded incremental decoder. Any malformed frame invalidates this exchange, never resynchronizes silently. */
|
|
29
|
+
class Decoder {
|
|
30
|
+
private var buffer = byteArrayOf()
|
|
31
|
+
fun reset() { buffer = byteArrayOf() }
|
|
32
|
+
fun feed(bytes: ByteArray): List<Response> {
|
|
33
|
+
val result = mutableListOf<Response>()
|
|
34
|
+
try {
|
|
35
|
+
// Append incrementally so a large/coalesced notification cannot grow the retained buffer without bound.
|
|
36
|
+
for (byte in bytes) {
|
|
37
|
+
buffer += byte
|
|
38
|
+
if (buffer.size <= 3) require(buffer.last() == header[buffer.lastIndex]) { "Invalid OTA header" }
|
|
39
|
+
if (buffer.size == 4) require(buffer[3] == 0.toByte()) { "Invalid OTA direction" }
|
|
40
|
+
if (buffer.size >= 7) {
|
|
41
|
+
val length = u16(buffer, 5)
|
|
42
|
+
require(length in 2..4096) { "Invalid OTA response length" }
|
|
43
|
+
if (buffer.size == length + 8) {
|
|
44
|
+
require(buffer.last() == 0x33.toByte()) { "Invalid OTA footer" }
|
|
45
|
+
result += Response(u8(buffer[4]), u8(buffer[8]), u8(buffer[7]), buffer.copyOfRange(9, buffer.size - 1))
|
|
46
|
+
buffer = byteArrayOf()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
} catch (error: IllegalArgumentException) {
|
|
51
|
+
reset()
|
|
52
|
+
throw error
|
|
53
|
+
}
|
|
54
|
+
return result
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fun deviceInfo(body: ByteArray): Map<Int, ByteArray> {
|
|
59
|
+
val fields = mutableMapOf<Int, ByteArray>()
|
|
60
|
+
var index = 0
|
|
61
|
+
while (index < body.size) {
|
|
62
|
+
val length = u8(body[index])
|
|
63
|
+
require(length >= 1 && length <= body.size - index - 1) { "Truncated OTA device info" }
|
|
64
|
+
val type = u8(body[index + 1])
|
|
65
|
+
require(!fields.containsKey(type)) { "Duplicate OTA device info" }
|
|
66
|
+
fields[type] = body.copyOfRange(index + 2, index + 1 + length)
|
|
67
|
+
index += 1 + length
|
|
68
|
+
}
|
|
69
|
+
return fields
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
fun fileOffset(body: ByteArray): Slice {
|
|
73
|
+
require(body.size == 6) { "Invalid OTA file offset" }
|
|
74
|
+
return Slice(u32(body, 0), u16(body, 4))
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
fun enterResult(body: ByteArray): EnterResult {
|
|
78
|
+
require(body.size == 8 && body[0] == 0.toByte() && u8(body[7]) in 0..1) { "OTA upgrade entry refused" }
|
|
79
|
+
return EnterResult(Slice(u32(body, 1), u16(body, 5)), body[7] == 1.toByte())
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
fun blockResult(body: ByteArray): BlockResult {
|
|
83
|
+
require(body.size == 9 && body[0] == 0.toByte()) { "OTA block refused" }
|
|
84
|
+
val delay = u16(body, 7)
|
|
85
|
+
require(delay <= 30000) { "Invalid OTA block delay" }
|
|
86
|
+
return BlockResult(Slice(u32(body, 1), u16(body, 5)), delay)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
fun firmwareSlice(firmware: ByteArray, slice: Slice): ByteArray {
|
|
90
|
+
require(slice.offset >= 0 && slice.offset <= firmware.size.toLong() && slice.length > 0 &&
|
|
91
|
+
slice.length.toLong() <= firmware.size.toLong() - slice.offset) { "OTA slice exceeds firmware" }
|
|
92
|
+
return firmware.copyOfRange(slice.offset.toInt(), slice.offset.toInt() + slice.length)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Each chunk gets its own CRC and sequence; only the final chunk gets a block response. */
|
|
96
|
+
fun blockParts(firmware: ByteArray, slice: Slice, crc: Boolean, writeCapacity: Int): List<ByteArray> {
|
|
97
|
+
val data = firmwareSlice(firmware, slice)
|
|
98
|
+
require(writeCapacity in 20..512) { "Unsupported OTA write capacity" }
|
|
99
|
+
val chunkSize = minOf(496, writeCapacity - 16) - if (crc) 4 else 0
|
|
100
|
+
require(chunkSize > 0) { "OTA write capacity too small for CRC" }
|
|
101
|
+
return (data.indices step chunkSize).map { start ->
|
|
102
|
+
val piece = data.copyOfRange(start, minOf(start + chunkSize, data.size))
|
|
103
|
+
val checksum = if (crc) u32Bytes(CRC32().apply { update(piece) }.value) else byteArrayOf()
|
|
104
|
+
u32Bytes(slice.offset + start) + piece + checksum
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private fun u8(value: Byte) = value.toInt() and 255
|
|
109
|
+
private fun u16(bytes: ByteArray, offset: Int) = (u8(bytes[offset]) shl 8) or u8(bytes[offset + 1])
|
|
110
|
+
private fun u32(bytes: ByteArray, offset: Int): Long = (0..3).fold(0L) { value, index -> (value shl 8) or u8(bytes[offset + index]).toLong() }
|
|
111
|
+
private fun u32Bytes(value: Long) = byteArrayOf((value shr 24).toByte(), (value shr 16).toByte(), (value shr 8).toByte(), value.toByte())
|
|
112
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
package com.mentra.bluetoothsdk.sgcs
|
|
2
|
+
|
|
3
|
+
import org.junit.Assert.assertFalse
|
|
4
|
+
import org.junit.Assert.assertTrue
|
|
5
|
+
import org.junit.Test
|
|
6
|
+
|
|
7
|
+
class NimoFirmwareTargetTest {
|
|
8
|
+
@Test fun acceptsOnlyTheSupportedBuild() {
|
|
9
|
+
assertTrue(NimoFirmwareTarget.isCurrent("0.1.1.1", "FW-VERSION-v0.1.1.1-20260827164351-537cf1-dirty-Debug"))
|
|
10
|
+
assertTrue(NimoFirmwareTarget.isCurrent("0.1.1.1", ""))
|
|
11
|
+
assertFalse(NimoFirmwareTarget.isCurrent("0.1.1.1", "FW-VERSION-v0.1.1.1-20260101000000-abcdef-Release"))
|
|
12
|
+
assertFalse(NimoFirmwareTarget.isCurrent("0.1.0.9", "FW-VERSION-v0.1.0.9-20250101000000-123456-Release"))
|
|
13
|
+
assertFalse(NimoFirmwareTarget.isCurrent("", ""))
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
package com.mentra.bluetoothsdk.sgcs
|
|
2
|
+
|
|
3
|
+
import org.junit.Assert.*
|
|
4
|
+
import org.junit.Test
|
|
5
|
+
|
|
6
|
+
class NimoFirmwareUpdaterTest {
|
|
7
|
+
private class Clock : NimoScheduler {
|
|
8
|
+
val tasks = mutableListOf<Pair<Long, () -> Unit>>(); var now = 0L
|
|
9
|
+
override fun post(delayMs: Long, task: () -> Unit): () -> Unit {
|
|
10
|
+
val e = (now + delayMs) to task; tasks += e; return { tasks.remove(e) }
|
|
11
|
+
}
|
|
12
|
+
fun run(limit: Int = 100000) { var n = 0
|
|
13
|
+
while (tasks.isNotEmpty() && n++ < limit) { val e = tasks.minByOrNull { it.first }!!; tasks.remove(e); now = e.first; e.second() } }
|
|
14
|
+
}
|
|
15
|
+
private fun resp(cmd: Int, seq: Int, body: ByteArray, status: Int = 0): ByteArray {
|
|
16
|
+
val len = body.size + 2
|
|
17
|
+
return byteArrayOf(0x70, 0x07, 0x6E, 0, cmd.toByte(), (len shr 8).toByte(), len.toByte(), status.toByte(), seq.toByte()) + body + 0x33.toByte()
|
|
18
|
+
}
|
|
19
|
+
private fun u32(v: Int) = byteArrayOf((v shr 24).toByte(), (v shr 16).toByte(), (v shr 8).toByte(), v.toByte())
|
|
20
|
+
private fun u16(v: Int) = byteArrayOf((v shr 8).toByte(), v.toByte())
|
|
21
|
+
|
|
22
|
+
@Test fun fullTransferSendsReset() {
|
|
23
|
+
val fw = ByteArray(1000) { it.toByte() }
|
|
24
|
+
val clock = Clock()
|
|
25
|
+
var result: String? = "pending"
|
|
26
|
+
val received = ByteArray(fw.size); var syncCalls = 0
|
|
27
|
+
val commands = mutableListOf<Int>()
|
|
28
|
+
lateinit var updater: NimoFirmwareUpdater
|
|
29
|
+
val blockSize = 256
|
|
30
|
+
updater = NimoFirmwareUpdater(fw, 100, clock, write = { pkt, done ->
|
|
31
|
+
val cmd = pkt[4].toInt() and 255; val seq = pkt[7].toInt() and 255
|
|
32
|
+
val params = pkt.copyOfRange(8, pkt.size - 1)
|
|
33
|
+
commands += cmd
|
|
34
|
+
clock.post(1) { done(true) }
|
|
35
|
+
val reply: ByteArray? = when (cmd) {
|
|
36
|
+
0x02 -> byteArrayOf(2, 3, 1, 2, 5, 1, 3, 2, 80, 80)
|
|
37
|
+
0xE1 -> u32(0) + u16(16)
|
|
38
|
+
0xE2 -> byteArrayOf(0)
|
|
39
|
+
0xE3 -> byteArrayOf(0) + u32(0) + u16(blockSize) + byteArrayOf(1)
|
|
40
|
+
0xE5 -> {
|
|
41
|
+
val off = ((params[0].toInt() and 255) shl 24) or ((params[1].toInt() and 255) shl 16) or ((params[2].toInt() and 255) shl 8) or (params[3].toInt() and 255)
|
|
42
|
+
val data = params.copyOfRange(4, params.size - 4)
|
|
43
|
+
data.copyInto(received, off)
|
|
44
|
+
val end = off + data.size
|
|
45
|
+
if (end % blockSize == 0 || end == fw.size) {
|
|
46
|
+
if (end >= fw.size) byteArrayOf(0) + u32(0) + u16(0) + u16(0)
|
|
47
|
+
else byteArrayOf(0) + u32(end) + u16(minOf(blockSize, fw.size - end)) + u16(10)
|
|
48
|
+
} else null
|
|
49
|
+
}
|
|
50
|
+
0xE6 -> byteArrayOf(0)
|
|
51
|
+
0xE8 -> if (syncCalls++ < 2) byteArrayOf(1) else byteArrayOf(0)
|
|
52
|
+
else -> null
|
|
53
|
+
}
|
|
54
|
+
if (reply != null) clock.post(2) { updater.receive(resp(cmd, seq, reply)) }
|
|
55
|
+
}, progress = {}, finished = { result = it })
|
|
56
|
+
updater.start()
|
|
57
|
+
clock.run()
|
|
58
|
+
assertNull(result)
|
|
59
|
+
assertArrayEquals(fw, received)
|
|
60
|
+
assertEquals(0x03, commands.last())
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@Test fun refusalReportsFailureWithoutReset() {
|
|
64
|
+
val clock = Clock(); var result: String? = "pending"; val commands = mutableListOf<Int>()
|
|
65
|
+
lateinit var updater: NimoFirmwareUpdater
|
|
66
|
+
updater = NimoFirmwareUpdater(ByteArray(100), 100, clock, write = { pkt, done ->
|
|
67
|
+
val cmd = pkt[4].toInt() and 255; val seq = pkt[7].toInt() and 255; commands += cmd
|
|
68
|
+
done(true)
|
|
69
|
+
val reply = when (cmd) { 0x02 -> byteArrayOf(2, 3, 1, 2, 5, 1, 3, 2, 10, 10); 0xE1 -> u32(0) + u16(16); 0xE2 -> byteArrayOf(2); else -> null }
|
|
70
|
+
if (reply != null) clock.post(1) { updater.receive(resp(cmd, seq, reply)) }
|
|
71
|
+
}, progress = {}, finished = { result = it })
|
|
72
|
+
updater.start(); clock.run()
|
|
73
|
+
assertNotNull(result); assertNotEquals("pending", result)
|
|
74
|
+
assertFalse(commands.contains(0x03)); assertFalse(commands.contains(0xE3))
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
package com.mentra.bluetoothsdk.sgcs
|
|
2
|
+
|
|
3
|
+
import java.io.File
|
|
4
|
+
import org.json.JSONObject
|
|
5
|
+
import org.junit.Assert.*
|
|
6
|
+
import org.junit.Test
|
|
7
|
+
|
|
8
|
+
class NimoOtaProtocolTest {
|
|
9
|
+
private val fixtures = JSONObject(File("../test-fixtures/nimo-ota.json").readText())
|
|
10
|
+
private fun bytes(hex: String) = hex.chunked(2).map { it.toInt(16).toByte() }.toByteArray()
|
|
11
|
+
|
|
12
|
+
@Test fun capturedRequestsAndResponsesMatchIncludingResetWithoutBusinessByte() {
|
|
13
|
+
val requests = fixtures.getJSONArray("requests")
|
|
14
|
+
for (index in 0 until requests.length()) {
|
|
15
|
+
val item = requests.getJSONObject(index)
|
|
16
|
+
assertArrayEquals(bytes(item.getString("frame")), NimoOtaProtocol.request(item.getInt("command"), item.getInt("sequence"), bytes(item.getString("params"))))
|
|
17
|
+
}
|
|
18
|
+
val responses = fixtures.getJSONArray("responses")
|
|
19
|
+
var combined = byteArrayOf()
|
|
20
|
+
for (index in 0 until responses.length()) {
|
|
21
|
+
val item = responses.getJSONObject(index)
|
|
22
|
+
val frame = bytes(item.getString("frame"))
|
|
23
|
+
combined += frame
|
|
24
|
+
// Every possible split must produce exactly one identical response.
|
|
25
|
+
for (split in 0..frame.size) {
|
|
26
|
+
val decoder = NimoOtaProtocol.Decoder()
|
|
27
|
+
val actual = (decoder.feed(frame.copyOfRange(0, split)) + decoder.feed(frame.copyOfRange(split, frame.size))).single()
|
|
28
|
+
assertEquals(item.getInt("command"), actual.command)
|
|
29
|
+
assertEquals(item.getInt("sequence"), actual.sequence)
|
|
30
|
+
assertEquals(item.getInt("status"), actual.status)
|
|
31
|
+
assertArrayEquals(bytes(item.getString("body")), actual.body)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
assertEquals(responses.length(), NimoOtaProtocol.Decoder().feed(combined).size)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Test fun smallPhoneWritesUsePerChunkCrcAndPreserveRequestedOffset() {
|
|
38
|
+
val firmware = bytes(fixtures.getString("firmware"))
|
|
39
|
+
val blocks = fixtures.getJSONArray("blocks")
|
|
40
|
+
for (index in 0 until blocks.length()) {
|
|
41
|
+
val item = blocks.getJSONObject(index)
|
|
42
|
+
val parts = NimoOtaProtocol.blockParts(firmware, NimoOtaProtocol.Slice(item.getLong("offset"), item.getInt("length")), item.getBoolean("crc"), item.getInt("capacity"))
|
|
43
|
+
val expected = item.getJSONArray("parts")
|
|
44
|
+
assertEquals(expected.length(), parts.size)
|
|
45
|
+
parts.forEachIndexed { i, part ->
|
|
46
|
+
assertArrayEquals(bytes(expected.getString(i)), part)
|
|
47
|
+
assertTrue(NimoOtaProtocol.request(0xE5, i, part).size <= item.getInt("capacity"))
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@Test fun rejectsMalformedDeviceDataAndOutOfBoundsRequests() {
|
|
53
|
+
for (hex in listOf("71", "70076ec0", "70076e00020001", "70076e00021001", "70076e0003000200fa00")) {
|
|
54
|
+
assertThrows(IllegalArgumentException::class.java) { NimoOtaProtocol.Decoder().feed(bytes(hex)) }
|
|
55
|
+
}
|
|
56
|
+
for (hex in listOf("00", "0201", "01000100")) {
|
|
57
|
+
assertThrows(IllegalArgumentException::class.java) { NimoOtaProtocol.deviceInfo(bytes(hex)) }
|
|
58
|
+
}
|
|
59
|
+
for (slice in listOf(NimoOtaProtocol.Slice(-1, 1), NimoOtaProtocol.Slice(100, 1), NimoOtaProtocol.Slice(0, 0), NimoOtaProtocol.Slice(Long.MAX_VALUE, 1))) {
|
|
60
|
+
assertThrows(IllegalArgumentException::class.java) { NimoOtaProtocol.firmwareSlice(ByteArray(100), slice) }
|
|
61
|
+
}
|
|
62
|
+
assertThrows(IllegalArgumentException::class.java) { NimoOtaProtocol.blockParts(ByteArray(100), NimoOtaProtocol.Slice(0, 100), true, 20) }
|
|
63
|
+
assertThrows(IllegalArgumentException::class.java) { NimoOtaProtocol.enterResult(bytes("0100000012100001")) }
|
|
64
|
+
assertThrows(IllegalArgumentException::class.java) { NimoOtaProtocol.blockResult(bytes("000000000000007531")) }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@Test fun interpretsCapturedPreflightAndBlockRequests() {
|
|
68
|
+
val info = NimoOtaProtocol.deviceInfo(bytes("0600000e000e0205010000020103026464020301020400020501"))
|
|
69
|
+
assertArrayEquals(bytes("00000201"), info[1])
|
|
70
|
+
assertArrayEquals(bytes("6464"), info[2])
|
|
71
|
+
val entered = NimoOtaProtocol.enterResult(bytes("0000000012100001"))
|
|
72
|
+
assertEquals(NimoOtaProtocol.Slice(18, 4096), entered.slice)
|
|
73
|
+
assertTrue(entered.crc)
|
|
74
|
+
assertEquals(NimoOtaProtocol.Slice(4114, 4096), NimoOtaProtocol.blockResult(bytes("000000101210000000")).slice)
|
|
75
|
+
assertEquals(NimoOtaProtocol.Slice(0, 0), NimoOtaProtocol.blockResult(ByteArray(9)).slice)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -162,11 +162,41 @@ class NimoReadinessDriverTest {
|
|
|
162
162
|
assertTrue(failures.isEmpty())
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
|
|
165
|
+
@Test fun canvasWaitsForTheSupportedFirmwareVersion() {
|
|
166
|
+
finishHandshake(peer = true, packed = null)
|
|
167
|
+
assertKeys() // No Launch against firmware that has not reported its version.
|
|
168
|
+
emitVersion(SUPPORTED_PACKED, SUPPORTED_DETAIL)
|
|
169
|
+
assertKeys(1)
|
|
170
|
+
assertTrue(failures.isEmpty())
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@Test fun otherFirmwareWithoutAnOtaChannelStillStartsTheCanvas() {
|
|
174
|
+
// The test link exposes no OTA characteristics, so the update is unavailable and the session proceeds.
|
|
175
|
+
finishHandshake(peer = true, packed = (1 shl 21), detail = "FW-VERSION-v0.1.0.0-20250101000000-abcdef-Release")
|
|
176
|
+
assertKeys(1)
|
|
177
|
+
assertTrue(failures.isEmpty())
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
private fun finishHandshake(peer: Boolean?, packed: Int? = SUPPORTED_PACKED, detail: String = SUPPORTED_DETAIL) {
|
|
166
181
|
field("twsConnected").set(nimo, true)
|
|
167
182
|
field("peerCompanionReady").set(nimo, peer)
|
|
168
183
|
Nimo::class.java.getDeclaredMethod("finishHandshake").apply { isAccessible = true }.invoke(nimo)
|
|
169
184
|
idle()
|
|
185
|
+
if (packed != null) emitVersion(packed, detail)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** GET_VERSION / GET_VERSION_DETAIL replies; the canvas starts only after the version check. */
|
|
189
|
+
private fun emitVersion(packed: Int, detail: String) {
|
|
190
|
+
val le = byteArrayOf(packed.toByte(), (packed shr 8).toByte(), (packed shr 16).toByte(), (packed shr 24).toByte())
|
|
191
|
+
emit(packet(NimoProtocol.CMD_GET_PARAMETER, NimoProtocol.GET_VERSION, byteArrayOf(0) + le))
|
|
192
|
+
emit(packet(NimoProtocol.CMD_GET_PARAMETER, NimoProtocol.GET_VERSION_DETAIL,
|
|
193
|
+
byteArrayOf(0) + detail.toByteArray(Charsets.UTF_8)))
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
private companion object {
|
|
197
|
+
// 0.1.1.1 packed as major<<28 | minor<<21 | micro<<12 | build.
|
|
198
|
+
const val SUPPORTED_PACKED = (1 shl 21) or (1 shl 12) or 1
|
|
199
|
+
const val SUPPORTED_DETAIL = "FW-VERSION-v0.1.1.1-20260827164351-537cf1-dirty-Debug"
|
|
170
200
|
}
|
|
171
201
|
|
|
172
202
|
private fun newGatt(): BluetoothGatt = ShadowBluetoothGatt.newInstance(
|
|
@@ -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-beta.
|
|
5
|
-
"releaseSetId": "mentra-3.4.0-beta.
|
|
6
|
-
"sourceCommit": "
|
|
7
|
-
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.
|
|
8
|
-
"otaManifestSha256": "
|
|
4
|
+
"releaseIdentity": "3.4.0-beta.1347",
|
|
5
|
+
"releaseSetId": "mentra-3.4.0-beta.1347",
|
|
6
|
+
"sourceCommit": "9086db8ca1ff7a4b340f0b6cd54a82e3cafea65e",
|
|
7
|
+
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1347.json",
|
|
8
|
+
"otaManifestSha256": "4404546c1a7bd968296afc23cbf95e4832e2753a37735d3f23792168cc45bd19"
|
|
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,iBAAiB;IACpC,cAAc,EAAE,wBAAwB;IACxC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,mIAAmI;IACrJ,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-beta.
|
|
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,iBAAiB;IACpC,cAAc,EAAE,wBAAwB;IACxC,cAAc,EAAE,0CAA0C;IAC1D,gBAAgB,EAAE,mIAAmI;IACrJ,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-beta.1347\",\n \"releaseSetId\": \"mentra-3.4.0-beta.1347\",\n \"sourceCommit\": \"9086db8ca1ff7a4b340f0b6cd54a82e3cafea65e\",\n \"otaManifestUrl\": \"https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1347.json\",\n \"otaManifestSha256\": \"4404546c1a7bd968296afc23cbf95e4832e2753a37735d3f23792168cc45bd19\"\n})\n"]}
|
|
@@ -51,7 +51,9 @@ Pod::Spec.new do |s|
|
|
|
51
51
|
s.ios.vendored_frameworks = 'Packages/SherpaOnnx/sherpa-onnx.xcframework'
|
|
52
52
|
|
|
53
53
|
s.resource_bundles = {
|
|
54
|
-
'BluetoothSDKPrivacy' => ['Source/PrivacyInfo.xcprivacy']
|
|
54
|
+
'BluetoothSDKPrivacy' => ['Source/PrivacyInfo.xcprivacy'],
|
|
55
|
+
# NIMO firmware the SGC installs when connected glasses report another version.
|
|
56
|
+
'MentraNimoFirmware' => ['Resources/NimoFirmware/*.bin']
|
|
55
57
|
}
|
|
56
58
|
# Phone-side Silero speech activity runs through the iOS-only sherpa-onnx framework.
|
|
57
59
|
s.ios.resource_bundles = {
|
|
Binary file
|
|
@@ -16,7 +16,7 @@ enum BluetoothSdkDefaults {
|
|
|
16
16
|
/// 20-minute unworn power-off 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-beta.
|
|
19
|
+
private static let swiftPackageSdkVersion = "3.4.0-beta.1347"
|
|
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-beta.
|
|
7
|
-
static let releaseSetId = "mentra-3.4.0-beta.
|
|
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-beta.
|
|
10
|
-
static let otaManifestSha256 = "
|
|
6
|
+
static let releaseIdentity = "3.4.0-beta.1347"
|
|
7
|
+
static let releaseSetId = "mentra-3.4.0-beta.1347"
|
|
8
|
+
static let sourceCommit = "9086db8ca1ff7a4b340f0b6cd54a82e3cafea65e"
|
|
9
|
+
static let otaManifestUrl = "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.4.0/mentra-live-ota-3.4.0-beta.1347.json"
|
|
10
|
+
static let otaManifestSha256 = "4404546c1a7bd968296afc23cbf95e4832e2753a37735d3f23792168cc45bd19"
|
|
11
11
|
}
|