Add FRC Driver Station connection support.

The 2017 FRC Driver Station supports getting the robot IP via a TCP
connection that returns JSON.  Use this to support overriding the
server IP address used for client connections.

Default to using this approach for client connections in the NetworkTable
interfaces.

Add support for setting the server address without stopping and
restarting the client.

SetTeam now also round-robins by default.
This commit is contained in:
Peter Johnson
2016-11-04 16:01:42 -07:00
parent 34acd9d47c
commit 77edf1e103
15 changed files with 538 additions and 66 deletions

38
src/DsClient.h Normal file
View File

@@ -0,0 +1,38 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2016. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#ifndef NT_DSCLIENT_H_
#define NT_DSCLIENT_H_
#include "support/atomic_static.h"
#include "support/SafeThread.h"
namespace nt {
class DsClient {
public:
static DsClient& GetInstance() {
ATOMIC_STATIC(DsClient, instance);
return instance;
}
~DsClient() = default;
void Start(unsigned int port);
void Stop();
private:
DsClient() = default;
class Thread;
wpi::SafeThreadOwner<Thread> m_owner;
ATOMIC_STATIC_DECL(DsClient)
};
} // namespace nt
#endif // NT_DSCLIENT_H_