WPILibC++  unspecified
XboxController.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2016-2017 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include "ErrorBase.h"
11 #include "GamepadBase.h"
12 
13 namespace frc {
14 
15 class DriverStation;
16 
26 class XboxController : public GamepadBase, public ErrorBase {
27  public:
28  explicit XboxController(int port);
29  virtual ~XboxController() = default;
30 
31  XboxController(const XboxController&) = delete;
32  XboxController& operator=(const XboxController&) = delete;
33 
34  double GetX(JoystickHand hand) const override;
35  double GetY(JoystickHand hand) const override;
36 
37  bool GetBumper(JoystickHand hand) const override;
38  bool GetStickButton(JoystickHand hand) const override;
39 
40  virtual double GetTriggerAxis(JoystickHand hand) const;
41 
42  bool GetAButton() const;
43  bool GetBButton() const;
44  bool GetXButton() const;
45  bool GetYButton() const;
46  bool GetBackButton() const;
47  bool GetStartButton() const;
48 
49  private:
50  DriverStation& m_ds;
51 };
52 
53 } // namespace frc
bool GetStartButton() const
Read the value of the start button on the controller.
Definition: XboxController.cpp:142
Definition: Timer.cpp:18
bool GetBButton() const
Read the value of the B button on the controller.
Definition: XboxController.cpp:110
Handle input from Xbox 360 or Xbox One controllers connected to the Driver Station.
Definition: XboxController.h:26
double GetX(JoystickHand hand) const override
Get the X axis value of the controller.
Definition: XboxController.cpp:35
virtual double GetTriggerAxis(JoystickHand hand) const
Get the trigger axis value of the controller.
Definition: XboxController.cpp:88
bool GetYButton() const
Read the value of the Y button on the controller.
Definition: XboxController.cpp:126
Provide access to the network communication data to / from the Driver Station.
Definition: DriverStation.h:28
XboxController(int port)
Construct an instance of an Xbox controller.
Definition: XboxController.cpp:24
double GetY(JoystickHand hand) const override
Get the Y axis value of the controller.
Definition: XboxController.cpp:48
bool GetXButton() const
Read the value of the X button on the controller.
Definition: XboxController.cpp:118
bool GetStickButton(JoystickHand hand) const override
Read the value of the stick button on the controller.
Definition: XboxController.cpp:75
bool GetBackButton() const
Read the value of the back button on the controller.
Definition: XboxController.cpp:134
Base class for most objects.
Definition: ErrorBase.h:74
bool GetBumper(JoystickHand hand) const override
Read the value of the bumper button on the controller.
Definition: XboxController.cpp:61
bool GetAButton() const
Read the value of the A button on the controller.
Definition: XboxController.cpp:102
Gamepad Interface.
Definition: GamepadBase.h:17