mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
@@ -40,20 +40,20 @@ class NetworkTable : public ITable {
|
||||
|
||||
/**
|
||||
* set that network tables should be a client
|
||||
* This must be called before initalize or GetTable
|
||||
* This must be called before initialize or GetTable
|
||||
*/
|
||||
static void SetClientMode();
|
||||
|
||||
/**
|
||||
* set that network tables should be a server
|
||||
* This must be called before initalize or GetTable
|
||||
* This must be called before initialize or GetTable
|
||||
*/
|
||||
static void SetServerMode();
|
||||
|
||||
/**
|
||||
* set the team the robot is configured for (this will set the ip address that
|
||||
* set the team the robot is configured for (this will set the mdns address that
|
||||
* network tables will connect to in client mode)
|
||||
* This must be called before initalize or GetTable
|
||||
* This must be called before initialize or GetTable
|
||||
* @param team the team number
|
||||
*/
|
||||
static void SetTeam(int team);
|
||||
|
||||
@@ -60,7 +60,7 @@ public class NetworkTable implements ITable, IRemote {
|
||||
|
||||
/**
|
||||
* set that network tables should be a server
|
||||
* This must be called before initalize or getTable
|
||||
* This must be called before initialize or getTable
|
||||
*/
|
||||
public synchronized static void setServerMode() {
|
||||
if (!client)
|
||||
@@ -71,7 +71,7 @@ public class NetworkTable implements ITable, IRemote {
|
||||
|
||||
/**
|
||||
* set that network tables should be a client
|
||||
* This must be called before initalize or getTable
|
||||
* This must be called before initialize or getTable
|
||||
*/
|
||||
public synchronized static void setClientMode() {
|
||||
if (client)
|
||||
@@ -81,13 +81,13 @@ public class NetworkTable implements ITable, IRemote {
|
||||
}
|
||||
|
||||
/**
|
||||
* set the team the robot is configured for (this will set the ip address that
|
||||
* set the team the robot is configured for (this will set the mdns address that
|
||||
* network tables will connect to in client mode)
|
||||
* This must be called before initalize or getTable
|
||||
* This must be called before initialize or getTable
|
||||
* @param team the team number
|
||||
*/
|
||||
public synchronized static void setTeam(int team) {
|
||||
setIPAddress("10." + (team / 100) + "." + (team % 100) + ".2");
|
||||
setIPAddress("roboRIO-" + team + "-FRC.local");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,9 +41,9 @@ void NetworkTable::SetServerMode() { s_client = false; }
|
||||
void NetworkTable::SetTeam(int team) {
|
||||
char tmp[30];
|
||||
#ifdef _MSC_VER
|
||||
sprintf_s(tmp, "%d.%d.%d.%d\n", 10, team / 100, team % 100, 2);
|
||||
sprintf_s(tmp, "roboRIO-%d-FRC.local\n", team);
|
||||
#else
|
||||
std::snprintf(tmp, 30, "%d.%d.%d.%d\n", 10, team / 100, team % 100, 2);
|
||||
std::snprintf(tmp, 30, "roboRIO-%d-FRC.local\n",team);
|
||||
#endif
|
||||
SetIPAddress(tmp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user