• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: peripheral:didUpdateValueForCharacteristic:error: not called for notification
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: peripheral:didUpdateValueForCharacteristic:error: not called for notification


  • Subject: Re: peripheral:didUpdateValueForCharacteristic:error: not called for notification
  • From: Etan Kissling <email@hidden>
  • Date: Tue, 05 Aug 2014 08:19:16 +0000
  • Thread-topic: peripheral:didUpdateValueForCharacteristic:error: not called for notification

What happens if you dispatch_async the [self.peripheralManager updateValue:genuineValue forCharacteristic:fels.filterGenuineCharacteristic onSubscribedCentrals:nil] ?

Maybe there’s a problem with reentrancy if you update the value from within the “didSubscribeToCharacteristic” delegate method.

Etan

On 24.07.2014, at 17:37, Joe Rossano <email@hidden> wrote:

I am trying to write a BTLE monitoring app that receives notifications.

I have built both the central app and a mock peripheral app using Core Bluetooth (on iOS 7.1). My central can connect fine to the peripheral, which advertises a service that has 2 CBCharacteristicPropertyNotify characteristics. But here is what happens once the central discovers the characteristics (removing non-essential code for clarity).


PD = CBPeripheralDelegate in central
PMD = CBPeripheralManagerDelegate in peripheral


PD callback invoked
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
{
for (CBCharacteristic *characteristic in service.characteristics)
{
[peripheral setNotifyValue:YES forCharacteristic:characteristic];
}
}


PMD callback invoked twice for the 2 characteristics
- (void)peripheralManager:(CBPeripheralManager *)peripheral central:(CBCentral *)central didSubscribeToCharacteristic:(CBCharacteristic *)characteristic
{
if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:FILTER_GENUINE_CHARACTERISTIC_UUID]])
{
BOOL genuineSent = [self.peripheralManager updateValue:genuineValue forCharacteristic:self.filterGenuineCharacteristic onSubscribedCentrals:nil];
}
else if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:FILTER_LOADING_CHARACTERISTIC_UUID]])
{
BOOL loadingSent = [self.peripheralManager updateValue:loadingValue forCharacteristic:self.filterLoadingCharacteristic onSubscribedCentrals:nil];
}
}


* The first time this method is invoked the return from
updateValue:forCharacteristic:onSubscribedCentrals: in YES.The second time
the return is always NO.


PD callback invoked twice for the 2 characteristics
- (void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
* characteristic.isNotifying is always YES.


But that¹s it, no other callback methods are invoked!


PMD callback peripheralManagerIsReadyToUpdateSubscribers: is never called for the updateValue:forCharacteristic:onSubscribedCentrals: call that returned NO
- (void)peripheralManagerIsReadyToUpdateSubscribers:(CBPeripheralManager *)peripheral


PD callback peripheral:didUpdateValueForCharacteristic:error: is never called for the updateValue:forCharacteristic:onSubscribedCentrals: call that returned YES
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error



I have been testing these apps on an iPad Air and iPhone 5s, both running
iOS 7.1.

Any idea why the notification is never invoked?


Thanks,
Joe
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Next by Date: (testmail - can be ignored).
  • Next by thread: (testmail - can be ignored).
  • Index(es):
    • Date
    • Thread