Ios CBPeripheralManager读/写
我在iPhone上使用CoreBluetooth,我想知道是否有办法从外围设备发出读/写请求。我已经设置了一个CBPeripheralManager和一个代理,但是通过查看文档,我看不到任何读取外围设备属性甚至其自身属性的方法Ios CBPeripheralManager读/写,ios,core-bluetooth,Ios,Core Bluetooth,我在iPhone上使用CoreBluetooth,我想知道是否有办法从外围设备发出读/写请求。我已经设置了一个CBPeripheralManager和一个代理,但是通过查看文档,我看不到任何读取外围设备属性甚至其自身属性的方法 这只能从中央台进行吗?可以。CoreBluetooth假设,如果您正在设置外围设备,您不会查询Bluetooth堆栈来检索关于您自己的属性,而只是查询一些内部数据结构。是。CoreBluetooth假设如果您正在设置外围设备,您不会查询Bluetooth堆栈来检索关于您自
这只能从中央台进行吗?可以。CoreBluetooth假设,如果您正在设置外围设备,您不会查询Bluetooth堆栈来检索关于您自己的属性,而只是查询一些内部数据结构。是。CoreBluetooth假设如果您正在设置外围设备,您不会查询Bluetooth堆栈来检索关于您自己的属性,而只是查询一些内部数据结构。如果您试图从
CBPeripheralManager
向一个或多个连接的CBCentral
发送数据,使用已启用通知或指示的特征。cbperipheraldmanager
可以发送如下数据:
let success = peripheralManager.updateValue(data, forCharacteristic: characteristic,
onSubscribedCentrals: [central])
if !success {
// cache the data until the delegate method peripheralManagerIsReadyToUpdateSubscribers is called.
}
注意:确保CBCentral
s订阅您计划使用的特性
至于从
CBCentral
读取数据,您可以使用上述方法发送“读取请求”,并让CBCentral
响应您正在查找的数据。如果您试图从cbperipheraldmanager
向一个或多个连接的CBCentral
发送数据,使用已启用通知或指示的特征。cbperipheraldmanager
可以发送如下数据:
let success = peripheralManager.updateValue(data, forCharacteristic: characteristic,
onSubscribedCentrals: [central])
if !success {
// cache the data until the delegate method peripheralManagerIsReadyToUpdateSubscribers is called.
}
注意:确保CBCentral
s订阅您计划使用的特性
对于从CBCentral
读取数据,您可以使用上述方法发送“读取请求”,并让CBCentral
响应您要查找的数据