blob: 81461c5a62cb39d390fab69461bf7bde12b94f92 (
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
|
#ifndef _CLIENT_H_
#define _CLIENT_H_
#include <QObject>
#include <QtCore/QTextStream>
#include <policy/resource-set.h>
using namespace ResourcePolicy;
#define RES_AUDIO_PLAYBACK (1<<0)
#define RES_VIDEO_PLAYBACK (1<<1)
#define RES_AUDIO_RECORDING (1<<2)
#define RES_VIDEO_RECORDING (1<<3)
#define RES_VIBRA (1<<4)
#define RES_LEDS (1<<5)
#define RES_BACKLIGHT (1<<6)
#define RES_SYSTEM_BUTTON (1<<7)
#define RES_LOCK_BUTTON (1<<8)
#define RES_SCALE_BUTTON (1<<9)
#define RES_SNAP_BUTTON (1<<10)
#define RES_LENS_COVER (1<<11)
class Client : public QObject
{
Q_OBJECT
public:
Client(QString appClass);
~Client();
bool initialize(uint32_t all, uint32_t optional, bool alwaysReply, bool autoRelease);
static uint32_t parseResourceList(QString resourceListStr);
private slots:
void resourceAcquiredHandler(const QList<ResourceType>& grantedResList);
void resourceDeniedHandler();
void resourceLostHandler();
void resourceReleasedHandler();
protected:
void timerEvent(QTimerEvent *e);
private:
QTextStream* standardInput;
int mainTimerID;
uint32_t resourcesAll;
uint32_t resourcesOptional;
QString applicationClass;
ResourceSet* resourceSet;
Resource* allocateResource(ResourceType resource, bool optional);
ResourceType getResourceType(uint32_t resource);
void showPrompt();
void showResources(const QList<ResourceType> resList);
void showResources(const QList<Resource*> resList);
void updateSet(uint32_t list, uint32_t optional, bool remove);
};
#endif
|