mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
[hal] Add handle constructor and name getters for sim devices (#4925)
This commit is contained in:
@@ -27,6 +27,12 @@ SimDeviceSim::SimDeviceSim(const char* name, int index, int channel) {
|
||||
fmt::format("{}[{},{}]", name, index, channel).c_str());
|
||||
}
|
||||
|
||||
SimDeviceSim::SimDeviceSim(HAL_SimDeviceHandle handle) : m_handle(handle) {}
|
||||
|
||||
std::string SimDeviceSim::GetName() const {
|
||||
return std::string(HALSIM_GetSimDeviceName(m_handle));
|
||||
}
|
||||
|
||||
hal::SimValue SimDeviceSim::GetValue(const char* name) const {
|
||||
return HALSIM_GetSimValueHandle(m_handle, name);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,20 @@ class SimDeviceSim {
|
||||
*/
|
||||
SimDeviceSim(const char* name, int index, int channel);
|
||||
|
||||
/**
|
||||
* Constructs a SimDeviceSim.
|
||||
*
|
||||
* @param handle the low level handle for the corresponding SimDevice.
|
||||
*/
|
||||
explicit SimDeviceSim(HAL_SimDeviceHandle handle);
|
||||
|
||||
/**
|
||||
* Get the name of this object.
|
||||
*
|
||||
* @return name
|
||||
*/
|
||||
std::string GetName() const;
|
||||
|
||||
/**
|
||||
* Get the property object with the given name.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user