• QtAvahiServiceBrowser
  • QtAvahiServiceBrowser Class

    Allows to browse avahi services in the local network. More...

    Header: #include <QtAvahiServiceBrowser>
    Inherits: HardwareResource
    Inherited By:


    Public Functions

    QtAvahiServiceBrowser(QObject * parent = nullptr)
    virtual ~QtAvahiServiceBrowser()
    virtual QList<AvahiServiceEntry> serviceEntries() const = 0


    void serviceEntryAdded(const AvahiServiceEntry & entry)
    void serviceEntryRemoved(const AvahiServiceEntry & entry)

    Additional Inherited Members

    Detailed Description

    Allows to browse avahi services in the local network.

    The QtAvahiServiceBrowser allows to discover the avahi network and get services.


    In order to search for available avahi services in the current network you use this hardware resource like this:


    #include "network/avahi/avahiserviceentry.h"
    class DevicePluginExample : public DevicePlugin
        void init() override;
    private slots:
        void onServiceEntryAdded(const AvahiServiceEntry &serviceEntry);
        void onServiceEntryRemoved(const AvahiServiceEntry &serviceEntry);


    void DevicePluginExample::init() {
        connect(hardwareManager()->avahiBrowser(), &QtAvahiServiceBrowser::serviceEntryAdded, this, &DevicePluginExample::onServiceEntryAdded);
        connect(hardwareManager()->avahiBrowser(), &QtAvahiServiceBrowser::serviceEntryRemoved, this, &DevicePluginExample::onServiceEntryRemoved);
    void DevicePluginExample::onServiceEntryAdded(const AvahiServiceEntry &serviceEntry) {
        qCDebug(dcExample()) << "New service added to network:" << serviceEntry;
    void DevicePluginExample::onServiceEntryRemoved(const AvahiServiceEntry &serviceEntry) {
        qCDebug(dcExample()) << "Service removed from network:" << serviceEntry;

    See also AvahiServiceEntry.

    Member Function Documentation

    QtAvahiServiceBrowser::QtAvahiServiceBrowser(QObject * parent = nullptr)

    Constructs a new QtAvahiServiceBrowser with the given parent.

    [virtual] QtAvahiServiceBrowser::~QtAvahiServiceBrowser()

    Destroys this QtAvahiServiceBrowser;

    [pure virtual] QList<AvahiServiceEntry> QtAvahiServiceBrowser::serviceEntries() const

    Returns the list of available service entries in the network of this browser.

    [signal] void QtAvahiServiceBrowser::serviceEntryAdded(const AvahiServiceEntry & entry)

    This signal will be emitted when a new entry was added to the current entry list.

    [signal] void QtAvahiServiceBrowser::serviceEntryRemoved(const AvahiServiceEntry & entry)

    This signal will be emitted when a new entry was removed from the current entry list.