Re: Can't discover CBPeripheralManager services
Re: Can't discover CBPeripheralManager services
- Subject: Re: Can't discover CBPeripheralManager services
- From: Etan Kissling <email@hidden>
- Date: Sun, 17 Feb 2013 13:29:54 +0000
- Thread-topic: Can't discover CBPeripheralManager services
Khaks,
This delegate is only called when a updatesubscribers call returned NO. However, updatesubscribers sometimes returns YES although the notification was not properly received by the remote device.
Etan
Have you tried to wait delegate - (void)peripheralManagerIsReadyToUpdateSubscribers:(CBPeripheralManager
*)peripheral called before you call updateValue: ?
On Feb 17, 2013, at 7:16 PM, Arvydas Sidorenko < email@hidden> wrote:
My previous message got truncated.
The output of the code sample I provided is always:
Interrupting central: success
Interrupting central: success
Interrupting central: failed
Interrupting central: failed
Interrupting central: failed
Interrupting central: failed
...
On Sun, Feb 17, 2013 at 11:09 AM, Arvydas Sidorenko <email@hidden> wrote:
This was a false issue because I had a mistake in the way I was
retrieving the services on central side.
Not sure whether I should create a new thread about it, but I still
can't move forward with using CBPeripheralManager.
I am saving a custom service and characteristics in private
variabiables and when central discovers them it calls 'setNotifyValue'
for the ones which on peripheral device I have given
CBCharacteristicPropertyNotify property. On peripheral side
didSubscribeToCharacteristic is getting called correctly and in that
delegate I start a timer which sends uint16_t type value every 5
seconds. The problem is that on central side
didUpdateValueForCharacteristic never gets called. I know that central
is setup correctly because I use the same application to connect to
another Bluetooth 4.0 accessory, so I assume the issue in on
CBPeripheralManager side. What I have noticed is that on
didSubscribeToCharacteristic call the characteristic._isNotifying
value is always NO. Furthermore updateValue returns me 'YES' twice and
then all following calls return 'NO' and
peripheralManagerIsReadyToUpdateSubscribers is never called.
I have tried all sorts of combinations of properties and attributes
when creating the characteristic, but it doesn't seem to have any
impact.
This is an example:
self.periodicNotifChar = [[CBMutableCharacteristic alloc]
initWithType:[StUtils UUIDToCBUUID:CHARACTERISTIC_PERIODIC_NOTIF_UUID]
properties:CBCharacteristicPropertyNotify
value:nil
permissions:CBAttributePermissionsReadable
And when issuing a notification:
BOOL result = [self.peripheralManager updateValue:[@"12"
dataUsingEncoding:NSUTF8StringEncoding]
forCharacteristic:self.periodicNotifChar
onSubscribedCentrals:nil];
if (result)
NSLog(@"Interrupting central: success");
else
{
NSLog(@"Interrupting central: failed");
}
The output will always be
_______________________________________________
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
|
_______________________________________________
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