Re: First received advertisment data doesn't contain local name
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 <rmann@latencyzero.com> 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 <allprog@gmail.com> 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 <rmann@latencyzero.com> 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 (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/bluetooth-dev/allprog%40gmail.com
This email sent to allprog@gmail.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/bluetooth-dev/rmann%40latencyzero.co...
This email sent to rmann@latencyzero.com
-- Rick
_______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/bluetooth-dev/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com
participants (1)
-
Andras Kovi