mirror of
https://github.com/jellyfin/jellyfin-media-player.git
synced 2024-11-23 05:59:43 +00:00
Apple Remote : Update HIDRemote, fixes https://github.com/plexinc/plex-media-player-private/issues/669
Seems some newer version of HIDRemote was needed, tested on a 2010 macmini running High Sierra
This commit is contained in:
parent
a1011d89f4
commit
a4be5c220a
325
external/HIDRemote/HIDRemote.h
vendored
325
external/HIDRemote/HIDRemote.h
vendored
@ -1,32 +1,32 @@
|
|||||||
//
|
//
|
||||||
// HIDRemote.h
|
// HIDRemote.m
|
||||||
// HIDRemote V1.4 (18th February 2015)
|
// HIDRemote V1.6 (27th September 2017)
|
||||||
//
|
//
|
||||||
// Created by Felix Schwarz on 06.04.07.
|
// Created by Felix Schwarz on 06.04.07.
|
||||||
// Copyright 2007-2015 IOSPIRIT GmbH. All rights reserved.
|
// Copyright 2007-2017 IOSPIRIT GmbH. All rights reserved.
|
||||||
//
|
//
|
||||||
// The latest version of this class is available at
|
// The latest version of this class is available at
|
||||||
// http://www.iospirit.com/developers/hidremote/
|
// http://www.iospirit.com/developers/hidremote/
|
||||||
//
|
//
|
||||||
// ** LICENSE *************************************************************************
|
// ** LICENSE *************************************************************************
|
||||||
//
|
//
|
||||||
// Copyright (c) 2007-2014 IOSPIRIT GmbH (http://www.iospirit.com/)
|
// Copyright (c) 2007-2017 IOSPIRIT GmbH (http://www.iospirit.com/)
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
// Redistribution and use in source and binary forms, with or without modification,
|
||||||
// are permitted provided that the following conditions are met:
|
// are permitted provided that the following conditions are met:
|
||||||
//
|
//
|
||||||
// * Redistributions of source code must retain the above copyright notice, this list
|
// * Redistributions of source code must retain the above copyright notice, this list
|
||||||
// of conditions and the following disclaimer.
|
// of conditions and the following disclaimer.
|
||||||
//
|
//
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice, this
|
// * Redistributions in binary form must reproduce the above copyright notice, this
|
||||||
// list of conditions and the following disclaimer in the documentation and/or other
|
// list of conditions and the following disclaimer in the documentation and/or other
|
||||||
// materials provided with the distribution.
|
// materials provided with the distribution.
|
||||||
//
|
//
|
||||||
// * Neither the name of IOSPIRIT GmbH nor the names of its contributors may be used to
|
// * 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
|
// endorse or promote products derived from this software without specific prior
|
||||||
// written permission.
|
// written permission.
|
||||||
//
|
//
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
// 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
|
// 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
|
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
@ -40,7 +40,6 @@
|
|||||||
//
|
//
|
||||||
// ************************************************************************************
|
// ************************************************************************************
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************************
|
// ************************************************************************************
|
||||||
// ********************************** DOCUMENTATION ***********************************
|
// ********************************** DOCUMENTATION ***********************************
|
||||||
// ************************************************************************************
|
// ************************************************************************************
|
||||||
@ -67,6 +66,15 @@
|
|||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HIDREMOTE_THREADSAFETY_HARDENED_NOTIFICATION_HANDLING
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
|
||||||
|
// Enable thread-safe notification handling by default if deploying to OS X >= 10.5
|
||||||
|
#define HIDREMOTE_THREADSAFETY_HARDENED_NOTIFICATION_HANDLING 1
|
||||||
|
#else
|
||||||
|
#define HIDREMOTE_THREADSAFETY_HARDENED_NOTIFICATION_HANDLING 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -81,211 +89,213 @@
|
|||||||
#include <IOKit/hidsystem/IOHIDParameter.h>
|
#include <IOKit/hidsystem/IOHIDParameter.h>
|
||||||
#include <IOKit/hidsystem/IOHIDShared.h>
|
#include <IOKit/hidsystem/IOHIDShared.h>
|
||||||
|
|
||||||
#pragma mark -- Enums / Codes --
|
#pragma mark - Enums / Codes
|
||||||
|
|
||||||
|
#ifndef HID_REMOTE_MODE_ENUM
|
||||||
|
#define HID_REMOTE_MODE_ENUM 1
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
kHIDRemoteModeNone = 0L,
|
kHIDRemoteModeNone = 0L,
|
||||||
kHIDRemoteModeShared, // Share the remote with others - let's you listen to the remote control events as long as noone has an exclusive lock on it
|
kHIDRemoteModeShared, // Share the remote with others - let's you listen to the remote control events as long as noone has an exclusive lock on it
|
||||||
// (RECOMMENDED ONLY FOR SPECIAL PURPOSES)
|
// (RECOMMENDED ONLY FOR SPECIAL PURPOSES)
|
||||||
|
|
||||||
kHIDRemoteModeExclusive, // Try to acquire an exclusive lock on the remote (NOT RECOMMENDED)
|
kHIDRemoteModeExclusive, // Try to acquire an exclusive lock on the remote (NOT RECOMMENDED)
|
||||||
|
|
||||||
kHIDRemoteModeExclusiveAuto // Try to acquire an exclusive lock on the remote whenever the application has focus. Temporarily release control over the
|
kHIDRemoteModeExclusiveAuto // Try to acquire an exclusive lock on the remote whenever the application has focus. Temporarily release control over the
|
||||||
// remote when another application has focus (RECOMMENDED)
|
// remote when another application has focus (RECOMMENDED)
|
||||||
} HIDRemoteMode;
|
} HIDRemoteMode;
|
||||||
|
#endif /* HID_REMOTE_MODE_ENUM */
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
/* A code reserved for "no button" (needed for tracking) */
|
/* A code reserved for "no button" (needed for tracking) */
|
||||||
kHIDRemoteButtonCodeNone = 0L,
|
kHIDRemoteButtonCodeNone = 0L,
|
||||||
|
|
||||||
/* Standard codes - available for white plastic and aluminum remote */
|
/* Standard codes - available for white plastic and aluminum remote */
|
||||||
kHIDRemoteButtonCodeUp,
|
kHIDRemoteButtonCodeUp,
|
||||||
kHIDRemoteButtonCodeDown,
|
kHIDRemoteButtonCodeDown,
|
||||||
kHIDRemoteButtonCodeLeft,
|
kHIDRemoteButtonCodeLeft,
|
||||||
kHIDRemoteButtonCodeRight,
|
kHIDRemoteButtonCodeRight,
|
||||||
kHIDRemoteButtonCodeCenter,
|
kHIDRemoteButtonCodeCenter,
|
||||||
kHIDRemoteButtonCodeMenu,
|
kHIDRemoteButtonCodeMenu,
|
||||||
|
|
||||||
/* Extra codes - Only available for the new aluminum version of the remote */
|
/* Extra codes - Only available for the new aluminum version of the remote */
|
||||||
kHIDRemoteButtonCodePlay,
|
kHIDRemoteButtonCodePlay,
|
||||||
|
|
||||||
/* Masks */
|
/* Masks */
|
||||||
kHIDRemoteButtonCodeCodeMask = 0xFFL,
|
kHIDRemoteButtonCodeCodeMask = 0xFFL,
|
||||||
kHIDRemoteButtonCodeHoldMask = (1L << 16L),
|
kHIDRemoteButtonCodeHoldMask = (1L << 16L),
|
||||||
kHIDRemoteButtonCodeSpecialMask = (1L << 17L),
|
kHIDRemoteButtonCodeSpecialMask = (1L << 17L),
|
||||||
kHIDRemoteButtonCodeAluminumMask = (1L << 21L), // PRIVATE - only used internally
|
kHIDRemoteButtonCodeAluminumMask = (1L << 21L), // PRIVATE - only used internally
|
||||||
|
|
||||||
/* Hold button standard codes - available for white plastic and aluminum remote */
|
/* Hold button standard codes - available for white plastic and aluminum remote */
|
||||||
kHIDRemoteButtonCodeUpHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodeUp),
|
kHIDRemoteButtonCodeUpHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodeUp),
|
||||||
kHIDRemoteButtonCodeDownHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodeDown),
|
kHIDRemoteButtonCodeDownHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodeDown),
|
||||||
kHIDRemoteButtonCodeLeftHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodeLeft),
|
kHIDRemoteButtonCodeLeftHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodeLeft),
|
||||||
kHIDRemoteButtonCodeRightHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodeRight),
|
kHIDRemoteButtonCodeRightHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodeRight),
|
||||||
kHIDRemoteButtonCodeCenterHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodeCenter),
|
kHIDRemoteButtonCodeCenterHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodeCenter),
|
||||||
kHIDRemoteButtonCodeMenuHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodeMenu),
|
kHIDRemoteButtonCodeMenuHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodeMenu),
|
||||||
|
|
||||||
/* Hold button extra codes - Only available for aluminum version of the remote */
|
/* Hold button extra codes - Only available for aluminum version of the remote */
|
||||||
kHIDRemoteButtonCodePlayHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodePlay),
|
kHIDRemoteButtonCodePlayHold = (kHIDRemoteButtonCodeHoldMask|kHIDRemoteButtonCodePlay),
|
||||||
|
|
||||||
/* DEPRECATED codes - compatibility with HIDRemote 1.0 */
|
/* DEPRECATED codes - compatibility with HIDRemote 1.0 */
|
||||||
kHIDRemoteButtonCodePlus = kHIDRemoteButtonCodeUp,
|
kHIDRemoteButtonCodePlus = kHIDRemoteButtonCodeUp,
|
||||||
kHIDRemoteButtonCodePlusHold = kHIDRemoteButtonCodeUpHold,
|
kHIDRemoteButtonCodePlusHold = kHIDRemoteButtonCodeUpHold,
|
||||||
kHIDRemoteButtonCodeMinus = kHIDRemoteButtonCodeDown,
|
kHIDRemoteButtonCodeMinus = kHIDRemoteButtonCodeDown,
|
||||||
kHIDRemoteButtonCodeMinusHold = kHIDRemoteButtonCodeDownHold,
|
kHIDRemoteButtonCodeMinusHold = kHIDRemoteButtonCodeDownHold,
|
||||||
kHIDRemoteButtonCodePlayPause = kHIDRemoteButtonCodeCenter,
|
kHIDRemoteButtonCodePlayPause = kHIDRemoteButtonCodeCenter,
|
||||||
kHIDRemoteButtonCodePlayPauseHold = kHIDRemoteButtonCodeCenterHold,
|
kHIDRemoteButtonCodePlayPauseHold = kHIDRemoteButtonCodeCenterHold,
|
||||||
|
|
||||||
/* Special purpose codes */
|
/* Special purpose codes */
|
||||||
kHIDRemoteButtonCodeIDChanged = (kHIDRemoteButtonCodeSpecialMask|(1L << 18L)), // (the ID of the connected remote has changed, you can safely ignore this)
|
kHIDRemoteButtonCodeIDChanged = (kHIDRemoteButtonCodeSpecialMask|(1L << 18L)), // (the ID of the connected remote has changed, you can safely ignore this)
|
||||||
#ifdef _HIDREMOTE_EXTENSIONS
|
#ifdef _HIDREMOTE_EXTENSIONS
|
||||||
#define _HIDREMOTE_EXTENSIONS_SECTION 1
|
#define _HIDREMOTE_EXTENSIONS_SECTION 1
|
||||||
#include "HIDRemoteAdditions.h"
|
#include "HIDRemoteAdditions.h"
|
||||||
#undef _HIDREMOTE_EXTENSIONS_SECTION
|
#undef _HIDREMOTE_EXTENSIONS_SECTION
|
||||||
#endif /* _HIDREMOTE_EXTENSIONS */
|
#endif /* _HIDREMOTE_EXTENSIONS */
|
||||||
} HIDRemoteButtonCode;
|
} HIDRemoteButtonCode;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
kHIDRemoteModelUndetermined = 0L, // Assume a white plastic remote
|
kHIDRemoteModelUndetermined = 0L, // Assume a white plastic remote
|
||||||
kHIDRemoteModelWhitePlastic, // Signal *likely* to be coming from a white plastic remote
|
kHIDRemoteModelWhitePlastic, // Signal *likely* to be coming from a white plastic remote
|
||||||
kHIDRemoteModelAluminum // Signal *definitely* coming from an aluminum remote
|
kHIDRemoteModelAluminum // Signal *definitely* coming from an aluminum remote
|
||||||
} HIDRemoteModel;
|
} HIDRemoteModel;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
kHIDRemoteAluminumRemoteSupportLevelNone = 0L, // This system has no support for the Aluminum Remote at all
|
kHIDRemoteAluminumRemoteSupportLevelNone = 0L, // This system has no support for the Aluminum Remote at all
|
||||||
kHIDRemoteAluminumRemoteSupportLevelEmulation, // This system possibly has support for the Aluminum Remote (via emulation)
|
kHIDRemoteAluminumRemoteSupportLevelEmulation, // This system possibly has support for the Aluminum Remote (via emulation)
|
||||||
kHIDRemoteAluminumRemoteSupportLevelNative // This system has native support for the Aluminum Remote
|
kHIDRemoteAluminumRemoteSupportLevelNative // This system has native support for the Aluminum Remote
|
||||||
} HIDRemoteAluminumRemoteSupportLevel;
|
} HIDRemoteAluminumRemoteSupportLevel;
|
||||||
|
|
||||||
@class HIDRemote;
|
@class HIDRemote;
|
||||||
|
|
||||||
#pragma mark -- Delegate protocol (mandatory) --
|
#pragma mark - Delegate protocol (mandatory)
|
||||||
@protocol HIDRemoteDelegate
|
@protocol HIDRemoteDelegate
|
||||||
|
|
||||||
// Notification of button events
|
// Notification of button events
|
||||||
- (void)hidRemote:(HIDRemote *)hidRemote // The instance of HIDRemote sending this
|
- (void)hidRemote:(HIDRemote *)hidRemote // The instance of HIDRemote sending this
|
||||||
eventWithButton:(HIDRemoteButtonCode)buttonCode // Event for the button specified by code
|
eventWithButton:(HIDRemoteButtonCode)buttonCode // Event for the button specified by code
|
||||||
isPressed:(BOOL)isPressed // The button was pressed (YES) / released (NO)
|
isPressed:(BOOL)isPressed // The button was pressed (YES) / released (NO)
|
||||||
fromHardwareWithAttributes:(NSMutableDictionary *)attributes; // Information on the device this event comes from
|
fromHardwareWithAttributes:(NSMutableDictionary *)attributes; // Information on the device this event comes from
|
||||||
|
|
||||||
@optional
|
@optional
|
||||||
|
|
||||||
// Notification of ID changes
|
// Notification of ID changes
|
||||||
- (void)hidRemote:(HIDRemote *)hidRemote // Invoked when the user switched to a remote control with a different ID
|
- (void)hidRemote:(HIDRemote *)hidRemote // Invoked when the user switched to a remote control with a different ID
|
||||||
remoteIDChangedOldID:(SInt32)old
|
remoteIDChangedOldID:(SInt32)old
|
||||||
newID:(SInt32)newID
|
newID:(SInt32)newID
|
||||||
forHardwareWithAttributes:(NSMutableDictionary *)attributes;
|
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
|
- (void)hidRemote:(HIDRemote *)hidRemote // Invoked when new hardware was found / added to HIDRemote's pool
|
||||||
foundNewHardwareWithAttributes:(NSMutableDictionary *)attributes;
|
foundNewHardwareWithAttributes:(NSMutableDictionary *)attributes;
|
||||||
|
|
||||||
- (void)hidRemote:(HIDRemote *)hidRemote // Invoked when initialization of new hardware as requested failed
|
- (void)hidRemote:(HIDRemote *)hidRemote // Invoked when initialization of new hardware as requested failed
|
||||||
failedNewHardwareWithError:(NSError *)error;
|
failedNewHardwareWithError:(NSError *)error;
|
||||||
|
|
||||||
- (void)hidRemote:(HIDRemote *)hidRemote // Invoked when hardware was removed from HIDRemote's pool
|
- (void)hidRemote:(HIDRemote *)hidRemote // Invoked when hardware was removed from HIDRemote's pool
|
||||||
releasedHardwareWithAttributes:(NSMutableDictionary *)attributes;
|
releasedHardwareWithAttributes:(NSMutableDictionary *)attributes;
|
||||||
|
|
||||||
// ### WARNING: Unless you know VERY PRECISELY what you are doing, do not implement any of the delegate methods below. ###
|
// ### WARNING: Unless you know VERY PRECISELY what you are doing, do not implement any of the delegate methods below. ###
|
||||||
|
|
||||||
// Matching of newly found receiver hardware
|
// Matching of newly found receiver hardware
|
||||||
- (BOOL)hidRemote:(HIDRemote *)hidRemote // Invoked when new hardware is inspected
|
- (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
|
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 persued further.
|
// to use it, or NO if it should not be persued further.
|
||||||
|
|
||||||
// Exlusive lock lending
|
// Exlusive lock lending
|
||||||
- (BOOL)hidRemote:(HIDRemote *)hidRemote
|
- (BOOL)hidRemote:(HIDRemote *)hidRemote
|
||||||
lendExclusiveLockToApplicationWithInfo:(NSDictionary *)applicationInfo;
|
lendExclusiveLockToApplicationWithInfo:(NSDictionary *)applicationInfo;
|
||||||
|
|
||||||
- (void)hidRemote:(HIDRemote *)hidRemote
|
- (void)hidRemote:(HIDRemote *)hidRemote
|
||||||
exclusiveLockReleasedByApplicationWithInfo:(NSDictionary *)applicationInfo;
|
exclusiveLockReleasedByApplicationWithInfo:(NSDictionary *)applicationInfo;
|
||||||
|
|
||||||
- (BOOL)hidRemote:(HIDRemote *)hidRemote
|
- (BOOL)hidRemote:(HIDRemote *)hidRemote
|
||||||
shouldRetryExclusiveLockWithInfo:(NSDictionary *)applicationInfo;
|
shouldRetryExclusiveLockWithInfo:(NSDictionary *)applicationInfo;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
#pragma mark -- Actual header file for class --
|
#pragma mark - Actual header file for class
|
||||||
|
|
||||||
@interface HIDRemote : NSObject
|
@interface HIDRemote : NSObject
|
||||||
{
|
{
|
||||||
// IOMasterPort
|
// IOMasterPort
|
||||||
mach_port_t _masterPort;
|
mach_port_t _masterPort;
|
||||||
|
|
||||||
// Notification ports
|
// Notification ports
|
||||||
IONotificationPortRef _notifyPort;
|
IONotificationPortRef _notifyPort;
|
||||||
CFRunLoopSourceRef _notifyRLSource;
|
CFRunLoopSourceRef _notifyRLSource;
|
||||||
|
|
||||||
// Matching iterator
|
// Matching iterator
|
||||||
io_iterator_t _matchingServicesIterator;
|
io_iterator_t _matchingServicesIterator;
|
||||||
|
|
||||||
// SecureInput notification
|
// SecureInput notification
|
||||||
io_object_t _secureInputNotification;
|
io_object_t _secureInputNotification;
|
||||||
|
|
||||||
// Service attributes
|
// Service attributes
|
||||||
NSMutableDictionary *_serviceAttribMap;
|
NSMutableDictionary *_serviceAttribMap;
|
||||||
|
|
||||||
// Mode
|
// Mode
|
||||||
HIDRemoteMode _mode;
|
HIDRemoteMode _mode;
|
||||||
BOOL _autoRecover;
|
BOOL _autoRecover;
|
||||||
NSTimer *_autoRecoveryTimer;
|
NSTimer *_autoRecoveryTimer;
|
||||||
|
|
||||||
// Delegate
|
// Delegate
|
||||||
NSObject <HIDRemoteDelegate> *_delegate;
|
NSObject <HIDRemoteDelegate> *_delegate;
|
||||||
|
|
||||||
// Last seen ID and remote model
|
// Last seen ID and remote model
|
||||||
SInt32 _lastSeenRemoteID;
|
SInt32 _lastSeenRemoteID;
|
||||||
HIDRemoteModel _lastSeenModel;
|
HIDRemoteModel _lastSeenModel;
|
||||||
SInt32 _lastSeenModelRemoteID;
|
SInt32 _lastSeenModelRemoteID;
|
||||||
|
|
||||||
// Unused button codes
|
// Unused button codes
|
||||||
NSArray *_unusedButtonCodes;
|
NSArray *_unusedButtonCodes;
|
||||||
|
|
||||||
// Simulate Plus/Minus Hold
|
// Simulate Plus/Minus Hold
|
||||||
BOOL _simulateHoldEvents;
|
BOOL _simulateHoldEvents;
|
||||||
|
|
||||||
// SecureEventInput workaround
|
// SecureEventInput workaround
|
||||||
BOOL _secureEventInputWorkAround;
|
BOOL _secureEventInputWorkAround;
|
||||||
UInt64 _lastSecureEventInputPIDSum;
|
UInt64 _lastSecureEventInputPIDSum;
|
||||||
uid_t _lastFrontUserSession;
|
uid_t _lastFrontUserSession;
|
||||||
BOOL _lastScreenIsLocked;
|
BOOL _lastScreenIsLocked;
|
||||||
|
|
||||||
// Exclusive lock lending
|
// Exclusive lock lending
|
||||||
BOOL _exclusiveLockLending;
|
BOOL _exclusiveLockLending;
|
||||||
BOOL _sendExclusiveResourceReuseNotification;
|
BOOL _sendExclusiveResourceReuseNotification;
|
||||||
NSNumber *_waitForReturnByPID;
|
NSNumber *_waitForReturnByPID;
|
||||||
NSNumber *_returnToPID;
|
NSNumber *_returnToPID;
|
||||||
BOOL _isRestarting;
|
BOOL _isRestarting;
|
||||||
|
|
||||||
// Status notifications
|
// Status notifications
|
||||||
BOOL _sendStatusNotifications;
|
BOOL _sendStatusNotifications;
|
||||||
NSString *_pidString;
|
NSString *_pidString;
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
BOOL _applicationIsTerminating;
|
BOOL _applicationIsTerminating;
|
||||||
BOOL _isStopping;
|
BOOL _isStopping;
|
||||||
|
|
||||||
// Thread safety
|
// 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) */
|
#if 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;
|
NSThread *_runOnThread;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark -- PUBLIC: Shared HID Remote --
|
#pragma mark - PUBLIC: Shared HID Remote
|
||||||
+ (HIDRemote *)sharedHIDRemote;
|
+ (HIDRemote *)sharedHIDRemote;
|
||||||
|
|
||||||
#pragma mark -- PUBLIC: System Information --
|
#pragma mark - PUBLIC: System Information
|
||||||
+ (BOOL)isCandelairInstalled;
|
+ (BOOL)isCandelairInstalled;
|
||||||
+ (BOOL)isCandelairInstallationRequiredForRemoteMode:(HIDRemoteMode)remoteMode;
|
+ (BOOL)isCandelairInstallationRequiredForRemoteMode:(HIDRemoteMode)remoteMode;
|
||||||
+ (SInt32)OSXVersion;
|
+ (SInt32)OSXVersion;
|
||||||
- (HIDRemoteAluminumRemoteSupportLevel)aluminiumRemoteSystemSupportLevel;
|
- (HIDRemoteAluminumRemoteSupportLevel)aluminiumRemoteSystemSupportLevel;
|
||||||
|
|
||||||
#pragma mark -- PUBLIC: Interface / API --
|
#pragma mark - PUBLIC: Interface / API
|
||||||
- (BOOL)startRemoteControl:(HIDRemoteMode)hidRemoteMode;
|
- (BOOL)startRemoteControl:(HIDRemoteMode)hidRemoteMode;
|
||||||
- (void)stopRemoteControl;
|
- (void)stopRemoteControl;
|
||||||
|
|
||||||
- (BOOL)isStarted;
|
- (BOOL)isStarted;
|
||||||
@ -307,7 +317,7 @@ typedef enum
|
|||||||
- (void)setUnusedButtonCodes:(NSArray *)newArrayWithUnusedButtonCodesAsNSNumbers;
|
- (void)setUnusedButtonCodes:(NSArray *)newArrayWithUnusedButtonCodesAsNSNumbers;
|
||||||
- (NSArray *)unusedButtonCodes;
|
- (NSArray *)unusedButtonCodes;
|
||||||
|
|
||||||
#pragma mark -- PUBLIC: Expert APIs --
|
#pragma mark - PUBLIC: Expert APIs
|
||||||
- (void)setEnableSecureEventInputWorkaround:(BOOL)newEnableSecureEventInputWorkaround;
|
- (void)setEnableSecureEventInputWorkaround:(BOOL)newEnableSecureEventInputWorkaround;
|
||||||
- (BOOL)enableSecureEventInputWorkaround;
|
- (BOOL)enableSecureEventInputWorkaround;
|
||||||
|
|
||||||
@ -317,28 +327,28 @@ typedef enum
|
|||||||
- (BOOL)isApplicationTerminating;
|
- (BOOL)isApplicationTerminating;
|
||||||
- (BOOL)isStopping;
|
- (BOOL)isStopping;
|
||||||
|
|
||||||
#pragma mark -- PRIVATE: HID Event handling --
|
#pragma mark - PRIVATE: HID Event handling
|
||||||
- (void)_handleButtonCode:(HIDRemoteButtonCode)buttonCode isPressed:(BOOL)isPressed hidAttribsDict:(NSMutableDictionary *)hidAttribsDict;
|
- (void)_handleButtonCode:(HIDRemoteButtonCode)buttonCode isPressed:(BOOL)isPressed hidAttribsDict:(NSMutableDictionary *)hidAttribsDict;
|
||||||
- (void)_sendButtonCode:(HIDRemoteButtonCode)buttonCode isPressed:(BOOL)isPressed hidAttribsDict:(NSMutableDictionary *)hidAttribsDict;
|
- (void)_sendButtonCode:(HIDRemoteButtonCode)buttonCode isPressed:(BOOL)isPressed hidAttribsDict:(NSMutableDictionary *)hidAttribsDict;
|
||||||
- (void)_hidEventFor:(io_service_t)hidDevice from:(IOHIDQueueInterface **)interface withResult:(IOReturn)result;
|
- (void)_hidEventFor:(io_service_t)hidDevice from:(IOHIDQueueInterface **)interface withResult:(IOReturn)result;
|
||||||
|
|
||||||
#pragma mark -- PRIVATE: Service setup and destruction --
|
#pragma mark - PRIVATE: Service setup and destruction
|
||||||
- (BOOL)_prematchService:(io_object_t)service;
|
- (BOOL)_prematchService:(io_object_t)service;
|
||||||
- (HIDRemoteButtonCode)buttonCodeForUsage:(unsigned int)usage usagePage:(unsigned int)usagePage;
|
- (HIDRemoteButtonCode)buttonCodeForUsage:(unsigned int)usage usagePage:(unsigned int)usagePage;
|
||||||
- (BOOL)_setupService:(io_object_t)service;
|
- (BOOL)_setupService:(io_object_t)service;
|
||||||
- (void)_destructService:(io_object_t)service;
|
- (void)_destructService:(io_object_t)service;
|
||||||
|
|
||||||
#pragma mark -- PRIVATE: Distributed notifiations handling --
|
#pragma mark - PRIVATE: Distributed notifiations handling
|
||||||
- (void)_postStatusWithAction:(NSString *)action;
|
- (void)_postStatusWithAction:(NSString *)action;
|
||||||
- (void)_handleNotifications:(NSNotification *)notification;
|
- (void)_handleNotifications:(NSNotification *)notification;
|
||||||
- (void)_setSendStatusNotifications:(BOOL)doSend;
|
- (void)_setSendStatusNotifications:(BOOL)doSend;
|
||||||
- (BOOL)_sendStatusNotifications;
|
- (BOOL)_sendStatusNotifications;
|
||||||
|
|
||||||
#pragma mark -- PRIVATE: Application becomes active / inactive handling for kHIDRemoteModeExclusiveAuto --
|
#pragma mark - PRIVATE: Application becomes active / inactive handling for kHIDRemoteModeExclusiveAuto
|
||||||
- (void)_appStatusChanged:(NSNotification *)notification;
|
- (void)_appStatusChanged:(NSNotification *)notification;
|
||||||
- (void)_delayedAutoRecovery:(NSTimer *)aTimer;
|
- (void)_delayedAutoRecovery:(NSTimer *)aTimer;
|
||||||
|
|
||||||
#pragma mark -- PRIVATE: Notification handling --
|
#pragma mark - PRIVATE: Notification handling
|
||||||
- (void)_serviceMatching:(io_iterator_t)iterator;
|
- (void)_serviceMatching:(io_iterator_t)iterator;
|
||||||
- (void)_serviceNotificationFor:(io_service_t)service messageType:(natural_t)messageType messageArgument:(void *)messageArgument;
|
- (void)_serviceNotificationFor:(io_service_t)service messageType:(natural_t)messageType messageArgument:(void *)messageArgument;
|
||||||
- (void)_updateSessionInformation;
|
- (void)_updateSessionInformation;
|
||||||
@ -346,12 +356,12 @@ typedef enum
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#pragma mark -- Information attribute keys --
|
#pragma mark - Information attribute keys
|
||||||
extern NSString *kHIDRemoteManufacturer;
|
extern NSString *kHIDRemoteManufacturer;
|
||||||
extern NSString *kHIDRemoteProduct;
|
extern NSString *kHIDRemoteProduct;
|
||||||
extern NSString *kHIDRemoteTransport;
|
extern NSString *kHIDRemoteTransport;
|
||||||
|
|
||||||
#pragma mark -- Internal/Expert attribute keys (AKA: don't touch these unless you really, really, REALLY know what you do) --
|
#pragma mark - Internal/Expert attribute keys (AKA: don't touch these unless you really, really, REALLY know what you do)
|
||||||
extern NSString *kHIDRemoteCFPluginInterface;
|
extern NSString *kHIDRemoteCFPluginInterface;
|
||||||
extern NSString *kHIDRemoteHIDDeviceInterface;
|
extern NSString *kHIDRemoteHIDDeviceInterface;
|
||||||
extern NSString *kHIDRemoteCookieButtonCodeLUT;
|
extern NSString *kHIDRemoteCookieButtonCodeLUT;
|
||||||
@ -365,14 +375,14 @@ extern NSString *kHIDRemoteSimulateHoldEventsOriginButtonCode;
|
|||||||
extern NSString *kHIDRemoteAluminumRemoteSupportLevel;
|
extern NSString *kHIDRemoteAluminumRemoteSupportLevel;
|
||||||
extern NSString *kHIDRemoteAluminumRemoteSupportOnDemand;
|
extern NSString *kHIDRemoteAluminumRemoteSupportOnDemand;
|
||||||
|
|
||||||
#pragma mark -- Distributed notifications --
|
#pragma mark - Distributed notifications
|
||||||
extern NSString *kHIDRemoteDNHIDRemotePing;
|
extern NSString *kHIDRemoteDNHIDRemotePing;
|
||||||
extern NSString *kHIDRemoteDNHIDRemoteRetry;
|
extern NSString *kHIDRemoteDNHIDRemoteRetry;
|
||||||
extern NSString *kHIDRemoteDNHIDRemoteStatus;
|
extern NSString *kHIDRemoteDNHIDRemoteStatus;
|
||||||
|
|
||||||
extern NSString *kHIDRemoteDNHIDRemoteRetryGlobalObject;
|
extern NSString *kHIDRemoteDNHIDRemoteRetryGlobalObject;
|
||||||
|
|
||||||
#pragma mark -- Distributed notifications userInfo keys and values --
|
#pragma mark - Distributed notifications userInfo keys and values
|
||||||
extern NSString *kHIDRemoteDNStatusHIDRemoteVersionKey;
|
extern NSString *kHIDRemoteDNStatusHIDRemoteVersionKey;
|
||||||
extern NSString *kHIDRemoteDNStatusPIDKey;
|
extern NSString *kHIDRemoteDNStatusPIDKey;
|
||||||
extern NSString *kHIDRemoteDNStatusModeKey;
|
extern NSString *kHIDRemoteDNStatusModeKey;
|
||||||
@ -385,8 +395,11 @@ extern NSString *kHIDRemoteDNStatusActionStop;
|
|||||||
extern NSString *kHIDRemoteDNStatusActionUpdate;
|
extern NSString *kHIDRemoteDNStatusActionUpdate;
|
||||||
extern NSString *kHIDRemoteDNStatusActionNoNeed;
|
extern NSString *kHIDRemoteDNStatusActionNoNeed;
|
||||||
|
|
||||||
#pragma mark -- Driver compatibility flags --
|
#pragma mark - Driver compatibility flags
|
||||||
|
#ifndef HID_REMOTE_COMPATIBILITY_FLAGS_ENUM
|
||||||
|
#define HID_REMOTE_COMPATIBILITY_FLAGS_ENUM 1
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
kHIDRemoteCompatibilityFlagsStandardHIDRemoteDevice = 1L,
|
kHIDRemoteCompatibilityFlagsStandardHIDRemoteDevice = 1L,
|
||||||
} HIDRemoteCompatibilityFlags;
|
} HIDRemoteCompatibilityFlags;
|
||||||
|
#endif /* HID_REMOTE_COMPATIBILITY_FLAGS_ENUM */
|
||||||
|
3484
external/HIDRemote/HIDRemote.m
vendored
3484
external/HIDRemote/HIDRemote.m
vendored
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user