WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::sim::GenericHIDSim Class Reference

Class to control a simulated generic joystick. More...

#include <wpi/simulation/GenericHIDSim.hpp>

Inheritance diagram for wpi::sim::GenericHIDSim:
wpi::sim::GamepadSim wpi::sim::JoystickSim wpi::sim::NiDsPS4ControllerSim wpi::sim::NiDsPS5ControllerSim wpi::sim::NiDsStadiaControllerSim wpi::sim::NiDsXboxControllerSim

Public Member Functions

 GenericHIDSim (const GenericHID &joystick)
 Constructs from a GenericHID object.
 GenericHIDSim (int port)
 Constructs from a joystick port number.
void NotifyNewData ()
 Updates joystick data so that new values are visible to the user program.
void SetRawButton (int button, bool value)
 Set the value of a given button.
void SetRawAxis (int axis, double value)
 Set the value of a given axis.
void SetPOV (int pov, DriverStation::POVDirection value)
 Set the value of a given POV.
void SetPOV (DriverStation::POVDirection value)
 Set the value of the default POV (port 0).
void SetAxesMaximumIndex (int maximumIndex)
void SetAxesAvailable (int count)
 Set the axis count of this device.
void SetPOVsMaximumIndex (int maximumIndex)
void SetPOVsAvailable (int count)
 Set the POV count of this device.
void SetButtonsMaximumIndex (int maximumIndex)
void SetButtonsAvailable (uint64_t count)
 Set the button count of this device.
void SetGamepadType (GenericHID::HIDType type)
 Set the type of this device.
void SetSupportedOutputs (GenericHID::SupportedOutputs supportedOutputs)
void SetName (const char *name)
 Set the name of this device.
int32_t GetLeds ()
 Get the value of set LEDs.
double GetRumble (GenericHID::RumbleType type)
 Get the joystick rumble.

Protected Attributes

int m_port
 GenericHID port.

Detailed Description

Class to control a simulated generic joystick.

Constructor & Destructor Documentation

◆ GenericHIDSim() [1/2]

wpi::sim::GenericHIDSim::GenericHIDSim ( const GenericHID & joystick)
explicit

Constructs from a GenericHID object.

Parameters
joystickjoystick to simulate

◆ GenericHIDSim() [2/2]

wpi::sim::GenericHIDSim::GenericHIDSim ( int port)
explicit

Constructs from a joystick port number.

Parameters
portport number

Member Function Documentation

◆ GetLeds()

int32_t wpi::sim::GenericHIDSim::GetLeds ( )

Get the value of set LEDs.

Returns
the led color

◆ GetRumble()

double wpi::sim::GenericHIDSim::GetRumble ( GenericHID::RumbleType type)

Get the joystick rumble.

Parameters
typethe rumble to read
Returns
the rumble value

◆ NotifyNewData()

void wpi::sim::GenericHIDSim::NotifyNewData ( )

Updates joystick data so that new values are visible to the user program.

◆ SetAxesAvailable()

void wpi::sim::GenericHIDSim::SetAxesAvailable ( int count)

Set the axis count of this device.

Parameters
countthe new axis count

◆ SetAxesMaximumIndex()

void wpi::sim::GenericHIDSim::SetAxesMaximumIndex ( int maximumIndex)

◆ SetButtonsAvailable()

void wpi::sim::GenericHIDSim::SetButtonsAvailable ( uint64_t count)

Set the button count of this device.

Parameters
countthe new button count

◆ SetButtonsMaximumIndex()

void wpi::sim::GenericHIDSim::SetButtonsMaximumIndex ( int maximumIndex)

◆ SetGamepadType()

void wpi::sim::GenericHIDSim::SetGamepadType ( GenericHID::HIDType type)

Set the type of this device.

Parameters
typethe new device type

◆ SetName()

void wpi::sim::GenericHIDSim::SetName ( const char * name)

Set the name of this device.

Parameters
namethe new device name

◆ SetPOV() [1/2]

void wpi::sim::GenericHIDSim::SetPOV ( DriverStation::POVDirection value)

Set the value of the default POV (port 0).

Parameters
valuethe new value

◆ SetPOV() [2/2]

void wpi::sim::GenericHIDSim::SetPOV ( int pov,
DriverStation::POVDirection value )

Set the value of a given POV.

Parameters
povthe POV to set
valuethe new value

◆ SetPOVsAvailable()

void wpi::sim::GenericHIDSim::SetPOVsAvailable ( int count)

Set the POV count of this device.

Parameters
countthe new POV count

◆ SetPOVsMaximumIndex()

void wpi::sim::GenericHIDSim::SetPOVsMaximumIndex ( int maximumIndex)

◆ SetRawAxis()

void wpi::sim::GenericHIDSim::SetRawAxis ( int axis,
double value )

Set the value of a given axis.

Parameters
axisthe axis to set
valuethe new value

◆ SetRawButton()

void wpi::sim::GenericHIDSim::SetRawButton ( int button,
bool value )

Set the value of a given button.

Parameters
buttonthe button to set
valuethe new value

◆ SetSupportedOutputs()

void wpi::sim::GenericHIDSim::SetSupportedOutputs ( GenericHID::SupportedOutputs supportedOutputs)

Member Data Documentation

◆ m_port

int wpi::sim::GenericHIDSim::m_port
protected

GenericHID port.


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