10 #include "MotorSafety.h"
11 #include "SensorBase.h"
12 #include "tables/ITableListener.h"
13 #include "LiveWindow/LiveWindowSendable.h"
14 #include "tables/ITable.h"
39 enum Value { kOff, kOn, kForward, kReverse };
40 enum Direction { kBothDirections, kForwardOnly, kReverseOnly };
42 Relay(uint32_t channel, Direction direction = kBothDirections);
45 void Set(Value value);
47 uint32_t GetChannel()
const;
55 void GetDescription(std::ostringstream& desc)
const override;
58 std::shared_ptr<nt::Value> value,
bool isNew)
override;
63 void InitTable(std::shared_ptr<ITable> subTable)
override;
64 std::shared_ptr<ITable>
GetTable()
const override;
66 std::shared_ptr<ITable> m_table;
70 Direction m_direction;
72 std::unique_ptr<MotorSafetyHelper> m_safetyHelper;
A table whose values can be read and written to.
Definition: ITable.h:43
virtual ~Relay()
Free the resource associated with a relay.
Definition: Relay.cpp:76
float GetExpiration() const override
Return the expiration time for the relay object.
Definition: Relay.cpp:213
Definition: MotorSafety.h:14
void Set(Value value)
Set the relay state.
Definition: Relay.cpp:108
Live Window Sendable is a special type of object sendable to the live window.
Definition: LiveWindowSendable.h:18
bool IsAlive() const override
Check if the relay object is currently alive or stopped due to a timeout.
Definition: Relay.cpp:220
std::string GetSmartDashboardType() const override
Definition: Relay.cpp:285
Base class for all sensors.
Definition: SensorBase.h:20
bool IsSafetyEnabled() const override
Check if motor safety is enabled for this object.
Definition: Relay.cpp:242
std::shared_ptr< ITable > GetTable() const override
Definition: Relay.cpp:292
Definition: MotorSafetyHelper.h:17
void StartLiveWindowMode() override
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: Relay.cpp:273
A listener that listens to changes in values in a ITable.
Definition: ITableListener.h:18
Value Get() const
Get the Relay State.
Definition: Relay.cpp:169
Class for Spike style relay outputs.
Definition: Relay.h:34
Relay(uint32_t channel, Direction direction=kBothDirections)
Relay constructor given a channel.
Definition: Relay.cpp:29
void SetExpiration(float timeout) override
Set the expiration time for the Relay object.
Definition: Relay.cpp:205
void StopLiveWindowMode() override
Stop having this sendable object automatically respond to value changes.
Definition: Relay.cpp:279
void StopMotor() override
Stop the motor associated with this PWM object.
Definition: Relay.cpp:227
void InitTable(std::shared_ptr< ITable > subTable) override
Initializes a table for this sendable object.
Definition: Relay.cpp:287
void UpdateTable() override
Update the table for this sendable object with the latest values.
Definition: Relay.cpp:259
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:39
void SetSafetyEnabled(bool enabled) override
Enable/disable motor safety for this device Turn on and off the motor safety option for this relay ob...
Definition: Relay.cpp:234