51- (id) initWithDelegate: (
id) _remoteControlDelegate {
52 if ( (
self = [super
init]) ) {
53 delegate = [_remoteControlDelegate retain];
55 NSLog(
@"Apple RemoteControl initWithDelegate ok");
66- (void) setListeningToRemote: (
BOOL) value {
68 NSLog(
@"Apple RemoteControl setListeningToRemote ok");
76- (void) startListening: (
id) sender {
78 NSLog(
@"Apple RemoteControl startListening ok");
82- (void) stopListening: (
id) sender {
84 NSLog(
@"Apple RemoteControl stopListening ok");
92- (void) setOpenInExclusiveMode: (
BOOL) value {
98 NSLog(
@"Apple RemoteControl: sending event for button identifier\n");
104+ (void) sendDistributedNotification: (NSString*) notificationName targetBundleIdentifier: (NSString*) targetIdentifier
106 NSDictionary* userInfo = [NSDictionary dictionaryWithObjectsAndKeys: [NSString stringWithCString:[
self remoteControlDeviceName] encoding:NSASCIIStringEncoding],
107 kRemoteControlDeviceName ,
108 [[NSBundle mainBundle] bundleIdentifier] ,
109 kApplicationIdentifier,
111 kTargetApplicationIdentifier ,
114 NSLog(
@"Apple Remote: sendDistributedNotification ...");
116 NSEnumerator* itKey = [userInfo keyEnumerator];
117 NSEnumerator* itVal = [userInfo objectEnumerator];
119 NSString* sKey = [itKey nextObject];
120 NSString* sVal = [itVal nextObject];
123 if( !sKey) sKey =
@"nil";
124 if( !sVal) sVal =
@"nil";
125 NSLog(
@"\tARdict[\"%@\
"] = \"%@\"",sKey,sVal);
129 [[NSDistributedNotificationCenter defaultCenter] postNotificationName:notificationName
132 deliverImmediately:YES];
135+ (void) sendFinishedNotificationForAppIdentifier: (NSString*) identifier {
136 [
self sendDistributedNotification:FINISHED_USING_REMOTE_CONTROL_NOTIFICATION targetBundleIdentifier:identifier];
138 NSLog(
@"Apple RemoteControl: sendFinishedNotificationForAppIdentifier ...");
142 [
self sendDistributedNotification:REQUEST_FOR_REMOTE_CONTROL_NOTIFICATION targetBundleIdentifier:nil];
144 NSLog(
@"Apple RemoteControl: sendRequestForRemoteControlNotification ...");
RemoteControlEventIdentifier
NSString * kRemoteControlDeviceName
NSString * kTargetApplicationIdentifier
NSString * kApplicationIdentifier
NSString * REQUEST_FOR_REMOTE_CONTROL_NOTIFICATION
NSString * FINISHED_USING_REMOTE_CONTROL_NOTIFICATION
FILE * init(int, char **)
BOOL isListeningToRemote()
BOOL isOpenInExclusiveMode()
const char * remoteControlDeviceName()
void sendRequestForRemoteControlNotification()
const wchar_t *typedef BOOL