mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
Merge pull request #51 from robotdotnet/RemoteChanges
Adds extended Remote Connection Listener
This commit is contained in:
@@ -214,9 +214,9 @@ public class NetworkTable implements ITable, IRemote {
|
||||
|
||||
public void apply(int uid, boolean connected, ConnectionInfo conn) {
|
||||
if (connected)
|
||||
targetListener.connected(targetSource);
|
||||
targetListener.connectedEx(targetSource, conn);
|
||||
else
|
||||
targetListener.disconnected(targetSource);
|
||||
targetListener.disconnectedEx(targetSource, conn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package edu.wpi.first.wpilibj.tables;
|
||||
|
||||
import edu.wpi.first.wpilibj.networktables.ConnectionInfo;
|
||||
|
||||
/**
|
||||
* A listener that listens for connection changes in a {@link IRemote} object
|
||||
*
|
||||
@@ -17,4 +19,22 @@ public interface IRemoteConnectionListener {
|
||||
* @param remote the object that disconnected
|
||||
*/
|
||||
public void disconnected(IRemote remote);
|
||||
/**
|
||||
* Extended version of connected called when an IRemote is connected.
|
||||
* Contains the connection info of the connected remote
|
||||
* @param remote the object that connected
|
||||
* @param info the connection info for the connected remote
|
||||
*/
|
||||
default public void connectedEx(IRemote remote, ConnectionInfo info) {
|
||||
connected(remote);
|
||||
}
|
||||
/**
|
||||
* Extended version of connected called when an IRemote is disconnected.
|
||||
* Contains the connection info of the disconnected remote
|
||||
* @param remote the object that disconnected
|
||||
* @param info the connection info for the disconnected remote
|
||||
*/
|
||||
default public void disconnectedEx(IRemote remote, ConnectionInfo info) {
|
||||
disconnected(remote);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user