如何从BLE快速读取血压读数

时间:2019-05-24 09:23:15

标签: swift bluetooth-lowenergy

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

0 个答案:

没有答案