1 #import <Foundation/Foundation.h>
2 #import <IOKit/hid/IOHIDLib.h>
4 @protocol NJHIDManagerDelegate
;
6 @interface NJHIDManager
: NSObject
7 // Light OO wrapper around IOKit callbacks.
9 - (id
)initWithCriteria
:(NSArray
*)criteria
10 delegate
:(id
<NJHIDManagerDelegate
>)delegate
;
12 @
property (nonatomic
, weak
) id
<NJHIDManagerDelegate
> delegate
;
14 @
property (nonatomic
, copy
) NSArray
*criteria
;
15 // Changing the criteria may trigger a stop and restart. If this
16 // happens, messages will be sent to the delegate as usual.
18 @
property (nonatomic
, assign
) BOOL running
;
19 // Assigning YES is like sending start; NO like stop.
26 @protocol NJHIDManagerDelegate
28 - (void)HIDManagerDidStart
:(NJHIDManager
*)manager
;
29 - (void)HIDManagerDidStop
:(NJHIDManager
*)manager
;
30 // Stopping the device will not trigger any removal messages, so any
31 // cleanup in the delegate must be done here.
33 - (void)HIDManager
:(NJHIDManager
*)manager deviceAdded
:(IOHIDDeviceRef
)device
;
34 - (void)HIDManager
:(NJHIDManager
*)manager deviceRemoved
:(IOHIDDeviceRef
)device
;
36 - (void)HIDManager
:(NJHIDManager
*)manager valueChanged
:(IOHIDValueRef
)value
;
38 - (void)HIDManager
:(NJHIDManager
*)manager didError
:(NSError
*)error
;