Saturday, October 25, 2014

Generic Access Profile (GAP)


GAP controls advertising and connections in Bluetooth. GAP makes your device visible to the outside world, and determines how two devices can or can't interact with each other.


Advertising Data Payload and Scan Data Payload

There are two ways to send advertising out with GAP - the Advertising Data payload and the Scan Response payload.

Both payloads are identical and can contain up to 31 bytes of data, but only the advertising data payload is mandatory, since this is the payload that will be constantly transmitted out from the device to let central devices in range know that it exists. 

The scan response payload is an optional secondary payload that central devices can request, and allows device designers to fit a bit more information in the advertising payload such a strings for a device name, etc.

How Advertising Process works

A peripheral device will set a specific advertising interval, and every time this interval passes, it re-transmit it's Primary advertising packet. A longer delays saves power but feels less responsive

How Scan Process works

If a listening device is interested in the scan response payload (and it is available on the
peripheral) it can optionally request the scan response payload, and the peripheral will respond with the additional data.

How advertising payloads and scan response payloads work










What is Broadcasting

Another cool feature in BLE is that devices can send unsolicited broadcasts of small chunks of data. Unlike real Bluetooth, scanning for devices in the LE world can be passive - you just listen for advertisement packets on the right channels and you hear all the advertisements. 

How Broadcasting Works

By including a small amount of custom data in the 31 byte advertising or scan response payloads, you can use a low cost BLE peripheral to sent data one-way to any devices in listening range. This data is also called Manufacturer Specific Data.

Note: This approach is used by Apple's iBeacon protocol. It inserts a custom payload in the main advertising packet. We will talk about this custom payload in later posts.

How Broadcast Works













Once you establish a connection between your peripheral and a central device, the advertising process will generally stop and you will typically no longer be able to send advertising packets out anymore, and you will use GATT services and characteristics to communicate in both directions.


No comments:

Post a Comment