我的环境是iPhone5(iOS7.0.2)
和BLE
标签。我想向BLE
标签发送数据。所以我使用这种方法:
- (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
?