Libpointing
An open-source cross-platform library to get raw events from pointing devices and master transfer functions.
 All Classes Functions Variables Typedefs Enumerator Pages
osxHIDUtils.h
1 /* -*- mode: c++ -*-
2  *
3  * pointing/input/osx/osxHIDUtils.h --
4  *
5  * Initial software
6  * Authors: Nicolas Roussel
7  * Copyright © Inria
8  *
9  * http://libpointing.org/
10  *
11  * This software may be used and distributed according to the terms of
12  * the GNU General Public License version 2 or any later version.
13  *
14  */
15 
16 #ifndef osxHIDUtils_h
17 #define osxHIDUtils_h
18 
19 #include <pointing/utils/URI.h>
20 
21 #include <IOKit/hid/IOHIDDevice.h>
22 #include <IOKit/usb/IOUSBLib.h>
23 
24 #include <iostream>
25 #include <string>
26 
27 namespace pointing {
28 
29  int32_t
30  hidDeviceGetIntProperty(IOHIDDeviceRef device,
31  CFStringRef prop, int32_t defval=0) ;
32 
33  std::string
34  hidDeviceGetStringProperty(IOHIDDeviceRef device,
35  CFStringRef prop, std::string defval="") ;
36 
37  URI
38  hidDeviceURI(IOHIDDeviceRef device) ;
39 
40  SInt32 // -1 if resolution is unknown
41  hidGetPointingResolution(IOHIDDeviceRef device) ;
42 
43 
44  double // in seconds (-1 if interval is unknown)
45  hidGetReportInterval(IOHIDDeviceRef device) ;
46 
47  void
48  hidDebugDevice(IOHIDDeviceRef device, std::ostream& out) ;
49 
50  // -----------------------------------------------------------------------
51 
52  std::string // can be used to create an osxHIDInputDevice
53  hidDeviceFromVendorProductUsagePageUsage(int vendorID, int productID,
54  int primaryUsagePage, int primaryUsage) ;
55 
56  // -----------------------------------------------------------------------
57 
58  std::string
59  hidAnyPointingDevice(void) ;
60 
61  std::string
62  hidXYElements(void) ;
63 
64 }
65 
66 #endif