| Wheelchair Control Diploma Thesis, Author: Ondrej Vozda, FEEC BUT, 2013

- Main Page
- Packages
- Classes
- Files

- Class List
- Class Index
- Class Members

All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public Types | Public Member Functions | Properties | Private Member Functions | List of all members
CsharpUSBJoystick.USB_Joystick Class Reference

Class to handle joystick input using Microsoft DirectX. More...

## Public Types
enum | JoystickButton : byte { BUTTON_TRIGGER = 1, BUTTON_UPPER_TRIGGER_1 = 2, BUTTON_UPPER_TRIGGER_2 = 3 }
| Frequently used joystick buttons. More...

## Public Member Functions
| USB_Joystick (int rangeMin, int rangeMax, double thresholdPerc, System.Windows.Forms.Form form)
| Creates a new USB_Joystick object and initializes the minimum and maximum range values of the joystick along with the threshold percentage. More...
| USB_Joystick (int rangeMin, int rangeMax, System.Windows.Forms.Form form)
| Creates a new USB_Joystick object and initializes the minimum and maximum range values of the joystick, along with setting the threshold percentage to a default value. More...
| USB_Joystick (System.Windows.Forms.Form form)
  | Creates a new USB_Joystick object and sets the minimum/maximum range values along the threshold percentage of the joystick to default values. Parameters
  form | Form to set the cooperative level for the joystick.
More...
string | ButtonValue (int index)
| Returns the value of the specified button. More...
bool | ButtonPressed (int index)
| Returns the state of a button. More...
bool | ButtonClicked (int index)
| Returns true if specified button has been clicked. More...
bool | IsXOutsideThreshold ()
| Returns true if the joystick's current X position is outside of the threshold. More...
bool | IsYOutsideThreshold ()
| Returns true if the joystick's current Y position is outside of the threshold. More...
void | GetData ()
| Acquires the joystick if necessary, and starts polling the joystick for information. Uses the same concepts behind the DirectX 9 SDK Joystick sample download. More...
void | PresetValues ()
| Presets all of the values that are required to use an object of the USB_Joystick class. More...
void | UnacquireAppDevice ()
| Unacquires the device More...
void | Dispose ()
| Calls the methods that are used to dispose of this object, and all objects contained within. More...

## Properties
double | ThresholdPerc`[get, set]`
| Gets or sets the threshold based on a percentage scale. More...
int | ThresholdMin`[get]`
| Returns the minimum value of the threshold. More...
JoystickState | State`[get]`
| Returns the current Joystick state. More...
int | ThresholdMax`[get]`
| Returns the maximum value of the threshold. More...
System.Drawing.PointF | GetRawXYPerc`[get]`
| Returns the raw value of the joystick's X and Y coordinates converted into a percent. More...
int | NumberOfButtons`[get]`
| Returns the number of buttons on the joystick. More...
bool | IsXYInsideThreshold`[get]`
| Returns true if the joystick's current position is inside the threshold More...

## Private Member Functions
void | SetThreshold ()
| Sets the threshold of the X and Y joystick values. More...
bool | InitDirectInput (System.Windows.Forms.Form Form1)
| Finds the first joystick attached, and initializes it. Uses the same concepts behind the DirectX 9 Joystick sample download. More...

## Detailed Description

Class to handle joystick input using Microsoft DirectX.

Definition at line 82 of file USBJoystick.cs.

## Member Enumeration Documentation

enum CsharpUSBJoystick.USB_Joystick.JoystickButton : byte

Frequently used joystick buttons.

Enumerator
BUTTON_TRIGGER | Front trigger button.
BUTTON_UPPER_TRIGGER_1 | Top-rear trigger button.
BUTTON_UPPER_TRIGGER_2 | Top-front trigger button.

Definition at line 90 of file USBJoystick.cs.

## Constructor & Destructor Documentation

CsharpUSBJoystick.USB_Joystick.USB_Joystick | ( | int | rangeMin,
|  | int | rangeMax,
|  | double | thresholdPerc,
|  | System.Windows.Forms.Form | form
| ) |  |

Creates a new USB_Joystick object and initializes the minimum and maximum range values of the joystick along with the threshold percentage.

Parameters

  rangeMin | The minimum value for the range of the joystick.
  rangeMax | The maximum value for the range of the joystick.
  thresholdPerc | The threshold percentage. Value must be between 0.0 and .99.
  form | Form to set the cooperative level for the joystick.

Definition at line 130 of file USBJoystick.cs.

CsharpUSBJoystick.USB_Joystick.USB_Joystick | ( | int | rangeMin,
|  | int | rangeMax,
|  | System.Windows.Forms.Form | form
| ) |  |

Creates a new USB_Joystick object and initializes the minimum and maximum range values of the joystick, along with setting the threshold percentage to a default value.

