libXpertMass Developer Documentation
  • libXpertMass
  • MassDataClient
  • MassDataClient Class

    class MsXpS::libXpertMass::MassDataClient

    The MassDataClient class provides a network client. More...

    Header: #include <MassDataClient.hpp>
    Inherits: QObject

    Public Functions

    MassDataClient(const QString &ip_address, int port_number, int connection_frequency = 1, QObject *parent = nullptr)
    virtual ~MassDataClient()
    QString getStatus()

    Protected Slots

    virtual void readData()
    void reportError(QAbstractSocket::SocketError socket_error)
    void requestNewData()

    Protected Variables

    int m_connectionFrequency
    QByteArray m_data
    QDataStream m_inStream
    QString m_ipAddress
    int m_portNumber
    QTcpSocket *mpa_tcpSocket

    Detailed Description

    Member Function Documentation

    [explicit] MassDataClient::MassDataClient(const QString &ip_address, int port_number, int connection_frequency = 1, QObject *parent = nullptr)

    Constructs a MassDataClient instance.

    [virtual noexcept] MassDataClient::~MassDataClient()

    Destructs this MassDataClient instance.

    QString MassDataClient::getStatus()

    Returns a string display the connection details.

    [virtual protected slot] void MassDataClient::readData()

    Reads the data into the QByteArray m_data member using the QDataStream m_inStream member.

    Emits the newDataSignal() signal with m_data;.

    [protected slot] void MassDataClient::reportError(QAbstractSocket::SocketError socket_error)

    Reports the error socket_error.

    [protected slot] void MassDataClient::requestNewData()

    Tries a connection to the server using the member QTcpSocket.

    Member Variable Documentation

    int MassDataClient::m_connectionFrequency

    This variable holds the frequency at which the client connects to the server, in times per second.

    A frequency of 1 means that the connection will be tried once per second. This is empirically correct.

    QByteArray MassDataClient::m_data

    This variable holds the data being transported.

    QDataStream MassDataClient::m_inStream

    This variable holds the data stream in input in this MassDataClient instance.

    QString MassDataClient::m_ipAddress

    This variable holds the server IP address to which the connection must be made.

    int MassDataClient::m_portNumber

    This variable holds the port number to which to attach during the connection..

    QTcpSocket *MassDataClient::mpa_tcpSocket

    This variable holds the socket that is used for the connection.