mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[ntcore] Change Java event mask to EnumSet (#4564)
Also convert NetworkTableInstance.getNetworkMode() to return EnumSet.
This commit is contained in:
@@ -17,6 +17,7 @@ import edu.wpi.first.networktables.NetworkTableListener;
|
||||
import edu.wpi.first.networktables.StringPublisher;
|
||||
import edu.wpi.first.networktables.Topic;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
|
||||
/**
|
||||
* The preferences class provides a relatively simple way to save important values to the roboRIO to
|
||||
@@ -77,7 +78,7 @@ public final class Preferences {
|
||||
m_listener =
|
||||
NetworkTableListener.createListener(
|
||||
m_tableSubscriber,
|
||||
NetworkTableEvent.kImmediate | NetworkTableEvent.kPublish,
|
||||
EnumSet.of(NetworkTableEvent.Kind.kImmediate, NetworkTableEvent.Kind.kPublish),
|
||||
event -> {
|
||||
if (event.topicInfo != null) {
|
||||
Topic topic = event.topicInfo.getTopic();
|
||||
|
||||
@@ -155,7 +155,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
// wait for the NT server to actually start
|
||||
try {
|
||||
int count = 0;
|
||||
while ((inst.getNetworkMode() & NetworkTableInstance.kNetModeStarting) != 0) {
|
||||
while (inst.getNetworkMode().contains(NetworkTableInstance.NetworkMode.kStarting)) {
|
||||
Thread.sleep(10);
|
||||
count++;
|
||||
if (count > 100) {
|
||||
|
||||
Reference in New Issue
Block a user