mirror of
https://github.com/nymea/nymea-plugins.git
synced 2026-07-15 00:22:26 +02:00
40 lines
824 B
C++
40 lines
824 B
C++
#ifndef OWLETCLIENT_H
|
|
#define OWLETCLIENT_H
|
|
|
|
#include <QObject>
|
|
#include <QHostAddress>
|
|
#include <QTcpSocket>
|
|
|
|
class OwletTransport;
|
|
|
|
class OwletClient : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit OwletClient(OwletTransport *transport, QObject *parent = nullptr);
|
|
|
|
OwletTransport *transport() const;
|
|
|
|
int sendCommand(const QString &method, const QVariantMap ¶ms = QVariantMap());
|
|
|
|
signals:
|
|
void connected();
|
|
void disconnected();
|
|
void error();
|
|
|
|
void replyReceived(int commandId, const QVariantMap ¶ms);
|
|
void notificationReceived(const QString &name, const QVariantMap ¶ms);
|
|
|
|
private slots:
|
|
void dataReceived(const QByteArray &data);
|
|
|
|
private:
|
|
OwletTransport *m_transport = nullptr;
|
|
int m_commandId = 0;
|
|
|
|
QByteArray m_receiveBuffer;
|
|
|
|
};
|
|
|
|
#endif // OWLETCLIENT_H
|