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#include "IOHITabletPointer.h"
25
26OSDefineMetaClassAndStructors(IOHITabletPointer, IOHIDevice)
27
28UInt16 IOHITabletPointer::generateDeviceID()
29{
30    static UInt16 _nextDeviceID = 0;
31    return _nextDeviceID++;
32}
33
34bool IOHITabletPointer::init( OSDictionary *propTable )
35{
36    if (!IOHIDevice::init(propTable)) {
37        return false;
38    }
39
40    _deviceID = generateDeviceID();
41    setProperty(kIOHITabletPointerDeviceID, (unsigned long long)_deviceID, 16);
42
43    return true;
44}
45
46bool IOHITabletPointer::attach( IOService * provider )
47{
48    if (!IOHIDevice::attach(provider)) {
49        return false;
50    }
51
52    _tablet = OSDynamicCast(IOHITablet, provider);
53
54    return true;
55}
56
57void IOHITabletPointer::dispatchTabletEvent(NXEventData *tabletEvent,
58                                            AbsoluteTime ts)
59{
60    if (_tablet) {
61        _tablet->dispatchTabletEvent(tabletEvent, ts);
62    }
63}
64
65void IOHITabletPointer::dispatchProximityEvent(NXEventData *proximityEvent,
66                                               AbsoluteTime ts)
67{
68    if (_tablet) {
69        _tablet->dispatchProximityEvent(proximityEvent, ts);
70    }
71}
72