如何从核心蓝牙设备读取信息

Lal*_*wal 11 ipad ios core-bluetooth

我正在开发iOS核心蓝牙应用程序,我可以使用iPad3连接BLE设备.我能够到达街区didDiscoverServices,但无法从这里出发.

我的问题是;

  1. 如何从蓝牙设备读取特性?
  2. 如何阅读蓝牙设备的其他信息?

帮助我或提供任何建议.

谢谢Wilhelmsen的回复.

我从上面提到的块中得到了以下内容:

[0] - Service : <CBConcreteService: 0x1769a0> UUID: Generic Attribute Profile
[1] - Service : <CBConcreteService: 0x174470> UUID: Generic Access Profile
[2] - Service : <CBConcreteService: 0x1744e0> UUID: Unknown (<00005301 00000041 4c505749 53450000>)

Characteristic

[0] - Characteristic : <CBConcreteCharacteristic: 0x15d410> UUID: Service Changed

[0] - Characteristic : <CBConcreteCharacteristic: 0x1805b0> UUID: Device Name
[1] - Characteristic : <CBConcreteCharacteristic: 0x1806a0> UUID: Appearence

[0] - Characteristic : <CBConcreteCharacteristic: 0x183810> UUID: Unknown (<00004301 00000041 4c505749 53450000>)
[1] - Characteristic : <CBConcreteCharacteristic: 0x1838a0> UUID: Unknown (<00004302 00000041 4c505749 53450000>)
Run Code Online (Sandbox Code Playgroud)

现在如何在didUpdateValueForCharacteristic块中获取此特征的确切值?

chw*_*hwi 12

通过框架好好阅读.如果你到目前为止,你应该没有任何问题找到'discoverCharacteristics'和外围代表回调'didDiscoverCharacteristic'.您需要知道要发现的服务和特征的UUID,并将其应用于这些方法.

然后你可以阅读'readValueForCharacteristic'和委托回调'didUpdateValueForCharacteristic'.

这是从我的手机发送的,所以当我上电脑时我可能会编辑一下.希望能帮助到你

新问题:

[connectedPeripheral readValueForCharacteristic:wantedCharacteristic] 
Run Code Online (Sandbox Code Playgroud)

和外围代表

- (void) peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error{

NSLog(@"Characteristic value : %@ with ID %@", characteristic.value, characteristic.UUID);
[delegate characteristicValueRead:characteristic.value];
}
Run Code Online (Sandbox Code Playgroud)

适合我