Skip navigation
Home > All Places > Software Forums > WICED Studio Wi-Fi/Combo > WICED Studio Wi-Fi/Combo Forums > Blog > 2016 > June

<Notify/Indicate Features>

We have new notify/indicate features implemented in the BIG Smart Server that will be included in the next release. In this guide we will how you how to get notifications/indications using curl commands on Cygwin. For a basic guide of how to use the BIG RESTful Smart Server please refer to the following blog.

BIG RESTful Smart Server Demo


In this example, we will sign up for notifications for the heart rate value on a virtual heart rate monitor device on iOS LightBlue. This was verified in SDK 3.5.2 on BCM943341WCD1. Please download the attached patch and copy the three files over to <SDK>/libraries/daemons/bt_internet_gateway/restful_smart_server.



  1. Scan for devices

          a. curl -v -X GET “http://<BIG_SERVER_ADDR>/gap/nodes?passive=1


          b. If you add the following options to the curl command when you scan, it will skip the redundancies and only print out unique device handles.


          c. curl -v -X GET "http:// <BIG_SERVER_ADDR>/gap/nodes?passive=1" 2>/dev/null | grep handle | sort -u



   d. You might get multiple handles if you are in a busy environment. In order to narrow down the possibility of the handles that could be the device you wish to test, try running the above (c) command without your device powered up (or deactivated in LightBlue), and do another scan with the device powered up. Then you can run the command (a) and check the RSSI value associated with the possible handles. The one with the highest signal strength should be your device if it is set close to your WICED device.


      **NOTE: Using a LightBlue virtual peripheral device, the BD_ADDR handle can change after disconnection so be sure to scan and check the BD_ADDR handle again.


     2. Connect to BLE device

          a. curl -v -X PUT "http://<BIG_SERVER_ADDR>/gap/nodes/<node_handle>?connect=1"


     3. Perform primary service discovery

          a. curl -v -X GET “http://<BIG_SERVER_ADDR>/gatt/nodes/<node_handle>/services?primary=1”    


          **NOTE: Same with BD_ADDR, service handles might change after disconnection on the same LightBlue devices. The uuids will stay the same though.


     4. Perform characteristic discovery of the service

          c. curl -v -X GET "http://<BIG_SERVER_ADDR>/gatt/nodes/<node_handle>/services/<service_ref_handle>/characteristics"


          **NOTE: Same with BD_ADDR, service handles might change after disconnection on the same LightBlue devices. The uuids will stay the same though.

    **NOTE: in the service and characteristic handle, you need to use the values on the end of “self” : { “href”: …/003700360035”}, instead of the 4 digit “handle” number.




Now you should have all the handles you need to sign up for the desired characteristic. You can follow the steps below to turn on notify/indicate and you will see the results streaming into your WICED device.

  1. Enable Notify or Indicate

          a.      curl -v -X GET “http://<BIG_SERVER_ADDR>/gatt/nodes/<node_handle>/characteristics/<characteristic_ref_handle>?notify=1

          b.      curl -v -X GET “http://<BIG_SERVER_ADDR>/gatt/nodes/<node_handle>/characteristics/<characteristic_ref_handle>?indicate=1


          **NOTE: Check if your device characteristic has the notify/indicate property. It will show as the following in LightBlue.



    2. Subscribe to Notify or Indicate and wait for notifications / indications

          a.      curl -v -X GET “http://<BIG_SERVER_ADDR>/gatt/nodes/<node_handle>/characteristics/<characteristic_ref_handle>/value?notify=1&event=1

          b.      curl -v -X GET "http://<BIG_SERVER_ADDR>/gatt/nodes/<node_handle>/characteristics/<characteristic_ref_handle>/value?indicate=1&event=1"


     3. Results

     This is the reply you should be getting afterwards. You will see the notify values streaming in through your device. In the below screen I am manually changing the numbers on LightBlue. 


