Merge pull request #36 from ThadHouse/master

Makes SetTeam use Mdns
This commit is contained in:
Peter Johnson
2015-11-19 23:15:06 -08:00
3 changed files with 11 additions and 11 deletions

View File

@@ -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);

View File

@@ -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");
}
/**

View File

@@ -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);
}