Skip to content

Commit 0260139

Browse files
committed
feat(ble): discover ASK radios by service UUID
ASK was matching a list of GAP name prefixes. MeshCore companions advertise Nordic UART; a radio with a custom name never showed up.
1 parent 921ebd9 commit 0260139

8 files changed

Lines changed: 15 additions & 163 deletions

File tree

MC1/Info-Debug.plist

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,6 @@
2626
<array>
2727
<string>6E400001-B5A3-F393-E0A9-E50E24DCCA9E</string>
2828
</array>
29-
<key>NSAccessorySetupBluetoothNames</key>
30-
<array>
31-
<string>MeshCore-</string>
32-
<string>Whisper-</string>
33-
<string>wadamesh-</string>
34-
<string>WisCore</string>
35-
<string>XIAO</string>
36-
<string>elecrow</string>
37-
<string>HT-n5262</string>
38-
<string>Seeed</string>
39-
<string>BQ</string>
40-
<string>ProMicro</string>
41-
<string>Keepteen</string>
42-
<string>Meshtiny</string>
43-
<string>T1000-E-BOOT</string>
44-
<string>me25ls01-BOOT</string>
45-
<string>X1-BOOT</string>
46-
<string>NRF52 DK</string>
47-
<string>T-Impulse</string>
48-
</array>
4929
<key>NSAccessorySetupSupports</key>
5030
<array>
5131
<string>Bluetooth</string>

MC1/Info.plist

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,6 @@
2626
<array>
2727
<string>6E400001-B5A3-F393-E0A9-E50E24DCCA9E</string>
2828
</array>
29-
<key>NSAccessorySetupBluetoothNames</key>
30-
<array>
31-
<string>MeshCore-</string>
32-
<string>Whisper-</string>
33-
<string>wadamesh-</string>
34-
<string>WisCore</string>
35-
<string>XIAO</string>
36-
<string>elecrow</string>
37-
<string>HT-n5262</string>
38-
<string>Seeed</string>
39-
<string>BQ</string>
40-
<string>ProMicro</string>
41-
<string>Keepteen</string>
42-
<string>Meshtiny</string>
43-
<string>T1000-E-BOOT</string>
44-
<string>me25ls01-BOOT</string>
45-
<string>X1-BOOT</string>
46-
<string>NRF52 DK</string>
47-
<string>T-Impulse</string>
48-
</array>
4929
<key>NSAccessorySetupSupports</key>
5030
<array>
5131
<string>Bluetooth</string>
Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,9 @@
11
import Foundation
22

3-
struct AccessorySetupKitDiscoveryCriterion: Equatable {
4-
let bluetoothServiceUUID: String
5-
let bluetoothNameSubstring: String
6-
}
7-
83
enum AccessorySetupKitDiscoveryCriteria {
94
/// Opt into AccessorySetupKit filtered discovery (iOS 26.1+) so the picker can relabel
105
/// each match with its advertised BLE name; older systems use the static picker label.
116
static let usesFilteredDiscovery = true
127

13-
static let bluetoothNameSubstrings = [
14-
"MeshCore-",
15-
"Whisper-",
16-
"wadamesh-",
17-
"WisCore",
18-
"XIAO",
19-
"elecrow",
20-
"HT-n5262",
21-
"Seeed",
22-
"BQ",
23-
"ProMicro",
24-
"Keepteen",
25-
"Meshtiny",
26-
"T1000-E-BOOT",
27-
"me25ls01-BOOT",
28-
"X1-BOOT",
29-
"NRF52 DK",
30-
"T-Impulse",
31-
]
32-
33-
static let supportedBluetoothCriteria = bluetoothNameSubstrings.map {
34-
AccessorySetupKitDiscoveryCriterion(
35-
bluetoothServiceUUID: BLEServiceUUID.nordicUART,
36-
bluetoothNameSubstring: $0
37-
)
38-
}
39-
40-
static let diagnosticsSummary = supportedBluetoothCriteria
41-
.map { "\($0.bluetoothNameSubstring)->\($0.bluetoothServiceUUID)" }
42-
.joined(separator: ", ")
8+
static let bluetoothServiceUUID = BLEServiceUUID.nordicUART
439
}

MC1Services/Sources/MC1Services/Services/AccessorySetupKitLogFormatter.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
11
import Foundation
22