* STATE: DO => DO_DONE handle 0x600057380; line 1337 (connection #0)

* STATE: DO_DONE => WAITPERFORM handle 0x600057380; line 1464 (connection #0)

* STATE: WAITPERFORM => PERFORM handle 0x600057380; line 1474 (connection #0)

* HTTP 1.1 or later with persistent connection, pipelining supported

< HTTP/1.1 200 OK

< Content-Type: text/event-stream

< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0

< Pragma: no-cache

< Connection: Keep-Alive

* no chunk, no close, no size. Assume close to signal end


data: 0050


data: 0064


data: 0064


data: 0064


data: 0078


data: 0078


data: 0078


data: 0078


data: 1111


data: 0078


data: 0078


data: 0078


data: 2222


data: 0078


data: 0078


data: 3333





One thing to keep in mind is that if you are testing with LightBlue, connection will be dropped quickly so you will have to use a script to process all the commands within the time frame. From the moment you lose connection and reconnect again, the BD_ADDR or the handles for services and characteristics could change so you will have to double check them. For this reason it will be easier to maintain the connection using scripts. Make a file run_notification.bat and copy the following contents. You can run it as

>run_notification.bat <BD_ADDR>


and you will have to change addr, serv(service) and char(characteristic) in the file accordingly to the device and characteristic you are using.





curl -v -X PUT "http://$addr/gap/nodes/$1?connect=1&enable=1"

curl -v -X GET "http://$addr/gatt/nodes/$1/services?primary=1&uuid=180D"

curl -v -X GET "http://$addr/gatt/nodes/$1/services/$serv/characteristics"


curl -v -X GET "http://$addr/gatt/nodes/$1/characteristics/$char?notify=1"

curl -v -X GET http://$addr/gatt/nodes/$1/characteristics/$char/value?notify=1&event=

To write a user defined string for CHAR_DESCRIPTOR_UUID16, you need to do the following.


1. Add a char description and make the permission readable in wiced_bt_gatt_db.c



2. Add USER_DESCRIPTOR in enum in wiced_bt_gatt_db.h


3. In ble_proximity_reporter.c, define a global user_defined_str

static char user_defined_str[] = "Temperature in the room";


4. Add the following switch clause to ble_proximity_gatt_read_request() in ble_proximity_reporter.c


       p_attribute_value_source = user_defined_str;

       attribute_value_length = sizeof( user_defined_str );



5. In your LightBlue you should now see the string attached to the characteristic



In order to use notifications in BLE peripheral mode, you will need to define the CCCD in the GATT database and send the notifications or indications according to the value the client sets it. I attached a zip file that has addition of code using a CCCD for notifications in the ble_proximity_reporter. Please look at the following for a description of changes made (in red).


** This was verified on a BCM943341WCD1 board with the iPhone LightBlue app.


1. First you will need to define the characteristic descriptor in wiced_bt_gatt_db.c, and also add properties to the characteristic that you want to receive notifications.


















2. In wiced_bt_gatt_db.h, add a handle for HDLC_TX_POWER_LEVEL_DESCRIPTOR,



    // ***** Primary service 'TX Power'








3. In ble_proximity_reporter.c, add a global descriptor value and add a clause to function ble_proximity_gatt_write_request() to enable the client writing to the descriptor.



static int8_t  proximity_tx_power_level_descriptor;




      proximity_tx_power_level_descriptor = attribute_value;

      WPRINT_APP_INFO( ("POWER_LEVEL_DESCRIPTOR written as 0x%x\n", attribute_value));




4. Once the descriptor is defined, we are going to use the function wiced_bt_gatt_send_notification() to send notifications every 2 seconds. We shall set the value to decrease from 20 to 1. The following code should be added in application_start() afterwiced_bt_stack_init() in ble_proximity_reporter.c.



void application_start( void )


    /* Initialize WICED platform */

    wiced_init( );


    /* Initialize Bluetooth controller and host stack */

    wiced_bt_stack_init( ble_proximity_management_callback, &wiced_bt_cfg_settings, wiced_bt_cfg_buf_pools );



    for (uint8_t i = 20; i > 0; i-- )


        // If notification is set

        if ( proximity_tx_power_level_descriptor == 0x1 )


            proximity_tx_power_level = i;

            wiced_bt_gatt_send_notification (proximity_connection_handle, HDLC_TX_POWER_LEVEL_VALUE, sizeof(proximity_tx_power_level), &proximity_tx_power_level );







**For indications, use the function wiced_bt_gatt_send_indication() when the proximity_tx_power_level_descriptor == 0x2



5. For the first parameter in the function, proximity_connection_handle, this should be defined as a global variable and maintained inble_proximity_gatt_cback(). Whenever a new connection is established it should store the connection handle, and when connection is lost it should reset it to 0. ( Add red code in ble_proximity_reporter.c )



static uint16_t proximity_connection_handle = 0;


/* GATT event handler */

static wiced_bt_gatt_status_t ble_proximity_gatt_cback( wiced_bt_gatt_evt_t event, wiced_bt_gatt_event_data_t *p_event_data )


    wiced_bt_gatt_status_t status = WICED_BT_GATT_SUCCESS;

    uint8_t *bda;


    switch ( event )



            /* GATT connection status change */

            bda = p_event_data->connection_status.bd_addr;

            WPRINT_BT_APP_INFO( ("GATT connection to [%02X:%02X:%02X:%02X:%02X:%02X] %s.\n", bda[0], bda[1], bda[2], bda[3], bda[4], bda[5], (p_event_data->connection_status.connected ? "established" : "released")) );


            if ( p_event_data->connection_status.connected )


                /* Connection established. Get current TX power  (required for setting TX power attribute in GATT database) */

                wiced_bt_dev_read_tx_power( p_event_data->connection_status.bd_addr, p_event_data->connection_status.transport, (wiced_bt_dev_cmpl_cback_t *) ble_proximity_tx_power_callback );


                /* Store information  */

                proximity_connection_handle = p_event_data->connection_status.conn_id;


                /* Disable connectability. */

                wiced_bt_start_advertisements( BTM_BLE_ADVERT_OFF, 0, NULL );




                /* Connection released. Re-enable BLE connectability. */

                wiced_bt_start_advertisements( BTM_BLE_ADVERT_UNDIRECTED_HIGH, 0, NULL );

                /* test code for directed adv */

                /* wiced_bt_start_advertisements (BTM_BLE_ADVERT_DIRECTED_HIGH, 0, p_event_data->connection_status.bd_addr); */


                proximity_connection_handle = 0;


                WPRINT_BT_APP_INFO( ("Waiting for proximity monitor to connect...\n") );








6. That's it! Now compile the code and download it to your WICED board. When you connect to "WICED Proximity" and select "Tx Power Level" from the LightBlue app of your iPhone (below) or the WICED Smart Explorer app in your Android device.


You should see the notifications arriving once you set "Listen to notifications". This app only counts down from 20 to 1 every 2 seconds after it resets, so if you don't see it counting down on your client try resetting the WICED board and connecting to it faster.




I hope this helped in getting you started with notifications!




In this application you will connect the WICED Sense device to Avnet IoT starter kit over BLE and publish the WICED Sense sensors data to IBM Bluemix using MQTT.

1) Open the project contents provided below

2) Copy the ibm_bt_smartbridge folder from unzipped folder

3) Go back to the SDK (eclipse IDE) navigate to demo folder by expanding apps folder in Project Explorer. Right click and paste the ibm_bt_smartbridge folder.



