aboutsummaryrefslogtreecommitdiff
path: root/tools/EventClients
diff options
context:
space:
mode:
Diffstat (limited to 'tools/EventClients')
-rwxr-xr-xtools/EventClients/Clients/KodiSend/kodi-send.py6
-rw-r--r--tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.h44
-rw-r--r--tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.m370
-rw-r--r--tools/EventClients/Clients/OSXRemote/XBMCDebugHelpers.h8
-rw-r--r--tools/EventClients/Clients/OSXRemote/XBMCHelper.h2
-rw-r--r--tools/EventClients/Clients/OSXRemote/XBMCHelper.m8
-rw-r--r--tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.h4
-rw-r--r--tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.mm82
-rw-r--r--tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm52
-rwxr-xr-xtools/EventClients/Clients/PS3SixaxisController/ps3d.py2
-rw-r--r--tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp58
-rw-r--r--tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.h28
-rw-r--r--tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.cpp16
-rw-r--r--tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.h6
-rw-r--r--tools/EventClients/Clients/WiiRemote/wiiuse_v0.12/LICENSE_noncommercial4
-rw-r--r--tools/EventClients/Clients/Xbox360Controller/Xbox360EventClient.cpp2
-rw-r--r--tools/EventClients/Clients/Xbox360Controller/targetver.h4
-rw-r--r--tools/EventClients/examples/java/XBMCDemoClient1.java16
-rwxr-xr-xtools/EventClients/examples/python/example_action.py4
-rwxr-xr-xtools/EventClients/examples/python/example_button2.py2
-rwxr-xr-xtools/EventClients/examples/python/example_notification.py10
-rwxr-xr-xtools/EventClients/examples/python/example_simple.py2
-rw-r--r--tools/EventClients/lib/c++/xbmcclient.h10
-rw-r--r--tools/EventClients/lib/java/src/org/xbmc/eventclient/Packet.java48
-rw-r--r--tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketACTION.java8
-rw-r--r--tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBUTTON.java34
-rw-r--r--tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBYE.java4
-rw-r--r--tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketHELO.java8
-rw-r--r--tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketLOG.java4
-rw-r--r--tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketMOUSE.java4
-rw-r--r--tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketNOTIFICATION.java6
-rw-r--r--tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketPING.java2
-rw-r--r--tools/EventClients/lib/java/src/org/xbmc/eventclient/XBMCClient.java66
-rw-r--r--tools/EventClients/lib/python/ps3/sixaxis.py22
-rwxr-xr-xtools/EventClients/lib/python/ps3/sixpair.py4
35 files changed, 475 insertions, 475 deletions
diff --git a/tools/EventClients/Clients/KodiSend/kodi-send.py b/tools/EventClients/Clients/KodiSend/kodi-send.py
index 2eebc556b7..d5c00a112f 100755
--- a/tools/EventClients/Clients/KodiSend/kodi-send.py
+++ b/tools/EventClients/Clients/KodiSend/kodi-send.py
@@ -80,14 +80,14 @@ def main():
actions.append({'type': TYPE_DELAY, 'content': int(a)})
else:
assert False, "unhandled option"
-
+
addr = (ip, port)
sock = socket(AF_INET,SOCK_DGRAM)
-
+
if len(actions) is 0:
usage()
sys.exit(0)
-
+
for action in actions:
print('Sending: %s' % action)
if action['type'] == TYPE_ACTION:
diff --git a/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.h b/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.h
index 8a847aeae3..5c3aed373e 100644
--- a/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.h
+++ b/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.h
@@ -12,21 +12,21 @@
//
// Copyright (c) 2007-2014 IOSPIRIT GmbH (http://www.iospirit.com/)
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
-//
+//
// * Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
-//
+//
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
-//
+//
// * Neither the name of IOSPIRIT GmbH nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior
// written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
@@ -178,7 +178,7 @@ typedef enum
newID:(SInt32)newID
forHardwareWithAttributes:(NSMutableDictionary *)attributes;
-// Notification about hardware additions/removals
+// Notification about hardware additions/removals
- (void)hidRemote:(HIDRemote *)hidRemote // Invoked when new hardware was found / added to HIDRemote's pool
foundNewHardwareWithAttributes:(NSMutableDictionary *)attributes;
@@ -192,7 +192,7 @@ typedef enum
// Matching of newly found receiver hardware
- (BOOL)hidRemote:(HIDRemote *)hidRemote // Invoked when new hardware is inspected
- inspectNewHardwareWithService:(io_service_t)service //
+ inspectNewHardwareWithService:(io_service_t)service //
prematchResult:(BOOL)prematchResult; // Return YES if HIDRemote should go on with this hardware and try
// to use it, or NO if it should not be pursued further.
@@ -206,7 +206,7 @@ typedef enum
- (BOOL)hidRemote:(HIDRemote *)hidRemote
shouldRetryExclusiveLockWithInfo:(NSDictionary *)applicationInfo;
-@end
+@end
#pragma mark -- Actual header file for class --
@@ -219,56 +219,56 @@ typedef enum
// Notification ports
IONotificationPortRef _notifyPort;
CFRunLoopSourceRef _notifyRLSource;
-
+
// Matching iterator
io_iterator_t _matchingServicesIterator;
-
+
// SecureInput notification
io_object_t _secureInputNotification;
-
+
// Service attributes
NSMutableDictionary *_serviceAttribMap;
-
+
// Mode
HIDRemoteMode _mode;
BOOL _autoRecover;
NSTimer *_autoRecoveryTimer;
-
+
// Delegate
NSObject <HIDRemoteDelegate> *_delegate;
-
+
// Last seen ID and remote model
SInt32 _lastSeenRemoteID;
HIDRemoteModel _lastSeenModel;
SInt32 _lastSeenModelRemoteID;
-
+
// Unused button codes
NSArray *_unusedButtonCodes;
-
+
// Simulate Plus/Minus Hold
BOOL _simulateHoldEvents;
-
+
// SecureEventInput workaround
BOOL _secureEventInputWorkAround;
UInt64 _lastSecureEventInputPIDSum;
uid_t _lastFrontUserSession;
BOOL _lastScreenIsLocked;
-
+
// Exclusive lock lending
BOOL _exclusiveLockLending;
BOOL _sendExclusiveResourceReuseNotification;
NSNumber *_waitForReturnByPID;
NSNumber *_returnToPID;
BOOL _isRestarting;
-
+
// Status notifications
BOOL _sendStatusNotifications;
NSString *_pidString;
-
+
// Status
BOOL _applicationIsTerminating;
BOOL _isStopping;
-
+
// Thread safety
#ifdef HIDREMOTE_THREADSAFETY_HARDENED_NOTIFICATION_HANDLING /* #define HIDREMOTE_THREADSAFETY_HARDENED_NOTIFICATION_HANDLING if you're running your HIDRemote instance on a background thread (requires OS X 10.5 or later) */
NSThread *_runOnThread;
@@ -285,7 +285,7 @@ typedef enum
- (HIDRemoteAluminumRemoteSupportLevel)aluminiumRemoteSystemSupportLevel;
#pragma mark -- PUBLIC: Interface / API --
-- (BOOL)startRemoteControl:(HIDRemoteMode)hidRemoteMode;
+- (BOOL)startRemoteControl:(HIDRemoteMode)hidRemoteMode;
- (void)stopRemoteControl;
- (BOOL)isStarted;
diff --git a/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.m b/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.m
index b916210fe4..216c3adf6c 100644
--- a/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.m
+++ b/tools/EventClients/Clients/OSXRemote/HIDRemote/HIDRemote.m
@@ -12,21 +12,21 @@
//
// Copyright (c) 2007-2014 IOSPIRIT GmbH (http://www.iospirit.com/)
// All rights reserved.
-//
+//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
-//
+//
// * Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
-//
+//
// * Redistributions in binary form must reproduce the above copyright notice, this
// list of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
-//
+//
// * Neither the name of IOSPIRIT GmbH nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior
// written permission.
-//
+//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
@@ -52,7 +52,7 @@
#import "HIDRemote.h"
// Callback Prototypes
-static void HIDEventCallback( void * target,
+static void HIDEventCallback( void * target,
IOReturn result,
void * refcon,
void * sender);
@@ -83,7 +83,7 @@ static HIDRemote *sHIDRemote = nil;
{
sHIDRemote = [[HIDRemote alloc] init];
}
-
+
return (sHIDRemote);
}
@@ -94,7 +94,7 @@ static HIDRemote *sHIDRemote = nil;
#ifdef HIDREMOTE_THREADSAFETY_HARDENED_NOTIFICATION_HANDLING
_runOnThread = [[NSThread currentThread] retain];
#endif
-
+
// Detect application becoming active/inactive
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_appStatusChanged:) name:NSApplicationDidBecomeActiveNotification object:[NSApplication sharedApplication]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_appStatusChanged:) name:NSApplicationWillResignActiveNotification object:[NSApplication sharedApplication]];
@@ -102,18 +102,18 @@ static HIDRemote *sHIDRemote = nil;
// Handle distributed notifications
_pidString = [[NSString alloc] initWithFormat:@"%d", getpid()];
-
+
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleNotifications:) name:kHIDRemoteDNHIDRemotePing object:nil];
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleNotifications:) name:kHIDRemoteDNHIDRemoteRetry object:kHIDRemoteDNHIDRemoteRetryGlobalObject];
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleNotifications:) name:kHIDRemoteDNHIDRemoteRetry object:_pidString];
// Enabled by default: simulate hold events for plus/minus
_simulateHoldEvents = YES;
-
+
// Enabled by default: work around for a locking issue introduced with Security Update 2008-004 / 10.4.9 and beyond (credit for finding this workaround goes to Martin Kahr)
_secureEventInputWorkAround = YES;
_secureInputNotification = 0;
-
+
// Initialize instance variables
_lastSeenRemoteID = -1;
_lastSeenModel = kHIDRemoteModelUndetermined;
@@ -121,7 +121,7 @@ static HIDRemote *sHIDRemote = nil;
_exclusiveLockLending = NO;
_sendExclusiveResourceReuseNotification = YES;
_applicationIsTerminating = NO;
-
+
// Send status notifications
_sendStatusNotifications = YES;
}
@@ -139,7 +139,7 @@ static HIDRemote *sHIDRemote = nil;
[[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kHIDRemoteDNHIDRemoteRetry object:kHIDRemoteDNHIDRemoteRetryGlobalObject];
[[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kHIDRemoteDNHIDRemoteRetry object:_pidString];
[[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:nil object:nil]; /* As demanded by the documentation for -[NSDistributedNotificationCenter removeObserver:name:object:] */
-
+
[self stopRemoteControl];
[self setExclusiveLockLendingEnabled:NO];
@@ -205,14 +205,14 @@ static HIDRemote *sHIDRemote = nil;
return (YES);
}
break;
-
+
default:
return (NO);
break;
}
break;
}
-
+
return (NO);
}
@@ -228,7 +228,7 @@ static HIDRemote *sHIDRemote = nil;
NSOperatingSystemVersion osVersion;
osVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
-
+
sHRGestaltOSXVersion = (SInt32)(0x01000 | ((osVersion.majorVersion-10)<<8) | (osVersion.minorVersion<<4) | osVersion.patchVersion);
#else
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_9
@@ -238,7 +238,7 @@ static HIDRemote *sHIDRemote = nil;
if ([[NSProcessInfo processInfo] respondsToSelector:@selector(operatingSystemVersion)])
{
osVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
-
+
sHRGestaltOSXVersion = (SInt32)(0x01000 | ((osVersion.majorVersion-10)<<8) | (osVersion.minorVersion<<4) | osVersion.patchVersion);
}
else
@@ -257,7 +257,7 @@ static HIDRemote *sHIDRemote = nil;
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_9 */
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9 */
}
-
+
return (sHRGestaltOSXVersion);
}
@@ -266,13 +266,13 @@ static HIDRemote *sHIDRemote = nil;
HIDRemoteAluminumRemoteSupportLevel supportLevel = kHIDRemoteAluminumRemoteSupportLevelNone;
NSEnumerator *attribDictsEnum;
NSDictionary *hidAttribsDict;
-
+
attribDictsEnum = [_serviceAttribMap objectEnumerator];
-
+
while ((hidAttribsDict = [attribDictsEnum nextObject]) != nil)
{
NSNumber *deviceSupportLevel;
-
+
if ((deviceSupportLevel = [hidAttribsDict objectForKey:kHIDRemoteAluminumRemoteSupportLevel]) != nil)
{
if ([deviceSupportLevel intValue] > (int)supportLevel)
@@ -281,7 +281,7 @@ static HIDRemote *sHIDRemote = nil;
}
}
}
-
+
return (supportLevel);
}
@@ -293,16 +293,16 @@ static HIDRemote *sHIDRemote = nil;
kern_return_t kernReturn;
CFMutableDictionaryRef matchDict=NULL;
io_service_t rootService;
-
+
do
{
// Get IOKit master port
kernReturn = IOMasterPort(bootstrap_port, &_masterPort);
if ((kernReturn!=kIOReturnSuccess) || (_masterPort==0)) { break; }
-
+
// Setup notification port
_notifyPort = IONotificationPortCreate(_masterPort);
-
+
if ((_notifyRLSource = IONotificationPortGetRunLoopSource(_notifyPort)) != NULL)
{
CFRunLoopAddSource( CFRunLoopGetCurrent(),
@@ -313,7 +313,7 @@ static HIDRemote *sHIDRemote = nil;
{
break;
}
-
+
// Setup SecureInput notification
if ((hidRemoteMode == kHIDRemoteModeExclusive) || (hidRemoteMode == kHIDRemoteModeExclusiveAuto))
{
@@ -326,7 +326,7 @@ static HIDRemote *sHIDRemote = nil;
(void *)self,
&_secureInputNotification);
if (kernReturn != kIOReturnSuccess) { break; }
-
+
[self _updateSessionInformation];
}
else
@@ -348,35 +348,35 @@ static HIDRemote *sHIDRemote = nil;
&_matchingServicesIterator);
if (kernReturn != kIOReturnSuccess) { break; }
- // Setup serviceAttribMap
+ // Setup serviceAttribMap
_serviceAttribMap = [[NSMutableDictionary alloc] init];
if (_serviceAttribMap==nil) { break; }
-
+
// Phew .. everything went well!
_mode = hidRemoteMode;
CFRelease(matchDict);
-
+
[self _serviceMatching:_matchingServicesIterator];
-
+
[self _postStatusWithAction:kHIDRemoteDNStatusActionStart];
-
+
// Register for system wake notifications
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(_computerDidWake:) name:NSWorkspaceDidWakeNotification object:nil];
-
+
return (YES);
}while(0);
-
+
// An error occured. Do necessary clean up.
if (matchDict!=NULL)
{
CFRelease(matchDict);
matchDict = NULL;
}
-
+
[self stopRemoteControl];
}
-
+
return (NO);
}
@@ -397,22 +397,22 @@ static HIDRemote *sHIDRemote = nil;
if (_serviceAttribMap!=nil)
{
NSDictionary *cloneDict = [[NSDictionary alloc] initWithDictionary:_serviceAttribMap];
-
+
if (cloneDict!=nil)
{
NSEnumerator *mapKeyEnum = [cloneDict keyEnumerator];
NSNumber *serviceValue;
-
+
while ((serviceValue = [mapKeyEnum nextObject]) != nil)
{
[self _destructService:(io_object_t)[serviceValue unsignedIntValue]];
serviceCount++;
};
-
+
[cloneDict release];
cloneDict = nil;
}
-
+
[_serviceAttribMap release];
_serviceAttribMap = nil;
}
@@ -422,7 +422,7 @@ static HIDRemote *sHIDRemote = nil;
IOObjectRelease((io_object_t) _matchingServicesIterator);
_matchingServicesIterator = 0;
}
-
+
if (_secureInputNotification!=0)
{
IOObjectRelease((io_object_t) _secureInputNotification);
@@ -464,7 +464,7 @@ static HIDRemote *sHIDRemote = nil;
if (((_mode==kHIDRemoteModeExclusive) || (_mode==kHIDRemoteModeExclusiveAuto)) && (_sendExclusiveResourceReuseNotification==YES) && (_exclusiveLockLending==NO) && (serviceCount>0))
{
_mode = kHIDRemoteModeNone;
-
+
if (!_isRestarting)
{
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:kHIDRemoteDNHIDRemoteRetry
@@ -481,7 +481,7 @@ static HIDRemote *sHIDRemote = nil;
// Unregister from system wake notifications
[[[NSWorkspace sharedWorkspace] notificationCenter] removeObserver:self name:NSWorkspaceDidWakeNotification object:nil];
}
-
+
_mode = kHIDRemoteModeNone;
_isStopping = NO;
}
@@ -535,7 +535,7 @@ static HIDRemote *sHIDRemote = nil;
{
[newArrayWithUnusedButtonCodesAsNSNumbers retain];
[_unusedButtonCodes release];
-
+
_unusedButtonCodes = newArrayWithUnusedButtonCodesAsNSNumbers;
[self _postStatusWithAction:kHIDRemoteDNStatusActionUpdate];
@@ -567,7 +567,7 @@ static HIDRemote *sHIDRemote = nil;
if (newExclusiveLockLendingEnabled != _exclusiveLockLending)
{
_exclusiveLockLending = newExclusiveLockLendingEnabled;
-
+
if (_exclusiveLockLending)
{
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(_handleNotifications:) name:kHIDRemoteDNHIDRemoteStatus object:nil];
@@ -575,7 +575,7 @@ static HIDRemote *sHIDRemote = nil;
else
{
[[NSDistributedNotificationCenter defaultCenter] removeObserver:self name:kHIDRemoteDNHIDRemoteStatus object:nil];
-
+
[_waitForReturnByPID release];
_waitForReturnByPID = nil;
}
@@ -622,7 +622,7 @@ static HIDRemote *sHIDRemote = nil;
return;
}
}
-
+
if ([[notification name] isEqual:NSApplicationWillResignActiveNotification])
{
if (_mode != kHIDRemoteModeExclusiveAuto)
@@ -630,7 +630,7 @@ static HIDRemote *sHIDRemote = nil;
return;
}
}
-
+
[self performSelector:@selector(_appStatusChanged:) onThread:_runOnThread withObject:notification waitUntilDone:[[notification name] isEqual:NSApplicationWillTerminateNotification]];
return;
}
@@ -669,11 +669,11 @@ static HIDRemote *sHIDRemote = nil;
_autoRecover = YES;
}
}
-
+
if ([[notification name] isEqual:NSApplicationWillTerminateNotification])
{
_applicationIsTerminating = YES;
-
+
if ([self isStarted])
{
[self stopRemoteControl];
@@ -745,7 +745,7 @@ static HIDRemote *sHIDRemote = nil;
if ([self isStarted])
{
BOOL retry = YES;
-
+
// Ignore our own global retry broadcasts
if ([[notification object] isEqual:kHIDRemoteDNHIDRemoteRetryGlobalObject])
{
@@ -759,7 +759,7 @@ static HIDRemote *sHIDRemote = nil;
}
}
}
-
+
if (retry)
{
if (([self delegate] != nil) &&
@@ -768,22 +768,22 @@ static HIDRemote *sHIDRemote = nil;
retry = [[self delegate] hidRemote:self shouldRetryExclusiveLockWithInfo:[notification userInfo]];
}
}
-
+
if (retry)
{
HIDRemoteMode restartInMode = _mode;
-
+
if (restartInMode != kHIDRemoteModeNone)
{
_isRestarting = YES;
[self stopRemoteControl];
-
+
[_returnToPID release];
_returnToPID = nil;
-
+
[self startRemoteControl:restartInMode];
_isRestarting = NO;
-
+
if (restartInMode != kHIDRemoteModeShared)
{
_returnToPID = [[[notification userInfo] objectForKey:kHIDRemoteDNStatusPIDKey] retain];
@@ -797,18 +797,18 @@ static HIDRemote *sHIDRemote = nil;
_returnToPID = [[[notification userInfo] objectForKey:kHIDRemoteDNStatusPIDKey] retain];
[self _postStatusWithAction:kHIDRemoteDNStatusActionNoNeed];
[_returnToPID release];
-
+
_returnToPID = cacheReturnPID;
}
}
}
-
+
if (_exclusiveLockLending)
{
if ([notificationName isEqual:kHIDRemoteDNHIDRemoteStatus])
{
NSString *action;
-
+
if ((action = [[notification userInfo] objectForKey:kHIDRemoteDNStatusActionKey]) != nil)
{
if ((_mode == kHIDRemoteModeNone) && (_waitForReturnByPID!=nil))
@@ -818,13 +818,13 @@ static HIDRemote *sHIDRemote = nil;
if ((pidNumber = [[notification userInfo] objectForKey:kHIDRemoteDNStatusPIDKey]) != nil)
{
returnToPIDNumber = [[notification userInfo] objectForKey:kHIDRemoteDNStatusReturnToPIDKey];
-
+
if ([action isEqual:kHIDRemoteDNStatusActionStart])
{
if ([pidNumber isEqual:_waitForReturnByPID])
{
NSNumber *startMode;
-
+
if ((startMode = [[notification userInfo] objectForKey:kHIDRemoteDNStatusModeKey]) != nil)
{
if ([startMode intValue] == kHIDRemoteModeShared)
@@ -844,7 +844,7 @@ static HIDRemote *sHIDRemote = nil;
{
[_waitForReturnByPID release];
_waitForReturnByPID = nil;
-
+
if (([self delegate] != nil) &&
([[self delegate] respondsToSelector:@selector(hidRemote:exclusiveLockReleasedByApplicationWithInfo:)]))
{
@@ -866,7 +866,7 @@ static HIDRemote *sHIDRemote = nil;
{
NSNumber *originPID = [[notification userInfo] objectForKey:kHIDRemoteDNStatusPIDKey];
BOOL lendLock = YES;
-
+
if ([originPID intValue] != getpid())
{
if (([self delegate] != nil) &&
@@ -874,16 +874,16 @@ static HIDRemote *sHIDRemote = nil;
{
lendLock = [[self delegate] hidRemote:self lendExclusiveLockToApplicationWithInfo:[notification userInfo]];
}
-
+
if (lendLock)
{
[_waitForReturnByPID release];
_waitForReturnByPID = [originPID retain];
-
+
if (_waitForReturnByPID != nil)
{
[self stopRemoteControl];
-
+
[[NSDistributedNotificationCenter defaultCenter] postNotificationName:kHIDRemoteDNHIDRemoteRetry
object:[NSString stringWithFormat:@"%d", [_waitForReturnByPID intValue]]
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
@@ -918,7 +918,7 @@ static HIDRemote *sHIDRemote = nil;
BOOL serviceMatches = NO;
NSString *ioClass;
NSNumber *candelairHIDRemoteCompatibilityMask;
-
+
if (service != 0)
{
// IOClass matching
@@ -933,14 +933,14 @@ static HIDRemote *sHIDRemote = nil;
CFTypeRef candelairHIDRemoteCompatibilityDevice;
serviceMatches = YES;
-
+
if ((candelairHIDRemoteCompatibilityDevice = IORegistryEntryCreateCFProperty((io_registry_entry_t)service, CFSTR("CandelairHIDRemoteCompatibilityDevice"), kCFAllocatorDefault, 0)) != NULL)
{
if (CFEqual(kCFBooleanTrue, candelairHIDRemoteCompatibilityDevice))
{
serviceMatches = NO;
}
-
+
CFRelease (candelairHIDRemoteCompatibilityDevice);
}
}
@@ -950,7 +950,7 @@ static HIDRemote *sHIDRemote = nil;
{
serviceMatches = YES;
}
-
+
CFRelease((CFTypeRef)ioClass);
}
@@ -968,7 +968,7 @@ static HIDRemote *sHIDRemote = nil;
serviceMatches = NO;
}
}
-
+
CFRelease((CFTypeRef)candelairHIDRemoteCompatibilityMask);
}
}
@@ -978,7 +978,7 @@ static HIDRemote *sHIDRemote = nil;
{
serviceMatches = [((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self inspectNewHardwareWithService:service prematchResult:serviceMatches];
}
-
+
return (serviceMatches);
}
@@ -995,7 +995,7 @@ static HIDRemote *sHIDRemote = nil;
// Aluminum Remote: Center
buttonCode = (kHIDRemoteButtonCodeCenter|kHIDRemoteButtonCodeAluminumMask);
break;
-
+
case kHIDUsage_Csmr_ModeStep:
// Aluminium Remote: Center Hold
buttonCode = (kHIDRemoteButtonCodeCenterHold|kHIDRemoteButtonCodeAluminumMask);
@@ -1005,11 +1005,11 @@ static HIDRemote *sHIDRemote = nil;
// Aluminum Remote: Play/Pause
buttonCode = (kHIDRemoteButtonCodePlay|kHIDRemoteButtonCodeAluminumMask);
break;
-
+
case kHIDUsage_Csmr_Rewind:
buttonCode = kHIDRemoteButtonCodeLeftHold;
break;
-
+
case kHIDUsage_Csmr_FastForward:
buttonCode = kHIDRemoteButtonCodeRightHold;
break;
@@ -1027,7 +1027,7 @@ static HIDRemote *sHIDRemote = nil;
break;
}
break;
-
+
case kHIDPage_GenericDesktop:
switch (usage)
{
@@ -1056,7 +1056,7 @@ static HIDRemote *sHIDRemote = nil;
break;
}
break;
-
+
case 0x06: /* Reserved */
switch (usage)
{
@@ -1065,7 +1065,7 @@ static HIDRemote *sHIDRemote = nil;
break;
}
break;
-
+
case 0xFF01: /* Vendor specific */
switch (usage)
{
@@ -1081,7 +1081,7 @@ static HIDRemote *sHIDRemote = nil;
}
break;
}
-
+
return (buttonCode);
}
@@ -1115,52 +1115,52 @@ static HIDRemote *sHIDRemote = nil;
kIOCFPlugInInterfaceID,
&cfPluginInterface,
&score);
-
+
if (kernResult != kIOReturnSuccess)
{
error = [NSError errorWithDomain:NSMachErrorDomain code:kernResult userInfo:nil];
errorCode = 1;
- break;
+ break;
}
-
+
// .. use it to get the HID interface ..
- hResult = (*cfPluginInterface)->QueryInterface( cfPluginInterface,
+ hResult = (*cfPluginInterface)->QueryInterface( cfPluginInterface,
CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID122),
(LPVOID)&hidDeviceInterface);
-
+
if ((hResult!=S_OK) || (hidDeviceInterface==NULL))
{
error = [NSError errorWithDomain:NSMachErrorDomain code:hResult userInfo:nil];
errorCode = 2;
- break;
+ break;
}
-
+
// .. then open it ..
switch (_mode)
{
case kHIDRemoteModeShared:
hResult = (*hidDeviceInterface)->open(hidDeviceInterface, kIOHIDOptionsTypeNone);
break;
-
+
case kHIDRemoteModeExclusive:
case kHIDRemoteModeExclusiveAuto:
hResult = (*hidDeviceInterface)->open(hidDeviceInterface, kIOHIDOptionsTypeSeizeDevice);
break;
-
+
default:
goto cleanUp; // Ugh! But there are no "double breaks" available in C AFAIK ..
break;
}
-
+
if (hResult!=S_OK)
{
error = [NSError errorWithDomain:NSMachErrorDomain code:hResult userInfo:nil];
errorCode = 3;
break;
}
-
+
opened = YES;
// .. query the HID elements ..
@@ -1171,7 +1171,7 @@ static HIDRemote *sHIDRemote = nil;
{
error = [NSError errorWithDomain:NSMachErrorDomain code:returnCode userInfo:nil];
errorCode = 4;
-
+
break;
}
@@ -1206,7 +1206,7 @@ static HIDRemote *sHIDRemote = nil;
UInt32 i, hidElementCnt = CFArrayGetCount(hidElements);
NSMutableDictionary *cookieButtonCodeLUT = [[NSMutableDictionary alloc] init];
NSMutableDictionary *cookieCount = [[NSMutableDictionary alloc] init];
-
+
if ((cookieButtonCodeLUT==nil) || (cookieCount==nil))
{
[cookieButtonCodeLUT release];
@@ -1220,20 +1220,20 @@ static HIDRemote *sHIDRemote = nil;
break;
}
-
+
// Analyze the HID elements and find matching elements
for (i=0;i<hidElementCnt;i++)
{
CFDictionaryRef hidDict;
NSNumber *usage, *usagePage, *cookie;
HIDRemoteButtonCode buttonCode = kHIDRemoteButtonCodeNone;
-
+
hidDict = CFArrayGetValueAtIndex(hidElements, i);
-
+
usage = (NSNumber *) CFDictionaryGetValue(hidDict, CFSTR(kIOHIDElementUsageKey));
usagePage = (NSNumber *) CFDictionaryGetValue(hidDict, CFSTR(kIOHIDElementUsagePageKey));
cookie = (NSNumber *) CFDictionaryGetValue(hidDict, CFSTR(kIOHIDElementCookieKey));
-
+
if ((usage!=nil) && (usagePage!=nil) && (cookie!=nil))
{
// Find the button codes for the ID combos
@@ -1245,23 +1245,23 @@ static HIDRemote *sHIDRemote = nil;
#include "HIDRemoteAdditions.h"
#undef _HIDREMOTE_EXTENSIONS_SECTION
#endif /* _HIDREMOTE_EXTENSIONS */
-
+
// Did record match?
if (buttonCode != kHIDRemoteButtonCodeNone)
{
NSString *pairString = [[NSString alloc] initWithFormat:@"%u_%u", [usagePage unsignedIntValue], [usage unsignedIntValue]];
NSNumber *buttonCodeNumber = [[NSNumber alloc] initWithUnsignedInt:(unsigned int)buttonCode];
-
+
#ifdef _HIDREMOTE_EXTENSIONS
// Debug logging code
#define _HIDREMOTE_EXTENSIONS_SECTION 4
#include "HIDRemoteAdditions.h"
#undef _HIDREMOTE_EXTENSIONS_SECTION
#endif /* _HIDREMOTE_EXTENSIONS */
-
+
[cookieCount setObject:buttonCodeNumber forKey:pairString];
[cookieButtonCodeLUT setObject:buttonCodeNumber forKey:cookie];
-
+
(*hidQueueInterface)->addElement(hidQueueInterface,
(IOHIDElementCookie) [cookie unsignedIntValue],
0);
@@ -1272,13 +1272,13 @@ static HIDRemote *sHIDRemote = nil;
#include "HIDRemoteAdditions.h"
#undef _HIDREMOTE_EXTENSIONS_SECTION
#endif /* _HIDREMOTE_EXTENSIONS */
-
+
[buttonCodeNumber release];
[pairString release];
}
}
}
-
+
// Compare number of *unique* matches (thus the cookieCount dictionary) with required minimum
if ([cookieCount count] < 10)
{
@@ -1302,16 +1302,16 @@ static HIDRemote *sHIDRemote = nil;
[cookieCount release];
cookieCount = nil;
}
-
+
// Finish setup of IOHIDQueueInterface with CFRunLoop
returnCode = (*hidQueueInterface)->createAsyncEventSource(hidQueueInterface, &queueEventSource);
if ((returnCode != kIOReturnSuccess) || (queueEventSource == NULL))
{
error = [NSError errorWithDomain:NSMachErrorDomain code:returnCode userInfo:nil];
errorCode = 9;
- break;
+ break;
}
-
+
returnCode = (*hidQueueInterface)->setEventCallout(hidQueueInterface, HIDEventCallback, (void *)((intptr_t)service), (void *)self);
if (returnCode != kIOReturnSuccess)
{
@@ -1319,12 +1319,12 @@ static HIDRemote *sHIDRemote = nil;
errorCode = 10;
break;
}
-
+
CFRunLoopAddSource( CFRunLoopGetCurrent(),
queueEventSource,
kCFRunLoopCommonModes);
[hidAttribsDict setObject:[NSValue valueWithPointer:(const void *)queueEventSource] forKey:kHIDRemoteCFRunLoopSource];
-
+
returnCode = (*hidQueueInterface)->start(hidQueueInterface);
if (returnCode != kIOReturnSuccess)
{
@@ -1332,7 +1332,7 @@ static HIDRemote *sHIDRemote = nil;
errorCode = 11;
break;
}
-
+
queueStarted = YES;
// Setup device notifications
@@ -1350,7 +1350,7 @@ static HIDRemote *sHIDRemote = nil;
}
[hidAttribsDict setObject:[NSNumber numberWithUnsignedInt:(unsigned int)serviceNotification] forKey:kHIDRemoteServiceNotification];
-
+
// Retain service
if (IOObjectRetain(service) != kIOReturnSuccess)
{
@@ -1358,13 +1358,13 @@ static HIDRemote *sHIDRemote = nil;
errorCode = 13;
break;
}
-
+
[hidAttribsDict setObject:[NSNumber numberWithUnsignedInt:(unsigned int)service] forKey:kHIDRemoteService];
-
+
// Get some (somewhat optional) infos on the device
{
CFStringRef product, manufacturer, transport;
-
+
if ((product = IORegistryEntryCreateCFProperty( (io_registry_entry_t)service,
(CFStringRef) @"Product",
kCFAllocatorDefault,
@@ -1374,7 +1374,7 @@ static HIDRemote *sHIDRemote = nil;
{
[hidAttribsDict setObject:(NSString *)product forKey:kHIDRemoteProduct];
}
-
+
CFRelease(product);
}
@@ -1387,7 +1387,7 @@ static HIDRemote *sHIDRemote = nil;
{
[hidAttribsDict setObject:(NSString *)manufacturer forKey:kHIDRemoteManufacturer];
}
-
+
CFRelease(manufacturer);
}
@@ -1400,16 +1400,16 @@ static HIDRemote *sHIDRemote = nil;
{
[hidAttribsDict setObject:(NSString *)transport forKey:kHIDRemoteTransport];
}
-
+
CFRelease(transport);
}
}
-
+
// Determine Aluminum Remote support
{
CFNumberRef aluSupport;
HIDRemoteAluminumRemoteSupportLevel supportLevel = kHIDRemoteAluminumRemoteSupportLevelNone;
-
+
if ((_mode == kHIDRemoteModeExclusive) || (_mode == kHIDRemoteModeExclusiveAuto))
{
// Determine if this driver offers on-demand support for the Aluminum Remote (only relevant under OS versions < 10.6.2)
@@ -1433,11 +1433,11 @@ static HIDRemote *sHIDRemote = nil;
[hidAttribsDict setObject:[NSNumber numberWithBool:YES] forKey:kHIDRemoteAluminumRemoteSupportOnDemand];
}
-
+
CFRelease(aluSupport);
}
}
-
+
if (supportLevel == kHIDRemoteAluminumRemoteSupportLevelNone)
{
if ((aluSupport = IORegistryEntryCreateCFProperty((io_registry_entry_t)service,
@@ -1449,13 +1449,13 @@ static HIDRemote *sHIDRemote = nil;
{
supportLevel = (HIDRemoteAluminumRemoteSupportLevel) [(NSNumber *)aluSupport intValue];
}
-
+
CFRelease(aluSupport);
}
else
{
CFStringRef ioKitClassName;
-
+
if ((ioKitClassName = IORegistryEntryCreateCFProperty( (io_registry_entry_t)service,
CFSTR(kIOClassKey),
kCFAllocatorDefault,
@@ -1476,7 +1476,7 @@ static HIDRemote *sHIDRemote = nil;
supportLevel = kHIDRemoteAluminumRemoteSupportLevelNative;
}
}
-
+
CFRelease(ioKitClassName);
}
}
@@ -1484,24 +1484,24 @@ static HIDRemote *sHIDRemote = nil;
[hidAttribsDict setObject:(NSNumber *)[NSNumber numberWithInt:(int)supportLevel] forKey:kHIDRemoteAluminumRemoteSupportLevel];
}
-
+
// Add it to the serviceAttribMap
[_serviceAttribMap setObject:hidAttribsDict forKey:[NSNumber numberWithUnsignedInt:(unsigned int)service]];
-
+
// And we're done with setup ..
if (([self delegate]!=nil) &&
([[self delegate] respondsToSelector:@selector(hidRemote:foundNewHardwareWithAttributes:)]))
{
[((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self foundNewHardwareWithAttributes:hidAttribsDict];
}
-
+
[hidAttribsDict release];
hidAttribsDict = nil;
-
+
return(YES);
}while(0);
-
+
cleanUp:
if (([self delegate]!=nil) &&
@@ -1509,7 +1509,7 @@ static HIDRemote *sHIDRemote = nil;
{
if (error!=nil)
{
- error = [NSError errorWithDomain:[error domain]
+ error = [NSError errorWithDomain:[error domain]
code:[error code]
userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:errorCode] forKey:@"InternalErrorCode"]
];
@@ -1517,7 +1517,7 @@ static HIDRemote *sHIDRemote = nil;
[((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self failedNewHardwareWithError:error];
}
-
+
// An error occured or this device is not of interest .. cleanup ..
if (serviceNotification!=0)
{
@@ -1530,7 +1530,7 @@ static HIDRemote *sHIDRemote = nil;
CFRunLoopSourceInvalidate(queueEventSource);
queueEventSource=NULL;
}
-
+
if (hidQueueInterface!=NULL)
{
if (queueStarted)
@@ -1547,13 +1547,13 @@ static HIDRemote *sHIDRemote = nil;
[hidAttribsDict release];
hidAttribsDict = nil;
}
-
+
if (hidElements!=NULL)
{
CFRelease(hidElements);
hidElements = NULL;
}
-
+
if (hidDeviceInterface!=NULL)
{
if (opened)
@@ -1564,13 +1564,13 @@ static HIDRemote *sHIDRemote = nil;
// opened = NO;
hidDeviceInterface = NULL;
}
-
+
if (cfPluginInterface!=NULL)
{
IODestroyPlugInInterface(cfPluginInterface);
cfPluginInterface = NULL;
}
-
+
return (NO);
}
@@ -1578,14 +1578,14 @@ static HIDRemote *sHIDRemote = nil;
{
NSNumber *serviceValue;
NSMutableDictionary *serviceDict = NULL;
-
+
if ((serviceValue = [NSNumber numberWithUnsignedInt:(unsigned int)service]) == nil)
{
return;
}
-
+
serviceDict = [_serviceAttribMap objectForKey:serviceValue];
-
+
if (serviceDict!=nil)
{
IOHIDDeviceInterface122 **hidDeviceInterface = NULL;
@@ -1605,7 +1605,7 @@ static HIDRemote *sHIDRemote = nil;
cfPluginInterface = (IOCFPlugInInterface **) ([serviceDict objectForKey:kHIDRemoteCFPluginInterface] ? [[serviceDict objectForKey:kHIDRemoteCFPluginInterface] pointerValue] : NULL);
cookieButtonMap = (NSMutableDictionary *) [serviceDict objectForKey:kHIDRemoteCookieButtonCodeLUT];
simulateHoldTimer = (NSTimer *) [serviceDict objectForKey:kHIDRemoteSimulateHoldEventsTimer];
-
+
[serviceDict retain];
[_serviceAttribMap removeObjectForKey:serviceValue];
@@ -1625,7 +1625,7 @@ static HIDRemote *sHIDRemote = nil;
{
[((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self releasedHardwareWithAttributes:serviceDict];
}
-
+
if (simulateHoldTimer!=nil)
{
[simulateHoldTimer invalidate];
@@ -1642,12 +1642,12 @@ static HIDRemote *sHIDRemote = nil;
queueEventSource,
kCFRunLoopCommonModes);
}
-
+
if ((hidQueueInterface!=NULL) && (cookieButtonMap!=nil))
{
NSEnumerator *cookieEnum = [cookieButtonMap keyEnumerator];
NSNumber *cookie;
-
+
while ((cookie = [cookieEnum nextObject]) != nil)
{
if ((*hidQueueInterface)->hasElement(hidQueueInterface, (IOHIDElementCookie) [cookie unsignedIntValue]))
@@ -1657,25 +1657,25 @@ static HIDRemote *sHIDRemote = nil;
}
};
}
-
+
if (hidQueueInterface!=NULL)
{
(*hidQueueInterface)->stop(hidQueueInterface);
(*hidQueueInterface)->dispose(hidQueueInterface);
(*hidQueueInterface)->Release(hidQueueInterface);
}
-
+
if (hidDeviceInterface!=NULL)
{
(*hidDeviceInterface)->close(hidDeviceInterface);
(*hidDeviceInterface)->Release(hidDeviceInterface);
}
-
+
if (cfPluginInterface!=NULL)
{
IODestroyPlugInInterface(cfPluginInterface);
}
-
+
if (theService!=0)
{
IOObjectRelease(theService);
@@ -1692,11 +1692,11 @@ static HIDRemote *sHIDRemote = nil;
NSMutableDictionary *hidAttribsDict;
NSTimer *shTimer;
NSNumber *shButtonCode;
-
+
if ((hidAttribsDict = (NSMutableDictionary *)[aTimer userInfo]) != nil)
{
if (((shTimer = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsTimer]) != nil) &&
- ((shButtonCode = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsOriginButtonCode]) != nil))
+ ((shButtonCode = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsOriginButtonCode]) != nil))
{
[shTimer invalidate];
[hidAttribsDict removeObjectForKey:kHIDRemoteSimulateHoldEventsTimer];
@@ -1726,16 +1726,16 @@ static HIDRemote *sHIDRemote = nil;
if (isPressed)
{
[hidAttribsDict setObject:[NSNumber numberWithUnsignedInt:buttonCode] forKey:kHIDRemoteSimulateHoldEventsOriginButtonCode];
-
+
if ((shTimer = [[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:0.7] interval:0.1 target:self selector:@selector(_simulateHoldEvent:) userInfo:hidAttribsDict repeats:NO]) != nil)
{
[hidAttribsDict setObject:shTimer forKey:kHIDRemoteSimulateHoldEventsTimer];
-
+
// Using CFRunLoopAddTimer instead of [[NSRunLoop currentRunLoop] addTimer:.. for consistency with run loop modes.
// The kCFRunLoopCommonModes counterpart NSRunLoopCommonModes is only available in 10.5 and later, whereas this code
// is designed to be also compatible with 10.4. CFRunLoopTimerRef is "toll-free-bridged" with NSTimer since 10.0.
CFRunLoopAddTimer(CFRunLoopGetCurrent(), (CFRunLoopTimerRef)shTimer, kCFRunLoopCommonModes);
-
+
[shTimer release];
break;
@@ -1745,7 +1745,7 @@ static HIDRemote *sHIDRemote = nil;
{
shTimer = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsTimer];
shButtonCode = [hidAttribsDict objectForKey:kHIDRemoteSimulateHoldEventsOriginButtonCode];
-
+
if ((shTimer!=nil) && (shButtonCode!=nil))
{
[self _sendButtonCode:(HIDRemoteButtonCode)[shButtonCode unsignedIntValue] isPressed:YES hidAttribsDict:hidAttribsDict];
@@ -1762,10 +1762,10 @@ static HIDRemote *sHIDRemote = nil;
[hidAttribsDict removeObjectForKey:kHIDRemoteSimulateHoldEventsTimer];
[hidAttribsDict removeObjectForKey:kHIDRemoteSimulateHoldEventsOriginButtonCode];
-
+
break;
}
-
+
default:
[self _sendButtonCode:buttonCode isPressed:isPressed hidAttribsDict:hidAttribsDict];
break;
@@ -1807,14 +1807,14 @@ static HIDRemote *sHIDRemote = nil;
}
break;
}
-
+
// As soon as we have received a code that's unique to the Aluminum Remote, we can tell kHIDRemoteButtonCodePlayHold and kHIDRemoteButtonCodeCenterHold apart.
// Prior to that, a long press of the new "Play" button will be submitted as a "kHIDRemoteButtonCodeCenterHold", not a "kHIDRemoteButtonCodePlayHold" code.
if ((buttonCode == kHIDRemoteButtonCodeCenterHold) && (_lastSeenModel == kHIDRemoteModelAluminum))
{
buttonCode = kHIDRemoteButtonCodePlayHold;
}
-
+
[((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self eventWithButton:(buttonCode & (~kHIDRemoteButtonCodeAluminumMask)) isPressed:isPressed fromHardwareWithAttributes:hidAttribsDict];
}
}
@@ -1822,19 +1822,19 @@ static HIDRemote *sHIDRemote = nil;
- (void)_hidEventFor:(io_service_t)hidDevice from:(IOHIDQueueInterface **)interface withResult:(IOReturn)result
{
NSMutableDictionary *hidAttribsDict = [[[_serviceAttribMap objectForKey:[NSNumber numberWithUnsignedInt:(unsigned int)hidDevice]] retain] autorelease];
-
+
if (hidAttribsDict!=nil)
{
IOHIDQueueInterface **queueInterface = NULL;
-
+
queueInterface = [[hidAttribsDict objectForKey:kHIDRemoteHIDQueueInterface] pointerValue];
-
+
if (interface == queueInterface)
{
NSNumber *lastButtonPressedNumber = nil;
HIDRemoteButtonCode lastButtonPressed = kHIDRemoteButtonCodeNone;
NSMutableDictionary *cookieButtonMap = nil;
-
+
cookieButtonMap = [hidAttribsDict objectForKey:kHIDRemoteCookieButtonCodeLUT];
if ((lastButtonPressedNumber = [hidAttribsDict objectForKey:kHIDRemoteLastButtonPressed]) != nil)
@@ -1846,27 +1846,27 @@ static HIDRemote *sHIDRemote = nil;
{
IOHIDEventStruct hidEvent;
AbsoluteTime supportedTime = { 0,0 };
-
+
result = (*queueInterface)->getNextEvent( queueInterface,
&hidEvent,
supportedTime,
0);
-
+
if (result == kIOReturnSuccess)
{
NSNumber *buttonCodeNumber = [cookieButtonMap objectForKey:[NSNumber numberWithUnsignedInt:(unsigned int) hidEvent.elementCookie]];
-
+
#ifdef _HIDREMOTE_EXTENSIONS
// Debug logging code
#define _HIDREMOTE_EXTENSIONS_SECTION 5
#include "HIDRemoteAdditions.h"
#undef _HIDREMOTE_EXTENSIONS_SECTION
#endif /* _HIDREMOTE_EXTENSIONS */
-
+
if (buttonCodeNumber!=nil)
{
HIDRemoteButtonCode buttonCode = [buttonCodeNumber unsignedIntValue];
-
+
if (hidEvent.value == 0)
{
if (buttonCode == lastButtonPressed)
@@ -1891,21 +1891,21 @@ static HIDRemote *sHIDRemote = nil;
{
[((NSObject <HIDRemoteDelegate> *)[self delegate]) hidRemote:self remoteIDChangedOldID:_lastSeenRemoteID newID:hidEvent.value forHardwareWithAttributes:hidAttribsDict];
}
-
+
_lastSeenRemoteID = hidEvent.value;
_lastSeenModel = kHIDRemoteModelUndetermined;
}
-
+
[self _handleButtonCode:buttonCode isPressed:YES hidAttribsDict:hidAttribsDict];
lastButtonPressed = buttonCode;
}
}
}
};
-
+
[hidAttribsDict setObject:[NSNumber numberWithUnsignedInt:lastButtonPressed] forKey:kHIDRemoteLastButtonPressed];
}
-
+
#ifdef _HIDREMOTE_EXTENSIONS
// Debug logging code
#define _HIDREMOTE_EXTENSIONS_SECTION 6
@@ -1940,9 +1940,9 @@ static HIDRemote *sHIDRemote = nil;
{
NSArray *consoleUsersArray;
io_service_t rootService;
-
+
if (_masterPort==0) { return; }
-
+
if ((rootService = IORegistryGetRootEntry(_masterPort)) != 0)
{
if ((consoleUsersArray = (NSArray *)IORegistryEntryCreateCFProperty((io_registry_entry_t)rootService, CFSTR("IOConsoleUsers"), kCFAllocatorDefault, 0)) != nil)
@@ -1950,14 +1950,14 @@ static HIDRemote *sHIDRemote = nil;
if ([consoleUsersArray isKindOfClass:[NSArray class]]) // Be careful - ensure this really is an array
{
NSEnumerator *consoleUsersEnum; // I *love* Obj-C2's fast enumerators, but we need to stay compatible with 10.4 :-/
-
+
if ((consoleUsersEnum = [consoleUsersArray objectEnumerator]) != nil)
{
UInt64 secureEventInputPIDSum = 0;
uid_t frontUserSession = 0;
BOOL screenIsLocked = NO;
NSDictionary *consoleUserDict;
-
+
while ((consoleUserDict = [consoleUsersEnum nextObject]) != nil)
{
if ([consoleUserDict isKindOfClass:[NSDictionary class]]) // Be careful - ensure this really is a dictionary
@@ -1966,7 +1966,7 @@ static HIDRemote *sHIDRemote = nil;
NSNumber *onConsole;
NSNumber *userID;
NSNumber *screenIsLockedBool;
-
+
if ((secureInputPID = [consoleUserDict objectForKey:@"kCGSSessionSecureInputPID"]) != nil)
{
if ([secureInputPID isKindOfClass:[NSNumber class]])
@@ -1974,7 +1974,7 @@ static HIDRemote *sHIDRemote = nil;
secureEventInputPIDSum += ((UInt64) [secureInputPID intValue]);
}
}
-
+
if (((onConsole = [consoleUserDict objectForKey:@"kCGSSessionOnConsoleKey"]) != nil) &&
((userID = [consoleUserDict objectForKey:@"kCGSSessionUserIDKey"]) != nil))
{
@@ -1986,7 +1986,7 @@ static HIDRemote *sHIDRemote = nil;
}
}
}
-
+
if ((screenIsLockedBool = [consoleUserDict objectForKey:@"CGSSessionScreenIsLocked"]) != nil)
{
if ([screenIsLockedBool isKindOfClass:[NSNumber class]])
@@ -2002,10 +2002,10 @@ static HIDRemote *sHIDRemote = nil;
_lastScreenIsLocked = screenIsLocked;
}
}
-
+
CFRelease((CFTypeRef)consoleUsersArray);
}
-
+
IOObjectRelease((io_object_t) rootService);
}
}
@@ -2016,7 +2016,7 @@ static HIDRemote *sHIDRemote = nil;
{
HIDRemoteMode restartInMode = _mode;
unsigned checkActiveRemoteControlCount = [self activeRemoteControlCount];
-
+
// Only restart when we already have active remote controls - to avoid race conditions with other applications using kHIDRemoteModeExclusive mode (new in V1.2.1)
if (checkActiveRemoteControlCount > 0)
{
@@ -2024,7 +2024,7 @@ static HIDRemote *sHIDRemote = nil;
[self stopRemoteControl];
[self startRemoteControl:restartInMode];
_isRestarting = NO;
-
+
// Check whether we lost a remote control due to restarting/secure input change notification handling (new in V1.2.1)
if (checkActiveRemoteControlCount != [self activeRemoteControlCount])
{
@@ -2042,9 +2042,9 @@ static HIDRemote *sHIDRemote = nil;
UInt64 old_lastSecureEventInputPIDSum = _lastSecureEventInputPIDSum;
uid_t old_lastFrontUserSession = _lastFrontUserSession;
BOOL old_lastScreenIsLocked = _lastScreenIsLocked;
-
+
[self _updateSessionInformation];
-
+
if (((old_lastSecureEventInputPIDSum != _lastSecureEventInputPIDSum) ||
(old_lastFrontUserSession != _lastFrontUserSession) ||
(old_lastScreenIsLocked != _lastScreenIsLocked)) && _secureEventInputWorkAround)
@@ -2082,7 +2082,7 @@ static HIDRemote *sHIDRemote = nil;
#pragma mark - PRIVATE: IOKitLib Callbacks
-static void HIDEventCallback( void * target,
+static void HIDEventCallback( void * target,
IOReturn result,
void * refCon,
void * sender)
@@ -2114,7 +2114,7 @@ static void ServiceNotificationCallback(void * refCon,
{
HIDRemote *hidRemote = (HIDRemote *)refCon;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
+
[hidRemote _serviceNotificationFor:service
messageType:messageType
messageArgument:messageArgument];
@@ -2129,7 +2129,7 @@ static void SecureInputNotificationCallback( void * refCon,
{
HIDRemote *hidRemote = (HIDRemote *)refCon;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
+
[hidRemote _secureInputNotificationFor:service
messageType:messageType
messageArgument:messageArgument];
diff --git a/tools/EventClients/Clients/OSXRemote/XBMCDebugHelpers.h b/tools/EventClients/Clients/OSXRemote/XBMCDebugHelpers.h
index 8650f87412..d57fef2fad 100644
--- a/tools/EventClients/Clients/OSXRemote/XBMCDebugHelpers.h
+++ b/tools/EventClients/Clients/OSXRemote/XBMCDebugHelpers.h
@@ -4,17 +4,17 @@
//
// Created by Stephan Diederich on 21.09.08.
// Copyright 2008 University Heidelberg. All rights reserved.
-//
+//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -36,7 +36,7 @@
#define ELOG(s, ...) NSLog(@"[ERROR] " s, ##__VA_ARGS__)
#define DLOG(s, ...) LOG(s, ##__VA_ARGS__)
#else
-#define LOG(s, ...)
+#define LOG(s, ...)
#define ILOG(s, ...) NSLog(@"[INFO] " s, ##__VA_ARGS__)
#define ELOG(s, ...) NSLog(@"[ERROR] " s, ##__VA_ARGS__)
#define DLOG(s, ...) LOG(s, ##__VA_ARGS__)
diff --git a/tools/EventClients/Clients/OSXRemote/XBMCHelper.h b/tools/EventClients/Clients/OSXRemote/XBMCHelper.h
index 5aa984cda3..da33a8b603 100644
--- a/tools/EventClients/Clients/OSXRemote/XBMCHelper.h
+++ b/tools/EventClients/Clients/OSXRemote/XBMCHelper.h
@@ -21,7 +21,7 @@
- (void) enableVerboseMode:(bool) f_really;
- (void) setApplicationPath:(NSString*) fp_app_path;
-- (void) setApplicationHome:(NSString*) fp_home_path;
+- (void) setApplicationHome:(NSString*) fp_home_path;
- (void) connectToServer:(NSString*) fp_server onPort:(int) f_port withMode:(eRemoteMode) f_mode withTimeout:(double) f_timeout;
- (void) disconnect;
diff --git a/tools/EventClients/Clients/OSXRemote/XBMCHelper.m b/tools/EventClients/Clients/OSXRemote/XBMCHelper.m
index d3f0d38bcb..018426a96c 100644
--- a/tools/EventClients/Clients/OSXRemote/XBMCHelper.m
+++ b/tools/EventClients/Clients/OSXRemote/XBMCHelper.m
@@ -148,7 +148,7 @@
[mp_wrapper handleEvent:ATV_BUTTON_RIGHT];
else
[mp_wrapper handleEvent:ATV_BUTTON_RIGHT_RELEASE];
- break;
+ break;
case kHIDRemoteButtonCodeCenter:
if(isPressed) [mp_wrapper handleEvent:ATV_BUTTON_CENTER];
break;
@@ -183,7 +183,7 @@
break;
case kHIDRemoteButtonCodeCenterHold:
if(isPressed) [mp_wrapper handleEvent:ATV_BUTTON_CENTER_H];
- break;
+ break;
case kHIDRemoteButtonCodeMenuHold:
if(isPressed) {
[self checkAndLaunchApp]; //launch mp_app_path if it's not running
@@ -202,13 +202,13 @@
// Notification of ID changes
-- (void)hidRemote:(HIDRemote *)hidRemote remoteIDChangedOldID:(SInt32)old
+- (void)hidRemote:(HIDRemote *)hidRemote remoteIDChangedOldID:(SInt32)old
newID:(SInt32)newID forHardwareWithAttributes:(NSMutableDictionary *)attributes
{
if(m_verbose)
NSLog(@"Change of remote ID from %d to %d", old, newID);
[mp_wrapper switchRemote: newID];
-
+
}
#pragma mark -
diff --git a/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.h b/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.h
index 7c78ef7920..08332f4030 100644
--- a/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.h
+++ b/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.h
@@ -10,12 +10,12 @@
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#import <Cocoa/Cocoa.h>
diff --git a/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.mm b/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.mm
index 3bc580e51f..97b2e789f2 100644
--- a/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.mm
+++ b/tools/EventClients/Clients/OSXRemote/xbmcclientwrapper.mm
@@ -10,12 +10,12 @@
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
@@ -31,12 +31,12 @@
class XBMCClientEventSequence{
public:
XBMCClientEventSequence(){}
-
+
//implicit conversion
XBMCClientEventSequence(eATVClientEvent f_event){
m_stream.push_back(f_event);
}
-
+
std::string str() const{
std::stringstream ss;
for(std::vector<eATVClientEvent>::const_iterator it = m_stream.begin();
@@ -49,7 +49,7 @@ public:
void clear(){
m_stream.clear();
}
-
+
//
// operators
//
@@ -63,7 +63,7 @@ public:
}
friend bool operator <(XBMCClientEventSequence const& fcr_lhs,XBMCClientEventSequence const& fcr_rhs){
return fcr_lhs.m_stream < fcr_rhs.m_stream;
- }
+ }
friend bool operator ==(XBMCClientEventSequence const& fcr_lhs,XBMCClientEventSequence const& fcr_rhs){
return fcr_lhs.m_stream == fcr_rhs.m_stream;
}
@@ -83,7 +83,7 @@ class XBMCClientWrapperImpl{
tSequenceMap m_sequence_map;
tMultiRemoteMap m_multiremote_map;
eRemoteMode m_mode;
- int m_socket;
+ int m_socket;
std::string m_address;
int m_port;
XBMCClientEventSequence m_sequence;
@@ -109,7 +109,7 @@ public:
void switchRemote(int f_device_id){
m_device_id = f_device_id;
}
- void handleEvent(eATVClientEvent f_event);
+ void handleEvent(eATVClientEvent f_event);
void enableVerboseMode(bool f_value){
m_verbose_mode = f_value;
}
@@ -122,7 +122,7 @@ void XBMCClientWrapperImpl::timerCallBack (CFRunLoopTimerRef timer, void *info)
fprintf(stderr, "Error. invalid argument to timer callback\n");
return;
}
-
+
XBMCClientWrapperImpl *p_impl = (XBMCClientWrapperImpl *)info;
p_impl->sendSequence();
p_impl->resetTimer();
@@ -136,12 +136,12 @@ void XBMCClientWrapperImpl::resetTimer(){
CFRelease(m_timer);
m_timer = NULL;
}
-}
+}
void XBMCClientWrapperImpl::restartTimer(){
if (m_timer)
- resetTimer();
-
+ resetTimer();
+
CFRunLoopTimerContext context = { 0, this, 0, 0, 0 };
m_timer = CFRunLoopTimerCreate(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent() + m_sequence_timeout, 0, 0, 0, timerCallBack, &context);
CFRunLoopAddTimer(CFRunLoopGetCurrent(), m_timer, kCFRunLoopCommonModes);
@@ -173,7 +173,7 @@ XBMCClientWrapperImpl::XBMCClientWrapperImpl(eRemoteMode f_mode, const std::stri
NSLog(@"XBMCClientWrapperImpl started in normal mode sending to address %s, port %i", fcr_address.c_str(), f_port);
populateEventMap();
}
-
+
//open udp port etc
m_socket = socket(AF_INET, SOCK_DGRAM, 0);
if (m_socket < 0)
@@ -185,7 +185,7 @@ XBMCClientWrapperImpl::XBMCClientWrapperImpl(eRemoteMode f_mode, const std::stri
namespace {
struct delete_second{
- template <class T>
+ template <class T>
void operator ()(T& fr_pair){
delete fr_pair.second;
}
@@ -208,14 +208,14 @@ void XBMCClientWrapperImpl::sendButton(eATVClientEvent f_event){
if(m_mode == MULTIREMOTE_MODE){
tMultiRemoteMap::iterator it = m_multiremote_map.find(std::make_pair(m_device_id, f_event));
if(it == m_multiremote_map.end()){
- ELOG(@"XBMCClientWrapperImpl::sendButton: No mapping defined for remoteID: %i button %i", m_device_id, f_event);
+ ELOG(@"XBMCClientWrapperImpl::sendButton: No mapping defined for remoteID: %i button %i", m_device_id, f_event);
return;
}
lp_packet = it->second;
} else {
tEventMap::iterator it = m_event_map.find(f_event);
if(it == m_event_map.end()){
- ELOG(@"XBMCClientWrapperImpl::sendButton: No mapping defined for button %i", f_event);
+ ELOG(@"XBMCClientWrapperImpl::sendButton: No mapping defined for button %i", f_event);
return;
}
lp_packet = it->second;
@@ -224,7 +224,7 @@ void XBMCClientWrapperImpl::sendButton(eATVClientEvent f_event){
CAddress addr(m_address.c_str(), m_port);
if(m_verbose_mode)
NSLog(@"XBMCClientWrapperImpl::sendButton sending button %i down:%i up:%i", lp_packet->GetButtonCode(), lp_packet->GetFlags()&BTN_DOWN,lp_packet->GetFlags()&BTN_UP );
- lp_packet->Send(m_socket, addr);
+ lp_packet->Send(m_socket, addr);
}
void XBMCClientWrapperImpl::sendSequence(){
@@ -232,7 +232,7 @@ void XBMCClientWrapperImpl::sendSequence(){
if(it != m_sequence_map.end()){
CPacketBUTTON& packet = *(it->second);
CAddress addr(m_address.c_str());
- packet.Send(m_socket, addr);
+ packet.Send(m_socket, addr);
if(m_verbose_mode)
NSLog(@"XBMCClientWrapperImpl::sendSequence sent sequence %i down:%i up:%i", packet.GetButtonCode(), packet.GetFlags()&BTN_DOWN,packet.GetFlags()&BTN_UP );
} else {
@@ -241,12 +241,12 @@ void XBMCClientWrapperImpl::sendSequence(){
m_sequence.clear();
}
-void XBMCClientWrapperImpl::handleEvent(eATVClientEvent f_event){
+void XBMCClientWrapperImpl::handleEvent(eATVClientEvent f_event){
if(m_mode != UNIVERSAL_MODE){
sendButton(f_event);
} else {
//in universal mode no keys are directly send. instead a key-sequence is assembled and a timer started
- //when the timer expires, that key sequence is checked against predefined sequences and if it is a valid one,
+ //when the timer expires, that key sequence is checked against predefined sequences and if it is a valid one,
//a button press is generated
if(m_sequence.str().empty()){
if(isStartToken(f_event)){
@@ -271,7 +271,7 @@ void XBMCClientWrapperImpl::handleEvent(eATVClientEvent f_event){
void XBMCClientWrapperImpl::populateEventMap(){
tEventMap& lr_map = m_event_map;
-
+
lr_map.insert(std::make_pair(ATV_BUTTON_CENTER, new CPacketBUTTON(5, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
lr_map.insert(std::make_pair(ATV_BUTTON_RIGHT, new CPacketBUTTON(4, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
lr_map.insert(std::make_pair(ATV_BUTTON_RIGHT_RELEASE, new CPacketBUTTON(4, "CC:AppleRemote", BTN_UP | BTN_NO_REPEAT | BTN_QUEUE)));
@@ -283,12 +283,12 @@ void XBMCClientWrapperImpl::populateEventMap(){
lr_map.insert(std::make_pair(ATV_BUTTON_UP_RELEASE, new CPacketBUTTON(1, "CC:AppleRemote", BTN_UP | BTN_QUEUE)));
lr_map.insert(std::make_pair(ATV_BUTTON_DOWN, new CPacketBUTTON(2, "CC:AppleRemote", BTN_DOWN | BTN_QUEUE)));
lr_map.insert(std::make_pair(ATV_BUTTON_DOWN_RELEASE, new CPacketBUTTON(2, "CC:AppleRemote", BTN_UP | BTN_QUEUE)));
-
+
// only present on ATV <= 2.1 <--- check that; OSX seems to have the release parts
- lr_map.insert(std::make_pair(ATV_BUTTON_RIGHT_H, new CPacketBUTTON(10, "CC:AppleRemote", BTN_DOWN | BTN_QUEUE)));
- lr_map.insert(std::make_pair(ATV_BUTTON_RIGHT_H_RELEASE, new CPacketBUTTON(10, "CC:AppleRemote", BTN_UP | BTN_QUEUE)));
+ lr_map.insert(std::make_pair(ATV_BUTTON_RIGHT_H, new CPacketBUTTON(10, "CC:AppleRemote", BTN_DOWN | BTN_QUEUE)));
+ lr_map.insert(std::make_pair(ATV_BUTTON_RIGHT_H_RELEASE, new CPacketBUTTON(10, "CC:AppleRemote", BTN_UP | BTN_QUEUE)));
lr_map.insert(std::make_pair(ATV_BUTTON_LEFT_H, new CPacketBUTTON(9, "CC:AppleRemote", BTN_DOWN | BTN_QUEUE)));
- lr_map.insert(std::make_pair(ATV_BUTTON_LEFT_H_RELEASE, new CPacketBUTTON(9, "CC:AppleRemote", BTN_UP | BTN_QUEUE)));
+ lr_map.insert(std::make_pair(ATV_BUTTON_LEFT_H_RELEASE, new CPacketBUTTON(9, "CC:AppleRemote", BTN_UP | BTN_QUEUE)));
//new aluminium remote buttons
lr_map.insert(std::make_pair(ATV_BUTTON_PLAY, new CPacketBUTTON(12, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
@@ -296,7 +296,7 @@ void XBMCClientWrapperImpl::populateEventMap(){
// only present on atv >= 2.2
lr_map.insert(std::make_pair(ATV_BUTTON_CENTER_H, new CPacketBUTTON(7, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
-
+
//learned remote buttons (ATV >=2.3)
lr_map.insert(std::make_pair(ATV_LEARNED_PLAY, new CPacketBUTTON(70, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
lr_map.insert(std::make_pair(ATV_LEARNED_PAUSE, new CPacketBUTTON(71, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
@@ -321,7 +321,7 @@ void XBMCClientWrapperImpl::populateSequenceMap(){
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_UP, new CPacketBUTTON(23, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_DOWN, new CPacketBUTTON(24, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_MENU, new CPacketBUTTON(25, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
-
+
sequence_prefix.clear();
sequence_prefix << ATV_BUTTON_MENU_H << ATV_BUTTON_CENTER;
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_CENTER, new CPacketBUTTON(26, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
@@ -330,7 +330,7 @@ void XBMCClientWrapperImpl::populateSequenceMap(){
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_UP, new CPacketBUTTON(29, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_DOWN, new CPacketBUTTON(30, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_MENU, new CPacketBUTTON(31, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
-
+
sequence_prefix.clear();
sequence_prefix << ATV_BUTTON_MENU_H << ATV_BUTTON_UP;
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_CENTER, new CPacketBUTTON(32, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
@@ -339,7 +339,7 @@ void XBMCClientWrapperImpl::populateSequenceMap(){
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_UP, new CPacketBUTTON(35, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_DOWN, new CPacketBUTTON(36, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_MENU, new CPacketBUTTON(37, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
-
+
sequence_prefix.clear();
sequence_prefix << ATV_BUTTON_MENU_H << ATV_BUTTON_DOWN;
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_CENTER, new CPacketBUTTON(38, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
@@ -348,7 +348,7 @@ void XBMCClientWrapperImpl::populateSequenceMap(){
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_UP, new CPacketBUTTON(41, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_DOWN, new CPacketBUTTON(42, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_MENU, new CPacketBUTTON(43, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
-
+
sequence_prefix.clear();
sequence_prefix << ATV_BUTTON_MENU_H << ATV_BUTTON_RIGHT;
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_CENTER, new CPacketBUTTON(44, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
@@ -357,7 +357,7 @@ void XBMCClientWrapperImpl::populateSequenceMap(){
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_UP, new CPacketBUTTON(47, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_DOWN, new CPacketBUTTON(48, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_MENU, new CPacketBUTTON(49, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
-
+
sequence_prefix.clear();
sequence_prefix << ATV_BUTTON_MENU_H << ATV_BUTTON_LEFT;
m_sequence_map.insert(std::make_pair( sequence_prefix + ATV_BUTTON_CENTER, new CPacketBUTTON(50, "CC:AppleRemote", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
@@ -376,11 +376,11 @@ void XBMCClientWrapperImpl::populateMultiRemoteModeMap(){
{
// keymaps for mult-apple-remote, including the device-key sent after remote-switch
// we just add them here with unique button numbers and do the real mapping in keymap.xml
- // as an offset for the buttons we use the device
-
+ // as an offset for the buttons we use the device
+
// this loop should probably be replaced by a proper setting of the individual keys
// cons: currently only button-codes (aka ints) are sent
- // way too lazy ;)
+ // way too lazy ;)
// pro: custom tweaks. e.g. button 1 on the harmony may be (153, ATV_BUTTON_LEFT) and this should not get a repeat
// maybe use the loop and tweak individual buttons later; plex maps here to strings, and later in keymap.xml to other strings,
// but this may need another kind of remote in XBMC source
@@ -388,22 +388,22 @@ void XBMCClientWrapperImpl::populateMultiRemoteModeMap(){
m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_UP_RELEASE), new CPacketBUTTON(1 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE)));
m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_DOWN), new CPacketBUTTON(2 + offset, "CC:Harmony", BTN_DOWN | BTN_QUEUE)));
m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_DOWN_RELEASE), new CPacketBUTTON(2 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE)));
-
+
m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_LEFT), new CPacketBUTTON(3 + offset, "CC:Harmony", BTN_DOWN | BTN_QUEUE)));
m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_LEFT_RELEASE), new CPacketBUTTON(3 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE)));
m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_RIGHT), new CPacketBUTTON(4 + offset, "CC:Harmony", BTN_DOWN | BTN_QUEUE)));
m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_RIGHT_RELEASE), new CPacketBUTTON(4 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE)));
-
+
m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_CENTER), new CPacketBUTTON(5 + offset, "CC:Harmony", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_MENU), new CPacketBUTTON(6 + offset, "CC:Harmony", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_CENTER_H), new CPacketBUTTON(7 + offset, "CC:Harmony", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_MENU_H), new CPacketBUTTON(8 + offset, "CC:Harmony", BTN_DOWN | BTN_NO_REPEAT | BTN_QUEUE)));
-
+
m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_RIGHT_H), new CPacketBUTTON(9 + offset, "CC:Harmony", BTN_DOWN | BTN_QUEUE)));
m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_RIGHT_H_RELEASE),new CPacketBUTTON(9 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE)));
-
- m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_LEFT_H), new CPacketBUTTON(10 + offset, "CC:Harmony", BTN_DOWN | BTN_QUEUE)));
- m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_LEFT_H_RELEASE),new CPacketBUTTON(10 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE)));
+
+ m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_LEFT_H), new CPacketBUTTON(10 + offset, "CC:Harmony", BTN_DOWN | BTN_QUEUE)));
+ m_multiremote_map.insert(std::make_pair(std::make_pair(*device_id,ATV_BUTTON_LEFT_H_RELEASE),new CPacketBUTTON(10 + offset, "CC:Harmony", BTN_UP | BTN_QUEUE)));
}
}
@@ -413,7 +413,7 @@ void XBMCClientWrapperImpl::populateMultiRemoteModeMap(){
}
- (id) initWithMode:(eRemoteMode) f_mode serverAddress:(NSString*) fp_server port:(int) f_port verbose:(bool) f_verbose{
if( ![super init] )
- return nil;
+ return nil;
mp_impl = new XBMCClientWrapperImpl(f_mode, [fp_server UTF8String], f_port, f_verbose);
return self;
}
diff --git a/tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm b/tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm
index 9895629215..8670d06c81 100644
--- a/tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm
+++ b/tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm
@@ -37,7 +37,7 @@ static struct option long_options[] = {
{ "verbose", no_argument, 0, 'v' },
{ "externalConfig", no_argument, 0, 'x' },
{ "appPath", required_argument, 0, 'a' },
-{ "appHome", required_argument, 0, 'z' },
+{ "appHome", required_argument, 0, 'z' },
{ 0, 0, 0, 0 },
};
@@ -67,30 +67,30 @@ void ReadConfig()
// Compute filename.
std::string strFile = getenv("HOME");
strFile += "/Library/Application Support/Kodi/XBMCHelper.conf";
-
+
// Open file.
std::ifstream ifs(strFile.c_str());
if (!ifs)
return;
-
+
// Read file.
stringstream oss;
oss << ifs.rdbuf();
-
+
if (!ifs && !ifs.eof())
return;
-
+
// Tokenize.
string strData(oss.str());
istringstream is(strData);
vector<string> args = vector<string>(istream_iterator<string>(is), istream_iterator<string>());
-
+
// Convert to char**.
int argc = args.size() + 1;
char** argv = new char*[argc + 1];
int i = 0;
argv[i++] = (char*)"XBMCHelper";
-
+
for (vector<string>::iterator it = args.begin(); it != args.end(); ){
//fixup the arguments, here: remove '"' like bash would normally do
std::string::size_type j = 0;
@@ -98,12 +98,12 @@ void ReadConfig()
it->replace(j, 1, "");
argv[i++] = (char* )(*it++).c_str();
}
-
+
argv[i] = 0;
-
+
// Parse the arguments.
ParseOptions(argc, argv);
-
+
delete[] argv;
}
@@ -122,8 +122,8 @@ void ParseOptions(int argc, char** argv)
g_universal_timeout = 0.5;
g_verbose_mode = false;
NSLog(@"ParseOptions - force VerboseMode on");
-
- while ((c = getopt_long(argc, argv, options, long_options, &option_index)) != -1)
+
+ while ((c = getopt_long(argc, argv, options, long_options, &option_index)) != -1)
{
switch (c) {
case 'h':
@@ -150,7 +150,7 @@ void ParseOptions(int argc, char** argv)
case 'm':
g_mode = MULTIREMOTE_MODE;
NSLog(@"ParseOptions - MultiRemoteMode on");
- break;
+ break;
case 't':
g_universal_timeout = atof(optarg) * 0.001;
NSLog(@"ParseOptions - Universal Timeout %lf", g_universal_timeout);
@@ -178,22 +178,22 @@ void ParseOptions(int argc, char** argv)
//reset getopts state
optreset = 1;
optind = 0;
-
+
if (readExternal == true)
- ReadConfig();
-
+ ReadConfig();
+
}
//----------------------------------------------------------------------------
void ConfigureHelper(){
[gp_xbmchelper enableVerboseMode:g_verbose_mode];
-
+
//set apppath to startup when pressing Menu
- [gp_xbmchelper setApplicationPath:[NSString stringWithUTF8String:g_app_path.c_str()]];
+ [gp_xbmchelper setApplicationPath:[NSString stringWithUTF8String:g_app_path.c_str()]];
//set apppath to startup when pressing Menu
[gp_xbmchelper setApplicationHome:[NSString stringWithUTF8String:g_app_home.c_str()]];
//connect to specified server
- [gp_xbmchelper connectToServer:[NSString stringWithUTF8String:g_server_address.c_str()] onPort:g_server_port withMode:g_mode withTimeout: g_universal_timeout];
+ [gp_xbmchelper connectToServer:[NSString stringWithUTF8String:g_server_address.c_str()] onPort:g_server_port withMode:g_mode withTimeout: g_universal_timeout];
}
//----------------------------------------------------------------------------
@@ -215,32 +215,32 @@ void Reconfigure(int nSignal)
//----------------------------------------------------------------------------
int main (int argc, char * argv[]) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
-
+
int instanceLockFile = open("/tmp/xbmchelper.lock", O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
if (flock(instanceLockFile, LOCK_EX | LOCK_NB) != 0)
{
NSLog(@"Already running - exiting ...");
return 0;
}
-
+
ParseOptions(argc,argv);
NSLog(@"%s %s starting up...", PROGNAME, PROGVERS);
- gp_xbmchelper = [[XBMCHelper alloc] init];
+ gp_xbmchelper = [[XBMCHelper alloc] init];
if(gp_xbmchelper){
signal(SIGHUP, Reconfigure);
signal(SIGINT, Reconfigure);
signal(SIGTERM, Reconfigure);
-
+
ConfigureHelper();
-
+
//run event loop in this thread
RunCurrentEventLoop(kEventDurationForever);
NSLog(@"%s %s exiting...", PROGNAME, PROGVERS);
//cleanup
- [gp_xbmchelper release];
+ [gp_xbmchelper release];
} else {
- NSLog(@"%s %s failed to initialize remote.", PROGNAME, PROGVERS);
+ NSLog(@"%s %s failed to initialize remote.", PROGNAME, PROGVERS);
return -1;
}
[pool drain];
diff --git a/tools/EventClients/Clients/PS3SixaxisController/ps3d.py b/tools/EventClients/Clients/PS3SixaxisController/ps3d.py
index 254a17961c..f961cf8d33 100755
--- a/tools/EventClients/Clients/PS3SixaxisController/ps3d.py
+++ b/tools/EventClients/Clients/PS3SixaxisController/ps3d.py
@@ -261,7 +261,7 @@ class SixWatch(threading.Thread):
class ZeroconfThread ( threading.Thread ):
"""
-
+
"""
def __init__(self):
threading.Thread.__init__(self)
diff --git a/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp b/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp
index 825bce4f6c..d18ae8a015 100644
--- a/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp
+++ b/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.cpp
@@ -59,20 +59,20 @@ void CWiiRemote::MessageCallback(cwiid_wiimote_t *wiiremote, int mesg_count, uni
#endif
/* The MessageCallback for the Wiiremote.
- This callback is used for error reports, mainly to see if the connection has been broken
+ This callback is used for error reports, mainly to see if the connection has been broken
This callback is also used for getting the IR sources, if this is done in update as with buttons we usually only get 1 IR source at a time wich is much harder to calculate */
void CWiiRemote::MessageCallback(cwiid_wiimote_t *wiiremote, int mesg_count, union cwiid_mesg mesg[], struct timespec *timestamp)
{
for (int i=0; i < mesg_count; i++)
{
int valid_source;
- switch (mesg[i].type)
+ switch (mesg[i].type)
{
case CWIID_MESG_IR:
valid_source = 0;
- for (int j = 0; j < CWIID_IR_SRC_COUNT; j++)
+ for (int j = 0; j < CWIID_IR_SRC_COUNT; j++)
{
- if (mesg[i].ir_mesg.src[j].valid)
+ if (mesg[i].ir_mesg.src[j].valid)
valid_source++;
}
if (valid_source == 2)
@@ -87,7 +87,7 @@ void CWiiRemote::MessageCallback(cwiid_wiimote_t *wiiremote, int mesg_count, uni
g_WiiRemote.CalculateMousePointer(mesg[i].ir_mesg.src[0].pos[CWIID_X],
mesg[i].ir_mesg.src[0].pos[CWIID_Y],
mesg[i].ir_mesg.src[1].pos[CWIID_X],
- mesg[i].ir_mesg.src[1].pos[CWIID_Y]);
+ mesg[i].ir_mesg.src[1].pos[CWIID_Y]);
}
break;
case CWIID_MESG_ERROR:
@@ -95,7 +95,7 @@ void CWiiRemote::MessageCallback(cwiid_wiimote_t *wiiremote, int mesg_count, uni
break;
case CWIID_MESG_BTN:
g_WiiRemote.ProcessKey(mesg[i].btn_mesg.buttons);
- break;
+ break;
case CWIID_MESG_STATUS:
//Here we can figure out Extension types and such
break;
@@ -227,13 +227,13 @@ void CWiiRemote::Initialize(CAddress Addr, int Socket)
ToggleBit(m_rptMode, CWIID_RPT_NUNCHUK);
//If wiiremote is used as a mouse, then report the IR sources
-#ifndef CWIID_OLD
- if (m_useIRMouse)
+#ifndef CWIID_OLD
+ if (m_useIRMouse)
#endif
- ToggleBit(m_rptMode, CWIID_RPT_IR);
+ ToggleBit(m_rptMode, CWIID_RPT_IR);
//Have the first and fourth LED on the Wiiremote shine when connected
- ToggleBit(m_ledState, CWIID_LED1_ON);
+ ToggleBit(m_ledState, CWIID_LED1_ON);
ToggleBit(m_ledState, CWIID_LED4_ON);
}
@@ -267,9 +267,9 @@ void CWiiRemote::EnableMouseEmulation()
m_useIRMouse = true;
#ifndef CWIID_OLD
- //We toggle IR Reporting (Save resources?)
+ //We toggle IR Reporting (Save resources?)
if (!(m_rptMode & CWIID_RPT_IR))
- ToggleBit(m_rptMode, CWIID_RPT_IR);
+ ToggleBit(m_rptMode, CWIID_RPT_IR);
if (m_connected)
SetRptMode();
#endif
@@ -285,7 +285,7 @@ void CWiiRemote::DisableMouseEmulation()
m_useIRMouse = false;
#ifndef CWIID_OLD
- //We toggle IR Reporting (Save resources?)
+ //We toggle IR Reporting (Save resources?)
if (m_rptMode & CWIID_RPT_IR)
ToggleBit(m_rptMode, CWIID_RPT_IR);
if (m_connected)
@@ -308,18 +308,18 @@ void CWiiRemote::Disconnect()
if (m_connected)
m_DisconnectWhenPossible = true;
}
-
-#ifdef CWIID_OLD
+
+#ifdef CWIID_OLD
/* This function is mostly a hack as CWIID < 6.0 doesn't report on disconnects, this function is called everytime
a message is sent to the callback (Will be once every 10 ms or so) this is to see if the connection is interrupted. */
void CWiiRemote::CheckIn()
{ //This is always called from a criticalsection
m_LastMsgTime = getTicks();
-}
-#endif
+}
+#endif
//---------------------Private-------------------------------------------------------------------
-/* Connect is designed to be run in a different thread as it only
+/* Connect is designed to be run in a different thread as it only
exits if wiiremote is either disabled or a connection is made*/
bool CWiiRemote::Connect()
{
@@ -356,10 +356,10 @@ bool CWiiRemote::Connect()
notification.Send(m_Socket, m_MyAddr);
}
#ifdef CWIID_OLD
- /* CheckIn to say that this is the last msg, If this isn't called it could give issues if we Connects -> Disconnect and then try to connect again
+ /* CheckIn to say that this is the last msg, If this isn't called it could give issues if we Connects -> Disconnect and then try to connect again
the CWIID_OLD hack would automatically disconnect the wiiremote as the lastmsg is too old. */
CheckIn();
-#endif
+#endif
m_connected = true;
CPacketLOG log(LOGNOTICE, "Successfully connected a WiiRemote");
@@ -397,7 +397,7 @@ void CWiiRemote::DisconnectNow(bool startConnectThread)
}
#ifdef CWIID_OLD
-/* This is a harsh check if there really is a connection, It will mainly be used in CWIID < 6.0
+/* This is a harsh check if there really is a connection, It will mainly be used in CWIID < 6.0
as it doesn't report connect error, wich is needed to see if the Wiiremote suddenly disconnected.
This could possible be done with bluetooth specific queries but I cannot find how to do it. */
bool CWiiRemote::CheckConnection()
@@ -451,7 +451,7 @@ void CWiiRemote::ProcessKey(int Key)
}
else
{
- if (getTicks() - m_lastKeyPressed > WIIREMOTE_BUTTON_DELAY_TIME)
+ if (getTicks() - m_lastKeyPressed > WIIREMOTE_BUTTON_DELAY_TIME)
{
m_buttonRepeat = true;
m_lastKeyPressed = getTicks();
@@ -471,12 +471,12 @@ void CWiiRemote::ProcessKey(int Key)
RtnKey = 3;
else if (Key == CWIID_BTN_DOWN)
RtnKey = 2;
-
+
else if (Key == CWIID_BTN_A)
RtnKey = 5;
else if (Key == CWIID_BTN_B)
RtnKey = 6;
-
+
else if (Key == CWIID_BTN_MINUS)
RtnKey = 7;
else if (Key == CWIID_BTN_PLUS)
@@ -484,7 +484,7 @@ void CWiiRemote::ProcessKey(int Key)
else if (Key == CWIID_BTN_HOME)
RtnKey = 8;
-
+
else if (Key == CWIID_BTN_1)
RtnKey = 10;
else if (Key == CWIID_BTN_2)
@@ -546,7 +546,7 @@ void CWiiRemote::ProcessNunchuck(struct cwiid_nunchuk_mesg &Nunchuck)
}
else
{
- if (getTicks() - m_lastKeyPressedNunchuck > WIIREMOTE_BUTTON_DELAY_TIME)
+ if (getTicks() - m_lastKeyPressedNunchuck > WIIREMOTE_BUTTON_DELAY_TIME)
{
m_buttonRepeatNunchuck = true;
m_lastKeyPressedNunchuck = getTicks();
@@ -575,7 +575,7 @@ void CWiiRemote::SetRptMode()
{ //Sets our wiiremote to report something, for example IR, Buttons
#ifdef CWIID_OLD
if (cwiid_command(m_wiiremoteHandle, CWIID_CMD_RPT_MODE, m_rptMode))
-#else
+#else
if (cwiid_set_rpt_mode(m_wiiremoteHandle, m_rptMode))
#endif
{
@@ -588,7 +588,7 @@ void CWiiRemote::SetLedState()
{ //Sets our leds on the wiiremote
#ifdef CWIID_OLD
if (cwiid_command(m_wiiremoteHandle, CWIID_CMD_LED, m_ledState))
-#else
+#else
if (cwiid_set_led(m_wiiremoteHandle, m_ledState))
#endif
{
@@ -749,7 +749,7 @@ int main(int argc, char **argv)
g_WiiRemote.EnableMouseEmulation();
else
g_WiiRemote.DisableMouseEmulation();
-
+
g_Ping->Send(sockfd, my_addr);
bool HaveConnected = false;
while (true)
diff --git a/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.h b/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.h
index 003f40f18d..58d051e1d2 100644
--- a/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.h
+++ b/tools/EventClients/Clients/WiiRemote/CWIID_WiiRemote.h
@@ -70,13 +70,13 @@ class CWiiRemote
public:
CWiiRemote(char *btaddr = NULL);
~CWiiRemote();
-
+
void Initialize(CAddress Addr, int Socket);
- void Disconnect();
+ void Disconnect();
bool GetConnected();
bool EnableWiiRemote();
- bool DisableWiiRemote();
+ bool DisableWiiRemote();
void Update();
@@ -86,7 +86,7 @@ public:
void EnableMouseEmulation();
void DisableMouseEmulation();
- bool Connect();
+ bool Connect();
void SetBluetoothAddress(const char * btaddr);
void SetSensitivity(float DeadX, float DeadY, int Samples);
@@ -103,7 +103,7 @@ private:
#ifdef CWIID_OLD
bool CheckConnection();
int m_LastMsgTime;
-#endif
+#endif
char *m_JoyMap;
int m_lastKeyPressed;
int m_LastKey;
@@ -117,12 +117,12 @@ private:
void SetLedState();
void SetupWiiRemote();
-
+
bool m_connected;
bool m_DisconnectWhenPossible;
bool m_connectThreadRunning;
-
+
//CWIID Specific
cwiid_wiimote_t *m_wiiremoteHandle;
unsigned char m_ledState;
@@ -141,25 +141,25 @@ private:
int m_Socket;
CAddress m_MyAddr;
-
- // Mouse
+
+ // Mouse
bool m_haveIRSources;
bool m_isActive;
bool m_useIRMouse;
int m_lastActiveTime;
-
-/* The protected functions is for the static callbacks */
+
+/* The protected functions is for the static callbacks */
protected:
//Connection
void DisconnectNow(bool startConnectThread);
-
+
//Mouse
void CalculateMousePointer(int x1, int y1, int x2, int y2);
// void SetIR(bool set);
-
+
//Button
void ProcessKey(int Key);
-
+
//Nunchuck
void ProcessNunchuck(struct cwiid_nunchuk_mesg &Nunchuck);
#ifdef CWIID_OLD
diff --git a/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.cpp b/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.cpp
index e24c8ed2c9..48f5a1a947 100644
--- a/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.cpp
+++ b/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.cpp
@@ -39,11 +39,11 @@ void CWiiController::get_keys(wiimote* wm)
}
}
-void CWiiController::handleKeyPress()
+void CWiiController::handleKeyPress()
{
if ((m_holdableReleased && m_buttonDownTime < g_hold_button_timeout))
EventClient.SendButton(m_buttonReleased, m_joyString, BTN_QUEUE | BTN_NO_REPEAT);
- if (m_buttonPressed && !m_holdableHeld && !m_buttonHeld)
+ if (m_buttonPressed && !m_holdableHeld && !m_buttonHeld)
EventClient.SendButton(m_buttonPressed, m_joyString, BTN_QUEUE | BTN_NO_REPEAT);
}
@@ -66,7 +66,7 @@ void CWiiController::handleACC(float currentRoll, float currentPitch)
if (rollWeight > 65000)
rollWeight = 65000;
- if (m_start_pitch == 0)
+ if (m_start_pitch == 0)
m_start_pitch = currentPitch;
m_abs_pitch = smoothDeg(m_abs_pitch, currentPitch);
m_rel_pitch = m_start_pitch - m_abs_pitch;
@@ -81,7 +81,7 @@ void CWiiController::handleACC(float currentRoll, float currentPitch)
{
m_currentAction = ACTION_ROLL;
}
- else if ((g_deadzone - (abs((int)m_rel_pitch)) < 5) && (abs((int)m_abs_roll) < (g_deadzone / 1.5)))
+ else if ((g_deadzone - (abs((int)m_rel_pitch)) < 5) && (abs((int)m_abs_roll) < (g_deadzone / 1.5)))
// crossed the pitch deadzone threshold while inside the roll deadzone
{
m_currentAction = ACTION_PITCH;
@@ -126,7 +126,7 @@ int connectWiimote(wiimote** wiimotes)
wm = wiimotes[0];
if (connected)
{
- EventClient.SendHELO("Wii Remote", ICON_PNG, NULL);
+ EventClient.SendHELO("Wii Remote", ICON_PNG, NULL);
wiiuse_set_leds(wm, WIIMOTE_LED_1);
wiiuse_rumble(wm, 1);
wiiuse_set_orient_threshold(wm,1);
@@ -193,7 +193,7 @@ int32_t getTicks(void)
return ticks;
}
-int main(int argc, char** argv)
+int main(int argc, char** argv)
{
int32_t timeout = 0;
bool connected = 0;
@@ -217,13 +217,13 @@ int main(int argc, char** argv)
if ((controller.m_buttonDownTime > g_repeat_rate) && controller.m_repeatableHeld)
controller.handleRepeat();
}
- if (wiiuse_poll(wiimotes, MAX_WIIMOTES))
+ if (wiiuse_poll(wiimotes, MAX_WIIMOTES))
{
for (int i = 0; i < MAX_WIIMOTES; ++i)
//MAX_WIIMOTES hardcoded at 1.
{
DisableMotionSensing(wm);
- switch (wiimotes[i]->event)
+ switch (wiimotes[i]->event)
{
case WIIUSE_EVENT:
diff --git a/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.h b/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.h
index d231436546..7226137364 100644
--- a/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.h
+++ b/tools/EventClients/Clients/WiiRemote/WiiUse_WiiRemote.h
@@ -48,11 +48,11 @@
#define WIIMOTE_BUTTON_DOWN 0x0400
#define WIIMOTE_BUTTON_UP 0x0800
#define WIIMOTE_BUTTON_PLUS 0x1000
-
+
#define WIIMOTE_NUM_BUTTONS 11
#define KEYCODE_BUTTON_UP 1
#define KEYCODE_BUTTON_DOWN 2
-#define KEYCODE_BUTTON_LEFT 3
+#define KEYCODE_BUTTON_LEFT 3
#define KEYCODE_BUTTON_RIGHT 4
#define KEYCODE_BUTTON_A 5
#define KEYCODE_BUTTON_B 6
@@ -95,7 +95,7 @@ class CWiiController{
float m_start_roll;
float m_start_pitch;
char* m_joyString;
-
+
void get_keys(wiimote* wm);
void handleKeyPress();
diff --git a/tools/EventClients/Clients/WiiRemote/wiiuse_v0.12/LICENSE_noncommercial b/tools/EventClients/Clients/WiiRemote/wiiuse_v0.12/LICENSE_noncommercial
index b556a2278c..ea8fae6d14 100644
--- a/tools/EventClients/Clients/WiiRemote/wiiuse_v0.12/LICENSE_noncommercial
+++ b/tools/EventClients/Clients/WiiRemote/wiiuse_v0.12/LICENSE_noncommercial
@@ -15,7 +15,7 @@ in works that are PROPRIETARY.
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
- 0. Additional Definitions.
+ 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
@@ -116,7 +116,7 @@ the following:
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
- Version.
+ Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
diff --git a/tools/EventClients/Clients/Xbox360Controller/Xbox360EventClient.cpp b/tools/EventClients/Clients/Xbox360Controller/Xbox360EventClient.cpp
index 077914f446..106befba98 100644
--- a/tools/EventClients/Clients/Xbox360Controller/Xbox360EventClient.cpp
+++ b/tools/EventClients/Clients/Xbox360Controller/Xbox360EventClient.cpp
@@ -102,7 +102,7 @@ void checkAll(Xbox360Controller &cont)
checkThumb(cont, client, 1, "leftthumbstickdown", "leftthumbstickup");
checkThumb(cont, client, 2, "rightthumbstickleft", "rightthumbstickright");
checkThumb(cont, client, 3, "rightthumbstickdown", "rightthumbstickup");
- }
+ }
}
int main(int argc, char* argv[])
diff --git a/tools/EventClients/Clients/Xbox360Controller/targetver.h b/tools/EventClients/Clients/Xbox360Controller/targetver.h
index 6fe8eb79e1..5697f1a757 100644
--- a/tools/EventClients/Clients/Xbox360Controller/targetver.h
+++ b/tools/EventClients/Clients/Xbox360Controller/targetver.h
@@ -1,8 +1,8 @@
#pragma once
// The following macros define the minimum required platform. The minimum required platform
-// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
-// your application. The macros work by enabling all features available on platform versions up to and
+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
+// your application. The macros work by enabling all features available on platform versions up to and
// including the version specified.
// Modify the following defines if you have to target a platform prior to the ones specified below.
diff --git a/tools/EventClients/examples/java/XBMCDemoClient1.java b/tools/EventClients/examples/java/XBMCDemoClient1.java
index 0be3865cbd..922d4d64ed 100644
--- a/tools/EventClients/examples/java/XBMCDemoClient1.java
+++ b/tools/EventClients/examples/java/XBMCDemoClient1.java
@@ -22,23 +22,23 @@ public class XBMCDemoClient1 {
Thread.sleep(20000);
XBMCClient oXBMCClient = new XBMCClient(host, 9777, "My Client", "/usr/share/xbmc/media/icon.png");
-
+
Thread.sleep(7000);
-
+
oXBMCClient.sendNotification("My Title", "My Message");
-
-
+
+
Thread.sleep(7000);
oXBMCClient.sendButton("KB", "escape", false, true, false, (short)0 , (byte)0);
-
+
Thread.sleep(7000);
oXBMCClient.sendButton("KB", "escape", true, true, false, (short)0 , (byte)0);
oXBMCClient.sendNotification("My Title", "Escape sent");
-
+
Thread.sleep(1000);
-
+
oXBMCClient.sendButton("KB", "escape", true, false, false, (short)0 , (byte)0);
oXBMCClient.sendNotification("My Title", "Escape released");
@@ -46,7 +46,7 @@ public class XBMCDemoClient1 {
oXBMCClient.sendLog((byte)0, "My Client disconnects....");
oXBMCClient.sendNotification("My Title", "Client will disconnect");
oXBMCClient.stopClient();
-
+
}
}
diff --git a/tools/EventClients/examples/python/example_action.py b/tools/EventClients/examples/python/example_action.py
index 6de0bb3825..16b270c235 100755
--- a/tools/EventClients/examples/python/example_action.py
+++ b/tools/EventClients/examples/python/example_action.py
@@ -13,7 +13,7 @@ def main():
host = "localhost"
port = 9777
-
+
# Create an XBMCClient object and connect
xbmc = XBMCClient("Example Remote", "../../icons/bluetooth.png")
xbmc.connect()
@@ -28,7 +28,7 @@ def main():
except Exception as e:
print(str(e))
xbmc.send_action("ActivateWindow(ShutdownMenu)")
-
+
# ok we're done, close the connection
# Note that closing the connection clears any repeat key that is
diff --git a/tools/EventClients/examples/python/example_button2.py b/tools/EventClients/examples/python/example_button2.py
index b420bd84b8..e2ec759bb4 100755
--- a/tools/EventClients/examples/python/example_button2.py
+++ b/tools/EventClients/examples/python/example_button2.py
@@ -61,7 +61,7 @@ def main():
# doesn't matter.
packet = PacketBUTTON(code=0x28, down=0)
packet.send(sock, addr)
-
+
# ok we're done, close the connection
# Note that closing the connection clears any repeat key that is
# active. So in this example, the actual release button event above
diff --git a/tools/EventClients/examples/python/example_notification.py b/tools/EventClients/examples/python/example_notification.py
index 81bbadccd2..72c0bbcb8d 100755
--- a/tools/EventClients/examples/python/example_notification.py
+++ b/tools/EventClients/examples/python/example_notification.py
@@ -13,26 +13,26 @@ from socket import *
def main():
import time
import sys
-
+
host = "localhost"
port = 9777
addr = (host, port)
sock = socket(AF_INET,SOCK_DGRAM)
-
+
packet = PacketHELO("Email Notifier", ICON_NONE)
packet.send(sock, addr)
# wait for 5 seconds
time.sleep (5)
-
+
packet = PacketNOTIFICATION("New Mail!", # caption
"RE: Check this out", # message
ICON_PNG, # optional icon type
"../../icons/mail.png") # icon file (local)
packet.send(sock, addr)
-
+
packet = PacketBYE()
packet.send(sock, addr)
-
+
if __name__=="__main__":
main()
diff --git a/tools/EventClients/examples/python/example_simple.py b/tools/EventClients/examples/python/example_simple.py
index 6218131e13..f28b002841 100755
--- a/tools/EventClients/examples/python/example_simple.py
+++ b/tools/EventClients/examples/python/example_simple.py
@@ -13,7 +13,7 @@ def main():
host = "localhost"
port = 9777
-
+
# Create an XBMCClient object and connect
xbmc = XBMCClient("Example Remote", "../../icons/bluetooth.png")
xbmc.connect()
diff --git a/tools/EventClients/lib/c++/xbmcclient.h b/tools/EventClients/lib/c++/xbmcclient.h
index b6465af6ce..59e3f15297 100644
--- a/tools/EventClients/lib/c++/xbmcclient.h
+++ b/tools/EventClients/lib/c++/xbmcclient.h
@@ -103,7 +103,7 @@ public:
CAddress(const char *Address, int Port = STD_PORT)
{
m_Addr.sin_port = htons(Port);
-
+
struct hostent *h;
if (Address == NULL || (h=gethostbyname(Address)) == NULL)
{
@@ -329,7 +329,7 @@ public:
unsigned int len = strlen(DevName);
for (unsigned int i = 0; i < len; i++)
- m_DeviceName.push_back(DevName[i]);
+ m_DeviceName.push_back(DevName[i]);
m_IconType = IconType;
@@ -647,7 +647,7 @@ public:
m_Payload.push_back(((m_Y & 0xff00) >> 8));
m_Payload.push_back( (m_Y & 0x00ff));
}
-
+
virtual ~CPacketMOUSE()
{ }
};
@@ -692,7 +692,7 @@ public:
m_Payload.push_back('\0');
}
-
+
virtual ~CPacketLOG()
{ }
};
@@ -728,7 +728,7 @@ public:
m_Payload.push_back('\0');
}
-
+
virtual ~CPacketACTION()
{ }
};
diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/Packet.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/Packet.java
index f9c9041ba3..09507cbe1b 100644
--- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/Packet.java
+++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/Packet.java
@@ -73,15 +73,15 @@ import java.net.InetAddress;
*
*/
public abstract class Packet {
-
+
private byte[] sig;
private byte[] payload = new byte[0];
private byte minver;
private byte majver;
-
- private short packettype;
-
-
+
+ private short packettype;
+
+
private final static short MAX_PACKET_SIZE = 1024;
private final static short HEADER_SIZE = 32;
private final static short MAX_PAYLOAD_SIZE = MAX_PACKET_SIZE - HEADER_SIZE;
@@ -102,16 +102,16 @@ public abstract class Packet {
public final static byte ICON_JPEG = 0x01;
public final static byte ICON_PNG = 0x02;
public final static byte ICON_GIF = 0x03;
-
+
private static int uid = (int)(Math.random()*Integer.MAX_VALUE);
-
+
/**
* This is an Abstract class and cannot be instanced. Please use one of the Packet implementation Classes
- * (PacketXXX).
- *
+ * (PacketXXX).
+ *
* Implements an XBMC Event Client Packet. Type is to be specified at creation time, Payload can be added
* with the various appendPayload methods. Packet can be sent through UDP-Socket with method "send".
- * @param packettype Type of Packet (PT_XXX)
+ * @param packettype Type of Packet (PT_XXX)
*/
protected Packet(short packettype)
{
@@ -122,7 +122,7 @@ public abstract class Packet {
}
/**
- * Appends a String to the payload (terminated with 0x00)
+ * Appends a String to the payload (terminated with 0x00)
* @param payload Payload as String
*/
protected void appendPayload(String payload)
@@ -172,7 +172,7 @@ public abstract class Packet {
protected void appendPayload(short s) {
appendPayload(shortToByteArray(s));
}
-
+
/**
* Get Number of Packets which will be sent with current Payload...
* @return Number of Packets
@@ -181,7 +181,7 @@ public abstract class Packet {
{
return (int)((payload.length + (MAX_PAYLOAD_SIZE - 1)) / MAX_PAYLOAD_SIZE);
}
-
+
/**
* Get Header for a specific Packet in this sequence...
* @param seq Current sequence number
@@ -207,10 +207,10 @@ public abstract class Packet {
System.arraycopy(uid, 0, header, 18, 4);
byte[] reserved = new byte[10];
System.arraycopy(reserved, 0, header, 22, 10);
-
+
return header;
}
-
+
/**
* Generates the whole UDP-Message with Header and Payload of a specific Packet in sequence
* @param seq Current sequence number
@@ -221,23 +221,23 @@ public abstract class Packet {
int maxseq = (int)((payload.length + (MAX_PAYLOAD_SIZE - 1)) / MAX_PAYLOAD_SIZE);
if(seq > maxseq)
return null;
-
+
short actpayloadsize;
-
+
if(seq == maxseq)
actpayloadsize = (short)(payload.length%MAX_PAYLOAD_SIZE);
-
+
else
actpayloadsize = (short)MAX_PAYLOAD_SIZE;
byte[] pack = new byte[HEADER_SIZE+actpayloadsize];
-
+
System.arraycopy(getHeader(seq, maxseq, actpayloadsize), 0, pack, 0, HEADER_SIZE);
System.arraycopy(payload, (seq-1)*MAX_PAYLOAD_SIZE, pack, HEADER_SIZE, actpayloadsize);
-
+
return pack;
}
-
+
/**
* Sends this packet to the EventServer
* @param adr Address of the EventServer
@@ -248,7 +248,7 @@ public abstract class Packet {
{
int maxseq = getNumPackets();
DatagramSocket s = new DatagramSocket();
-
+
// For each Packet in Sequence...
for(int seq=1;seq<=maxseq;seq++)
{
@@ -260,7 +260,7 @@ public abstract class Packet {
s.send(p);
}
}
-
+
/**
* Helper Method to convert an integer to a Byte array
* @param value
@@ -285,5 +285,5 @@ public abstract class Packet {
(byte)value};
}
-
+
}
diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketACTION.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketACTION.java
index 878710c3a9..eb597a21bf 100644
--- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketACTION.java
+++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketACTION.java
@@ -19,18 +19,18 @@
package org.xbmc.eventclient;
/**
* XBMC Event Client Class
- *
+ *
* An ACTION packet tells XBMC to do the action specified, based on the type it knows were it needs to be sent.
* The idea is that this will be as in scripting/skining and keymapping, just triggered from afar.
* @author Stefan Agner
*
*/
public class PacketACTION extends Packet {
-
+
public final static byte ACTION_EXECBUILTIN = 0x01;
public final static byte ACTION_BUTTON = 0x02;
-
+
/**
* An ACTION packet tells XBMC to do the action specified, based on the type it knows were it needs to be sent.
* @param actionmessage Actionmessage (as in scripting/skinning)
@@ -52,7 +52,7 @@ public class PacketACTION extends Packet {
super(PT_ACTION);
appendPayload(actionmessage, actiontype);
}
-
+
private void appendPayload(String actionmessage, byte actiontype)
{
appendPayload(actiontype);
diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBUTTON.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBUTTON.java
index b4ba1bbff2..de25a2c96d 100644
--- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBUTTON.java
+++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBUTTON.java
@@ -19,13 +19,13 @@
package org.xbmc.eventclient;
/**
* XBMC Event Client Class
- *
+ *
* A button packet send a key press or release event to XBMC
* @author Stefan Agner
*
*/
public class PacketBUTTON extends Packet {
-
+
protected final static byte BT_USE_NAME = 0x01;
protected final static byte BT_DOWN = 0x02;
protected final static byte BT_UP = 0x04;
@@ -44,12 +44,12 @@ public class PacketBUTTON extends Packet {
* @param down if this is 1, it implies a press event, 0 implies a release
* event. (default: 1)
* @param queue a queued key press means that the button event is
- * executed just once after which the next key press is processed.
+ * executed just once after which the next key press is processed.
* It can be used for macros. Currently there is no support for
* time delays between queued presses. (default: 0)
* @param amount unimplemented for now; in the future it will be used for
* specifying magnitude of analog key press events
- * @param axis
+ * @param axis
*/
public PacketBUTTON(short code, boolean repeat, boolean down, boolean queue, short amount, byte axis)
{
@@ -59,7 +59,7 @@ public class PacketBUTTON extends Packet {
short flags = 0;
appendPayload(code, map_name, button_name, repeat, down, queue, amount, axis, flags);
}
-
+
/**
* A button packet send a key press or release event to XBMC
* @param map_name a combination of map_name and button_name refers to a
@@ -73,19 +73,19 @@ public class PacketBUTTON extends Packet {
* <li>"LI:devicename" => LIRC remote map where 'devicename' is the
* actual device's name</li></ul>
* @param button_name a button name defined in the map specified in map_name.
- * For example, if map_name is "KB" referring to the <keyboard> section in Keymap.xml
+ * For example, if map_name is "KB" referring to the <keyboard> section in Keymap.xml
* then, valid button_names include "printscreen", "minus", "x", etc.
* @param repeat this key press should repeat until released (default: 1)
* Note that queued pressed cannot repeat.
* @param down if this is 1, it implies a press event, 0 implies a release
* event. (default: 1)
* @param queue a queued key press means that the button event is
- * executed just once after which the next key press is processed.
+ * executed just once after which the next key press is processed.
* It can be used for macros. Currently there is no support for
* time delays between queued presses. (default: 0)
* @param amount unimplemented for now; in the future it will be used for
* specifying magnitude of analog key press events
- * @param axis
+ * @param axis
*/
public PacketBUTTON(String map_name, String button_name, boolean repeat, boolean down, boolean queue, short amount, byte axis)
{
@@ -94,7 +94,7 @@ public class PacketBUTTON extends Packet {
short flags = BT_USE_NAME;
appendPayload(code, map_name, button_name, repeat, down, queue, amount, axis, flags);
}
-
+
/**
* Appends Payload for a Button Packet (this method is used by the different Constructors of this Packet)
* @param code raw button code (default: 0)
@@ -109,19 +109,19 @@ public class PacketBUTTON extends Packet {
* <li>"LI:devicename" => LIRC remote map where 'devicename' is the
* actual device's name</li></ul>
* @param button_name a button name defined in the map specified in map_name.
- * For example, if map_name is "KB" referring to the <keyboard> section in Keymap.xml
+ * For example, if map_name is "KB" referring to the <keyboard> section in Keymap.xml
* then, valid button_names include "printscreen", "minus", "x", etc.
* @param repeat this key press should repeat until released (default: 1)
* Note that queued pressed cannot repeat.
* @param down if this is 1, it implies a press event, 0 implies a release
* event. (default: 1)
* @param queue a queued key press means that the button event is
- * executed just once after which the next key press is processed.
+ * executed just once after which the next key press is processed.
* It can be used for macros. Currently there is no support for
* time delays between queued presses. (default: 0)
* @param amount unimplemented for now; in the future it will be used for
* specifying magnitude of analog key press events
- * @param axis
+ * @param axis
* @param flags Packet specific flags
*/
private void appendPayload(short code, String map_name, String button_name, boolean repeat, boolean down, boolean queue, short amount, byte axis, short flags)
@@ -130,24 +130,24 @@ public class PacketBUTTON extends Packet {
flags |= BT_USE_AMOUNT;
else
amount = 0;
-
+
if(down)
flags |= BT_DOWN;
else
flags |= BT_UP;
-
+
if(!repeat)
flags |= BT_NO_REPEAT;
-
+
if(queue)
flags |= BT_QUEUE;
-
+
if(axis == 1)
flags |= BT_AXISSINGLE;
else if (axis == 2)
flags |= BT_AXIS;
-
+
appendPayload(code);
appendPayload(flags);
appendPayload(amount);
diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBYE.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBYE.java
index b8b8944053..e63a2c6c3b 100644
--- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBYE.java
+++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketBYE.java
@@ -19,12 +19,12 @@
package org.xbmc.eventclient;
/**
* XBMC Event Client Class
- *
+ *
* A BYE packet terminates the connection to XBMC.
* @author Stefan Agner
*
*/
-public class PacketBYE extends Packet
+public class PacketBYE extends Packet
{
/**
diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketHELO.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketHELO.java
index cbcd56e745..95e8fa9891 100644
--- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketHELO.java
+++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketHELO.java
@@ -21,15 +21,15 @@ import java.nio.charset.Charset;
/**
* XBMC Event Client Class
- *
+ *
* A HELO packet establishes a valid connection to XBMC. It is the
* first packet that should be sent.
* @author Stefan Agner
*
*/
public class PacketHELO extends Packet {
-
-
+
+
/**
* A HELO packet establishes a valid connection to XBMC.
* @param devicename Name of the device which connects to XBMC
@@ -60,5 +60,5 @@ public class PacketHELO extends Packet {
this.appendPayload(0); // reserved2
this.appendPayload(iconData); // reserved2
}
-
+
}
diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketLOG.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketLOG.java
index afebce0048..b0d59bb591 100644
--- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketLOG.java
+++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketLOG.java
@@ -19,13 +19,13 @@
package org.xbmc.eventclient;
/**
* XBMC Event Client Class
- *
+ *
* A LOG packet tells XBMC to log the message to xbmc.log with the loglevel as specified.
* @author Stefan Agner
*
*/
public class PacketLOG extends Packet {
-
+
/**
* A LOG packet tells XBMC to log the message to xbmc.log with the loglevel as specified.
* @param loglevel the loglevel, follows XBMC standard.
diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketMOUSE.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketMOUSE.java
index 6c865ec7c4..816e1a72f8 100644
--- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketMOUSE.java
+++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketMOUSE.java
@@ -19,13 +19,13 @@
package org.xbmc.eventclient;
/**
* XBMC Event Client Class
- *
+ *
* A MOUSE packets sets the mouse position in XBMC
* @author Stefan Agner
*
*/
public class PacketMOUSE extends Packet {
-
+
protected final static byte MS_ABSOLUTE = 0x01;
/**
diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketNOTIFICATION.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketNOTIFICATION.java
index 3b8c96e8ff..7089ad6946 100644
--- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketNOTIFICATION.java
+++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketNOTIFICATION.java
@@ -19,7 +19,7 @@
package org.xbmc.eventclient;
/**
* XBMC Event Client Class
- *
+ *
* This packet displays a notification window in XBMC. It can contain
* a caption, a message and an icon.
* @author Stefan Agner
@@ -39,7 +39,7 @@ public class PacketNOTIFICATION extends Packet {
super(PT_NOTIFICATION);
appendPayload(title, message, iconType, iconData);
}
-
+
/**
* This packet displays a notification window in XBMC.
* @param title Message title
@@ -66,6 +66,6 @@ public class PacketNOTIFICATION extends Packet {
appendPayload(0); // reserved
if(iconData!=null)
appendPayload(iconData);
-
+
}
}
diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketPING.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketPING.java
index 18e74e2da6..2afbd8d66b 100644
--- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketPING.java
+++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/PacketPING.java
@@ -19,7 +19,7 @@
package org.xbmc.eventclient;
/**
* XBMC Event Client Class
- *
+ *
* A PING packet tells XBMC that the client is still alive. All valid
* packets act as ping (not just this one). A client needs to ping
* XBMC at least once in 60 seconds or it will time
diff --git a/tools/EventClients/lib/java/src/org/xbmc/eventclient/XBMCClient.java b/tools/EventClients/lib/java/src/org/xbmc/eventclient/XBMCClient.java
index 9642a6d76b..322ebf1796 100644
--- a/tools/EventClients/lib/java/src/org/xbmc/eventclient/XBMCClient.java
+++ b/tools/EventClients/lib/java/src/org/xbmc/eventclient/XBMCClient.java
@@ -24,14 +24,14 @@ import java.net.InetAddress;
/**
* XBMC Event Client Class
- *
+ *
* Implements an XBMC-Client. This class can be used to implement your own application which
* should act as a Input device for XBMC. Also starts a Ping-Thread, which tells the XBMC EventServer
- * that the client is alive. Therefore if you close your application you SHOULD call stopClient()!
+ * that the client is alive. Therefore if you close your application you SHOULD call stopClient()!
* @author Stefan Agner
*
*/
-public class XBMCClient
+public class XBMCClient
{
private boolean hasIcon = false;
private String deviceName;
@@ -40,9 +40,9 @@ public class XBMCClient
private byte[] iconData;
private InetAddress hostAddress;
private int hostPort;
-
+
/**
- * Starts a XBMC EventClient.
+ * Starts a XBMC EventClient.
* @param hostAddress Address of the Host running XBMC
* @param hostPort Port of the Host running XBMC (default 9777)
* @param deviceName Name of the Device
@@ -64,21 +64,21 @@ public class XBMCClient
FileInputStream iconFileStream = new FileInputStream(iconFile);
byte[] iconData = new byte[iconFileStream.available()];
iconFileStream.read(iconData);
-
+
hasIcon = true;
-
+
// Call start-Method...
startClient(hostAddress, hostPort, deviceName, iconType, iconData);
}
-
+
/**
- * Starts a XBMC EventClient.
+ * Starts a XBMC EventClient.
* @param hostAddress Address of the Host running XBMC
* @param hostPort Port of the Host running XBMC (default 9777)
* @param deviceName Name of the Device
* @param iconType Type of the icon file (see Packet.ICON_PNG, Packet.ICON_JPEG or Packet.ICON_GIF)
- * @param iconData The icon itself as a Byte-Array
+ * @param iconData The icon itself as a Byte-Array
* @throws IOException
*/
public XBMCClient(InetAddress hostAddress, int hostPort, String deviceName, byte iconType, byte[] iconData) throws IOException
@@ -86,9 +86,9 @@ public class XBMCClient
hasIcon = true;
startClient(hostAddress, hostPort, deviceName, iconType, iconData);
}
-
+
/**
- * Starts a XBMC EventClient without an icon.
+ * Starts a XBMC EventClient without an icon.
* @param hostAddress Address of the Host running XBMC
* @param hostPort Port of the Host running XBMC (default 9777)
* @param deviceName Name of the Device
@@ -104,12 +104,12 @@ public class XBMCClient
/**
- * Starts a XBMC EventClient.
+ * Starts a XBMC EventClient.
* @param hostAddress Address of the Host running XBMC
* @param hostPort Port of the Host running XBMC (default 9777)
* @param deviceName Name of the Device
* @param iconType Type of the icon file (see Packet.ICON_PNG, Packet.ICON_JPEG or Packet.ICON_GIF)
- * @param iconData The icon itself as a Byte-Array
+ * @param iconData The icon itself as a Byte-Array
* @throws IOException
*/
private void startClient(InetAddress hostAddress, int hostPort, String deviceName, byte iconType, byte[] iconData) throws IOException
@@ -118,7 +118,7 @@ public class XBMCClient
this.hostAddress = hostAddress;
this.hostPort = hostPort;
this.deviceName = deviceName;
-
+
this.iconType = iconType;
this.iconData = iconData;
@@ -128,14 +128,14 @@ public class XBMCClient
p = new PacketHELO(deviceName, iconType, iconData);
else
p = new PacketHELO(deviceName);
-
+
p.send(hostAddress, hostPort);
-
+
// Start Thread (for Ping packets...)
oPingThread = new PingThread(hostAddress, hostPort, 20000);
oPingThread.start();
}
-
+
/**
* Stops the XBMC EventClient (especially the Ping-Thread)
* @throws IOException
@@ -145,11 +145,11 @@ public class XBMCClient
// Stop Ping-Thread...
oPingThread.giveup();
oPingThread.interrupt();
-
+
PacketBYE p = new PacketBYE();
p.send(hostAddress, hostPort);
}
-
+
/**
* Displays a notification window in XBMC.
@@ -174,12 +174,12 @@ public class XBMCClient
* @param down if this is 1, it implies a press event, 0 implies a release
* event. (default: 1)
* @param queue a queued key press means that the button event is
- * executed just once after which the next key press is processed.
+ * executed just once after which the next key press is processed.
* It can be used for macros. Currently there is no support for
* time delays between queued presses. (default: 0)
* @param amount unimplemented for now; in the future it will be used for
* specifying magnitude of analog key press events
- * @param axis
+ * @param axis
*/
public void sendButton(short code, boolean repeat, boolean down, boolean queue, short amount, byte axis) throws IOException
{
@@ -200,19 +200,19 @@ public class XBMCClient
* <li>"LI:devicename" => LIRC remote map where 'devicename' is the
* actual device's name</li></ul>
* @param button_name a button name defined in the map specified in map_name.
- * For example, if map_name is "KB" referring to the <keyboard> section in Keymap.xml
+ * For example, if map_name is "KB" referring to the <keyboard> section in Keymap.xml
* then, valid button_names include "printscreen", "minus", "x", etc.
* @param repeat this key press should repeat until released (default: 1)
* Note that queued pressed cannot repeat.
* @param down if this is 1, it implies a press event, 0 implies a release
* event. (default: 1)
* @param queue a queued key press means that the button event is
- * executed just once after which the next key press is processed.
+ * executed just once after which the next key press is processed.
* It can be used for macros. Currently there is no support for
* time delays between queued presses. (default: 0)
* @param amount unimplemented for now; in the future it will be used for
* specifying magnitude of analog key press events
- * @param axis
+ * @param axis
*/
public void sendButton(String map_name, String button_name, boolean repeat, boolean down, boolean queue, short amount, byte axis) throws IOException
{
@@ -230,7 +230,7 @@ public class XBMCClient
PacketMOUSE p = new PacketMOUSE(x, y);
p.send(hostAddress, hostPort);
}
-
+
/**
* Sends a ping to the XBMC EventServer
* @throws IOException
@@ -259,7 +259,7 @@ public class XBMCClient
PacketLOG p = new PacketLOG(loglevel, logmessage);
p.send(hostAddress, hostPort);
}
-
+
/**
* Tells XBMC to do the action specified, based on the type it knows were it needs to be sent.
* @param actionmessage Actionmessage (as in scripting/skinning)
@@ -269,7 +269,7 @@ public class XBMCClient
PacketACTION p = new PacketACTION(actionmessage);
p.send(hostAddress, hostPort);
}
-
+
/**
* Implements a PingThread which tells XBMC EventServer that the Client is alive (this should
* be done at least every 60 seconds!
@@ -282,7 +282,7 @@ public class XBMCClient
private int hostPort;
private int sleepTime;
private boolean giveup = false;
-
+
public PingThread(InetAddress hostAddress, int hostPort, int sleepTime)
{
super("XBMC EventClient Ping-Thread");
@@ -290,12 +290,12 @@ public class XBMCClient
this.hostPort = hostPort;
this.sleepTime = sleepTime;
}
-
+
public void giveup()
{
giveup = true;
}
-
+
public void run()
{
while(!giveup)
@@ -304,10 +304,10 @@ public class XBMCClient
PacketPING p = new PacketPING();
p.send(hostAddress, hostPort);
} catch (IOException e) {
-
+
e.printStackTrace();
}
-
+
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
diff --git a/tools/EventClients/lib/python/ps3/sixaxis.py b/tools/EventClients/lib/python/ps3/sixaxis.py
index 44489e87e8..c690283078 100644
--- a/tools/EventClients/lib/python/ps3/sixaxis.py
+++ b/tools/EventClients/lib/python/ps3/sixaxis.py
@@ -111,8 +111,8 @@ def normalize(val):
if val > upperlimit:
val = upperlimit
- val = ((float(val) - offset) / (float(upperlimit) -
- lowerlimit)) * 65535.0
+ val = ((float(val) - offset) / (float(upperlimit) -
+ lowerlimit)) * 65535.0
if val <= 0:
val = 1
return val
@@ -147,17 +147,17 @@ def average(array):
for i in array:
val += i
return val / len(array)
-
+
def smooth(arr, val):
cnt = len(arr)
arr.insert(0, val)
arr.pop(cnt)
- return average(arr)
+ return average(arr)
def set_l2cap_mtu2(sock, mtu):
SOL_L2CAP = 6
L2CAP_OPTIONS = 1
-
+
s = sock.getsockopt (SOL_L2CAP, L2CAP_OPTIONS, 12)
o = list( struct.unpack ("HHHBBBH", s) )
o[0] = o[1] = mtu
@@ -168,7 +168,7 @@ def set_l2cap_mtu2(sock, mtu):
print("Warning: Unable to set mtu")
class sixaxis():
-
+
def __init__(self, xbmc, control_sock, interrupt_sock):
self.xbmc = xbmc
@@ -177,7 +177,7 @@ class sixaxis():
self.sumy = [0] * self.num_samples
self.sumr = [0] * self.num_samples
self.axis_amount = [0, 0, 0, 0]
-
+
self.released = set()
self.pressed = set()
self.pending = set()
@@ -185,7 +185,7 @@ class sixaxis():
self.psflags = 0
self.psdown = 0
self.mouse_enabled = 0
-
+
set_l2cap_mtu2(control_sock, 64)
set_l2cap_mtu2(interrupt_sock, 64)
time.sleep(0.25) # If we ask to quickly here, it sometimes doesn't start
@@ -200,7 +200,7 @@ class sixaxis():
# HID Command: HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_OUTPUT
# HID Report:1
- bytes = [0x52, 0x1]
+ bytes = [0x52, 0x1]
bytes.extend([0x00, 0x00, 0x00])
bytes.extend([0xFF, 0x72])
bytes.extend([0x00, 0x00, 0x00, 0x00])
@@ -214,7 +214,7 @@ class sixaxis():
#0x40 = 2Hz
bytes.extend([0xFF, 0x00, 0x01, 0x00, 0x01]) #LED4 [0xff, 0xff, 0x10, 0x10, 0x10]
bytes.extend([0xFF, 0x00, 0x01, 0x00, 0x01]) #LED3 [0xff, 0x40, 0x08, 0x10, 0x10]
- bytes.extend([0xFF, 0x00, 0x01, 0x00, 0x01]) #LED2 [0xff, 0x00, 0x10, 0x30, 0x30]
+ bytes.extend([0xFF, 0x00, 0x01, 0x00, 0x01]) #LED2 [0xff, 0x00, 0x10, 0x30, 0x30]
bytes.extend([0xFF, 0x00, 0x01, 0x00, 0x01]) #LED1 [0xff, 0x00, 0x10, 0x40, 0x10]
bytes.extend([0x00, 0x00, 0x00, 0x00, 0x00])
bytes.extend([0x00, 0x00, 0x00, 0x00, 0x00])
@@ -282,7 +282,7 @@ class sixaxis():
xpos = normalize_angle(roll, math.radians(30))
ypos = normalize_angle(pitch, math.radians(30))
-
+
axis = struct.unpack("BBBB", data[7:11])
return self.process_input(bflags, pressure, axis, xpos, ypos)
diff --git a/tools/EventClients/lib/python/ps3/sixpair.py b/tools/EventClients/lib/python/ps3/sixpair.py
index 264c2f778c..2fa8cae0e0 100755
--- a/tools/EventClients/lib/python/ps3/sixpair.py
+++ b/tools/EventClients/lib/python/ps3/sixpair.py
@@ -57,7 +57,7 @@ def set_pair(dev, mac):
handle.controlMsg(usb.ENDPOINT_OUT | usb.TYPE_CLASS | usb.RECIP_INTERFACE
, usb.REQ_SET_CONFIGURATION, msg, passed_value, itf.interfaceNumber, timeout)
finally:
- handle.releaseInterface()
+ handle.releaseInterface()
def get_pair(dev):
@@ -102,7 +102,7 @@ if __name__=="__main__":
except:
print("Failed to parse HCI address")
mac = None
-
+
for dev in devs:
if mac:
update_pair(dev, mac)