This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

reading the Bluetooth peripheral device name

I am using both the SmartRF05 board and the mini DK keyfob. I have loaded several different TI examples into each of them. All of them have the code shown below that looks like it sets the name. I also have code running on an Iphone 4S (IOS 5.1) and a MAC mini (MAC OS).


// GAP GATT Attributes
static uint8 attDeviceName[GAP_DEVICE_NAME_LEN] = "CC2540DK-mini Keyfob";

 
  // Set the GAP Attributes
  GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, attDeviceName );

I use the following to read the device name when running from the iPhone 4S or the MAC mini.

printf("Name: %s\n",[peripheral.name UTF8String]);

My questions are the following:

1. the name seen does not seem to match what is in quotes. keyfob example printed "Keyfobdemo". other examples were similar. They seemd to correspond to the file name but not exactly.

2. the name did not change when I flashed a different  example into the smartrf board or the keyfob.

3. the names were not the same depending on whether they were read on the iPhone 4S or the MAC mini. MAC Mini would read "null" a lot for the name.

4. how can I set this name based on the example I am running. It is essential to my application that I read a unique device name so as to make sure it is the proper BLE hardware before I try to connect.

yes I can make a characteristic in my device and try to read that to verify but that requires that I connect first. I could have several BLE devices in the vicinity. I want to ensure I have the correct one by name before I connect.



  • Timothy,

    My view is that you are changing the device name and NOT the deviceName exposed when the device broadcast is info (RSP_DATA)

    To Change the name visible from your iPhone, you need to set this name with the following fonction:

    GAPRole_SetParameter( GAPROLE_SCAN_RSP_DATA, sizeof ( deviceName ), deviceName );

    In the Keyfob demo, this value is set to:

    // GAP - SCAN RSP data (max size = 31 bytes)
    static uint8 deviceName[] =
    {
    // complete name
    0x0b, // length of first data structure (11 bytes excluding length byte)
    0x09, // AD Type = Complete local name
    0x4b, // 'K'
    0x65, // 'e'
    0x79, // 'y'
    0x66, // 'f'
    0x6f, // 'o'
    0x62, // 'b'
    0x64, // 'd'
    0x65, // 'e'
    0x6d, // 'm'
    0x6f, // 'o'
    };

    I hope it is the good answer :)

    -Fred

  • Fred

    Thanks for the quick response. You are exactly right. The data that is advertised is the value that is set to CBPeripheral peripheral.name. That answers what I see when I print the name. This matches for my device as well as keyfob and simpleBLE Peripheral examples as well.

    The iPhone "remembered" the first device name it saw when I changed the device name time and time again. The only way I was able to get the device name to change as seen by the iPhone was to COMPLETELY power down the iPhone and power up again. It would then see the new name. I think it is because the iPhone saw the same UUID and only the name changed so it must have ignored it. Is there a way to clear out all Bluetooth UUID so that it will always use the current scanned in device name.

    The MAC mini worked the same way. the MAC OS application did not see the device name change. iT remebered the "first" name it saw for the smartRF board.

    I am still confused how to guarantee that the name change is seen even though the device itself (UUID) remains the same. I am loading several different exampels and applications into the smartrf and keyfob. they all have different names obviously. the iPhone and mac min seem to "remember" the first one it sees.

  • Hi Fred ,

    Is there any way so that we can change this name from the Server ,not in the source code as mentioned by you ?

    Thanks 

    Senthil kumar .I

  • Hello Kumar,

    I have tried and read all the forum but no complete info to change the name :(

    We really need to get support from Texas Instrument !!!

    @TI support: Can you please help us ?

    - Fred

  • Hi

    In iOS 7 I find that the name does not change even if I power down/up the iPhone.

    have you found a solution to this?

    BR

    Eli

  • For iOS, there is a way to change the name. That is, change the MAC address. It seems that iOS remembers the device name by MAC address. If you change the MAC address, it is a new device for iOS,