4) Copy the bt_smartbridge folder from the folder located under libraries/daemons

5) Paste the above copied folder under libraries/daemons

On prompt of overwrite all files press “Yes to all”

6) Navigate to the ibm_bt_smartbridge project under demo and open the wifi_config_dct.h file, edit the SSID and passphrase as per your access point details.

Edit the “YOUR_AP_SSID”


On editing press the Save Icon on Top or “Ctrl+S” to save the changes made


7) Open the bt_smartbridge.c under ibm_bt_smartbridge demo folder and go to Line 257(Pressing Ctrl+L)

Edit the “WICED Sense Kit” to your WICED Sense kit device you have. Else retain it to be default


Press the Save Icon on Top or “Ctrl+S” to save the changes made


8) Import the platform files similar to step 5 and have it copied under the platforms folder


9) In order to compile and download the application to hardware. Create a new Make target in SDK by right clicking on WICED-SDK  in Make target window ( This is on the right side of the SDK)


10) On Click of New make target, the following window opens up. Type in

demo.ibm_bt_smartbridge-BCM94343W_AVN-ThreadX-NetX download download_apps run


11) To start the build process double click the make target that was created above

12) You can notice the progress of the build and download status on the console window as highlighted below

13) On successful build and download of the application, switch to the TeraTerm window and you will notice the hardware rebooting and launching the ibm_bt_smartbridge application


