Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
41ef416
DEV-1410: draft iOS BLE throughput test automation
harithjamadi Nov 4, 2026
becdca7
DEV-1410: build ThroughputRunner in TestApp, fix TestApp and update_w…
harithjamadi Nov 4, 2026
f953774
DEV-1410: Throughput Test screen in TestApp, multi-device scan and run
harithjamadi Nov 4, 2026
34917d4
DEV-1410: runner delegates off the main actor, live status on the thr…
harithjamadi Nov 4, 2026
543a650
DEV-1410: throughput runner survives a dropped link or an unanswered …
harithjamadi Nov 4, 2026
9e5d82c
DEV-1410: Shimmer3Protocol, stop the byte buffer race that aborted st…
harithjamadi Nov 4, 2026
a303429
DEV-1410: Shimmer3Protocol, wait for a whole reply without holding th…
harithjamadi Nov 4, 2026
dba8bed
DEV-1410: read the Bluetooth radio version (0xA1 / 0xA2)
harithjamadi Nov 4, 2026
b3b5091
DEV-1410: throughput runner records the radio and retries failed runs
harithjamadi Nov 4, 2026
2d5b2dc
DEV-1410: radio name stops at the version digits; quote it in the CSV
harithjamadi Nov 4, 2026
91839fa
DEV-1410: review fixes for the throughput runner and reply handling
harithjamadi Nov 5, 2026
085ca84
DEV-1410: record the phone model in the throughput CSV
harithjamadi Nov 5, 2026
f5cf703
DEV-1410: throughput CSV uses the wiki table's columns
harithjamadi Nov 5, 2026
00b0557
DEV-1410: one wiki table per release, with every device's rows
harithjamadi Nov 5, 2026
2b8533a
DEV-1410: every published run gets the next Test Results number
harithjamadi Nov 5, 2026
6c25af1
DEV-1410: one wiki table per API release; later runs add their rows
harithjamadi Nov 5, 2026
aa0dff6
Merge branch 'main' into DEV-1410_ios_throughput_automation
harithjamadi Nov 5, 2026
a2d343a
DEV-1410: note the API release in its own wiki column
harithjamadi Nov 5, 2026
2f1832a
DEV-1410: one 60 s run per setting, retried until ok
harithjamadi Nov 5, 2026
a69379f
DEV-1410: publish throughput results to the wiki in one command
harithjamadi Nov 5, 2026
42afbdc
DEV-1410: document the throughput test and wiki publish end to end
harithjamadi Nov 5, 2026
d11c318
DEV-1410: second review fixes
harithjamadi Nov 5, 2026
6aa379a
DEV-1410: wiki --push cancels cleanly when nothing can be typed; add …
harithjamadi Nov 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ShimmerBluetooth/ShimmerBluetooth/BleByteRadio.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ public class BleByteRadio : NSObject, ByteCommunication {


public func connect() async -> Bool? {
await self.bluetoothManager!.connect(activePeripheral: activePeripheral!)
// A connect CoreBluetooth failed or gave up on never reaches service discovery: return now
// instead of waiting for characteristics that will not come.
guard await self.bluetoothManager!.connect(activePeripheral: activePeripheral!) == true else {
return false
}

/*
if self.centralManager.state != .poweredOn {
Expand Down
10 changes: 6 additions & 4 deletions ShimmerBluetooth/ShimmerBluetooth/BluetoothManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public class BluetoothManager: NSObject {

self.centralManager.connect(activePeripheral, options: [CBConnectPeripheralOptionNotifyOnDisconnectionKey : NSNumber(value: true)])
return await withCheckedContinuation { continuation in
if self.continuation == nil {
// 2
self.continuation = continuation
}
// A connect that never completed (CoreBluetooth never times one out) is given up on
// here, so it cannot take this attempt's didConnect.
self.continuation?.resume(returning: false)
self.continuation = continuation
}
}

Expand Down Expand Up @@ -185,6 +185,8 @@ extension BluetoothManager: CBCentralManagerDelegate {
}*/
public func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
print("[ERROR] Could not connecto to peripheral \(peripheral.identifier.uuidString)")
self.continuation?.resume(returning: false)
self.continuation = nil
let pname = peripheral.name
delegates![pname!]!?.isDisconnected()
}
Expand Down
107 changes: 95 additions & 12 deletions ShimmerBluetooth/ShimmerBluetooth/Shimmer3Protocol.swift

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions ShimmerBluetooth/ShimmerBluetooth/ShimmerUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,27 @@ public class ShimmerUtilities{
return crcCalcArray
}

/// The short radio name the BLE-Throughput wiki uses, from the Bluetooth module's version
/// string (Shimmer3Protocol.btModuleVersion). An unrecognised string is returned trimmed.
/// "RN4678 V1.23 06/30/2021 (c)Microchip Technology Inc" -> "RN4678 v1.23"
/// "CYW20820 app=v01.04.16.16" -> "IF820 v01.04.16.16"
/// The IF820 module is built on the CYW20820. Java's BluetoothModuleVersionDetails maps the
/// same strings by table, with two slips (V1.22 -> "v1.23", V1.13.5 -> "v1.15.5"); this
/// takes the version from the string itself.
public static func btModuleDisplayName(_ version: String) -> String {
let s = version.trimmingCharacters(in: .whitespacesAndNewlines.union(.controlCharacters))
let words = s.split(separator: " ")
// Only the version's digits and dots: the IF820 follows it with a comma.
func versionDigits(_ w: Substring) -> Substring { w.prefix(while: { $0.isNumber || $0 == "." }) }
if words.count >= 2, words[0] == "RN4678", words[1].hasPrefix("V") {
return "RN4678 v\(versionDigits(words[1].dropFirst()))"
}
if words.count >= 2, words[0] == "CYW20820", words[1].hasPrefix("app=v") {
return "IF820 v\(versionDigits(words[1].dropFirst("app=v".count)))"
}
return s
}

static func shimmerUartCrcByte(_ crc: Int, _ b: UInt8) -> Int {
var crcValue = crc & 0xFFFF
crcValue = (crcValue >> 8) | (crcValue << 8)
Expand Down
14 changes: 14 additions & 0 deletions ShimmerBluetooth/ShimmerBluetoothTests/ShimmerUtilitiesTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,18 @@ class ShimmerUtilitiesTest: XCTestCase {
XCTAssertEqual(ShimmerUtilities.shimmerUartCrcCalc([0xFF, 0x8A, 0x71, 0x52, 0xAA], 4), [0x00, 0xE6], "only the first len bytes count")
}

func testBtModuleDisplayName() {
// Full strings from the Java API's BluetoothModuleVersionDetails
XCTAssertEqual(ShimmerUtilities.btModuleDisplayName("RN4678 V1.23 06/30/2021 (c)Microchip Technology Inc"), "RN4678 v1.23")
XCTAssertEqual(ShimmerUtilities.btModuleDisplayName("RN4678 V1.22 12/08/2020 (c)Microchip Technology Inc "), "RN4678 v1.22")
XCTAssertEqual(ShimmerUtilities.btModuleDisplayName("RN4678 V1.00.5 11/15/2016 (c)Microchip Technology Inc"), "RN4678 v1.00.5")
XCTAssertEqual(ShimmerUtilities.btModuleDisplayName("CYW20820 app=v01.04.16.16"), "IF820 v01.04.16.16")
XCTAssertEqual(ShimmerUtilities.btModuleDisplayName("CYW20820 app=v01.04.18.18\r\n"), "IF820 v01.04.18.18", "trailing CR LF")
XCTAssertEqual(ShimmerUtilities.btModuleDisplayName("CYW20820 app=v01.04.16.16, stack=v2.0"), "IF820 v01.04.16.16",
"a comma after the version, as a Shimmer3R v1.01.025 sends; kept, it split the CSV field")
XCTAssertEqual(ShimmerUtilities.btModuleDisplayName("RN4678 V1.23, 06/30/2021"), "RN4678 v1.23")
XCTAssertEqual(ShimmerUtilities.btModuleDisplayName("Ver 6.15 04/26/2013\r\n(c) Roving Networks"), "Ver 6.15 04/26/2013\r\n(c) Roving Networks", "unknown: kept")
XCTAssertEqual(ShimmerUtilities.btModuleDisplayName(""), "")
}

}
12 changes: 12 additions & 0 deletions TestApp/TestApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
3A780CCB2AE12CC500EAF050 /* TestAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A780CCA2AE12CC500EAF050 /* TestAppUITests.swift */; };
3A780CCD2AE12CC500EAF050 /* TestAppUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A780CCC2AE12CC500EAF050 /* TestAppUITestsLaunchTests.swift */; };
3A780CDC2AE12F2C00EAF050 /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A780CDB2AE12F2C00EAF050 /* ViewModel.swift */; };
3A780CDE2AE1300000EAF050 /* ThroughputRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A780CDF2AE1300000EAF050 /* ThroughputRunner.swift */; };
3A780CE02AE1300000EAF050 /* ThroughputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A780CE12AE1300000EAF050 /* ThroughputView.swift */; };
3AD18D8A2AE1436800AE7475 /* ShimmerBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AD18D892AE1436800AE7475 /* ShimmerBluetooth.framework */; };
3AD18D8B2AE1436800AE7475 /* ShimmerBluetooth.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3AD18D892AE1436800AE7475 /* ShimmerBluetooth.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -65,6 +67,8 @@
3A780CCA2AE12CC500EAF050 /* TestAppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestAppUITests.swift; sourceTree = "<group>"; };
3A780CCC2AE12CC500EAF050 /* TestAppUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestAppUITestsLaunchTests.swift; sourceTree = "<group>"; };
3A780CDB2AE12F2C00EAF050 /* ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = "<group>"; };
3A780CDF2AE1300000EAF050 /* ThroughputRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThroughputRunner.swift; sourceTree = "<group>"; };
3A780CE12AE1300000EAF050 /* ThroughputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThroughputView.swift; sourceTree = "<group>"; };
3AD18D892AE1436800AE7475 /* ShimmerBluetooth.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = ShimmerBluetooth.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -121,6 +125,8 @@
3A7712932AE2BAF9006213A8 /* Info.plist */,
3A7712922AE2B5C9006213A8 /* TestAppDebug.entitlements */,
3A780CDB2AE12F2C00EAF050 /* ViewModel.swift */,
3A780CDF2AE1300000EAF050 /* ThroughputRunner.swift */,
3A780CE12AE1300000EAF050 /* ThroughputView.swift */,
3A780CAE2AE12CC400EAF050 /* TestAppApp.swift */,
3A780CB02AE12CC400EAF050 /* ContentView.swift */,
3A780CB22AE12CC500EAF050 /* Assets.xcassets */,
Expand Down Expand Up @@ -296,6 +302,8 @@
files = (
3A780CB12AE12CC400EAF050 /* ContentView.swift in Sources */,
3A780CDC2AE12F2C00EAF050 /* ViewModel.swift in Sources */,
3A780CDE2AE1300000EAF050 /* ThroughputRunner.swift in Sources */,
3A780CE02AE1300000EAF050 /* ThroughputView.swift in Sources */,
3A780CAF2AE12CC400EAF050 /* TestAppApp.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -467,6 +475,8 @@
INFOPLIST_FILE = TestApp/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "";
INFOPLIST_KEY_NSBluetoothAlwaysUsageDescription = "Allow for Bluetooth use";
INFOPLIST_KEY_LSSupportsOpeningDocumentsInPlace = YES;
INFOPLIST_KEY_UIFileSharingEnabled = YES;
INFOPLIST_KEY_NSBluetoothPeripheralUsageDescription = "Please allow using Blueooth for discovering peripherals";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
Expand Down Expand Up @@ -518,6 +528,8 @@
INFOPLIST_FILE = TestApp/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "";
INFOPLIST_KEY_NSBluetoothAlwaysUsageDescription = "Allow for Bluetooth use";
INFOPLIST_KEY_LSSupportsOpeningDocumentsInPlace = YES;
INFOPLIST_KEY_UIFileSharingEnabled = YES;
INFOPLIST_KEY_NSBluetoothPeripheralUsageDescription = "Please allow using Blueooth for discovering peripherals";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
Expand Down
8 changes: 5 additions & 3 deletions TestApp/TestApp/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import SwiftUI

struct ContentView: View {
@StateObject var viewModel = ViewModel()

@State private var showThroughput = false

var body: some View {
VStack {
Image(systemName: "globe")
Expand All @@ -19,8 +20,9 @@ struct ContentView: View {

}
.padding()



Button("Throughput Test", action: { showThroughput = true })
.sheet(isPresented: $showThroughput) { ThroughputView() }
Button("Scan Veri",action: { viewModel.test()})
Button("Connect Dev1",action: { Task {
do {
Expand Down
Loading
Loading