some update
This commit is contained in:
parent
356cb3e541
commit
ac7411aa58
0
UsersREMI~1.HERAppDataLocalTemptmp8h6pg12m
Normal file
0
UsersREMI~1.HERAppDataLocalTemptmp8h6pg12m
Normal file
6
app.cpp
6
app.cpp
@ -1,7 +1,9 @@
|
|||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|
||||||
App::App() {
|
App::App() {
|
||||||
|
st.connectRequest("sdi.hevs.ch", 61614, "/", "sdi10", "809c02f36becb0868da98761fe3209f6");
|
||||||
|
st.sendRequest("/topic/sdi10.gem.command", "right");
|
||||||
|
st.subscribeRequest("/topic/sdi10.gem.field", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::connectConfirmation(bool success, int version) {
|
void App::connectConfirmation(bool success, int version) {
|
||||||
@ -13,7 +15,7 @@ void App::sendConfirmation(bool success) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void App::subscribeConfirmation(bool success) {
|
void App::subscribeConfirmation(bool success) {
|
||||||
|
st.sendRequest("/topic/sdi10.gem.command", "up");
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::receiveIndication(int id, QString destination, QString body) {
|
void App::receiveIndication(int id, QString destination, QString body) {
|
||||||
|
4
app.h
4
app.h
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "interface/iStompObserver.h"
|
#include "interface/iStompObserver.h"
|
||||||
|
#include "stomp.h"
|
||||||
|
|
||||||
class App : public QObject, public interface::iStompObserver {
|
class App : public QObject, public interface::iStompObserver {
|
||||||
public:
|
public:
|
||||||
@ -17,6 +18,9 @@ private:
|
|||||||
void receiveIndication(int id, QString destination, QString body);
|
void receiveIndication(int id, QString destination, QString body);
|
||||||
void disconnectConfirmation();
|
void disconnectConfirmation();
|
||||||
void disconnectIndication();
|
void disconnectIndication();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Stomp st;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APP_H
|
#endif // APP_H
|
||||||
|
12
main.cpp
12
main.cpp
@ -4,20 +4,12 @@
|
|||||||
|
|
||||||
#include "stompframe.h"
|
#include "stompframe.h"
|
||||||
#include "stomp.h"
|
#include "stomp.h"
|
||||||
|
#include "app.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
QApplication application(argc, argv);
|
QApplication application(argc, argv);
|
||||||
|
|
||||||
Stomp st;
|
App app;
|
||||||
st.connectRequest("sdi.hevs.ch", 61614, "/", "sdi10", "809c02f36becb0868da98761fe3209f6");
|
|
||||||
|
|
||||||
st.sendRequest("/topic/sdi10.gem.command", "right");
|
|
||||||
|
|
||||||
st.sendRequest("/topic/sdi10.gem.command", "up");
|
|
||||||
|
|
||||||
st.sendRequest("/topic/sdi10.gem.command", "left");
|
|
||||||
|
|
||||||
st.sendRequest("/topic/sdi10.gem.command", "down");
|
|
||||||
|
|
||||||
return application.exec();
|
return application.exec();
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,11 @@ void Stomp::sendRequest(QString destination, const QByteArray& body) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Stomp::subscribeRequest(QString destination, int id) {
|
void Stomp::subscribeRequest(QString destination, int id) {
|
||||||
|
QString sid = QString::number(id);
|
||||||
|
STOMPFrame(STOMPFrame::SUBSCRIBE, {
|
||||||
|
{"destination", destination},
|
||||||
|
{"id", sid}
|
||||||
|
}).send(socket_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stomp::disconnectRequest() {
|
void Stomp::disconnectRequest() {
|
||||||
|
Reference in New Issue
Block a user