47 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef STOMP_H
 | 
						|
#define STOMP_H
 | 
						|
 | 
						|
#include <QObject>
 | 
						|
#include "interface/iStompSubject.h"
 | 
						|
#include <QSslSocket>
 | 
						|
#include "stompframe.h"
 | 
						|
 | 
						|
#define MAX_OBSERVER 5
 | 
						|
 | 
						|
class Stomp : public QObject, public interface::iStompSubject{
 | 
						|
public:
 | 
						|
    Stomp();
 | 
						|
    ~Stomp();
 | 
						|
 | 
						|
 | 
						|
    // iStompSubject interface
 | 
						|
public:
 | 
						|
    bool subscribe(interface::iStompObserver* obs);
 | 
						|
    void unsubscribe(interface::iStompObserver* obs);
 | 
						|
    int connectRequest(QString host, int port, QString vhost, QString username, QString password);
 | 
						|
    void sendRequest(QString destination, const QByteArray& body);
 | 
						|
    void subscribeRequest(QString destination, int id);
 | 
						|
    void disconnectRequest();
 | 
						|
 | 
						|
protected:
 | 
						|
    void notifyConnectConfirmation(bool success, QString version);
 | 
						|
    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];
 | 
						|
 | 
						|
private:
 | 
						|
    QSslSocket socket_;
 | 
						|
    QString host_ = "sdi.hevs.ch";
 | 
						|
    QString vHost_ = "/";
 | 
						|
    int port_ = 61614;
 | 
						|
    QString user_ = "sdi10";
 | 
						|
    QString password_ = "809c02f36becb0868da98761fe3209f6";
 | 
						|
};
 | 
						|
 | 
						|
#endif // STOMP_H
 |