Skip to content

Commit c260ec0

Browse files
committed
Fixed issue with not sent data over UART: set connect write type.
Removed xcworkspace as we use SPM. Set filter by UART Service UUID on scanner device in UART section.
1 parent ac2d70d commit c260ec0

File tree

4 files changed

+9
-19
lines changed

4 files changed

+9
-19
lines changed

nRF Toolbox.xcodeproj/project.pbxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -2323,7 +2323,7 @@
23232323
"$(PROJECT_DIR)",
23242324
"$(PODS_ROOT)",
23252325
);
2326-
MARKETING_VERSION = 5.0.3;
2326+
MARKETING_VERSION = 5.0.4;
23272327
NEW_SETTING = "";
23282328
ONLY_ACTIVE_ARCH = YES;
23292329
OTHER_LDFLAGS = (
@@ -2490,7 +2490,7 @@
24902490
"$(PROJECT_DIR)",
24912491
"$(PODS_ROOT)",
24922492
);
2493-
MARKETING_VERSION = 5.0.3;
2493+
MARKETING_VERSION = 5.0.4;
24942494
NEW_SETTING = "";
24952495
ONLY_ACTIVE_ARCH = YES;
24962496
OTHER_LDFLAGS = (
@@ -2541,7 +2541,7 @@
25412541
"$(PROJECT_DIR)",
25422542
"$(PODS_ROOT)",
25432543
);
2544-
MARKETING_VERSION = 5.0.3;
2544+
MARKETING_VERSION = 5.0.4;
25452545
NEW_SETTING = "";
25462546
ONLY_ACTIVE_ARCH = NO;
25472547
OTHER_LDFLAGS = (

nRF Toolbox.xcworkspace/contents.xcworkspacedata

-10
This file was deleted.

nRF Toolbox/BluetoothManager/BluetoothManager.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class BluetoothManager: NSObject, CBPeripheralDelegate, CBCentralManagerDelegate
184184

185185
// Check what kind of Write Type is supported. By default it will try Without Response.
186186
// If the RX charactereisrtic have Write property the Write Request type will be used.
187-
let type: CBCharacteristicWriteType = uartRXCharacteristic.properties.contains(.write) ? .withResponse : .withoutResponse
187+
let type: CBCharacteristicWriteType = uartRXCharacteristic.properties.contains(.writeWithoutResponse) ? .withoutResponse : .withResponse
188188
let mtu = bluetoothPeripheral?.maximumWriteValueLength(for: type) ?? 20
189189

190190
// The following code will split the text into packets
@@ -231,16 +231,16 @@ class BluetoothManager: NSObject, CBPeripheralDelegate, CBCentralManagerDelegate
231231

232232
// Check what kind of Write Type is supported. By default it will try Without Response.
233233
// If the RX characteristic have Write property the Write Request type will be used.
234-
let type: CBCharacteristicWriteType = uartRXCharacteristic.properties.contains(.write) ? .withResponse : .withoutResponse
234+
let type: CBCharacteristicWriteType = uartRXCharacteristic.properties.contains(.writeWithoutResponse) ? .withoutResponse : .withResponse
235235
let mtu = bluetoothPeripheral?.maximumWriteValueLength(for: type) ?? 20
236236

237237
let data = aCommand.data.split(by: mtu)
238+
log(withLevel: .verbose, andMessage: "Writing to characteristic: \(uartRXCharacteristic.uuid.uuidString)")
239+
let typeAsString = type == .withoutResponse ? ".withoutResponse" : ".withResponse"
238240
data.forEach {
239241
self.bluetoothPeripheral!.writeValue($0, for: uartRXCharacteristic, type: type)
242+
log(withLevel: .debug, andMessage: "peripheral.writeValue(0x\($0.hexString), for: \(uartRXCharacteristic.uuid.uuidString), type: \(typeAsString))")
240243
}
241-
log(withLevel: .verbose, andMessage: "Writing to characteristic: \(uartRXCharacteristic.uuid.uuidString)")
242-
let typeAsString = type == .withoutResponse ? ".withoutResponse" : ".withResponse"
243-
log(withLevel: .debug, andMessage: "peripheral.writeValue(0x\(aCommand.data.hexString), for: \(uartRXCharacteristic.uuid.uuidString), type: \(typeAsString))")
244244
log(withLevel: .application, andMessage: "Sent command: \(aCommand.title)")
245245

246246
}

nRF Toolbox/Profiles/UART/UARTTabBarController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class UARTTabBarController: UITabBarController {
7373
private var emptyView: InfoActionView!
7474
let btManager = BluetoothManager()
7575
private lazy var bSettings: InfoActionView.ButtonSettings = ("Connect", { [unowned self] in
76-
let scanner = PeripheralScanner(services: nil)
76+
let scanner = PeripheralScanner(services: [CBUUID(string: ServiceIdentifiers.uartServiceUUIDString)])
7777
let vc = ConnectionViewController(scanner: scanner)
7878
vc.delegate = self
7979
let nc = UINavigationController.nordicBranded(rootViewController: vc)

0 commit comments

Comments
 (0)