Sunday 19 March 2017

GAP,GATT & Beacon

In the previous article Exploring BLE through nRF51 DK development board, we mentioned briefly about BLE and nRF51-dk. In this article we will be explaining two important concepts which are required to code a bluetooth application.

Before that you should know that bluetooth network model is based on 'proximity networking'  which implies that when two devices come into range of each other, they are capable of establishing a connection.
The advertising takes place in following ways:
1. GAP:

GAP is an acronym of Generic Access Profile, it is used to control the advertising and defines various roles of the devices.It is responsible for your device to be visible to the outer world.

Devices can be divided in the following two roles:
1. Peripheral : These devices are small and are restricted to lesser resources. They are used to connect to much more powerful central devices. eg: heart rate monitoring watches, beacons.
2. Central: These devices are with greater processing power and memory. eg: phones, tablets etc.

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

Peripheral Devices sets an advertising interval , and sends the advertising data in that duration. The Advertising Data is essential for peripheral device , as it signifies its existence to any nearby listening devices.
Scan Response is sent out by central device , if required for additional information from the peripheral.

During advertising process, a single peripheral advertising data can be scanned by two or more central devices as shown in the figure below.This is known as broadcasting.

                                                              Figure 1 Broadcast Topology

In our project we are using beacons. Please visit the first link to know what are beacons and how do they work.
Beacons advertise themselves by sending  advertising data, which can be of 47 bytes in length and consist of :
1 byte preamble
4 byte access address
2-39 bytes advertising channel PDU
3 bytes CRC

                                                                    Figure 2 Advertised Data

As shown in the figure above PDU contains header, MAC and Data upto 31 bytes.
The Data of 31 bytes contains Beacon prefix, Proximity UUID , Major , Minor and TX power as shown in the figure.
                                                               Figure 3 Inside the Data Bytes

Our task was to scan the beacons using nRF51-dk. We used the example code BLE_Observer , which scans the beacons and returns the values of MAC address, RSSI, Scan response , Advertising type,Proximity UUID , Major , Minor and TX power .

The main purpose of peripheral to advertise is to establish a connection with the central device.
Once the connection occurs advertising process ends and we use GATT services and characteristics to communicate in both directions.

BLE devices can operate in a non-connectable advertisement-only mode (where all the information is contained in the advertisement), but they can also allow connections (and usually do).
In our project , we are using only GAP and we have used it in our scanner.

2. GATT:

GATT is an acronym for the Generic Attribute Profile, and it defines the way that two Bluetooth Low Energy devices transfer data back and forth using concepts called Services and Characteristics.
As mentioned above, GATT comes into play once a connection is established.
Now comes the interesting part, as said peripheral device can be scanned by two or more central devices. But once a connection is established , peripheral cannot advertise anymore and communicates with a single central device.
But a central device is capable of establishing connection with two or more peripheral devices. This kind of topology is called Connected Network Topology.
Figure 4 Connected Topology
An important concept which comes into play in GATT is server/client relationship.
We would recommend you to visit the second link  mentioned below to understand the concept.

Useful/ Recommended Links:
http://www.pointrlabs.com/blog/beacons-everything-you-need-to-know/
https://learn.adafruit.com/introduction-to-bluetooth-low-energy/gatt
 

5 comments:


  1. My favourite blog! Thanks for sharing such insightful and relevant content.
    MDX Concepts Gypsum Spray for Bed Bugs

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. WE SPECIALIZE IN FAST APPROVALS
    You can access our Credit/funding facilities from Any location in the world.
    Reply for more information about our credit offer via Email: unitedglobalfinancier@gmail.com


    Are you frustrated or tired of seeking Financial assistance from Bank and different financial organization, have you encountered company with unsatisfied financial services?
    Here is your chance to secure fast and genuine money lending at a very low interest rate. For more information,
    Email: unitedglobalfinancier@gmail.com


    We offer the right solution to your financial needs.We stand apart from other lenders because we believe in customer service, and we stay with you until you get the results you want.In general we offer home finances,car finances,commercial finances,business finances,e.t.c, at lower interest rate of 3%.
    We provide our prospective customer long lasting financial solutions that helps their companies thrive and grow"and also help them to invest and clear you existing debts. Email: unitedglobalfinancier@gmail.com
    Contact us now for more information.


    We are financial builders and we give out loan to everyone ranging from personal, commercial, business financial with our amounts ranging from min 2,000.00 to 1,000,000.00 with a fixed and very low interest rate of 3%. Do you want to own a company? Do you want to own a Home? Is Your Company having financial problem? Do you have a contract/project and need money to fund it? Apply for a financial today and get financed within 3-4 working
    days.Email: unitedglobalfinancier@gmail.com

    Do you need a Loan?
    Are you looking for Finance?
    Are you looking for a Loan to enlarge your business?
    I think you have come to the right place.
    We offer Loans atlow interest rate.
    Interested people should please contact us on
    For immediate response to your application, Kindly
    reply to this email: unitedglobalfinancier@gmail.com

    DO YOU NEED A LOAN : TRUST ME WE CAN SOLVE YOUR FINANCE PROBLEM
    Do you need Personal Loan?
    Business Cash Loan?
    Unsecured Loan
    Fast and Simple Loan?
    Quick Application Process?
    Approvals within 24-72 Hours?
    No Hidden Fees Loan?
    Funding in less than 1 Week?
    Get unsecured working capital?
    Contact Us At : unitedglobalfinancier@gmail.com

    LOAN SERVICES AVAILABLE INCLUDE:
    ================================
    *Commercial Loans.
    *Personal Loans.
    *Business Loans.
    *Investments Loans.
    *Development Loans.
    *Acquisition Loans .
    *Construction loans.
    *Credit Card Clearance Loan
    *Debt Consolidation Loan
    *Business Loans And many More:

    LOAN APPLICATION FORM:
    =================
    Full Name:................
    Loan Amount Needed:.
    Purpose of loan:.......
    Loan Duration:..
    Gender:.............
    Marital status:....
    Location:..........
    Home Address:..
    City:............
    Country:......
    Phone:..........
    Mobile / Cell:....
    Occupation:......
    Monthly Income:....

    Contact Us At : unitedglobalfinancier@gmail.com

    ReplyDelete
  4. BUSINESS LOAN PERSONAL LOAN HERE APPLY NOW WhatsApp +918929509036 financialserviceoffer876@gmail.com Dr. James Eric

    ReplyDelete