Bag*_*yer 7 descriptor ios5 core-bluetooth
我的CoreBluetooth应用程序需要启用客户端特征配置描述符中的"指示位".这是我做的:
discoverServices调用discoverCharacteristics回调函数内
- (void)peripheral:(CBPeripheral*)peripheral diddiscoverServices:(NSError*)错误
调用discoverDescriptorsForCharacteristic内部的回调
- (void)peripheral:(CBPeripheral*)peripheral didDiscoverCharacteristicsForService:(CBService*)service error:(NSError*)error
内部回调
- (void)peripheral:(CBPeripheral*)peripheral didDiscoverDescriptorsForCharacteristic:(CBCharacteristic*)特征错误:(NSError*)错误
我打了电话:
if ( [[descriptor.UUID representativeString] isEqualToString:@"2902" ] )
{
const unsigned char raw_data[] = {0x02};
NSData *myData = [NSData dataWithBytes: raw_data length: 2];
[self.cBCP writeValue:myData forDescriptor:descriptor];
}
Run Code Online (Sandbox Code Playgroud)
但我的应用程序崩溃writeVale:.控制台中的错误消息是:
无法使用此方法编写客户端特征配置描述符!
任何的想法?谢谢
小智 0
问题是您无法像您那样使用 writeValue:forDescriptor: 方法写入客户端配置描述符 (UUID = 2902) 的值。
\n\n相反,您应该使用 CBPeripheral 类的 setNotifyValue:forCharacteristic: 方法来配置服务器上的特性\xe2\x80\x99s 值的客户端指示或通知。
\n| 归档时间: |
|
| 查看次数: |
2378 次 |
| 最近记录: |