9 Replies
      Latest reply on Aug 26, 2016 10:55 AM by NerkNerkNerk
      poshaughnessy Level 1 Level 1 (0 points)

        Our peripheral firmware is in development so we've been changing the device address and device name (which we're using for the ID) often. We've noticed that the name reported by iOS can be out of date, since it's caching it against the device address? I've tried switching Bluetooth off and on, even switching the phone off and on, but to no avail.

         

        Also, the 'name' is not matching up to 'kCBAdvDataLocalName' in the advertising data.

         

        For example, our peripheral is currently set to (and we've verified this with CySmart on the laptop):

         

             Address: ...:00:00:27

             Shortened Local Name: 000027 (This is set in the Scan Response Data)

         

        But iOS is reporting the device data as follows. 'kCBAdvDataLocalName' is up to date, but 'name' isn't...

         

         

             {

                 advertising =     {

                     kCBAdvDataIsConnectable = 1;

                     kCBAdvDataLocalName = 000027;

                 };

                 id = "379E9807-8F94-6397-CECE-E63F027FA614";

                 name = 000025;

                 rssi = "-65";

             }

         

        So, two questions please:

         

        • Anyone know why 'name' doesn't match up to 'kCBAdvDataLocalName'?
        • Is there a way to (preferably non-programmatically) clear the cache?

         

        Thanks in advance!

        • Re: Bluetooth name caching
          Gualtier Malde Apple Staff Apple Staff (490 points)

          There are 2 names to consider. The advertising name and the GAP (Generic Access Profile) name.

          For a peripheral which iOS has never connected before, the 'name' property reported is the advertising name. Once it is connected, the GAP name is cached, and is reported as the peripheral's name. GAP name is considered a "better" name due to the size restrictions on the advertising name.

           

          There is no rule that says both names must match. That depends on your use case and implementation. Some people will consider the GAP name as the fixed name, but the advertising name more of an "alias", as it can easily be changed.

           

          If you want both names in sync, you should change the GAP name as well along with the advertised name. Implemented properly, your CB manager delegate will receive a call to - peripheralDidUpdateName:

           

          If you want to manually clear the cache, you need to reset the iOS device.

          • Re: Bluetooth name caching
            CodeWarrior Level 1 Level 1 (0 points)

            For testing your bluetooth firmware, if you are not constructing a resolvable random address, I recommend changing the BD_ADDR for every new image you are testing.  Then nothing should be cached.  There is one recommendation by the BLE standard on the two naming conventions.  The advertised name can be shorter than the GAP device_name but they should both be the same name.  So if the full name of the device is 'PedoMeter' then a well-formed short name would be 'Pedo' not 'PM'.