• TransportInterface
  • TransportInterface Class

    (nymeaserver::TransportInterface)

    This class provides an interface for the JSON servers. More...

    Header: #include <TransportInterface>
    Inherits:
    Inherited By:

    nymeaserver::BluetoothServer, nymeaserver::TcpServer, and nymeaserver::WebSocketServer

    Public Functions

    TransportInterface(const ServerConfiguration & config, QObject * parent = nullptr)
    virtual ~TransportInterface() = 0
    ServerConfiguration configuration() const
    virtual void sendData(const QUuid & clientId, const QByteArray & data) = 0
    virtual void sendData(const QList<QUuid> & clients, const QByteArray & data) = 0
    void setConfiguration(const ServerConfiguration & config)

    Public Slots

    virtual void setServerName(const QString & serverName)
    virtual bool startServer() = 0
    virtual bool stopServer() = 0

    Signals

    void clientConnected(const QUuid & clientId)
    void clientDisconnected(const QUuid & clientId)
    void dataAvailable(const QUuid & clientId, const QByteArray & data)

    Detailed Description

    This class provides an interface for the JSON servers.

    See also WebSocketServer and TcpServer.

    Member Function Documentation

    TransportInterface::TransportInterface(const ServerConfiguration & config, QObject * parent = nullptr)

    Constructs a TransportInterface with the given config and parent.

    [pure virtual] TransportInterface::~TransportInterface()

    Virtual destructor for TransportInterface.

    [signal] void TransportInterface::clientConnected(const QUuid & clientId)

    This signal is emitted when a new client with the given clientId has been connected.

    See also WebSocketServer and TcpServer.

    [signal] void TransportInterface::clientDisconnected(const QUuid & clientId)

    This signal is emitted when a new client with the given clientId has been disconnected.

    See also WebSocketServer and TcpServer.

    ServerConfiguration TransportInterface::configuration() const

    Returns the {ServerConfiguration}.

    See also setConfiguration().

    [signal] void TransportInterface::dataAvailable(const QUuid & clientId, const QByteArray & data)

    This signal is emitted when valid data from the client with the given clientId are available.

    See also WebSocketServer, TcpServer, and BluetoothServer.

    [pure virtual] void TransportInterface::sendData(const QUuid & clientId, const QByteArray & data)

    Pure virtual method for sending data to the client with the id clientId over the corresponding TransportInterface.

    [pure virtual] void TransportInterface::sendData(const QList<QUuid> & clients, const QByteArray & data)

    Pure virtual method for sending data to clients over the corresponding TransportInterface.

    void TransportInterface::setConfiguration(const ServerConfiguration & config)

    Set the ServerConfiguration of this TransportInterface to the given config.

    See also configuration().

    [virtual slot] void TransportInterface::setServerName(const QString & serverName)

    Set the name of this TransportInterface to the given serverName.

    [pure virtual slot] bool TransportInterface::startServer()

    Pure virtual public slot for starting the corresponding TransportInterface. Returns true if started successfully.

    See also WebSocketServer::startServer() and TcpServer::startServer().

    [pure virtual slot] bool TransportInterface::stopServer()

    Pure virtual public slot for stopping the corresponding TransportInterface. Returns true if stopped successfully.

    See also WebSocketServer::stopServer() and TcpServer::stopServer().