mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[ntcore] Add client disconnect function (#5022)
As setServer doesn't disconnect, it's useful to have a function that disconnects without needing to completely stop the client.
This commit is contained in:
@@ -586,6 +586,12 @@ class NetworkTableInstance final {
|
||||
*/
|
||||
void SetServerTeam(unsigned int team, unsigned int port = 0);
|
||||
|
||||
/**
|
||||
* Disconnects the client if it's running and connected. This will
|
||||
* automatically start reconnection attempts to the current server list.
|
||||
*/
|
||||
void Disconnect();
|
||||
|
||||
/**
|
||||
* Starts requesting server address from Driver Station.
|
||||
* This connects to the Driver Station running on localhost to obtain the
|
||||
|
||||
@@ -163,6 +163,10 @@ inline void NetworkTableInstance::SetServerTeam(unsigned int team,
|
||||
::nt::SetServerTeam(m_handle, team, port);
|
||||
}
|
||||
|
||||
inline void NetworkTableInstance::Disconnect() {
|
||||
::nt::Disconnect(m_handle);
|
||||
}
|
||||
|
||||
inline void NetworkTableInstance::StartDSClient(unsigned int port) {
|
||||
::nt::StartDSClient(m_handle, port);
|
||||
}
|
||||
|
||||
@@ -1147,6 +1147,14 @@ void NT_SetServerMulti(NT_Inst inst, size_t count, const char** server_names,
|
||||
*/
|
||||
void NT_SetServerTeam(NT_Inst inst, unsigned int team, unsigned int port);
|
||||
|
||||
/**
|
||||
* Disconnects the client if it's running and connected. This will automatically
|
||||
* start reconnection attempts to the current server list.
|
||||
*
|
||||
* @param inst instance handle
|
||||
*/
|
||||
void NT_Disconnect(NT_Inst inst);
|
||||
|
||||
/**
|
||||
* Starts requesting server address from Driver Station.
|
||||
* This connects to the Driver Station running on localhost to obtain the
|
||||
|
||||
@@ -1087,6 +1087,14 @@ void SetServer(
|
||||
*/
|
||||
void SetServerTeam(NT_Inst inst, unsigned int team, unsigned int port);
|
||||
|
||||
/**
|
||||
* Disconnects the client if it's running and connected. This will automatically
|
||||
* start reconnection attempts to the current server list.
|
||||
*
|
||||
* @param inst instance handle
|
||||
*/
|
||||
void Disconnect(NT_Inst inst);
|
||||
|
||||
/**
|
||||
* Starts requesting server address from Driver Station.
|
||||
* This connects to the Driver Station running on localhost to obtain the
|
||||
|
||||
Reference in New Issue
Block a user