O'Reilly logo

Qt 5 Projects by Marco Piccolino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Making the server listen to the adapter

The first step involves a few operations:

  • Getting hold of the Bluetooth adapter's address
  • Creating a local device instance from the adapter
  • Making the device instance discoverable
  • Creating a Bluetooth server based on the RFCOMM protocol
  • Having the server listen to the adapter's address

We will also save a pointer to the server instance and the local adapter address in our channels instance, so that we can refer to them during the various initialization steps:

#ifndef BROADCASTER_BT_H#define BROADCASTER_BT_H...namespace channels {class BroadcasterBt : public BroadcasterChannel{    Q_OBJECTpublic:    explicit BroadcasterBt(QObject* parent = nullptr);    bool init() override;private:    QBluetoothServer* _server; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required