-
Notifications
You must be signed in to change notification settings - Fork 12
/
manager.h
51 lines (39 loc) · 935 Bytes
/
manager.h
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
#ifndef __MANAGER_H__
#define __MANAGER_H__
#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
#include "device.h"
class Manager
{
public:
enum {
S_UNKNOWN = 0x00,
S_RUN_ONCE = 0x01,
S_RUN_LOOP = 0x02
};
public:
static Manager * getInstance();
int parse(int argc, char *argv[]);
void run();
void connectDevice(struct am_device *amdevice);
void disConnectDevice(struct am_device *amdevice);
bool isActive();
bool isRunLoop();
void release();
private:
Manager();
Device * getDevice(struct am_device *amdevice, bool bcreate = false);
static void timeoutCallback(CFRunLoopTimerRef timer, void *arg);
static void deviceCallback(struct am_device_notification_callback_info *info, void *arg);
private:
static Manager *_inst;
CFMutableDictionaryRef _devices;
int _state;
private:
char *_device_id;
int _cmd;
char *_arg1;
char *_arg2;
char *_option;
};
#endif //__MANAGER_H__