PaulVdBergh
Posts: 8
Joined: Fri May 15, 2015 6:25 pm

Bluetooth BLE C/C++ development

Wed Apr 25, 2018 4:23 pm

Hi all,

I'm currently working on an IoT project involving ESP32 modules an an RPi. The RPi's main role is MQTT broker (mosquitto), in combination with apache2 webserver and a C++ program supervising the whole project.

ATM, all the IoT devices have a hard-coded SSID, wifi password, MQTT broker IP address etc. This implies that for every single device participating in the system, the source code has to be adopted (modifying some #define statements) and rebuild before flashing. This is a tendious proces and finaly not feasible when others want to use my system (model railroad control). So my idea is to connect the RPi over bluetooth BLE to the devices and set/modify settings in the device before it connects over TCP/IP to the broker.

I spend the whole day googling for info regarding C/C++ programming bluetooth under linux, but didn't found usefull info/tutorials on the subject. (However, found some interesting background info on the bluetooth technologies :) ). The best advice I found was digging into the bluez source-code :o .

So my simple question is : where do I find usefull info, tutorials and/or examples re bluetooth BLE programming in C/C++ under linux (more specific Debian, Raspbian) ?

Thanks in advance,

Paul

paulslocum
Posts: 75
Joined: Sun Apr 09, 2017 10:54 pm

Re: Bluetooth BLE C/C++ development

Wed Apr 25, 2018 7:11 pm

I have a bluetooth project working, and I did it all from the Bluez source code. I also had to update Bluez. The version that comes with Jessie was too buggy to be usable for my purposes.

Daniel Gessel
Posts: 26
Joined: Sun Dec 03, 2017 1:47 am

Re: Bluetooth BLE C/C++ development

Sat Dec 22, 2018 4:21 am

It took me quite some time to wrangle the bluetoothctl code and get BLE writes to a characteristic working from within a c program. I now know more about BLE and DBus than I ever planned on (with, admittedly, lots left to learn). My question now is about performance - my limited scenario (LEGO PoweredUp devices) seems to be limping along - i can only reliably write once per 100 milliseconds...

Return to “C/C++”