Add a .controllable key as a standard part of Sendable (#1225)

This indicates whether or not the Sendable listeners are installed.
It is set to true when SendableBuilder.startListeners() starts the listeners,
and set to false when SendableBuilder.stopListeners() stops the listeners.

This allows dashboards to choose to change their widget display based on
whether or not the value is actually controllable.
This commit is contained in:
Peter Johnson
2018-07-28 10:42:31 -07:00
committed by GitHub
parent 1d9ed8f458
commit 397a296e25
3 changed files with 8 additions and 0 deletions

View File

@@ -14,6 +14,7 @@ using namespace frc;
void SendableBuilderImpl::SetTable(std::shared_ptr<nt::NetworkTable> table) {
m_table = table;
m_controllableEntry = table->GetEntry(".controllable");
}
std::shared_ptr<nt::NetworkTable> SendableBuilderImpl::GetTable() {
@@ -30,10 +31,12 @@ void SendableBuilderImpl::UpdateTable() {
void SendableBuilderImpl::StartListeners() {
for (auto& property : m_properties) property.StartListener();
m_controllableEntry.SetBoolean(true);
}
void SendableBuilderImpl::StopListeners() {
for (auto& property : m_properties) property.StopListener();
m_controllableEntry.SetBoolean(false);
}
void SendableBuilderImpl::StartLiveWindowMode() {