Hello. Here is an example app that is capable of swapping between advertising and scanning.AdvertisementBLE advertisement packets consists of 31 bytes...
Hello. Here is an example app that is capable of swapping between advertising and scanning.
BLE advertisement packets consists of 31 bytes. Each field (i.e. appearance, name, service UUID or similar) has a header of 2 bytes (length and type), meaning that the maximum user payload is 29 bytes. That means the more fields that are packed into one advertisement packet, there are less bytes freed for user payload.
Here's an example of advertisement data(AD) from Bluetooth SIG documentation. (pdf attached)
You can view all the different data types and formats in the documentation attached.
In our SDK, each field is represented by BLE_ADV_FIELD data structure. Here's the definition:
typedef PACKED struct
UINT8 len; //length of field
UINT8 val; //value of field
UINT8 data[ADV_LEN_MAX-2]; // This is the data and the biggest one is 31-2 = 29
Notice the length, value, and the actual data in the struct corresponds to how AD is formatted in the example above.
You can change the advertisement packet by defining the fields in an array and initializing them.
// Format advertisement data. Data consists of 2 fields. Standard Advertisement flags
// and Broadcom Vendor specific data. The vendor specific data consists of
I have made an example app that swaps its role between advertising and scanning. The files are attached as adv.h and adv.c
The app first starts scanning, but you can change its role by pushing the button on the board. It has a minimum RSSI value, so you'll need to have advertising device close to the scanner in order for the scanner to pick up the advertisement.
I was able to put the code into two Tag 3 boards and test their functions.
Here's the app in action.
Both apps started:
One of them starts advertising:
AD in detail:
Notice how the advertisement data corresponds to how we set the BLE_ADV_FIELD array above.
If you are having problems with your installer, check that the download size of the installer is roughly 260MB, installer problems are typically caused by incomplete downloads.
The picture below shows a very common error message. Our SDK utilizes a 32-bit version of an Eclipse based IDE which requires a 32-bit version of JRE to be installed. If you already have the 64-bit JRE installed, you will also need to install the 32-bit version as well. The JRE is designed to allow both 32 and 64 bit variants to be installed on the system.
The WICED Sense kit uses a Silicon Labs USB to Serial Device. The TAG3 board uses an FTDI USB to Serial Device. Both should be installed as part of the SDK 2.2.1 installation process. If not, the FTDI drivers for the TAG3 reinstall them using the file /WICED-Smart-SDK/Drivers/dpinst.exe (make sure you access from the command line). The Silicon Labs USB Drivers can be foundWICED Sense Table of Contents
Everything we have for the WICED Sense, such as schematics, drivers, and Android application source code, can be accessed through theWICED Sense Table of Contents. A great post for the WICED Sense is theWICED SENSE Kit BLOGwhich is like a WICED Sense quick start guide.
Some Android devices appear to have issues pairing to the WICED Sense Tag from inside the app, linked is a work-around that should allow you to connect to your Android device:WICED Sense Android Pairing Work-Around