func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
if let e = error {
print("ERROR didUpdateValue \(e)")
return
}
var receivedMessage: String
if characteristic.uuid == UUID_BP_1 {
let receivedMessage = String(data: characteristic.value!, encoding: String.Encoding.utf8)
//receivedMessage = NSString(data: characteristic.value!, encoding: String.Encoding.utf8.rawValue)! as String
print("receivedMessage:\(receivedMessage)")
}
}
如果没有示例代码,则为nil