1/*
2 *
3 * @APPLE_LICENSE_HEADER_START@
4 *
5 * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
6 *
7 * This file contains Original Code and/or Modifications of Original Code
8 * as defined in and that are subject to the Apple Public Source License
9 * Version 2.0 (the 'License'). You may not use this file except in
10 * compliance with the License. Please obtain a copy of the License at
11 * http://www.opensource.apple.com/apsl/ and read it before using this
12 * file.
13 *
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
19 * Please see the License for the specific language governing rights and
20 * limitations under the License.
21 *
22 * @APPLE_LICENSE_HEADER_END@
23 */
24
25#ifndef _IOKIT_HID_IOHIDCONSUMER_H
26#define _IOKIT_HID_IOHIDCONSUMER_H
27
28#include <IOKit/IOLib.h>
29#include <IOKit/IOService.h>
30
31// HID system includes.
32#include <IOKit/hidsystem/IOHIDDescriptorParser.h>
33#include <IOKit/hidsystem/IOHIDShared.h>
34#include "IOHIKeyboard.h"
35#include "IOHIDKeyboard.h"
36#include "IOHIDEventService.h"
37
38// extra includes.
39#include <libkern/OSByteOrder.h>
40
41//====================================================================================================
42//	IOHIDConsumer
43//	Generic driver for usb devices that contain special keys.
44//====================================================================================================
45
46class IOHIDConsumer : public IOHIKeyboard
47{
48    OSDeclareDefaultStructors(IOHIDConsumer)
49
50    IOHIDKeyboard *         _keyboardNub;
51
52    UInt32                  _otherEventFlags;
53    UInt32                  _cachedEventFlags;
54    bool                    _otherCapsLockOn;
55
56	bool					_repeat;
57
58    bool                    _isDispatcher;
59
60    // Our implementation specific stuff.
61    UInt32                  findKeyboardsAndGetModifiers();
62
63public:
64    // Allocator
65    static IOHIDConsumer * 		Consumer(bool isDispatcher = false);
66
67    // IOService methods
68    virtual bool			init(OSDictionary *properties=0);
69    virtual bool			start(IOService * provider);
70    virtual void			stop(IOService * provider);
71
72    virtual void            dispatchConsumerEvent(
73                                IOHIDKeyboard *             sendingkeyboardNub,
74                                AbsoluteTime                timeStamp,
75                                UInt32                      usagePage,
76                                UInt32                      usage,
77                                UInt32						value,
78                                IOOptionBits                options = 0);
79
80    inline bool             isDispatcher() { return _isDispatcher;};
81
82    // IOHIKeyboard methods
83    virtual const unsigned char*	defaultKeymapOfLength( UInt32 * length );
84    virtual bool                    doesKeyLock(unsigned key);
85    virtual unsigned                eventFlags();
86    virtual unsigned                deviceFlags();
87    virtual void                    setDeviceFlags(unsigned flags);
88    virtual void                    setNumLock(bool val);
89    virtual bool                    numLock();
90    virtual bool                    alphaLock();
91};
92#endif /* !_IOKIT_HID_IOHIDCONSUMER_H */
93