Wingman3D provides an interface to the following Logitech (Vendor ID: 0x046D) USB HID compliant joysticks:.
More...
#include <Wingman3D.hpp>
Public Member Functions | |
| Wingman3D (int devNum=0) | |
| ~Wingman3D () | |
| int | getX () const |
| int | getMaxX () const |
| int | getY () const |
| int | getMaxY () const |
| int | getTwist () const |
| int | getMaxTwist () const |
| int | getNumButtons () const |
| bool | isButtonPressed (int button) const |
| int | getSliderValue () const |
| int | getMaxSliderValue () const |
| int | getHatSwitchStatus () const |
| bool | isStatusOk () const |
| char * | getStatusMessage () const |
| void | printDeviceInfo (int verbosity=1) const |
Protected Member Functions | |
| wingman_data_t | getWingmanData () const |
| wingman_data_t | getWingmanMaxData () const |
Wingman3D provides an interface to the following Logitech (Vendor ID: 0x046D) USB HID compliant joysticks:.
To use the joystick please ensure that the USB manager (devu-uhci or devu-ohci) and manager for HID devices (io-hid) are running. Your application will also need to be linked with the HID library libhiddi.so and the library created by this class. You will need to be root to use this class. Here are the commands to start the device managers (as root) :
/sbin/devu-uhci & (or /sbin/devu-ohci &) /sbin/io-hid & mount -Tio-hid devh-usb.so &
Example Program:
//======================================================================== // Wingman3D.t.cpp : Example program for Logitech Wingman HID Joystick // // Author : Vilas Kumar Chitrakaran <cvilas@ces.clemson.edu> // Date : March 2, 2004 // Compiler : GNU GCC 2.95.3qnx-nto // Operating System : QNX Momentics 6.2.1 //======================================================================== #include "Wingman3D.hpp" #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main() { Wingman3D joystick(0); if( !joystick.isStatusOk() ) { fprintf(stderr, "%s\n", joystick.getStatusMessage()); return EXIT_FAILURE; } sleep(1); joystick.printDeviceInfo(3); while(1) { fprintf(stdout, "\nx: %03d y: %03d z: %03d slide: %03d hat: %03d buttons: ", joystick.getX(), joystick.getY(), joystick.getTwist(), joystick.getSliderValue(), joystick.getHatSwitchStatus()); for(int i = 1; i < joystick.getNumButtons(); i++) if( joystick.isButtonPressed(i) ) fprintf(stdout, "%01d ", i); if( !joystick.isStatusOk() ) return -1; } return EXIT_SUCCESS; }
|
|
The default constructor. Establishes connection with the HID driver.
|
|
|
The default destructor disconnects from the HID driver and cleans up. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Print information about the device to stdout. Higher values of verbosity mean more detailed information. |
|
|
|
|
|
|
Logitech Wingman 3D Class Driver on Mon Aug 28 15:21:10 EDT 2006