• QtAvahiService
  • QtAvahiService Class

    (nymeaserver::QtAvahiService)

    Allows to publish an avahi service to the network. More...

    Header: #include <QtAvahiService>
    Inherits:

    Public Types

    enum QtAvahiServiceState { QtAvahiServiceStateUncomitted, QtAvahiServiceStateRegistering, QtAvahiServiceStateEstablished, QtAvahiServiceStateCollision, QtAvahiServiceStateFailure }

    Public Functions

    QtAvahiService(QObject * parent = nullptr)
    ~QtAvahiService()
    QString errorString() const
    QHostAddress hostAddress() const
    bool isValid() const
    QString name() const
    quint16 port() const
    bool registerService(const QString & name, const QHostAddress & hostAddress, const quint16 & port, const QString & serviceType = "_http._tcp", const QHash<QString, QString> & txtRecords = QHash<QString, QString)
    void resetService()
    QString serviceType() const
    QtAvahiServiceState state() const
    QHash<QString, QString> txtRecords() const
    bool updateTxtRecord(const QHash<QString, QString> & txtRecords)

    Signals

    void serviceStateChanged(const QtAvahiServiceState & state)

    Detailed Description

    Allows to publish an avahi service to the network.

    Member Type Documentation

    enum QtAvahiService::QtAvahiServiceState

    This enum type specifies the state of a QtAvahiService.

    ConstantValueDescription
    nymeaserver::QtAvahiService::QtAvahiServiceStateUncomitted0The group has not yet been committed, the user must still call avahi_entry_group_commit().
    nymeaserver::QtAvahiService::QtAvahiServiceStateRegistering1The entries of the group are currently being registered.
    nymeaserver::QtAvahiService::QtAvahiServiceStateEstablished2The entries have successfully been established.
    nymeaserver::QtAvahiService::QtAvahiServiceStateCollision3A name collision for one of the entries in the group has been detected, the entries have been withdrawn.
    nymeaserver::QtAvahiService::QtAvahiServiceStateFailure4Some kind of failure happened, the entries have been withdrawn.

    Member Function Documentation

    QtAvahiService::QtAvahiService(QObject * parent = nullptr)

    Constructs a new QtAvahiService with the given parent.

    QtAvahiService::~QtAvahiService()

    Destructs this QtAvahiService.

    QString QtAvahiService::errorString() const

    Returns the error string of this QtAvahiService.

    QHostAddress QtAvahiService::hostAddress() const

    Returns the hostAddress of this QtAvahiService.

    bool QtAvahiService::isValid() const

    Returns true if the service group was added and committed to the network without errors.

    QString QtAvahiService::name() const

    Returns the name of this QtAvahiService.

    quint16 QtAvahiService::port() const

    Returns the port of this QtAvahiService.

    bool QtAvahiService::registerService(const QString & name, const QHostAddress & hostAddress, const quint16 & port, const QString & serviceType = "_http._tcp", const QHash<QString, QString> & txtRecords = QHash<QString, QString)

    void QtAvahiService::resetService()

    Remove this service from the local network. This QtAvahiService can be reused to register a new avahi service.

    [signal] void QtAvahiService::serviceStateChanged(const QtAvahiServiceState & state)

    This signal will be emitted when the state of this QtAvahiService has changed.

    QString QtAvahiService::serviceType() const

    Returns the service type of this QtAvahiService.

    QtAvahiServiceState QtAvahiService::state() const

    QHash<QString, QString> QtAvahiService::txtRecords() const

    bool QtAvahiService::updateTxtRecord(const QHash<QString, QString> & txtRecords)

    Update the TXT record of this service. Returns true of the record could be updated.