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.

CC2540 DeviceNameWrite

Other Parts Discussed in Thread: CC2540

Hello,

I download the Example Code from the page:
http://processors.wiki.ti.com/index.php/CC2540_DeviceNameWrite

But it does not include any code with GGS_W_PERMIT_DEVICE_NAME_ATT

And I tried the following code, the permission of Device Name still be read only.
  // Set the GAP Attributes
  GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN-1, attDeviceName );
  uint8 devNamePermission = TRUE;
  GGS_SetParameter( GGS_W_PERMIT_DEVICE_NAME_ATT, sizeof ( uint8 ), &devNamePermission );

Are there something wrong?  Could anyone help me?
Thanks!

Jeff

  • +1 to have an answer ...

  • +1 to have an answer ...

  • I might have found an answer.  It seems to work for me, allowing both read and write using BTool.

    Try  this:

    uint8 devNamePermission = GATT_PERMIT_READ | GATT_PERMIT_WRITE;
    GGS_SetParameter( GGS_W_PERMIT_DEVICE_NAME_ATT, sizeof ( uint8 ), &devNamePermission ); 

    Peter

  • Hi Peter ,

    May i know how can i read and write the device name using Btool ?

    Regards ,

    Senthil 

  • Hi Peter ,

    There are two variables  available in Keyfobdemo.c which defines the name of the device .

    attDeviceName[GAP_DEVICE_NAME_LEN] = "CC2540DK-mini Keyfob";

    other one is 

    / 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'
    };

    When i am scanning using a Moto droid Razr phone i could able to see the name "Keyfobdemo" not the "CC2540DK-mini Keyfob" ???

  • Hi Senthil,

    I am unable to remember the exact procedure for reading the device name with BTool.  I think it is something like this:

    1) Read the handle for the device name characteristic UUID (I think it's 0x2A00)

    2) Read the value for that handle

    I have never tested on an Android device, but I have noticed that iOS reads the name from the advertising packet and also the device name characteristic.  It will display the advertising name first, and then replace it with the device name characteristic after it is read later.  Your device may only display the name for the advertising packet.

    Hope this helps.

    -Peter

  • Hi Peter ,

    When i discovered the charateristic UUID ,i got 0x0003 as a handle ! but when i am reading that value it's not reading anything  ! and upon writing  ,its showing "WRITE IS NOT PERMITTED !"

    Regards ,

    Senthil kumar .I 

  • Hi Senthil,

    The handle looks right to me.  Reading this value always worked on my end with the standard SimpleBLEPeripheral .hex file.  It might be worth loading the SimpleBLEPeripheral code back in your key fob to check.  After the permissions modification, both reading and writing worked.

    Peter

  • Hi Peter ,

    May I know how to implement the device name change ? tell me the process ...
    I tried with

    uint8 devNamePermission = GATT_PERMIT_READ|GATT_PERMIT_WRITE;
    GGS_SetParameter( GGS_W_PERMIT_DEVICE_NAME_ATT, sizeof ( uint8 ), &devNamePermission );

    it doesn't works to me ?