Files
allwpilib/wpilibc/src/main/native/include/frc/simulation/GenericHIDSim.h
Peter Johnson 8f1f64ffb6 Remove year from file copyright message (NFC) (#2972)
Also update copyright to include "and other WPILib contributors" and clarify
license referral language to not be restricted to FIRST teams.
2020-12-26 14:12:05 -08:00

73 lines
1.3 KiB
C++

// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#pragma once
#include <stdint.h>
#include "frc/GenericHID.h"
namespace frc {
class GenericHID;
namespace sim {
/**
* Class to control a simulated generic joystick.
*/
class GenericHIDSim {
public:
/**
* Constructs from a GenericHID object.
*
* @param joystick joystick to simulate
*/
explicit GenericHIDSim(const GenericHID& joystick);
/**
* Constructs from a joystick port number.
*
* @param port port number
*/
explicit GenericHIDSim(int port);
/**
* Updates joystick data so that new values are visible to the user program.
*/
void NotifyNewData();
void SetRawButton(int button, bool value);
void SetRawAxis(int axis, double value);
void SetPOV(int pov, int value);
void SetPOV(int value);
void SetAxisCount(int count);
void SetPOVCount(int count);
void SetButtonCount(int count);
void SetType(GenericHID::HIDType type);
void SetName(const char* name);
void SetAxisType(int axis, int type);
bool GetOutput(int outputNumber);
int64_t GetOutputs();
double GetRumble(GenericHID::RumbleType type);
protected:
int m_port;
};
} // namespace sim
} // namespace frc