This repository has been archived on 2024-10-30. You can view files and clone it, but cannot push or open issues or pull requests.
SDi-STOMP/stomp.h

47 lines
1.3 KiB
C
Raw Normal View History

2023-11-29 10:53:20 +00:00
#ifndef STOMP_H
#define STOMP_H
#include <QObject>
#include "interface/iStompSubject.h"
2023-11-30 08:53:53 +00:00
#include <QSslSocket>
#include "stompframe.h"
2023-11-29 10:53:20 +00:00
#define MAX_OBSERVER 5
class Stomp : public QObject, public interface::iStompSubject{
public:
Stomp();
2023-11-30 08:53:53 +00:00
~Stomp();
2023-11-29 10:53:20 +00:00
// iStompSubject interface
public:
bool subscribe(interface::iStompObserver* obs);
void unsubscribe(interface::iStompObserver* obs);
2023-11-30 08:53:53 +00:00
int connectRequest(QString host, int port, QString vhost, QString username, QString password);
2023-12-06 11:00:27 +00:00
void sendRequest(QString destination, const QByteArray& body);
2023-11-29 10:53:20 +00:00
void subscribeRequest(QString destination, int id);
void disconnectRequest();
protected:
2023-11-30 08:53:53 +00:00
void notifyConnectConfirmation(bool success, QString version);
2023-11-29 10:53:20 +00:00
void notifySendConfirmation(bool success);
void notifySubscribeConfirmation(bool success);
void notifyReceiveIndication(int id, QString destination, QString body);
void notifyDisconnectConfirmation();
void notifyDisconnectIndication();
protected:
interface::iStompObserver* observer_[MAX_OBSERVER];
2023-11-30 08:53:53 +00:00
private:
QSslSocket socket_;
QString host_ = "sdi.hevs.ch";
QString vHost_ = "/";
int port_ = 61614;
QString user_ = "sdi10";
QString password_ = "809c02f36becb0868da98761fe3209f6";
2023-11-29 10:53:20 +00:00
};
#endif // STOMP_H