WriteValue For Characteristics方法不在CoreBluetooth中运行

时间:2013-10-08 08:48:33

标签: ios objective-c bluetooth core-bluetooth

我的环境是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)

我还能看一眼吗? CBServiceCBCharacteristic

0 个答案:

没有答案