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: Andras Kovi <email@hidden>
- Date: Mon, 05 Nov 2012 01:51:41 +0100
I ran through the code. It seems to be ok. I can imagine that the simulator is misbehaving a little. If this name thing does not influence your business logic, I would suggest you to not care about it. Maybe the iPad will show the expected behavior.
For the connection, it may be better to remove the notification option for now. I don't know if it helps or not, but lowers the variables in the "equation". But again, I can imagine that the simulator is not simulating the real behavior.
Did you try to install apps like BLExplorer on the simulator and those successfully connected?
Side note: the services property of the peripheral will contain values only if you do a discoverServices call first.
Please let me know what did the test with the iPad yield. I'm really curious.
Andras
On 2012.11.05., at 1:19, Rick Mann <email@hidden> wrote:
> 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