私が取り組んでいるプロジェクトでは (Object-C ではなく Swift を使用しています!!!)、BLE 特性から抽出した UInt16 を文字列に変換する必要があるため、ラベルのテキストとして使用できます。すでにこの問題を解決した人はいますか?
事前にご協力いただきありがとうございます。
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