From 29aaea2d80a9eb1715b6cddfac2d2aacf76358bd Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Thu, 11 Feb 2016 23:55:16 +0100 Subject: launchpad ~mzanetti/rockwork/trunk r87 --- rockworkd/libpebble/screenshotendpoint.h | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 rockworkd/libpebble/screenshotendpoint.h (limited to 'rockworkd/libpebble/screenshotendpoint.h') 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 + +#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 -- cgit v1.2.3