我的环境是iPhone5(iOS7.0.2)
和BLE
标记。
我想将数据发送到BLE
Tag。所以我使用这种方法:
- (void) peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
{
for(CBCharacteristic *c in [service characteristics])
{
if([service isEqual:immediateAlertService] &&
[[c UUID] isEqual:ProximityTag.alertLevelCharacteristicUUID])//"2A06"
{
immediateAlertAlertLevelCharacteristic = c;
}
}
...
[self.peripheral writeValue:[NSData dataWithBytes:&level length:1] forCharacteristic:immediateAlertAlertLevelCharacteristic type:CBCharacteristicWriteWithoutResponse];
级别为0x70
。但有时writeValue方法不运行。
iPhone ==> data ==> tag (X)
tag ==> data ==> iPhone(O)
我还能看一眼吗? CBService
? CBCharacteristic
?