6#include <wpi/hal/Value.h>
13#include <wpi/hal/SimDevice.hpp>
30 SensorData(std::string name, std::function<HAL_Value()> supplier, HAL_Value defaultValue,
32 SensorData(std::string name, std::function<
double()> supplier,
double defaultVal);
33 SensorData(std::string name, std::function<
int()> supplier,
int defaultVal);
34 SensorData(std::string name, std::function<
bool()> supplier,
bool defaultVal);
35 SensorData(std::string name, std::function<int64_t()> supplier, int64_t defaultVal);
44 static std::function<HAL_Value()>
Convert(std::function<
double()> supplier);
45 static std::function<HAL_Value()>
Convert(std::function<
int()> supplier);
46 static std::function<HAL_Value()>
Convert(std::function<
bool()> supplier);
47 static std::function<HAL_Value()>
Convert(std::function<int64_t()> supplier);
65 void Set(HAL_Value val);
68 void Set(int64_t val);
80 HAL_SimValueHandle
CreateValue(HAL_SimDeviceHandle device, int32_t direction);
84 std::function<HAL_Value()> m_supplier;
86 HAL_Value m_defaultValue;
87 std::optional<std::vector<std::pair<std::function<bool()>, HAL_Value>>> m_triggerValues;
88 HAL_SimValueHandle m_glassValue{HAL_INVALID_HANDLE};
89 std::optional<HAL_Value> m_prev;
static HAL_Value Convert(int64_t value)
void AddSimTrigger(HAL_Value value, std::function< bool()> trigger)
SensorData(std::string name, std::function< HAL_Value()> supplier, HAL_Value defaultValue, HALValueType type)
double GetAsDouble() const
SensorData(std::string name, std::function< int()> supplier, int defaultVal)
static std::function< HAL_Value()> Convert(std::function< bool()> supplier)
bool GetAsBoolean() const
SensorData(std::string name, std::function< double()> supplier, double defaultVal)
SensorData(std::string name, std::function< int64_t()> supplier, int64_t defaultVal)
HAL_Value GetValue() const
HALValueType
Definition SensorData.hpp:26
@ kInt
Definition SensorData.hpp:26
@ kEnum
Definition SensorData.hpp:26
@ kBoolean
Definition SensorData.hpp:26
@ kLong
Definition SensorData.hpp:26
@ kDouble
Definition SensorData.hpp:26
HAL_SimValueHandle CreateValue(HAL_SimDeviceHandle device, int32_t direction)
static std::function< HAL_Value()> Convert(std::function< int()> supplier)
static HAL_Value Convert(int value)
int64_t GetAsLong() const
HAL_Value GetDefault() const
SensorData(std::string name, std::function< bool()> supplier, bool defaultVal)
std::string GetName() const
static std::function< HAL_Value()> Convert(std::function< double()> supplier)
HALValueType GetType() const
static HAL_Value Convert(double value)
static HAL_Value Convert(bool value)
static std::function< HAL_Value()> Convert(std::function< int64_t()> supplier)
Definition SimSensorConfig.hpp:15