blob: 583109dd62c16bead44e6e1d310f1962e2459b48 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#ifndef BANKMANAGER_H
#define BANKMANAGER_H
#include <QTimer>
#include <QUuid>
#include <QVector>
#include <QLoggingCategory>
class WatchConnector;
class UploadManager;
class AppManager;
class BankManager : public QObject
{
Q_OBJECT
QLoggingCategory l;
public:
struct SlotInfo {
bool used;
quint32 id;
QString name;
QString company;
quint32 flags;
quint16 version;
QUuid uuid;
};
explicit BankManager(WatchConnector *watch, UploadManager *upload, AppManager *apps, QObject *parent = 0);
int numSlots() const;
bool isUsed(int slot) const;
QUuid appAt(int slot) const;
signals:
void slotsChanged();
public slots:
bool uploadApp(const QUuid &uuid, int slot = -1);
bool unloadApp(int slot);
void refresh();
private:
int findUnusedSlot() const;
void refreshWatchApp(int slot, std::function<void()> successCallback, std::function<void(int)> errorCallback);
private slots:
void handleWatchConnected();
private:
WatchConnector *watch;
UploadManager *upload;
AppManager *apps;
enum ResultCodes {
Success = 1,
BankInUse = 2,
InvalidCommand = 3,
GeneralFailure = 4
};
QVector<SlotInfo> _slots;
QTimer *_refresh;
};
#endif // BANKMANAGER_H
|