This blog is designed to demonstrate how to add and remove peripheral devices from the White List using hello_sensor and hello_client.
We will use 2 TAG03 boards, but you can use 2 or more.
We will show you how to clear the white list and how to enable the white list and add a mac address to it as well as have advertisements sent only to the device which has been added to the white list.
1. Update hello_sensor
Attached is the modified hello_sensor.c file that should be downloaded to replace the existing hello_sensor.c file.
2. Change the makefile name of hello_sensor and download it. The new makefile should be as follows:
hello_sensor-BCM920736TAG_Q32 BT_DEVICE_ADDRESS=112233445567 UART=COMxx download
3. Change the makefile name of hello_client and download it. The new makefile should be as follows:
hello_client-BCM920736TAG_Q32 BT_DEVICE_ADDRESS=112233445566 UART=COMxx download
** Note: xx is the COM port number designated to your specific TAG03 board.
4. Open HCI traces for the board with hello_sensor programmed on it (board 'B') to observe the white list enable/disable and start/stop advertisement. (For more information on how to use traces, please check the Quick Start Guide)
5. Modify the client_addr array in the hello_sensor.c file to contain the mac address of hello_client as follows:
***NOTE: The client address (board B) should be the first address in the array.
6. Hold SW1 on the hello_client board (board 'A') for 6 seconds. While holding SW1 on board 'A', press SW1 on board 'B'. The following trace should pop up on the console, with the mac address of the client listed:
We can see that board 'B' is added to the white list for board 'A' and can now send notifications,etc.
Here are the steps required to delete an address from the white list:
- change the address on hello_client to be random:
hello_client-BCM920736TAG_Q32 BT_DEVICE_ADDRESS=random UART=COMxx download
2. Open HCI traces, and hold SW1 on hello_client board (board 'A') for 6 seconds. While holding SW1 on board 'A', press SW1 on board 'B'. You will see that board 'B' does not connect to board 'A'. This is because the white list of board 'A' does not include board 'B'. As a result, there will be no exchange of advertisements with board 'B'.
Fore more information on how to proceed, here is a chart:
hello_sensor.c.zip 11.0 K