diff options
author | Javier <dev.git@javispedro.com> | 2016-01-01 22:05:42 +0100 |
---|---|---|
committer | Javier <dev.git@javispedro.com> | 2016-01-01 22:05:42 +0100 |
commit | a45977185a485624095bff1a15024e9199eee676 (patch) | |
tree | 6cc57d085bdd01e493477c870dbe0548137998e1 /agents/notificationconn.h | |
parent | a24034bdfea259cdc09c74217be75d4f9de0dce5 (diff) | |
download | sapd-a45977185a485624095bff1a15024e9199eee676.tar.gz sapd-a45977185a485624095bff1a15024e9199eee676.zip |
reorganize source files into SAP and agents
Diffstat (limited to 'agents/notificationconn.h')
-rw-r--r-- | agents/notificationconn.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/agents/notificationconn.h b/agents/notificationconn.h new file mode 100644 index 0000000..092804a --- /dev/null +++ b/agents/notificationconn.h @@ -0,0 +1,86 @@ +#ifndef NOTIFICATIONCONN_H +#define NOTIFICATIONCONN_H + +#include <QtCore/QObject> +#include <QtCore/QDateTime> +#include <QtCore/QHash> +#include "sapconnection.h" +#include "sapsocket.h" + +#if SAILFISH +namespace watchfish +{ +class Notification; +class NotificationMonitor; +} +#endif + +class NotificationConn : public QObject +{ + Q_OBJECT + +public: + NotificationConn(SAPConnection *conn, QObject *parent = 0); + +protected: + enum NotificationType { + NotificationPopup = 0 + }; + + enum NotificationAttributeType { + NotificationPackageName = 0, + NotificationCount = 1, + NotificationTitle = 2, + NotificationTime = 3, + NotificationSender = 4, + NotificationBody = 5, + NotificationThumbnail = 6, + NotificationApplicationName = 7, + NotificationOpenInWatch = 9, + NotificationOpenInHost = 10, + NotificationId = 11 + }; + + struct Notification { + Notification(); + + NotificationType type; + int sequenceNumber; + bool urgent; + int applicationId; + int category; + QString packageName; + int count; + QString title; + QDateTime time; + int sender; + QString body; + QByteArray thumbnail; + QString applicationName; + //bool openInWatch; + //bool openInHost; + int notificationId; + }; + + QByteArray packNotification(const Notification &n); + void sendNotification(const Notification &n); + +private slots: + void handleConnected(); + void handleMessageReceived(); + +#if SAILFISH + void handleNotification(watchfish::Notification *n); +#endif + + void performTest(); + +private: + SAPConnection *_conn; + SAPSocket *_socket; + QHash<QString, short> _knownSenders; + int _lastSeqNumber; + int _lastNotifId; +}; + +#endif // NOTIFICATIONCONN_H |