Re: First received advertisment data doesn't contain local name
Re: First received advertisment data doesn't contain local name
- Subject: Re: First received advertisment data doesn't contain local name
- From: Rick Mann <email@hidden>
- Date: Sun, 04 Nov 2012 16:19:22 -0800
I do everything on the main thread, everything asynchronously (well, duh).
I did a little experimenting. I have CBCentralManagerScanOptionAllowDuplicatesKey = false. Assuming I do nothing else, just keep scanning, I get two discovery callbacks. One without the local name, one with, then no more:
2012-11-04 16:13:17.925 TestCBPeripheral[15145:c07] Central is Scanning
2012-11-04 16:13:17.946 TestCBPeripheral[15145:c07] {
kCBAdvDataServiceUUIDs = (
"Unknown (<323aa86f c2574104 9e462798 d317ebbc>)"
);
}
2012-11-04 16:13:17.947 TestCBPeripheral[15145:c07] service: Unknown (<323aa86f c2574104 9e462798 d317ebbc>)
2012-11-04 16:13:17.947 TestCBPeripheral[15145:c07] Found service: (null)
2012-11-04 16:13:17.948 TestCBPeripheral[15145:c07] {
kCBAdvDataLocalName = "Test Peripheral";
kCBAdvDataServiceUUIDs = (
"Unknown (<323aa86f c2574104 9e462798 d317ebbc>)"
);
}
2012-11-04 16:13:17.949 TestCBPeripheral[15145:c07] service: Unknown (<323aa86f c2574104 9e462798 d317ebbc>)
2012-11-04 16:13:17.949 TestCBPeripheral[15145:c07] Found service: Test Peripheral
Here's my code: http://pastebin.com/dhQD7YFD
It's more-or-less top-down, in terms of order of events/calls. It's conditionally compiled so that the Simulator is the Central, the device is the Peripheral.
--
Rick
On Nov 4, 2012, at 15:59 , Andras Kovi <email@hidden> wrote:
> What does "Before I can attempt to connect to it" mean? Do you try to connect to the peripheral in a separate thread or you start the connection asynchronously? Could you clarify?
>
> On 2012.11.04., at 23:56, Rick Mann <email@hidden> wrote:
>
>> Every time I scan for peripherals, the first peripheral discovered (my only peripheral) doesn't have the local name in it. Before I can attempt to connect to it, a second advertising packet comes in, and that one contains the local name.
>>
>> On the peripheral side, I'm only making the advertising call once, with a complete name and UUID packet:
>>
>> CBUUID* serviceUUID = [CBUUID UUIDWithString: kTestServiceUUID];
>> NSDictionary* dict = @{ CBAdvertisementDataServiceUUIDsKey : @[ serviceUUID ],
>> CBAdvertisementDataLocalNameKey : @"Test Peripheral" };
>> [self.pm startAdvertising: dict];
>>
>> But, without fail, when I run the central, the first discovery lacks the name.
>>
>> --
>> Rick
>>
>>
>>
>>
>> _______________________________________________
>> 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
--
Rick
_______________________________________________
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