I have just starting communicate with Carista device. I got all services and characteristics. But when I write command "ATZ" then it will give answer as "ATZ".
My actual result which I expect from device is "ATZELM327 v1.5"
Here I have attached my code review it.
func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
guard let characteristics = service.characteristics else { return }
for characteristic in characteristics {
print(characteristic)
caristaPeripheral.setNotifyValue(true, for: characteristic)
let ATZCommand = "ATZ"
let ATZBytes = ATZCommand.data(using: .utf8)
caristaPeripheral.writeValue(ATZBytes!, for: characteristic, type: .withResponse)
}
}
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
let string = String(data: characteristic.value!, encoding: .utf8)
print("CBCharacteristic : \(characteristic.uuid) ====> \(string ?? "none")")
}
Please guide me.