ios - Updating CentralManagers list of services for a peripheral -


Core has been an issue with bluetooth under iOS. I am programming an OTA updater, and in a strange issue Running when I turn the device into OATU mode, it disconnects and advertises different services under the same device, the UIID is a problem, when I try to find services from the newly connected device Give me the old list of services Which is not valid anymore. A split part of the problem is that the CBPeripheral.name value is the name of the original device, but returned to the ad dictionary DidDiscoverPeripheral is correct, this is the new name. Central Administration: (CBC Central Manager *) Central Duscare Supplementary Peripheral: (CBParyfare *) Peripheral Adadata: (NSStripe *) Advertisement Data: RSISI (NSN * *) RSS {Advertising (for advertising ( ID key) {NSLog (@ "key:% @, value:% @ \ n", key, [addata objectForca: key]); } NSLog (@ "Disclaimed Peripheral with Identifier:% @, State:% D, Name:% @, Service:% @", [Peripheral Identifier], [Peripheral State], [Peripheral Name], [Peripheral Services]); If (self! Self referrals) self. Refill = [[NSMUTABELARRAL] initWithObjects: peripheral, zero]; Else {for (int i = 0; i & lt; self.peripherals.count; i ++) {CBPerifheral * p = [self.peripherals objectAtIndex: i]; If ((p.identifier == NULL) || (Peripheral Identifier == faucet)); If ([UUIDSAreEqual himself: p.identifier UUID2: Peripheral Identifier]) [[Self-determination. ObjectItindex: I withObject: peripheral]; NSLog (@ "Duplicate UID Update was found ..."); Return; }} Peripheral Delegate = self; [Self.preferl add object: peripheral]; NSLog (@ "New UUID, Adding"); }}

Here I am looking back:

  key: kCBAdvDataChannel, value: 38 key: kCBAdvDataLocalName, value: Xxxx1000_boot key: kCBAdvDataIsConnectable, value: 1 Detected Peripherals with Identifier: & lt; __seconductuid 0x156787d0 & gt; 9E7A 4F 82-29F2-08EF-F6A599CCC 0790B 7F, State: 0, Name: Xxxx1000, Services: (empty)   

Often, for the next clean run of the program, it will show on the other side with Xxxx_boot for peripheral name and advertised name Xxxx (advertisement is always correct).

I do not know any way to clarify peripheral information saved in CBCentralManager, I also get new examples of a central manager, but nothing works. Any ideas?

Advertising is actually an indication that in practical terms to services hosted with your "shoe size" Anything can be included just look at you should never trust this data in particular and Core Bluetooth will not use this information in any other way.

The Peripheral name is full of related features on Peripherals, after being taught by IOS, it will be used in CBPFirefile.Name property and the advertised name will only be ignored. On the connection again, the name will automatically be refreshed.

Finally,

  1. Do not judge before connection, ads can lie and Core Bluetooth uses it carefully
  2. Connection Always search for services after
  3. keep the callback in mind

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -