1*cdf0e10cSrcweir /***************************************************************************** 2*cdf0e10cSrcweir * HIDRemoteControlDevice.h 3*cdf0e10cSrcweir * RemoteControlWrapper 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Created by Martin Kahr on 11.03.06 under a MIT-style license. 6*cdf0e10cSrcweir * Copyright (c) 2006 martinkahr.com. All rights reserved. 7*cdf0e10cSrcweir * 8*cdf0e10cSrcweir * Code modified and adapted to OpenOffice.org 9*cdf0e10cSrcweir * by Eric Bachard on 11.08.2008 under the same license 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * Permission is hereby granted, free of charge, to any person obtaining a 12*cdf0e10cSrcweir * copy of this software and associated documentation files (the "Software"), 13*cdf0e10cSrcweir * to deal in the Software without restriction, including without limitation 14*cdf0e10cSrcweir * the rights to use, copy, modify, merge, publish, distribute, sublicense, 15*cdf0e10cSrcweir * and/or sell copies of the Software, and to permit persons to whom the 16*cdf0e10cSrcweir * Software is furnished to do so, subject to the following conditions: 17*cdf0e10cSrcweir * 18*cdf0e10cSrcweir * The above copyright notice and this permission notice shall be included 19*cdf0e10cSrcweir * in all copies or substantial portions of the Software. 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22*cdf0e10cSrcweir * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23*cdf0e10cSrcweir * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 24*cdf0e10cSrcweir * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25*cdf0e10cSrcweir * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26*cdf0e10cSrcweir * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27*cdf0e10cSrcweir * THE SOFTWARE. 28*cdf0e10cSrcweir * 29*cdf0e10cSrcweir *****************************************************************************/ 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #import <Cocoa/Cocoa.h> 32*cdf0e10cSrcweir #import <IOKit/hid/IOHIDLib.h> 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #import "RemoteControl.h" 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir /* 37*cdf0e10cSrcweir Base class for HID based remote control devices 38*cdf0e10cSrcweir */ 39*cdf0e10cSrcweir @interface HIDRemoteControlDevice : RemoteControl { 40*cdf0e10cSrcweir IOHIDDeviceInterface** hidDeviceInterface; // see IOKit/hid/IOHIDLib.h 41*cdf0e10cSrcweir IOHIDQueueInterface** queue; // IOKit/hid/IOHIDLib.h 42*cdf0e10cSrcweir NSMutableArray* allCookies; 43*cdf0e10cSrcweir NSMutableDictionary* cookieToButtonMapping; 44*cdf0e10cSrcweir CFRunLoopSourceRef eventSource; 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir BOOL fixSecureEventInputBug; 47*cdf0e10cSrcweir BOOL openInExclusiveMode; 48*cdf0e10cSrcweir BOOL processesBacklog; 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir int supportedButtonEvents; 51*cdf0e10cSrcweir } 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir // When your application needs to much time on the main thread when processing an event other events 54*cdf0e10cSrcweir // may already be received which are put on a backlog. As soon as your main thread 55*cdf0e10cSrcweir // has some spare time this backlog is processed and may flood your delegate with calls. 56*cdf0e10cSrcweir // Backlog processing is turned off by default. 57*cdf0e10cSrcweir - (BOOL) processesBacklog; 58*cdf0e10cSrcweir - (void) setProcessesBacklog: (BOOL) value; 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir // methods that should be overwritten by subclasses 61*cdf0e10cSrcweir - (void) setCookieMappingInDictionary: (NSMutableDictionary*) cookieToButtonMapping; 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir - (void) sendRemoteButtonEvent: (RemoteControlEventIdentifier) event pressedDown: (BOOL) pressedDown; 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir + (BOOL) isRemoteAvailable; 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir @end 68