[wpilib] Prefix all NI DS specific controller classes (#8596)

Easier then the last one that put everything in a sub namespace. By
prefixing the name less things break, and intellisense will be less
confusing to new users during the transition.
This commit is contained in:
Thad House
2026-02-06 21:36:01 -08:00
committed by GitHub
parent 77b2f9802e
commit 5c5d5222f4
133 changed files with 1959 additions and 2682 deletions

View File

@@ -14,9 +14,9 @@
namespace wpi {
/**
* Handle input from PS4 controllers connected to the Driver Station.
* Handle input from NiDsPS4 controllers connected to the Driver Station.
*
* This class handles PS4 input that comes from the Driver Station. Each
* This class handles NiDsPS4 input that comes from the Driver Station. Each
* time a value is requested the most recent value is returned. There is a
* single class instance for each controller and the mapping of ports to
* hardware buttons depends on the code in the Driver Station.
@@ -25,9 +25,9 @@ namespace wpi {
* correct mapping, and only through the official NI DS. Sim is not guaranteed
* to have the same mapping, as well as any 3rd party controllers.
*/
class PS4Controller : public GenericHID,
class NiDsPS4Controller : public GenericHID,
public wpi::util::Sendable,
public wpi::util::SendableHelper<PS4Controller> {
public wpi::util::SendableHelper<NiDsPS4Controller> {
public:
/**
* Construct an instance of a controller.
@@ -37,12 +37,12 @@ class PS4Controller : public GenericHID,
* @param port The port on the Driver Station that the controller is plugged
* into (0-5).
*/
explicit PS4Controller(int port);
explicit NiDsPS4Controller(int port);
~PS4Controller() override = default;
~NiDsPS4Controller() override = default;
PS4Controller(PS4Controller&&) = default;
PS4Controller& operator=(PS4Controller&&) = default;
NiDsPS4Controller(NiDsPS4Controller&&) = default;
NiDsPS4Controller& operator=(NiDsPS4Controller&&) = default;
/**
* Get the X axis value of left side of the controller. Right is positive.
@@ -522,39 +522,7 @@ class PS4Controller : public GenericHID,
*/
BooleanEvent Touchpad(EventLoop* loop) const;
/**
* Read the value of the touchpad button on the controller.
*
* @return The state of the button.
* @deprecated Use GetTouchpadButton instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be
* automatically generated.
*/
[[deprecated("Use GetTouchpadButton instead")]]
bool GetTouchpad() const;
/**
* Whether the touchpad was pressed since the last check.
*
* @return Whether the touchpad was pressed since the last check.
* @deprecated Use GetTouchpadButtonPressed instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetTouchpadButtonPressed instead")]]
bool GetTouchpadPressed();
/**
* Whether the touchpad was released since the last check.
*
* @return Whether the touchpad was released since the last check.
* @deprecated Use GetLeftBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use GetTouchpadButtonReleased instead")]]
bool GetTouchpadReleased();
/** Represents a digital button on an PS4Controller. */
/** Represents a digital button on an NiDsPS4Controller. */
struct Button {
/// Square button.
static constexpr int kSquare = 0;
@@ -586,7 +554,7 @@ class PS4Controller : public GenericHID,
static constexpr int kTouchpad = 13;
};
/** Represents an axis on an PS4Controller. */
/** Represents an axis on an NiDsPS4Controller. */
struct Axis {
/// Left X axis.
static constexpr int kLeftX = 0;

View File

@@ -14,9 +14,9 @@
namespace wpi {
/**
* Handle input from PS5 controllers connected to the Driver Station.
* Handle input from NiDsPS5 controllers connected to the Driver Station.
*
* This class handles PS5 input that comes from the Driver Station. Each
* This class handles NiDsPS5 input that comes from the Driver Station. Each
* time a value is requested the most recent value is returned. There is a
* single class instance for each controller and the mapping of ports to
* hardware buttons depends on the code in the Driver Station.
@@ -25,9 +25,9 @@ namespace wpi {
* correct mapping, and only through the official NI DS. Sim is not guaranteed
* to have the same mapping, as well as any 3rd party controllers.
*/
class PS5Controller : public GenericHID,
class NiDsPS5Controller : public GenericHID,
public wpi::util::Sendable,
public wpi::util::SendableHelper<PS5Controller> {
public wpi::util::SendableHelper<NiDsPS5Controller> {
public:
/**
* Construct an instance of a controller.
@@ -37,12 +37,12 @@ class PS5Controller : public GenericHID,
* @param port The port on the Driver Station that the controller is plugged
* into (0-5).
*/
explicit PS5Controller(int port);
explicit NiDsPS5Controller(int port);
~PS5Controller() override = default;
~NiDsPS5Controller() override = default;
PS5Controller(PS5Controller&&) = default;
PS5Controller& operator=(PS5Controller&&) = default;
NiDsPS5Controller(NiDsPS5Controller&&) = default;
NiDsPS5Controller& operator=(NiDsPS5Controller&&) = default;
/**
* Get the X axis value of left side of the controller. Right is positive.
@@ -522,39 +522,7 @@ class PS5Controller : public GenericHID,
*/
BooleanEvent Touchpad(EventLoop* loop) const;
/**
* Read the value of the touchpad button on the controller.
*
* @return The state of the button.
* @deprecated Use GetTouchpadButton instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be
* automatically generated.
*/
[[deprecated("Use GetTouchpadButton instead")]]
bool GetTouchpad() const;
/**
* Whether the touchpad was pressed since the last check.
*
* @return Whether the touchpad was pressed since the last check.
* @deprecated Use GetTouchpadButtonPressed instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetTouchpadButtonPressed instead")]]
bool GetTouchpadPressed();
/**
* Whether the touchpad was released since the last check.
*
* @return Whether the touchpad was released since the last check.
* @deprecated Use GetLeftBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use GetTouchpadButtonReleased instead")]]
bool GetTouchpadReleased();
/** Represents a digital button on an PS5Controller. */
/** Represents a digital button on an NiDsPS5Controller. */
struct Button {
/// Square button.
static constexpr int kSquare = 0;
@@ -586,7 +554,7 @@ class PS5Controller : public GenericHID,
static constexpr int kTouchpad = 13;
};
/** Represents an axis on an PS5Controller. */
/** Represents an axis on an NiDsPS5Controller. */
struct Axis {
/// Left X axis.
static constexpr int kLeftX = 0;

View File

@@ -14,9 +14,9 @@
namespace wpi {
/**
* Handle input from Stadia controllers connected to the Driver Station.
* Handle input from NiDsStadia controllers connected to the Driver Station.
*
* This class handles Stadia input that comes from the Driver Station. Each
* This class handles NiDsStadia input that comes from the Driver Station. Each
* time a value is requested the most recent value is returned. There is a
* single class instance for each controller and the mapping of ports to
* hardware buttons depends on the code in the Driver Station.
@@ -25,9 +25,9 @@ namespace wpi {
* correct mapping, and only through the official NI DS. Sim is not guaranteed
* to have the same mapping, as well as any 3rd party controllers.
*/
class StadiaController : public GenericHID,
class NiDsStadiaController : public GenericHID,
public wpi::util::Sendable,
public wpi::util::SendableHelper<StadiaController> {
public wpi::util::SendableHelper<NiDsStadiaController> {
public:
/**
* Construct an instance of a controller.
@@ -37,12 +37,12 @@ class StadiaController : public GenericHID,
* @param port The port on the Driver Station that the controller is plugged
* into (0-5).
*/
explicit StadiaController(int port);
explicit NiDsStadiaController(int port);
~StadiaController() override = default;
~NiDsStadiaController() override = default;
StadiaController(StadiaController&&) = default;
StadiaController& operator=(StadiaController&&) = default;
NiDsStadiaController(NiDsStadiaController&&) = default;
NiDsStadiaController& operator=(NiDsStadiaController&&) = default;
/**
* Get the X axis value of left side of the controller. Right is positive.
@@ -537,73 +537,7 @@ class StadiaController : public GenericHID,
*/
BooleanEvent Frame(EventLoop* loop) const;
/**
* Read the value of the left bumper (LB) button on the controller.
*
* @return the state of the button
* @deprecated Use GetLeftBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use GetLeftBumperButton instead")]]
bool GetLeftBumper() const;
/**
* Read the value of the right bumper (RB) button on the controller.
*
* @return the state of the button
* @deprecated Use GetRightBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use GetRightBumperButton instead")]]
bool GetRightBumper() const;
/**
* Whether the left bumper (LB) was pressed since the last check.
*
* @return Whether the button was pressed since the last check
* @deprecated Use GetLeftBumperButtonPressed instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetLeftBumperButtonPressed instead")]]
bool GetLeftBumperPressed();
/**
* Whether the right bumper (RB) was pressed since the last check.
*
* @return Whether the button was pressed since the last check
* @deprecated Use GetRightBumperButtonPressed instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetRightBumperButtonPressed instead")]]
bool GetRightBumperPressed();
/**
* Whether the left bumper (LB) was released since the last check.
*
* @return Whether the button was released since the last check.
* @deprecated Use GetLeftBumperButtonReleased instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetLeftBumperButtonReleased instead")]]
bool GetLeftBumperReleased();
/**
* Whether the right bumper (RB) was released since the last check.
*
* @return Whether the button was released since the last check.
* @deprecated Use GetRightBumperButtonReleased instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetRightBumperButtonReleased instead")]]
bool GetRightBumperReleased();
/** Represents a digital button on an StadiaController. */
/** Represents a digital button on an NiDsStadiaController. */
struct Button {
/// A button.
static constexpr int kA = 0;
@@ -637,7 +571,7 @@ class StadiaController : public GenericHID,
static constexpr int kFrame = 14;
};
/** Represents an axis on an StadiaController. */
/** Represents an axis on an NiDsStadiaController. */
struct Axis {
/// Left X axis.
static constexpr int kLeftX = 0;

View File

@@ -14,9 +14,9 @@
namespace wpi {
/**
* Handle input from Xbox controllers connected to the Driver Station.
* Handle input from NiDsXbox controllers connected to the Driver Station.
*
* This class handles Xbox input that comes from the Driver Station. Each
* This class handles NiDsXbox input that comes from the Driver Station. Each
* time a value is requested the most recent value is returned. There is a
* single class instance for each controller and the mapping of ports to
* hardware buttons depends on the code in the Driver Station.
@@ -25,9 +25,9 @@ namespace wpi {
* correct mapping, and only through the official NI DS. Sim is not guaranteed
* to have the same mapping, as well as any 3rd party controllers.
*/
class XboxController : public GenericHID,
class NiDsXboxController : public GenericHID,
public wpi::util::Sendable,
public wpi::util::SendableHelper<XboxController> {
public wpi::util::SendableHelper<NiDsXboxController> {
public:
/**
* Construct an instance of a controller.
@@ -37,12 +37,12 @@ class XboxController : public GenericHID,
* @param port The port on the Driver Station that the controller is plugged
* into (0-5).
*/
explicit XboxController(int port);
explicit NiDsXboxController(int port);
~XboxController() override = default;
~NiDsXboxController() override = default;
XboxController(XboxController&&) = default;
XboxController& operator=(XboxController&&) = default;
NiDsXboxController(NiDsXboxController&&) = default;
NiDsXboxController& operator=(NiDsXboxController&&) = default;
/**
* Get the X axis value of left side of the controller. Right is positive.
@@ -442,73 +442,7 @@ class XboxController : public GenericHID,
*/
BooleanEvent RightStick(EventLoop* loop) const;
/**
* Read the value of the left bumper (LB) button on the controller.
*
* @return the state of the button
* @deprecated Use GetLeftBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use GetLeftBumperButton instead")]]
bool GetLeftBumper() const;
/**
* Read the value of the right bumper (RB) button on the controller.
*
* @return the state of the button
* @deprecated Use GetRightBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use GetRightBumperButton instead")]]
bool GetRightBumper() const;
/**
* Whether the left bumper (LB) was pressed since the last check.
*
* @return Whether the button was pressed since the last check
* @deprecated Use GetLeftBumperButtonPressed instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetLeftBumperButtonPressed instead")]]
bool GetLeftBumperPressed();
/**
* Whether the right bumper (RB) was pressed since the last check.
*
* @return Whether the button was pressed since the last check
* @deprecated Use GetRightBumperButtonPressed instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetRightBumperButtonPressed instead")]]
bool GetRightBumperPressed();
/**
* Whether the left bumper (LB) was released since the last check.
*
* @return Whether the button was released since the last check.
* @deprecated Use GetLeftBumperButtonReleased instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetLeftBumperButtonReleased instead")]]
bool GetLeftBumperReleased();
/**
* Whether the right bumper (RB) was released since the last check.
*
* @return Whether the button was released since the last check.
* @deprecated Use GetRightBumperButtonReleased instead. This function is
* deprecated for removal to make function names consistent to allow the HID
* classes to be automatically generated.
*/
[[deprecated("Use GetRightBumperButtonReleased instead")]]
bool GetRightBumperReleased();
/** Represents a digital button on an XboxController. */
/** Represents a digital button on an NiDsXboxController. */
struct Button {
/// A button.
static constexpr int kA = 0;
@@ -532,7 +466,7 @@ class XboxController : public GenericHID,
static constexpr int kRightStick = 9;
};
/** Represents an axis on an XboxController. */
/** Represents an axis on an NiDsXboxController. */
struct Axis {
/// Left X axis.
static constexpr int kLeftX = 0;

View File

@@ -10,28 +10,28 @@
namespace wpi {
class PS4Controller;
class NiDsPS4Controller;
namespace sim {
/**
* Class to control a simulated PS4 controller.
* Class to control a simulated NiDsPS4 controller.
*/
class PS4ControllerSim : public GenericHIDSim {
class NiDsPS4ControllerSim : public GenericHIDSim {
public:
/**
* Constructs from a PS4Controller object.
* Constructs from a NiDsPS4Controller object.
*
* @param joystick controller to simulate
*/
explicit PS4ControllerSim(const PS4Controller& joystick);
explicit NiDsPS4ControllerSim(const NiDsPS4Controller& joystick);
/**
* Constructs from a joystick port number.
*
* @param port port number
*/
explicit PS4ControllerSim(int port);
explicit NiDsPS4ControllerSim(int port);
/**
* Change the left X value of the controller's joystick.
@@ -172,18 +172,6 @@ class PS4ControllerSim : public GenericHIDSim {
* @param value the new value
*/
void SetTouchpadButton(bool value);
/**
* Change the value of the touchpad button on the controller.
*
* @param value the new value
* @deprecated Use SetTouchpadButton instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be
* automatically generated.
*/
[[deprecated("Use SetTouchpadButton instead")]]
void SetTouchpad(bool value);
};
} // namespace sim

View File

@@ -10,28 +10,28 @@
namespace wpi {
class PS5Controller;
class NiDsPS5Controller;
namespace sim {
/**
* Class to control a simulated PS5 controller.
* Class to control a simulated NiDsPS5 controller.
*/
class PS5ControllerSim : public GenericHIDSim {
class NiDsPS5ControllerSim : public GenericHIDSim {
public:
/**
* Constructs from a PS5Controller object.
* Constructs from a NiDsPS5Controller object.
*
* @param joystick controller to simulate
*/
explicit PS5ControllerSim(const PS5Controller& joystick);
explicit NiDsPS5ControllerSim(const NiDsPS5Controller& joystick);
/**
* Constructs from a joystick port number.
*
* @param port port number
*/
explicit PS5ControllerSim(int port);
explicit NiDsPS5ControllerSim(int port);
/**
* Change the left X value of the controller's joystick.
@@ -172,18 +172,6 @@ class PS5ControllerSim : public GenericHIDSim {
* @param value the new value
*/
void SetTouchpadButton(bool value);
/**
* Change the value of the touchpad button on the controller.
*
* @param value the new value
* @deprecated Use SetTouchpadButton instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be
* automatically generated.
*/
[[deprecated("Use SetTouchpadButton instead")]]
void SetTouchpad(bool value);
};
} // namespace sim

View File

@@ -10,28 +10,28 @@
namespace wpi {
class StadiaController;
class NiDsStadiaController;
namespace sim {
/**
* Class to control a simulated Stadia controller.
* Class to control a simulated NiDsStadia controller.
*/
class StadiaControllerSim : public GenericHIDSim {
class NiDsStadiaControllerSim : public GenericHIDSim {
public:
/**
* Constructs from a StadiaController object.
* Constructs from a NiDsStadiaController object.
*
* @param joystick controller to simulate
*/
explicit StadiaControllerSim(const StadiaController& joystick);
explicit NiDsStadiaControllerSim(const NiDsStadiaController& joystick);
/**
* Constructs from a joystick port number.
*
* @param port port number
*/
explicit StadiaControllerSim(int port);
explicit NiDsStadiaControllerSim(int port);
/**
* Change the left X value of the controller's joystick.
@@ -165,7 +165,6 @@ class StadiaControllerSim : public GenericHIDSim {
* @param value the new value
*/
void SetFrameButton(bool value);
};
} // namespace sim

View File

@@ -10,28 +10,28 @@
namespace wpi {
class XboxController;
class NiDsXboxController;
namespace sim {
/**
* Class to control a simulated Xbox controller.
* Class to control a simulated NiDsXbox controller.
*/
class XboxControllerSim : public GenericHIDSim {
class NiDsXboxControllerSim : public GenericHIDSim {
public:
/**
* Constructs from a XboxController object.
* Constructs from a NiDsXboxController object.
*
* @param joystick controller to simulate
*/
explicit XboxControllerSim(const XboxController& joystick);
explicit NiDsXboxControllerSim(const NiDsXboxController& joystick);
/**
* Constructs from a joystick port number.
*
* @param port port number
*/
explicit XboxControllerSim(int port);
explicit NiDsXboxControllerSim(int port);
/**
* Change the left X value of the controller's joystick.
@@ -144,29 +144,6 @@ class XboxControllerSim : public GenericHIDSim {
* @param value the new value
*/
void SetRightStickButton(bool value);
/**
* Change the left bumper value of the joystick.
*
* @param value the new value
* @deprecated Use SetLeftBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use SetLeftBumperButton instead")]]
void SetLeftBumper(bool value);
/**
* Change the right bumper value of the joystick.
*
* @param value the new value
* @deprecated Use SetRightBumperButton instead. This function is deprecated
* for removal to make function names consistent to allow the HID classes to
* be automatically generated.
*/
[[deprecated("Use SetRightBumperButton instead")]]
void SetRightBumper(bool value);
};
} // namespace sim