Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. BLE Heart Rate Server Example with GUI, QStandardPaths: XDG_RUNTIME_DIR not set
Forum Updated to NodeBB v4.3 + New Features

BLE Heart Rate Server Example with GUI, QStandardPaths: XDG_RUNTIME_DIR not set

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    efiLabs
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      E 1 Reply Last reply
      0
      • SGaistS SGaist

        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.

        E Offline
        E Offline
        efiLabs
        wrote on last edited by
        #3

        @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

        tx again

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved