BLE Heart Rate Server Example with GUI, QStandardPaths: XDG_RUNTIME_DIR not set
i'm aware that the Bluetooth Low Energy Heart Rate Server Example is a console app running with root privileges
however i need to expand it to simulate our particular server needs and a gui would be very handy to change various configs and automate data while testing
i have now a simple and empty gui form, for testing, and copied all the bt-ble part of the code from the console app's main into the gui form's constructor to see what happens
running it in creator shows the usual "qt.bluetooth.bluez: received advertising error" error message since it's not running with root privileges
trying to run the app outside of creator with "sudo ./BleDevice" throws the following error message
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' Segmentation fault (core dumped)
the fact that the app runs in user mode and only producing this bluez error would indicate to me that not too much is wrong with this quick fix initial setup to get somehow started
however when it comes to running with root privileges the error get's me to the end of my wisdom
const QScopedPointer<QLowEnergyController> leController(QLowEnergyController::createPeripheral());
const QScopedPointer<QLowEnergyService> service(leController->addService(serviceData));
the line which causes the error is the following
leController->startAdvertising(QLowEnergyAdvertisingParameters(), advertisingData, advertisingData);
basically how would parts of the console apps code be run piece by piece in a gui environment with root privileges or am i asking for the stars ???
any assistance would be highly appreciated
Hi and welcome to devnet,
What is usually done in such a case is that the application or more usually the daemon that needs elevated privileges runs without GUI and uses an IPC mechanism like DBus on Linux for communication so you can have a GUI for the user.
AFAIK; access to the X server is disabled by default for the root user which is likely one part of your problem.
@SGaist thanks for the reply
for now i'll fight a similar issue on android and depending on the outcome i'll attempt you suggestion
it's all related to the 20 byte limit on gatt characteristic data transfer