2 Replies Latest reply on Aug 25, 2015 3:24 AM by rajvirzala

    wiced wifi ble advertisement



      I am using wiced wifi 3.3.1 sdk in which ble is in peripheral mode.


      I have two questions related to ble advertisement


      1]  How to set advertisement flag as general to advertise indefinitely, currently  advertises for 90 seconds, then stops advertising. I can see MACRO "BTM_BLE_GENERAL_DISCOVERABLE_FLAG" but can't see any API to set advertisement indefinitely(General).

      2] How to set advertising data( manufacture data & list of supported services).

      e.g. I need to set manufacture data as 1122334455 & add list of supported services i.e temperature service with UUID 0xFFF0.


        • 1. Re: wiced wifi ble advertisement

          Hi Rajvirsinh,


          1) Initially the advertisement is set to BTM_BLE_ADVERT_UNDIRECTED_HIGH for 1 minute and then automatically changes to BTM_BLE_ADVERT_UNDIRECTED_LOW for another minute before it gets turned off completely.


          Using advertisements indefinitely would drain out your power quickly but if you choose to use it this way you can do the following. Using ble_proximity_reporter.c as the example,


          In ble_proximity_management_callback()



          Add the following

          if ( p_event_data->ble_advert_state_changed == BTM_BLE_ADVERT_OFF )


                wiced_bt_start_advertisements( BTM_BLE_ADVERT_UNDIRECTED_LOW, 0, NULL );



          This would catch when the advertisements are turned off completely and allows you to set it up again.

          If you choose to use BTM_BLE_ADVERT_UNDIRECTED_HIGH it will run advertisements in high duty cycle for one minute and automatically change to low duty cycle for one minute and then turn off. The above if clause should catch it and set it to run again.


          2) To change the advertisement data, in the ble_proximity_reporter.c you will see the function

          wiced_bt_ble_set_advertisement_data( BTM_BLE_ADVERT_BIT_FLAGS | BTM_BLE_ADVERT_BIT_DEV_NAME, &adv_data );


          This is where the adv data gets set.

          In the first parameter of this function add an additional


          for the manufacturer and



          for the list of services.


          This list is defined in libraries/drivers/bluetooth/include/wiced_bt_ble.h as enum wiced_bt_ble_advert_mask_e. You can find the advertisement data struct wiced_bt_ble_advert_data_t in this file as well.


          For the data, you must create an instance of wiced_bt_ble_manu_t and wiced_bt_ble_service_t and add these to adv_data.

              adv_data.p_manu and adv_data.p_services


          For instance, for the manufacturer data

              uint8_t manu_data[5] = {0x11, 0x22, 0x33, 0x44, 0x55};

              wiced_bt_ble_manu_t adv_manu = {5, manu_data};

              adv_data.p_manu = &adv_manu;


          The following shows the added Manufacturer data in the advertisement in the LightBlue app.



          I hope this helps.




          1 of 1 people found this helpful
          • 2. Re: wiced wifi ble advertisement

            Thanks JaeyoungY_71


            The solution you provided is working fine as usual.