Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. India
  4. How to use on-board raspberry-pi bluetooth with qt creator?
QtWS25 Last Chance

How to use on-board raspberry-pi bluetooth with qt creator?

Scheduled Pinned Locked Moved Unsolved India
1 Posts 1 Posters 1.2k Views
  • 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.
  • S Offline
    S Offline
    SHUBHAM SINGH RAO
    wrote on last edited by SHUBHAM SINGH RAO
    #1

    Hi there
    Problem Statement - I am using Qt Creator 3.2.1 (IDE Qt 5.3.2) and I am trying to control on-board bluetooth on raspberry pi 3 B+ using Qt creator
    I want to scan bluetooth devices and connect to them using Qt

    My work -

    I have included QT += bluetooth library in .pro file

    My code -

    #include <qbluetoothlocaldevice.h>
    #include<qbluetoothdevicediscoveryagent.h>
    #include<qbluetoothaddress.h>

    void MainWindow::startScan()
    {discoveryAgent->start();
    }

    void MainWindow::on_discoverable_clicked(bool checked)
    {
    if (checked)
    {
    localDevice>setHostMode(QBluetoothLocalDevice::HostDiscoverable);
    }
    else
    {
    localDevice>setHostMode(QBluetoothLocalDevice::HostConnectable);
    }
    }

    void MainWindow::on_power_clicked(bool checked)
    {
    if (checked)
    { localDevice->powerOn(); }
    else
    {
    localDevice>setHostMode(QBluetoothLocalDevice::HostPoweredOff);
    }
    }

    I took the help from this link -
    https://code.qt.io/cgit/qt/qtconnectivity.git/tree/examples/bluetooth/btscanner?h=5.13
    But I am not able to implement that. I am quite new in qt bluetooth

    My Requiement -
    I need the guidance how could I proceed in Qt bluetooth to control raspberry pi - on board bluetooth

    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