Parameters

  rangeMin | The minimum value for the range of the joystick.
  rangeMax | The maximum value for the range of the joystick.
  form | Form to set the cooperative level for the joystick.

Definition at line 157 of file USBJoystick.cs.

CsharpUSBJoystick.USB_Joystick.USB_Joystick | ( | System.Windows.Forms.Form | form | ) |

Creates a new USB_Joystick object and sets the minimum/maximum range values along the threshold percentage of the joystick to default values.

Parameters

  form | Form to set the cooperative level for the joystick.

Definition at line 166 of file USBJoystick.cs.

## Member Function Documentation

bool CsharpUSBJoystick.USB_Joystick.ButtonClicked | ( | int | index | ) |

Returns true if specified button has been clicked.

Parameters

  index | Index of button.

Returns
  True if button has been clicked.

Definition at line 284 of file USBJoystick.cs.

bool CsharpUSBJoystick.USB_Joystick.ButtonPressed | ( | int | index | ) |

Returns the state of a button.

Parameters

  index | The index of the button to be used to test whether it has been pressed.

Definition at line 267 of file USBJoystick.cs.

string CsharpUSBJoystick.USB_Joystick.ButtonValue | ( | int | index | ) |

Returns the value of the specified button.

Parameters

  index | Index of the button being pressed.

Definition at line 257 of file USBJoystick.cs.

void CsharpUSBJoystick.USB_Joystick.Dispose | ( |  | ) |

Calls the methods that are used to dispose of this object, and all objects contained within.

Definition at line 466 of file USBJoystick.cs.

void CsharpUSBJoystick.USB_Joystick.GetData | ( |  | ) |

Acquires the joystick if necessary, and starts polling the joystick for information. Uses the same concepts behind the DirectX 9 SDK Joystick sample download.

Definition at line 369 of file USBJoystick.cs.

bool CsharpUSBJoystick.USB_Joystick.InitDirectInput | ( | System.Windows.Forms.Form | Form1 | ) |
| private

Finds the first joystick attached, and initializes it. Uses the same concepts behind the DirectX 9 Joystick sample download.

Parameters

  Form1 | Form to set the cooperative level for the joystick.

Returns
  Returns true if the joystick was successfully created.

Definition at line 411 of file USBJoystick.cs.

bool CsharpUSBJoystick.USB_Joystick.IsXOutsideThreshold | ( |  | ) |

Returns true if the joystick's current X position is outside of the threshold.

Definition at line 304 of file USBJoystick.cs.

bool CsharpUSBJoystick.USB_Joystick.IsYOutsideThreshold | ( |  | ) |

Returns true if the joystick's current Y position is outside of the threshold.

Definition at line 320 of file USBJoystick.cs.

void CsharpUSBJoystick.USB_Joystick.PresetValues | ( |  | ) |

Presets all of the values that are required to use an object of the USB_Joystick class.

Definition at line 445 of file USBJoystick.cs.

void CsharpUSBJoystick.USB_Joystick.SetThreshold | ( |  | ) |
| private

Sets the threshold of the X and Y joystick values.

Definition at line 355 of file USBJoystick.cs.

void CsharpUSBJoystick.USB_Joystick.UnacquireAppDevice | ( |  | ) |

Unacquires the device

Definition at line 454 of file USBJoystick.cs.

## Property Documentation

System.Drawing.PointF CsharpUSBJoystick.USB_Joystick.GetRawXYPerc
| get

Returns the raw value of the joystick's X and Y coordinates converted into a percent.

Definition at line 230 of file USBJoystick.cs.

bool CsharpUSBJoystick.USB_Joystick.IsXYInsideThreshold
| get

Returns true if the joystick's current position is inside the threshold

Definition at line 337 of file USBJoystick.cs.

int CsharpUSBJoystick.USB_Joystick.NumberOfButtons
| get

Returns the number of buttons on the joystick.

Definition at line 243 of file USBJoystick.cs.

JoystickState CsharpUSBJoystick.USB_Joystick.State
| get

Returns the current Joystick state.

Definition at line 206 of file USBJoystick.cs.

int CsharpUSBJoystick.USB_Joystick.ThresholdMax
| get

Returns the maximum value of the threshold.

Definition at line 218 of file USBJoystick.cs.

int CsharpUSBJoystick.USB_Joystick.ThresholdMin
| get

Returns the minimum value of the threshold.

Definition at line 194 of file USBJoystick.cs.

double CsharpUSBJoystick.USB_Joystick.ThresholdPerc
| get set

Gets or sets the threshold based on a percentage scale.

Definition at line 177 of file USBJoystick.cs.

The documentation for this class was generated from the following file:

- C:/Users/Ondra/Desktop/Wheelchair Control/USBJoystick.cs