diff options
| -rw-r--r-- | DomeKey/AppDelegate.h | 3 | ||||
| -rw-r--r-- | DomeKey/AppDelegate.m | 24 | ||||
| -rw-r--r-- | DomeKey/HeadphoneKey.h | 1 | ||||
| -rw-r--r-- | DomeKey/HeadphoneKey.m | 21 | 
4 files changed, 28 insertions, 21 deletions
| diff --git a/DomeKey/AppDelegate.h b/DomeKey/AppDelegate.h index 6b1d9a4..b343d6c 100644 --- a/DomeKey/AppDelegate.h +++ b/DomeKey/AppDelegate.h @@ -11,6 +11,9 @@  @interface AppDelegate : NSObject <NSApplicationDelegate> {      HeadphoneKey *_headphone_key; +    MPRemoteCommandCenter *_blargh;  } +- (void)mpmediaplayerBS; +  @end diff --git a/DomeKey/AppDelegate.m b/DomeKey/AppDelegate.m index fab5171..32bbd47 100644 --- a/DomeKey/AppDelegate.m +++ b/DomeKey/AppDelegate.m @@ -14,7 +14,29 @@  {      _headphone_key = [[HeadphoneKey alloc] init];      [_headphone_key startMonitoringBluetoothEvents]; -    [_headphone_key mpmediaplayerBS]; + +    _blargh = [MPRemoteCommandCenter sharedCommandCenter]; + +    [[_blargh togglePlayPauseCommand] addTarget:self action:@selector(mpmediaplayerplaypauesss:)]; +} + +- (void)mpmediaplayerBS +{ +    MPRemoteCommandCenter *center = [MPRemoteCommandCenter sharedCommandCenter]; + +    [[center togglePlayPauseCommand] addTarget:self action:@selector(mpmediaplayerplaypauesss:)]; +// pauseCommand +// playCommand +// togglePlayPauseCommand +// nextTrackCommand +// previousTrackCommand +} + +- (MPRemoteCommandHandlerStatus) mpmediaplayerplaypauesss: (MPRemoteCommandEvent*) event +{ +    NSLog(@"Played from MPMediaPlayer"); + +    return MPRemoteCommandHandlerStatusSuccess;  }  @end diff --git a/DomeKey/HeadphoneKey.h b/DomeKey/HeadphoneKey.h index 61c4864..4f048e0 100644 --- a/DomeKey/HeadphoneKey.h +++ b/DomeKey/HeadphoneKey.h @@ -31,6 +31,5 @@ static const unsigned int TIMEOUT_MILLISECONDS = 1000;  - (void)handleDeadKey:(HeadphoneButton)button;  - (void)runAction;  - (void)startMonitoringBluetoothEvents; -- (void)mpmediaplayerBS;  @end diff --git a/DomeKey/HeadphoneKey.m b/DomeKey/HeadphoneKey.m index e1588eb..e5ea7b0 100644 --- a/DomeKey/HeadphoneKey.m +++ b/DomeKey/HeadphoneKey.m @@ -67,6 +67,8 @@              int key_flags = ([theEvent data1] & 0x0000FFFF);              int key_state = (((key_flags & 0xFF00) >> 8)) == 0xA; +            NSLog(@"Key from global monitor pressed"); +              // TODO: Fix magic numbers              if (key_code == 10 && key_flags == 6972) {                  switch ([theEvent data2]) { @@ -96,25 +98,6 @@          }];  } -- (void)mpmediaplayerBS -{ -    MPRemoteCommandCenter *center = [MPRemoteCommandCenter sharedCommandCenter]; - -    [[center togglePlayPauseCommand] addTarget:self action:@selector(mpmediaplayerplaypauesss:)]; -// pauseCommand -// playCommand -// togglePlayPauseCommand -// nextTrackCommand -// previousTrackCommand -} - -- (MPRemoteCommandHandlerStatus) mpmediaplayerplaypauesss: (MPRemoteCommandEvent*) event -{ -    NSLog(@"Played from MPMediaPlayer"); - -    return MPRemoteCommandHandlerStatusSuccess; -} -  - (void)handleDeadKey:(HeadphoneButton)button  {      NSNumber *storable_button = [NSNumber numberWithUnsignedInteger:button]; | 
