For the project I am working on (using Swift, not Object-C!!!) I need to convert a UInt16 that I extracted from a BLE characteristic to a string, so I can use it as text for a label. Anyone out there who already has solved this problem?
Thanks for your help in advance.
var currentValue: UInt16!
func peripheral(peripheral: CBPeripheral!, didUpdateValueForCharacteristic characteristic: CBCharacteristic!, error: NSError!) {
if characteristic.UUID == xgatt_io_p_1 {
let data = characteristic.value
let reportData = UnsafePointer<UInt16>(data.bytes)
currentValue = reportData.memory
}
readValue()
}
label.text = convertedCurrentValue