diff options
Diffstat (limited to 'rockworkd/libpebble/notificationendpoint.h')
| -rw-r--r-- | rockworkd/libpebble/notificationendpoint.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/rockworkd/libpebble/notificationendpoint.h b/rockworkd/libpebble/notificationendpoint.h new file mode 100644 index 0000000..211c8cd --- /dev/null +++ b/rockworkd/libpebble/notificationendpoint.h @@ -0,0 +1,64 @@ +#include <QObject> +#include <QUuid> +#include <QDateTime> + +#include "pebble.h" +#include "watchconnection.h" + +class LegacyNotification: public PebblePacket +{ +// class Meta: +// endpoint = 3000 +// endianness = '<' +public: + enum Source { + SourceEmail = 0, + SourceSMS = 1, + SourceFacebook = 2, + SourceTwitter = 3 + }; + + LegacyNotification(Source source, const QString &sender, const QString &body, const QDateTime ×tamp, const QString &subject): + PebblePacket(), + m_source(source), + m_sender(sender), + m_body(body), + m_timestamp(timestamp), + m_subject(subject) + {} + + QByteArray serialize() const override + { + QByteArray ret; + ret.append((quint8)m_source); + ret.append(packString(m_sender)); + ret.append(packString(m_body)); + ret.append(packString(QString::number(m_timestamp.toMSecsSinceEpoch()))); + ret.append(packString(m_subject)); + return ret; + } + +private: + + Source m_source; // uint8 + QString m_sender; + QString m_body; + QDateTime m_timestamp; + QString m_subject; +}; + +class NotificationEndpoint: public QObject +{ + Q_OBJECT +public: + NotificationEndpoint(Pebble *pebble, WatchConnection *watchConnection); + + void sendLegacyNotification(const Notification ¬ification); + +private slots: + void notificationReply(const QByteArray &data); + +private: + Pebble *m_pebble; + WatchConnection *m_watchConnection; +}; |
