mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
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:
@@ -57,6 +57,7 @@ public class SendableBuilderImpl implements SendableBuilder {
|
||||
private Runnable m_safeState;
|
||||
private Runnable m_updateTable;
|
||||
private NetworkTable m_table;
|
||||
private NetworkTableEntry m_controllableEntry;
|
||||
|
||||
/**
|
||||
* Set the network table. Must be called prior to any Add* functions being
|
||||
@@ -65,6 +66,7 @@ public class SendableBuilderImpl implements SendableBuilder {
|
||||
*/
|
||||
public void setTable(NetworkTable table) {
|
||||
m_table = table;
|
||||
m_controllableEntry = table.getEntry(".controllable");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,6 +98,7 @@ public class SendableBuilderImpl implements SendableBuilder {
|
||||
for (Property property : m_properties) {
|
||||
property.startListener();
|
||||
}
|
||||
m_controllableEntry.setBoolean(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,6 +108,7 @@ public class SendableBuilderImpl implements SendableBuilder {
|
||||
for (Property property : m_properties) {
|
||||
property.stopListener();
|
||||
}
|
||||
m_controllableEntry.setBoolean(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user