Hey guys, Let dive into the BLE Sub Section. I was not able to implement much on this front but it is not very difficult to implement. Let me go through the basics first
What is BLE ??
BLE Stands for Bluetooth Low Energy. It is a Simple yet Powerful Technology specially designed for Low power Applications. It's Strength lies in the STATE information transmission.
So, You may ask STATE information ?? Well that means something like Is the Device ON or OFF, is the fan ON or OFF what is the value of the PWM Signal going to LED, etc. State is just a small piece of information not something like IMAGES or AUDIO/ VIDEO, etc.
That being Cleared, BLE being Point to Point Communication protocol is organised into 2 Main Roles Client / Server OR Peripheral / Central OR Slave / Master
These means out of two devices one will me Master and one Will be Salve. The Master will control the Slave (Ohh This sounds more like 50 Shades of Grey !!! ***. !!)
These 2 profiles Majorly are known as GAP or Generic Access Profiles for you guys with BigAss Specks
(Thanks to LadyAda for this Image)
Moving on, the devices we usually implement as a End user device is a BLE Peripheral / Slave / Client device. So everything now on will be based on this statement.
So, In a Client Device How To send data to other Devices ?
Well, to ease things up Bluetooth implements a Service / Attribute Structure.
Puzzeled ??
Don't Worry, Let Me Explain.
Lets say you want to order a Brand New iPhone X/TEN/10/ Whatever !!!! Online I would prefer flipkart/ Amazon
So you would like to go to a Website that would Sell you the Item ?? like Amazon or best buy !! this is our Seller Service
Now Once you land up at Amazon You would like to go to the Mobile Section who offer Mobile Sale Services !! This is the Characteristic or Attributes
Now We would like to Go to the iPhone Section which would contain information on all iPhones !! This is the values in the Characteristic or Attributes
All of the Above is Geeky Known as GATT or Generic Attribute Profile
Refer this diagram for ease of understanding
Finally the Values which we will play with are in Name Value pair, i.e. UUID, VALUE.
This was the Super super dooper short introduction on BLE If you are interested in more I suggest gat a Pink hair Die and meet LadyAda Here.
Moving to the implementation Again ST was good to provide a LIBRARY for BLE HERE with an Example Application HERE .
While this is good for understanding the Basics of How things work. It's not enough to implement a custom BLE Service. For that I have these two links Below
2. How to change BLE_GAP Profile Selection
3. How to create custom GATT Services
Now there are some Predefined GATT Profiles Provided by Bluetooth themselves found at this link.
Finally , Let me show the little work I have done in BLE Part !! Its Actually nothing Great
Adding the Headers including GATT Profiles
#include "ble/BLE.h" #include "LEDService.h" #include "BatteryService.h" #include "DeviceInformationService.h"
Setting the parameters like Device List LIST
const static char DEVICE_NAME[] = "IoToWSbSr"; static const uint16_t uuid16_list[] = {LEDService::LED_SERVICE_UUID, //GattService::UUID_BATTERY_SERVICE, GattService::UUID_DEVICE_INFORMATION_SERVICE}; LEDService *ledServicePtr;
Setting the GATT Parameters
/* Setup Device Identification service. */ DeviceInformationService devInfoService(ble, "ST Micro", "NUCLEO-L476RG", "XXXX", "v1.0", "v1.0", "v1.0");
You can extend the to anything you would like to.
As I have Not yet customised the BLE Part much This is pretty much the basics. It will be easy to implement the custom GATT profiles .
Thanks for Reading
Regards,
GS Gill