14) Kindly make a note of two things highlighted on teraterm application


15) Make sure your laptop is connected to the same Access point as the Avnet IoT starter Kit is. In the above logs as an example you can notice “MMP” is SSID that the IoT starter kit is connecting to, laptop also is connected to the same access point.


16) Wait for the message in TeraTerm logs

[HTTP] wiced_http_server_start


17) After seeing these launch a browser on your laptop and enter the URL of the IP address the device. As an example notice the highlight in red above “”.

18)  You should see the below page being displayed ( This is the webpage hosted by the Avnet IoT Starter Kit)

Wake Up the WICED Sense ( by using the wake up button) and Hit on Rescan button on the webpage as shown below, this scans for the BLE devices around and displays the scan result.


19) Connect to the device with the WICED Sense advertising name

20) On successful connection the Device gets added under Connection list as seen below



21) On hitting “Details” button, the characteristics and services of the WICED Sense is displayed

  1. 9) The Avnet IoT starter kit is now publishing the WICED Sense sensor data to IBM Bluemix

22) Open a browser on your laptop. Make sure you are connected to a network with Internet connectivity. Type in the below URL


23) Enter the mac id of your device into the device id section of webpage and hit Go.

24) You should see the WICED Sense sensor data being published for every interval. Try shaking the WICED Sense and and notice the values changing on graph.


9/9/16 update:

PS: ibm_bt_smartbridge_V2 added for SDK 3.7.x onwards ..( the Bluetooth layer was changed hence sharing the new application/platform files and details)

It is possible to have a platform specific firmware files released by Broadcom to support specific partner modules or added features.


In order to accommodate specific firmware files for WLAN and BT/BLE, the common firmware files could be replaced in ./resources/firmware/<WLAN_CHIP>/ for WLAN and ./libraries/drivers/bluetooth/firmware/<BT_CHIP><BT_CHIP_REVISION>/ for BT/BLE. Replacing these firmware files will effect all other platforms because they share the same firmware files.




Instead of replacing the WLAN firmware file in common ./resources/firmware/<WLAN_CHIP>/ directory, the platform specific WLAN firmware could be placed in the platform directory. Such as, ./platforms/<platform>/firmware/ directory could be created and the platform specific WLAN firmware could be placed in there.


In order for makefiles to pick up the correct firmware, below lines need to be added in the platform makefile, ./platforms/<platform>/<platform>.mk:


$(NAME)_RESOURCES += ../platforms/$(PLATFORM)/firmware/PlatformSpecificFW.bin





Append the BT_CHIP_REVISION located in the ./platforms/<platform>/<platform>.mk makefile with your specific platform name.



BT_CHIP_REVISION      := B0_PlatformSpecificHCD


Create a directory in the ./libraries/drivers/bluetooth/firmware and name it as <BT_CHIP><BT_CHIP_REVISION> defined in the platform makefile.

Place the platform specific BT/BLE firmware file in this directory.


For example:

If the BCM943341WCD1 platform has a specific firmware, the following modifications could be made in the platform makefile.


BT_CHIP           := 43341
BT_CHIP_REVISION  := B0_PlatformSpecificHCD


The ./libraries/drivers/bluetooth/firmware/43341B0_PlatformSpecificHCD specific directory is created based on above changes. The platform specific BT/BLE firmware file bt_firmware_image.c file is placed in this new directory.


If needed, a platform specific firmware for 40MHz operations could be placed in the ./libraries/drivers/bluetooth/firmware/43341B0_PlatformSpecificHCD/40MHz directory as well.

Filter Blog

By date:
By tag: