Introduction

In part 1, we explored Bluetooth® advertising and the various roles devices may assume. In part 2, we’ll take a closer look at what can be inside advertising packets and consider how developers can receive and process them.

AD Types Used in Bluetooth Low Energy Advertising Packets

The current version of CSS is version 6 and this defines the AD Types which may be used in Bluetooth Low Energy advertising packets or Scan Response PDUs. Data type values are defined in the Assigned Number for GAP document.

Some of the types defined in the CSS which are more commonly used in advertising packets are explained next.

Service UUID

This refers to six distinct data types. The purpose of each of them is to provide a list of the UUIDs of the services supported by the device. The list can either represent the complete set of UUIDs or it can be incomplete and it can contain either 16-bit, 32-bit or 128-bit UUID values. So that’s 2 x 3 = 6. Get it?

Only UUIDs issued by the Bluetooth SIG may appear in the 16- or 32-bit lists.

Service Data

The Service Data AD Type allows arbitrary data associated with a specific UUID to be included in advertising packets or scan response PDUs. There are three variations of this type; one for 16-bit UUIDs, one for 32-bit UUIDs and one for 128-bit UUIDs. Google’s EddyStone beacon frame format uses this field with the 16-bit UUID 0xFEAA followed by service data which may be of one of three sub-types, UID, URL or TLM (telemetry).

Local Name

This is the device’s name or a shortened version of it.

Flags

This is an important AD Type and it is almost always included in advertising packets (It can’t be included in scan response PDUs). It tells you about the advertising state of the device and which of the two transports, Bluetooth® low energy and Bluetooth BR/EDR it supports.

A device which is discoverable can either be in Limited Discoverable Mode or General Discoverable Mode. Limited Discoverable Mode is used to suggest that the device should have a high priority to scanning devices and often the advertising interval used when in this mode is faster than when in the General Discoverable Mode. A device will be in Limited Discoverable Mode for a limited time only and the core specification recommends this be no more than one minute. A device whose Flags field indicates it is not discoverable just means scanning devices should ignore it.

TX Power Level

The transmitted power of the packet in dBm.

Service Solicitation

This type is not commonly used but it isn’t the easiest to understand so I’ve included it here in the hope that my explanation is useful.

GAP and GATT are not coupled in any way. A device may have any one of the GAP roles and at the same time be either a GATT-client or a GATT-server. Of course, some combinations are more common than others. A GAP Peripheral is very often a GATT server but it doesn’t have to be. It’s just as valid for a GAP Peripheral to be a GATT =Client. When this is the case, the discovery process works as it always does, with the GAP Peripheral advertising and the GAP Central scanning. The Central device will make the connection to the Peripheral but once that’s been achieved, the GAP Peripheral—now acting as a GATT Client—will use the Attribute Protocol (ATT) to exploit the GATT services on the GAP Central/GATT server device. This AD Type allows the GAP Peripheral to effectively say, “I’m interested in devices which have the following GATT services…”

Handling Advertising Packets in Code

How much work is involved in writing code which scans for and extracts information from advertising packets depends on the platform you’re developing on. Some platforms provide APIs to parse advertising packets and give you ready access to at least some of the fields but others may only give you a byte array. Others let you specify sophisticated filtering rules so you only “see” advertising packets relevant to your application whilst others send your application all advertising packets received. Some perform active scanning automatically. Some have explicit APIs that you must use to invoke active scanning.

Understanding what to do with a raw advertising packet in the form of a byte array will stand you in good stead for any platform and it’s really not difficult. To help you get started, I’ve created an Android application called AdvScanner which includes a full advertising packet parser. You can download the source code.

Browse through the code in the advscanner/advertising directory to see how parsing works in the AdvScanner application or run the application on your Android phone to explore the advertising packets being emitted by devices in your environment. You’ll need a device which supports Android 5 at a minimum to use the application.

Conclusion

Tardis
Bluetooth Advertising – more available space than you might think!

Advertising is a crucial part of Bluetooth® low energy and one which developers can exploit in various ways. I hope this guided tour has been useful!

Robust Indoor Distance Estimation Algorithms for Bluetooth® Channel Sounding

Bluetooth Channel Sounding is a powerful feature setting a clear and solid foundation for…

What’s New with Bluetooth® Technology: Channel Sounding, Upcoming Features, and Key Technology Trends

With over 5 billion devices shipping each year, Bluetooth technology is the most widely…

Bluetooth 6: What's New In The Latest Bluetooth Release?

Bluetooth technology is constantly growing, not only enhancing existing applications but also enabling entirely…

Bluetooth PAwR in a Large-Scale Test Network

In the ever-evolving, dynamic landscape of Bluetooth-connected smart devices, efficient interconnection and reliable communication…

Bluetooth Channel Sounding: How It Works and What It Means

Bluetooth® Channel Sounding is a new secure, fine-ranging capability that promises to enhance the…

Receiver Blocking Resilience Test Suite

This Test Suite tests the receiver blocking resilience of a Bluetooth implementation. It is…

Now Available: New Version of the Bluetooth Core SpecificationBluetoothコア仕様の新バージョンがリリース

Thanks to the dedication and hard work of the Bluetooth community, Bluetooth® technology is…

Channel Sounding: Technical Overview (Pt 2)

In Part 1 we introduced the new Bluetooth distance measurement innovation known as Channel…

Unlocking Healthcare Potential: SPP and Bluetooth® LE for Medical Devices

The Serial Port Profile (SPP) has long been a well-known standard for wireless serial…

The Bluetooth Roadmap: Bluetooth Specifications in ProgressBluetoothのロードマップ:策定中のBluetooth仕様

Though not commonly known among many consumers, Bluetooth® technology is constantly and consistently advancing to…

Bluetooth® Channel Sounding: A Technical Overview

This paper provides a detailed technical overview of Bluetooth® Channel Sounding, a secure fine ranging…

The Bluetooth® Mesh Primer

An introduction and explanation of important Bluetooth® Mesh concepts.

Enabling the Digital Transformation of Industrial IoT with Bluetooth®

The Industrial IoT is a digital transformation process for enterprises offering them compelling abilities…

Bluetooth® Technology for Linux Developers

Learn how to use the interprocess communication system D-Bus and the BlueZ APIs to create Bluetooth applications for Linux computers.

Designing and Developing Bluetooth® Internet Gateways

Learn about Bluetooth® internet gateways, how to make them secure and scalable, and design and implement your own...

The Bluetooth LE Security Study Guide

Learn about fundamental security concepts, the security features of Bluetooth Low Energy, and gain some hands-on experience using those features in device code.

NOTICE: The Bluetooth SIG updated its Terms of Use on 29 October 2024Learn more
 Get Help