Any good resources on implementing Firmware OTA over BLE? - bluetooth-lowenergy

I'd love to get a good overview of strategies applied to execute firmware updates over-the-air (FOTA / OTA via BLE) via Bluetooth Low Energy 4.1 and beyond.
The assumption being that the Client is an Android and / or iOS device.
Any hints and help are greatly appreciated.

Do you have a specific module/chip in mind for the peripheral device? Some vendors already provide a FOTA (Firmware Over the Air) service that is supported by their SDK or APIs on the embedded device.
Otherwise, if the vendor does not support it or you would like to implement your own, then you could follow the guidelines and model your system after theirs.
Here are some links that may help you:
mbed FOTA service
Cypress FOTA upgrade guidelines
ST FOTA upgrade
Make sure your firmware file and update process are secure

Related

Light Weight Bluetooth LE library in C

I have been looking around for a simple Bluetooth LE library in C that allows me to scan for BLE devices, connect and receive periodic notifications from a given service UUID from the BLE device. Something that directly works with Bluetooth sockets and libbluetooth(created from BlueZ) and not using DBUS. Pairing and security functionality are not required.
Came across https://github.com/labapart/gattlib. Appears to be good but uses dbus API and has dependency on libdbus, glib, so on. To use this library, there is an additional 5MB of libraries required, hence decided to go without dbus. We do not have space on our device to support 5MB of bluetooth stack on compressed rootfs image. The total size of our rootfs image is 9 MB. The bluetooth stack with dbus itself appears to be more than 50% of our rootfs size.
There is also - https://github.com/edrosten/libblepp which is in c++ and doesn't use dbus. This would require to write a C wrapper to be used in C programs and also overhead of C++ constructs such as compiler generated copy constructors, assignment operators and so on. Also issues in cross-compiling.
Target board is Xilinx Zynq running Linux and the build system is buildroot.
Please suggest.
Thanks
Found a solution, it may be of help for someone...
After searching and going through Linux Conference and IOT conference videos on youtube, figured that Bluez has light weight executables and the code is present in src/shared folder of Bluez. For btgattclient.c produces "gatt-client" executable when compiled which does the same functionality as "gatttool" and is not dependant on bluetoothd or dbus. The only dependency it has is on glib-2.0.
This is helpful if we need lightweight tools when the OS has no bluetoothd running or has no dbus library installed.
Thanks
If you want to use BlueZ for BLE communication, the only supported API is the D-Bus API. Everything else is either discouraged or deprecated.
If you want something more minimal and/or not use BlueZ at all, you can use the HCI_CHANNEL_USER feature in Linux to get raw access to the HCI connection in the kernel. With this you can use any Bluetooth Host stack software or write your own minimal if you only require an extremely small subset.
Questions asking for software library recommendations are not allowed on Stack Overflow due to the possibility for opinion-based results though.

Kaa to collect data from Tridium Niagara building automation system

I am currently evaluating IoT platforms which can connect to devices and controllers, then collect data and do some analytics
To start with I have this device "JACE 8000" which runs on Niagara platform, which has communication protocols like obix, mqtt etc
I would like to know if Kaa already has any existing module or plugin for this?
If not how to build a new one? and how easy is it to develop a new plugin
It appears that Kaa's preferred choice of protocol is MQTT. Niagara N4 happens to provide an abstract implementation of an MQTT driver, so I'm confident that would probably be your best route for development if you wanted a JACE to communicate with a Kaa network.
To go into any more depth is difficult here because you really need to be either a certified Niagara engineer or developer and have access to a workbench, documentation, and so on. The Niagara framework is a big beast!

Custom profile/services in Bluetooth low energy

Please don't mind my naivety. I am new to developing for Bluetooth Low Energy devices. My recent application needs to interact with the Mi Band 2 device. Got some guidance for connecting with the generic services from https://www.bluetooth.com/specifications/gatt/services
Now I need to read and work with the Custom Services of the device's BLE Stack.
Is there any way to find out which Custom service is meant for which purpose?
Custom services are custom, and not standardised. Anyone can design their own custom service and they don't need to document it.

BlueZ 5.30: D-Bus GATT API - Simply Discover and Connect to a BLE device in C

With the last release of BlueZ (5.30) the highlight was the completion of the GATT D-Bus apis. My goal is to programmatically (in C), as a BLE client:
scan for ble devices (which I can do with the hci layer)
Connect to an advertising BLE device
Get the UUIDs
Execute Read and Write to handles
The BlueZ community is strongly suggesting to use the GATT-Dbus api to accomplish this. After multiple searches and head scratching I was not successful to find a proper way or example that would perform this through GATT-DBUs api. It seems more complicate than just use directly the GATT layer. Unfortunately BlueZ removed direct access to make calls to gatt.
I'm very close to just pull the GATT source files out from Bluez, compile it as it's own independent library and directly use the GATT layer and calls to connect and execute reads/writes to ble device server. I know it is not the suggested way compared to the DBUS-GATT api but I'm out of options.
If anybody has any input on this or suggestion (with some sample code) please advise.
thank you in advance!
The best way to start with DBUS GATT API is to hace a look at the source code here: http://git.kernel.org/cgit/bluetooth/bluez.git/tree/
Under client folder you can find a full sample of how to use the DBUS GATT API. Actually that is the source of bluetoothctl tool.
Note that DBUS GATT API is still experimental but you can enable it running bluetoothd service with -E flag.
I had a similar issue which is to interact with a BLE device with a GATT C/C++ API.
In my case I had to use Bluez v4.101 - the latest Bluez version available in Ubuntu 14.04 LTS (read my story). In Bluez v4.x, there is no DBus API.
And actually, I have recently worked with Bluez v5 DBus API and I discovered if you do not use at least Bluez v5.39 (from April 2016) it is likely you will have issue with the DBus API. And as said before the DBus API is still experimental.
So to solve my Bluez v4.x dependency I had to pull the GATT source files out from Bluez and create my own library 'gattlib'. The project is Open-Source to encourage feedback and contribution.
I am using this library in my own GATT client project.
I wrote few examples to help people to start using it see the folder /examples of the project.
EDIT March 2017: I have just added DBus support to gattlib (https://github.com/labapart/gattlib/). From Bluez v5.42, gattlib automatically uses DBus API (DBus gattlib backend can also be forced when building the library to use it before v5.42).

Bluetooth 4.0 multiple UUIDs?

So we are working with Bluetooth 4.0 right now and are orientating the capabilities.
We are developing apps for iOS and Android.
Now while developing for iOS we descovered the service class uuid[b]s[/b]
This presumes we should be able to have multiple UUID's.
The question is:
Is het possible to have multiple UUID's broadcasting in the advertisement package? And how does such a package look like?
It is possible but the available space is limited.
If you are writing firmware for a device you'll probably want to look at some fairly low level documentation. The Core Bluetooth v4.1 spec, downloadable here https://www.bluetooth.org/en-us/specification/adopted-specifications, describes the format of the advertising packet in Vol.3, Part C, Section 11. You'll also need the supplement to understand the various data formats.
Yeah it's possible.
is it a RFCOmm or BLE communitcation?

Resources