33
enum AccessorySetupKitLogFormatter {
4-
private static let criteriaPreviewCount = 4
5-
6-
static func criteriaSummary(_ criteria: [AccessorySetupKitDiscoveryCriterion]) -> String {
7-
let preview = criteria.prefix(criteriaPreviewCount).map(\.bluetoothNameSubstring)
8-
let remainderCount = criteria.count - preview.count
9-
let previewText = preview.joined(separator: ", ")
10-
11-
if remainderCount > 0 {
12-
return "\(criteria.count) prefixes [\(previewText), +\(remainderCount) more]"
13-
}
14-
15-
return "\(criteria.count) prefixes [\(previewText)]"
16-
}
17-
184
static func selectionMessage(
195
accessoryName: String,
206
bluetoothID: UUID?,

MC1Services/Sources/MC1Services/Services/AccessorySetupKitService.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@
309309
pairedCount: \(pairedAccessories.count), \
310310
displayItems: \(displayItems.count), \
311311
filteredDiscovery: \(usedFilteredDiscovery), \
312-
criteria: \(AccessorySetupKitLogFormatter.criteriaSummary(AccessorySetupKitDiscoveryCriteria.supportedBluetoothCriteria))
312+
serviceUUID: \(AccessorySetupKitDiscoveryCriteria.bluetoothServiceUUID)
313313
"""
314314
)
315315

@@ -441,17 +441,18 @@
441441
}
442442

443443
private func makePickerDisplayItems(productImage: UIImage) -> [ASPickerDisplayItem] {
444-
AccessorySetupKitDiscoveryCriteria.supportedBluetoothCriteria.map { criterion in
445-
let descriptor = ASDiscoveryDescriptor()
446-
descriptor.bluetoothServiceUUID = CBUUID(string: criterion.bluetoothServiceUUID)
447-
descriptor.bluetoothNameSubstring = criterion.bluetoothNameSubstring
444+
let descriptor = ASDiscoveryDescriptor()
445+
descriptor.bluetoothServiceUUID = CBUUID(
446+
string: AccessorySetupKitDiscoveryCriteria.bluetoothServiceUUID
447+
)
448448

449-
return ASPickerDisplayItem(
449+
return [
450+
ASPickerDisplayItem(
450451
name: Self.defaultAccessoryName,
451452
productImage: productImage,
452453
descriptor: descriptor
453454
)
454-
}
455+
]
455456
}
456457

457458
/// Relabels a filtered-discovery match with its advertised BLE name, falling back to

MC1Services/Tests/MC1ServicesTests/Services/AccessorySetupKitDiscoveryCriteriaTests.swift

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,14 @@ import Testing
44
@Suite("AccessorySetupKit Discovery Criteria Tests")
55
struct AccessorySetupKitDiscoveryCriteriaTests {
66
@Test
7-
func `supported Bluetooth name substrings match shipped MeshCore families`() {
7+
func `picker discovers by Nordic UART service UUID only`() {
88
#expect(
9-
AccessorySetupKitDiscoveryCriteria.bluetoothNameSubstrings == [
10-
"MeshCore-",
11-
"Whisper-",
12-
"wadamesh-",
13-
"WisCore",
14-
"XIAO",
15-
"elecrow",
16-
"HT-n5262",
17-
"Seeed",
18-
"BQ",
19-
"ProMicro",
20-
"Keepteen",
21-
"Meshtiny",
22-
"T1000-E-BOOT",
23-
"me25ls01-BOOT",
24-
"X1-BOOT",
25-
"NRF52 DK",
26-
"T-Impulse",
27-
]
9+
AccessorySetupKitDiscoveryCriteria.bluetoothServiceUUID == BLEServiceUUID.nordicUART
10+
)
11+
#expect(
12+
AccessorySetupKitDiscoveryCriteria.bluetoothServiceUUID
13+
== "6E400001-B5A3-F393-E0A9-E50E24DCCA9E"
2814
)
29-
}
30-
31-
@Test
32-
func `all discovery criteria use the Nordic UART service UUID`() {
33-
let criteria = AccessorySetupKitDiscoveryCriteria.supportedBluetoothCriteria
34-
35-
#expect(criteria.count == AccessorySetupKitDiscoveryCriteria.bluetoothNameSubstrings.count)
36-
#expect(criteria.allSatisfy { $0.bluetoothServiceUUID == BLEServiceUUID.nordicUART })
37-
#expect(Set(criteria.map(\.bluetoothNameSubstring)).count == criteria.count)
3815
}
3916

4017
@Test

docs/Development.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -273,26 +273,6 @@ Required Info.plist keys:
273273
<array>
274274
<string>6E400001-B5A3-F393-E0A9-E50E24DCCA9E</string>
275275
</array>
276-
<key>NSAccessorySetupBluetoothNames</key>
277-
<array>
278-
<string>MeshCore-</string>
279-
<string>Whisper-</string>
280-
<string>wadamesh-</string>
281-
<string>WisCore</string>
282-
<string>XIAO</string>
283-
<string>elecrow</string>
284-
<string>HT-n5262</string>
285-
<string>Seeed</string>
286-
<string>BQ</string>
287-
<string>ProMicro</string>
288-
<string>Keepteen</string>
289-
<string>Meshtiny</string>
290-
<string>T1000-E-BOOT</string>
291-
<string>me25ls01-BOOT</string>
292-
<string>X1-BOOT</string>
293-
<string>NRF52 DK</string>
294-
<string>T-Impulse</string>
295-
</array>
296276
```
297277

298278
### iOS 18+ Features

project.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,24 +95,6 @@ targets:
9595
- Bluetooth
9696
NSAccessorySetupBluetoothServices:
9797
- "6E400001-B5A3-F393-E0A9-E50E24DCCA9E"
98-
NSAccessorySetupBluetoothNames:
99-
- "MeshCore-"
100-
- "Whisper-"
101-
- "wadamesh-"
102-
- "WisCore"
103-
- "XIAO"
104-
- "elecrow"
105-
- "HT-n5262"
106-
- "Seeed"
107-
- "BQ"
108-
- "ProMicro"
109-
- "Keepteen"
110-
- "Meshtiny"
111-
- "T1000-E-BOOT"
112-
- "me25ls01-BOOT"
113-
- "X1-BOOT"
114-
- "NRF52 DK"
115-
- "T-Impulse"
11698
configs:
11799
Debug:
118100
INFOPLIST_FILE: MC1/Info-Debug.plist

0 commit comments

Comments
 (0)