2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2017-08-19 23:08:27 -07:00
|
|
|
|
2015-08-28 12:35:04 -07:00
|
|
|
import edu.wpi.first.wpilibj.networktables.*;
|
|
|
|
|
import edu.wpi.first.wpilibj.tables.*;
|
|
|
|
|
|
|
|
|
|
public class Server {
|
|
|
|
|
private static class MyLogger implements NetworkTablesJNI.LoggerFunction {
|
|
|
|
|
public void apply(int level, String file, int line, String msg) {
|
|
|
|
|
System.err.println(msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
NetworkTablesJNI.setLogger(new MyLogger(), 0);
|
|
|
|
|
NetworkTable.setIPAddress("127.0.0.1");
|
|
|
|
|
NetworkTable.setPort(10000);
|
|
|
|
|
NetworkTable.setServerMode();
|
|
|
|
|
NetworkTable nt = NetworkTable.getTable("");
|
2020-12-30 16:17:20 -08:00
|
|
|
try {
|
|
|
|
|
Thread.sleep(1000);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
}
|
2015-08-28 12:35:04 -07:00
|
|
|
nt.putNumber("foo", 0.5);
|
|
|
|
|
nt.setFlags("foo", NetworkTable.PERSISTENT);
|
|
|
|
|
nt.putNumber("foo2", 0.5);
|
|
|
|
|
nt.putNumber("foo2", 0.7);
|
|
|
|
|
nt.putNumber("foo2", 0.6);
|
|
|
|
|
nt.putNumber("foo2", 0.5);
|
2020-12-30 16:17:20 -08:00
|
|
|
try {
|
|
|
|
|
Thread.sleep(10000);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
}
|
2015-08-28 12:35:04 -07:00
|
|
|
}
|
|
|
|
|
}
|