Allows to browse avahi services in the local network. More...
Header: | #include <QtAvahiServiceBrowser> |
Inherits: | HardwareResource |
Inherited By: |
QtAvahiServiceBrowser(QObject * parent = nullptr) | |
virtual | ~QtAvahiServiceBrowser() |
virtual QList<AvahiServiceEntry> | serviceEntries() const = 0 |
void | serviceEntryAdded(const AvahiServiceEntry & entry) |
void | serviceEntryRemoved(const AvahiServiceEntry & entry) |
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:
devicepluginexample.h
#include "network/avahi/avahiserviceentry.h" class DevicePluginExample : public DevicePlugin { ... public: void init() override; private slots: void onServiceEntryAdded(const AvahiServiceEntry &serviceEntry); void onServiceEntryRemoved(const AvahiServiceEntry &serviceEntry); ... };
devicepluginexample.cpp
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.
Constructs a new QtAvahiServiceBrowser with the given parent.
[virtual]
QtAvahiServiceBrowser::~QtAvahiServiceBrowser()Destroys this QtAvahiServiceBrowser;
[pure virtual]
QList<AvahiServiceEntry> QtAvahiServiceBrowser::serviceEntries() constReturns 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.