Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios CBPeripheralManager读/写_Ios_Core Bluetooth - Fatal编程技术网

Ios CBPeripheralManager读/写

Ios CBPeripheralManager读/写,ios,core-bluetooth,Ios,Core Bluetooth,我在iPhone上使用CoreBluetooth,我想知道是否有办法从外围设备发出读/写请求。我已经设置了一个CBPeripheralManager和一个代理,但是通过查看文档,我看不到任何读取外围设备属性甚至其自身属性的方法 这只能从中央台进行吗?可以。CoreBluetooth假设,如果您正在设置外围设备,您不会查询Bluetooth堆栈来检索关于您自己的属性,而只是查询一些内部数据结构。是。CoreBluetooth假设如果您正在设置外围设备,您不会查询Bluetooth堆栈来检索关于您自

我在iPhone上使用CoreBluetooth,我想知道是否有办法从外围设备发出读/写请求。我已经设置了一个CBPeripheralManager和一个代理,但是通过查看文档,我看不到任何读取外围设备属性甚至其自身属性的方法


这只能从中央台进行吗?

可以。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
响应您要查找的数据