-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #646 from AustinShalit/ntSource
Add NetworkTableSource
- Loading branch information
Showing
26 changed files
with
651 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,3 +88,7 @@ bower_components | |
**/generated | ||
*/generated_tests | ||
/bin/ | ||
|
||
### NetworkTables | ||
networktables.ini | ||
networktables.ini.bak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
core/src/main/java/edu/wpi/grip/core/operations/network/MapNetworkReceiverFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package edu.wpi.grip.core.operations.network; | ||
|
||
|
||
/** | ||
* A factory to create {@link NetworkReceiver NetworkRecievers}. | ||
*/ | ||
@FunctionalInterface | ||
public interface MapNetworkReceiverFactory { | ||
NetworkReceiver create(String path); | ||
} |
45 changes: 45 additions & 0 deletions
45
core/src/main/java/edu/wpi/grip/core/operations/network/NetworkReceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package edu.wpi.grip.core.operations.network; | ||
|
||
import java.util.function.Consumer; | ||
|
||
import static com.google.common.base.Preconditions.checkArgument; | ||
import static com.google.common.base.Preconditions.checkNotNull; | ||
|
||
/** | ||
* Manages the interface between the {@link PublishAnnotatedOperation} and the actual network | ||
* protocol implemented by a specific {@link Manager}. | ||
*/ | ||
public abstract class NetworkReceiver implements AutoCloseable { | ||
|
||
protected final String path; | ||
|
||
/** | ||
* Create a new NetworkReceiver with the specified path. | ||
* | ||
* @param path The path of the object to get | ||
*/ | ||
public NetworkReceiver(String path) { | ||
checkNotNull(path, "Path cannot be null"); | ||
checkArgument(!path.isEmpty(), "Path cannot be an empty string"); | ||
this.path = path; | ||
} | ||
|
||
/** | ||
* Get the value of the object. | ||
* | ||
* @return The value of this NetworkReceiver | ||
*/ | ||
public abstract Object getValue(); | ||
|
||
/** | ||
* Add a listener to the NetworkReceiver item. | ||
* | ||
* @param consumer The consumer to call when this item has a update | ||
*/ | ||
public abstract void addListener(Consumer<Object> consumer); | ||
|
||
/** | ||
* Close the network reciever. This should not throw an exception. | ||
*/ | ||
public abstract void close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.