Re: Core Bluetooth > CBPeripheralManager > addService: only works a limited number of times
Re: Core Bluetooth > CBPeripheralManager > addService: only works a limited number of times
- Subject: Re: Core Bluetooth > CBPeripheralManager > addService: only works a limited number of times
- From: Allan Young <email@hidden>
- Date: Fri, 11 Jan 2013 13:17:31 -0800
- Acceptlanguage: en-US
- Thread-topic: Core Bluetooth > CBPeripheralManager > addService: only works a limited number of times
Etan,
Just to check, you're referring to peripheralManagerDidUpdateState,
correct?
When my test app is running in Peripheral mode, and I switch that mode off
(calling the "stopPeripheral" method I included below), I do not get a
call to CBPeripheralManagerStatePoweredOff. Should I be?
peripheralManager:didAddService:error: is where I'm currently calling
[startAdvertising]
I'm currently performing the setup of the service and the [addService]
call in the CBPeripheralManagerStatePoweredOn state change.
-Allan
On 1/11/13 1:08 PM, "Etan Kissling" <email@hidden> wrote:
>Allan,
>
>regarding the peripheralManagerIsReadyToUpdateSubscribers: delegate call:
>it is only called after
>updateValue:forCharacteristic:onSubscribedCentrals: returned NO.
>This could explain why this delegate method is not invoked for you. I
>previously
>thought that it is always called.
>
>What happens if you
>
>- put the [removeAllServices] into the peripheralManagerHasUpdateState:
>delegate method when the state is CBPeripheralManagerStatePoweredOff?,
>
>- and the [startAdvertising] into the
>peripheralManager:didAddService:error: method?
>
>- Also add the [addService] call into the
>peripheralManagerHasUpdatedState: delegate
>when the state is CBPeripheralManagerStatePoweredOn.
>
>Etan
>
>
>On 11.01.2013, at 21:49, Allan Young <email@hidden>
> wrote:
>
>> I tried using the LightBlue app (BLExplr wasn't able to discover my
>> service).
>>
>> LightBlue reported the service the first three times that I added the
>> service (I tore down my peripheral and then re-created the service in
>> between each check).
>>
>> After that, no more service detected.
>>
>>
>> To tear down the service, I call:
>>
>> - (void) stopPeripheral
>> {
>> if ( self.peripheralManager )
>> {
>>
>> if ( self.peripheralManager.isAdvertising )
>> [ self.peripheralManager stopAdvertising ];
>>
>> [ self.peripheralManager removeAllServices ]; // Seems to have no
>> effect on this issue
>> self.peripheralManager = NULL;
>> }
>> }
>>
>> ... look correct?
>>
>> Allan
>>
>>
>>
>>
_______________________________________________
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