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/appmanager.h | 80 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 rockworkd/libpebble/appmanager.h (limited to 'rockworkd/libpebble/appmanager.h') diff --git a/rockworkd/libpebble/appmanager.h b/rockworkd/libpebble/appmanager.h new file mode 100644 index 0000000..4766ebc --- /dev/null +++ b/rockworkd/libpebble/appmanager.h @@ -0,0 +1,80 @@ +#ifndef APPMANAGER_H +#define APPMANAGER_H + +#include +#include +#include +#include "appinfo.h" +#include "watchconnection.h" + +class Pebble; + +class AppFetchResponse: public PebblePacket +{ +public: + enum Status { + StatusStart = 0x01, + StatusBusy = 0x02, + StatusInvalidUUID = 0x03, + StatusNoData = 0x04 + }; + AppFetchResponse(Status status = StatusNoData); + void setStatus(Status status); + + QByteArray serialize() const override; + +private: + quint8 m_command = 1; // I guess there's only one command for now + Status m_status = StatusNoData; +}; + +class AppManager : public QObject +{ + Q_OBJECT + +public: + enum Action { + ActionGetAppBankStatus = 1, + ActionRemoveApp = 2, + ActionRefreshApp = 3, + ActionGetAppBankUuids = 5 + }; + + explicit AppManager(Pebble *pebble, WatchConnection *connection); + + QList appUuids() const; + + AppInfo info(const QUuid &uuid) const; + + void insertAppInfo(const AppInfo &info); + + QUuid scanApp(const QString &path); + + void removeApp(const QUuid &uuid); + + void setAppOrder(const QList &newList); + +public slots: + void rescan(); + +private slots: + void handleAppFetchMessage(const QByteArray &data); + void sortingReply(const QByteArray &data); + +signals: + void appsChanged(); + + void uploadRequested(const QString &file, quint32 appInstallId); + + void idMismatchDetected(); + +private: + +private: + Pebble *m_pebble; + WatchConnection *m_connection; + QList m_appList; + QHash m_apps; +}; + +#endif // APPMANAGER_H -- cgit v1.2.3