forked from robbiehanson/AlarmClock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppleRemote.h
70 lines (57 loc) · 1.49 KB
/
AppleRemote.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// AppleRemote.h
// AppleRemote
//
// Created by Martin Kahr on 11.03.06.
// Copyright 2006 martinkahr.com. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <mach/mach.h>
#import <mach/mach_error.h>
#import <IOKit/IOKitLib.h>
#import <IOKit/IOCFPlugIn.h>
#import <IOKit/hid/IOHIDLib.h>
#import <IOKit/hid/IOHIDKeys.h>
#define AppleRemoteDeviceName "AppleIRController"
#define NUMBER_OF_APPLE_REMOTE_ACTIONS 9
enum AppleRemoteCookieIdentifier
{
kRemoteButtonVolume_Plus=0,
kRemoteButtonVolume_Minus,
kRemoteButtonMenu,
kRemoteButtonPlay,
kRemoteButtonRight,
kRemoteButtonLeft,
kRemoteButtonRight_Hold,
kRemoteButtonLeft_Hold,
kRemoteButtonPlay_Sleep
};
typedef enum AppleRemoteCookieIdentifier AppleRemoteCookieIdentifier;
/**
Encapsulates usage of the apple remote control.
The class is not thread safe.
**/
@interface AppleRemote : NSObject
{
IOHIDDeviceInterface** hidDeviceInterface;
IOHIDQueueInterface** queue;
IOHIDElementCookie* cookies;
BOOL openInExclusiveMode;
id delegate;
}
+ (AppleRemote *)sharedRemote;
- (BOOL)isRemoteAvailable;
- (BOOL)isOpenInExclusiveMode;
- (void)setOpenInExclusiveMode:(BOOL)value;
- (void)setDelegate:(id)delegate;
- (id)delegate;
- (BOOL)isListeningToRemote;
- (void)startListening;
- (void)stopListening;
@end
/**
Method definitions for the delegate of the AppleRemote class
**/
@interface NSObject(AppleRemoteDelegate)
- (void)appleRemoteButton:(AppleRemoteCookieIdentifier)buttonIdentifier pressedDown:(BOOL)pressedDown;
@end