summaryrefslogtreecommitdiff
path: root/rockworkd/libpebble/screenshotendpoint.h
diff options
context:
space:
mode:
Diffstat (limited to 'rockworkd/libpebble/screenshotendpoint.h')
-rw-r--r--rockworkd/libpebble/screenshotendpoint.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/rockworkd/libpebble/screenshotendpoint.h b/rockworkd/libpebble/screenshotendpoint.h
new file mode 100644
index 0000000..cca6cfd
--- /dev/null
+++ b/rockworkd/libpebble/screenshotendpoint.h
@@ -0,0 +1,52 @@
+#ifndef SCREENSHOTENDPOINT_H
+#define SCREENSHOTENDPOINT_H
+
+#include <QObject>
+
+#include "watchconnection.h"
+class Pebble;
+
+class ScreenshotRequestPackage: public PebblePacket
+{
+public:
+ QByteArray serialize() const override;
+private:
+ quint8 m_command = 0x00;
+};
+
+class ScreenshotEndpoint : public QObject
+{
+ Q_OBJECT
+public:
+ enum ResponseCode {
+ ResponseCodeOK = 0,
+ ResponseCodeMalformedCommand = 1,
+ ResponseCodeOutOfMemory = 2,
+ ResponseCodeAlreadyInProgress = 3
+ };
+
+ explicit ScreenshotEndpoint(Pebble *pebble, WatchConnection *connection, QObject *parent = 0);
+
+ void requestScreenshot();
+ void removeScreenshot(const QString &filename);
+
+ QStringList screenshots() const;
+
+signals:
+ void screenshotAdded(const QString &filename);
+ void screenshotRemoved(const QString &filename);
+
+private slots:
+ void handleScreenshotData(const QByteArray &data);
+
+private:
+ Pebble *m_pebble;
+ WatchConnection *m_connection;
+ quint32 m_waitingForMore = 0;
+ quint32 m_version = 0;
+ quint32 m_width = 0;
+ quint32 m_height = 0;
+ QByteArray m_accumulatedData;
+};
+
+#endif // SCREENSHOTENDPOINT_H