Part Number: CC2541
Hello,
Problem: Not able to change advertising name while CC2541 is advertising
Setup:
IAR Version: 8051 10.20.1
SDK Version: BLE-CC254x-1.4.2.2
Example: SimpleBLEBroadcaster
Configuration: Non-Connectable Advertisements
Board: Custom Board with CC2541
Code Snippet to modify name:
// GAP - Advertisement data (max size = 31 bytes, though this is
// best kept short to conserve power while advertisting)
static uint8 advertData[] =
{
// Flags; this sets the device to use limited discoverable
// mode (advertises for 30 seconds at a time) instead of general
// discoverable mode (advertises indefinitely)
0x02, // length of this data
GAP_ADTYPE_FLAGS,
GAP_ADTYPE_FLAGS_GENERAL,
// complete name
0x07, // length of first data structure (11 bytes excluding length byte)
GAP_ADTYPE_LOCAL_NAME_COMPLETE, // AD Type = Complete local name
0x47, //'G'
0x47, //'G'
0x58, //'X'
0x31, //'1'
0x32, //'2'
0x30, //'0'
// three-byte broadcast of the data "1 2 3"
0x04, // length of this data including the data type byte
GAP_ADTYPE_MANUFACTURER_SPECIFIC, // manufacturer specific advertisement data type
1,
2,
3
};
//In event processing function: SimpleBLEBroadcaster_ProcessEvent(), within an event the following lines have been used to change the name: advertData[5]=0x53; //'S' GAPRole_SetParameter( GAPROLE_ADVERT_DATA, sizeof ( advertData ),advertData); uint8 turnOnAdv = TRUE; GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &turnOnAdv );
With the code snippet above, name is being changed very rarely in order of 1-2 times in 30-40 tries. Can you please suggest a better way to make the modification.
Thank you,
Madhav