[hal] Add initial SystemServer support (#7463)

This commit is contained in:
Thad House
2024-12-01 04:31:26 +00:00
committed by GitHub
parent 82132c3272
commit c51f65bd4f
39 changed files with 1658 additions and 83 deletions

View File

@@ -0,0 +1,35 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
#include "SystemServer.h"
#include "mrc/NtNetComm.h"
namespace hal {
static nt::NetworkTableInstance ServerInstance;
void InitializeSystemServer() {
if (ServerInstance) {
return;
}
ServerInstance = nt::NetworkTableInstance::Create();
ServerInstance.SetServer("localhost", ROBOT_SYSTEM_SERVER_NT_PORT);
ServerInstance.StartClient4("RobotProgram");
}
void ShutdownSystemServer() {
if (!ServerInstance) {
return;
}
ServerInstance.StopClient();
nt::NetworkTableInstance::Destroy(ServerInstance);
}
nt::NetworkTableInstance GetSystemServer() {
return ServerInstance;
}
} // namespace hal