0
Ich versuche, Daten zu einem BLE senden, aber mein Gerät akzeptiert nur Byte-Arrays. Wie konvertiere ich Daten in Byte-Array und sende es in Swift 3?Wie wird ein Byte-Array an Swift 3 gesendet?
print("hex value is",hexRepresentation)
print("pairing code",pairingcode)
var aaa = calcchecksum(data:"4A6BF961585C3F86DCEB562CEC51A4CE")
if let auxData = (hexRepresentation+"4A6BF961585C3F86DCEB562CEC51A4CE"+aaa).data(using: .utf8), let lChar = self.mainCharacteristic {
let bytearraydata = [UInt8](auxData) as Data?
aPeripheral.writeValue(bytearraydata, for: lChar, type: .withResponse
}
Dies könnte helfen: https://stackoverflow.com/a/40278391/1187415. –