3 Replies Latest reply on May 26, 2016 12:22 AM by userc_40051

    Programmatically Changing BLE device name

      I want to have the last 4 characters of my device name be the last 4 hex characters of the MAC address.


      So in order to do this:


      -How do I retrieve the device MAC address? 


      -How do I programmatically set the device name ?

        • 1. Re: Programmatically Changing BLE device name

          Use CyBle_GetDeviceAddress to get the device MAC address. Use CyBle_GapSetLocalName to set the device local name. Call this API before the advertisement start APIs so that the device advertises with the new address.

          • 2. Re: Programmatically Changing BLE device name





            I am testing on a few devices, and for every single device I am getting same address when calling CyBle_GetDeviceAddress  with the addr type set to 0 for public address.




            I have 'Silicon generated "Company assigned" part of the address' checked in the BLE component, and the public address remains as:




            on every call to CyBle_GetDeviceAddress  I am getting: 0x80 0x95 0x19 0x29 0x49 0x80


            Am I comparing two different addresses? Shouldn't the company prefix and 'die' assigned address be there?

            • 3. Re: Programmatically Changing BLE device name



              I got a little further following this advice: http://www.cypress.com/forum/proc-ble/update-device-name-id-during-advertising


              I am now waiting until the BLESS state is event_close before getting the device address.


                  while( CyBle_GetBleSsState() !=  CYBLE_BLESS_STATE_EVENT_CLOSE )




              This gets me unique mac addresses.


              The other issue I ran into was that CyBle_GapSetLocalName was truncating the custom name I was setting based on the length I put in the component:




              Once I padded out the name I put in the component settings, this stopped truncating. 


              Is there a better way to do that?