You are here

Dynamic Advertising for Peripheral's local name? | Cypress Semiconductor

August 17, 2017: We apologize for any difficulties or delays in posting new discussions to the Community on We are in the process of merging our support forums onto a single platform in an effort to create a much-improved community experience for you.

Dynamic Advertising for Peripheral's local name?

Summary: 1 Reply, Latest post by jrow on 01 Nov 2016 06:37 AM PDT
Verified Answers: 0
Last post
Log in to post new comments.
Pat Dolan's picture
35 posts

I want the iOS central's user to able to select the contents of any of several characteristics (always 19 char in length) as the peripheral's local name displayed in the Advertising Data during a scan.  From what I've read in this forum I've come up with the following code whose function is supposed to take whatever 19 char string is written to the CYBLE_TOW_SERVICE_UPDATE_AD_DATA_CHAR_HANDLE characteristic and make it become the new local name AND update the advertising data with same:


Stack_Handler( uint32 eventCode, void *eventParam )



switch ( eventCode )








     wrReqParam = (CYBLE_GATTS_WRITE_REQ_PARAM_T *)eventParam;

     switch ( wrReqParam->handleValPair.attrHandle )



    CyBle_GattsWriteAttributeValue( &wrReqParam->handleValPair, 0, &connectionHandle, CYBLE_GATT_DB_LOCALLY_INITIATED);


   uint8 newName[19];


   sensorNameHandle.value.val = newName;

   sensorNameHandle.value.len = 19;

   CyBle_GattsReadAttributeValue(&sensorNameHandle,&connectionHandle, CYBLE_GATT_DB_LOCALLY_INITIATED);

   int i;

  for(i=0; i<19; i++){

  cyBle_discoveryData.advData[i+5] = newName[i];


   cyBle_discoveryData.advDataLen = 19;

  CyBle_GapSetLocalName((char *)newName);

  CyBle_GapUpdateAdvData(cyBle_discoveryModeInfo.advData, cyBle_discoveryModeInfo.scanRspData);



The perpheral's chracteristic CYBLE_TOW_SERVICE_UPDATE_AD_DATA_CHAR_HANDLE can be written to without problem but the local name and advertising data don't update.

Any pointers greatly appreciated.  Thanks.


jrow's picture
Cypress Employee
163 posts

What are you using to test on the client side? iOS caches certain things, particularly the device name after connecting and discovering the server's GATT structure. Can you perform the scan and connect/update tests using the CySmart dongle and software, which don't cache any values? This will also give you a complete byte-for-byte look at exactly what is in the advertisement payload.

Log in to post new comments.