2020-12-26 14:12:05 -08:00
|
|
|
// 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.
|
2018-09-28 04:18:18 -04:00
|
|
|
|
|
|
|
|
#include "frc/shuffleboard/Shuffleboard.h"
|
|
|
|
|
|
|
|
|
|
#include <networktables/NetworkTableInstance.h>
|
|
|
|
|
|
|
|
|
|
#include "frc/shuffleboard/ShuffleboardTab.h"
|
|
|
|
|
|
|
|
|
|
using namespace frc;
|
|
|
|
|
|
2020-12-28 12:58:06 -08:00
|
|
|
void Shuffleboard::Update() {
|
|
|
|
|
GetInstance().Update();
|
|
|
|
|
}
|
2018-09-28 04:18:18 -04:00
|
|
|
|
2021-06-06 16:13:58 -07:00
|
|
|
ShuffleboardTab& Shuffleboard::GetTab(std::string_view title) {
|
2018-09-28 04:18:18 -04:00
|
|
|
return GetInstance().GetTab(title);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-28 12:58:06 -08:00
|
|
|
void Shuffleboard::SelectTab(int index) {
|
|
|
|
|
GetInstance().SelectTab(index);
|
|
|
|
|
}
|
2018-11-28 01:12:50 -05:00
|
|
|
|
2021-06-06 16:13:58 -07:00
|
|
|
void Shuffleboard::SelectTab(std::string_view title) {
|
2018-11-28 01:12:50 -05:00
|
|
|
GetInstance().SelectTab(title);
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-28 04:18:18 -04:00
|
|
|
void Shuffleboard::EnableActuatorWidgets() {
|
|
|
|
|
GetInstance().EnableActuatorWidgets();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Shuffleboard::DisableActuatorWidgets() {
|
|
|
|
|
// Need to update to make sure the sendable builders are initialized
|
|
|
|
|
Update();
|
|
|
|
|
GetInstance().DisableActuatorWidgets();
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-19 02:15:30 -05:00
|
|
|
void Shuffleboard::StartRecording() {
|
|
|
|
|
GetRecordingController().StartRecording();
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-28 12:58:06 -08:00
|
|
|
void Shuffleboard::StopRecording() {
|
|
|
|
|
GetRecordingController().StopRecording();
|
|
|
|
|
}
|
2018-11-19 02:15:30 -05:00
|
|
|
|
2021-06-06 16:13:58 -07:00
|
|
|
void Shuffleboard::SetRecordingFileNameFormat(std::string_view format) {
|
2018-11-19 02:15:30 -05:00
|
|
|
GetRecordingController().SetRecordingFileNameFormat(format);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Shuffleboard::ClearRecordingFileNameFormat() {
|
|
|
|
|
GetRecordingController().ClearRecordingFileNameFormat();
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-06 16:13:58 -07:00
|
|
|
void Shuffleboard::AddEventMarker(std::string_view name,
|
|
|
|
|
std::string_view description,
|
2018-11-19 02:15:30 -05:00
|
|
|
ShuffleboardEventImportance importance) {
|
|
|
|
|
GetRecordingController().AddEventMarker(name, description, importance);
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-06 16:13:58 -07:00
|
|
|
void Shuffleboard::AddEventMarker(std::string_view name,
|
2018-11-19 02:15:30 -05:00
|
|
|
ShuffleboardEventImportance importance) {
|
|
|
|
|
AddEventMarker(name, "", importance);
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-28 04:18:18 -04:00
|
|
|
detail::ShuffleboardInstance& Shuffleboard::GetInstance() {
|
|
|
|
|
static detail::ShuffleboardInstance inst(
|
|
|
|
|
nt::NetworkTableInstance::GetDefault());
|
|
|
|
|
return inst;
|
|
|
|
|
}
|
2018-11-19 02:15:30 -05:00
|
|
|
|
|
|
|
|
detail::RecordingController& Shuffleboard::GetRecordingController() {
|
|
|
|
|
static detail::RecordingController inst(
|
|
|
|
|
nt::NetworkTableInstance::GetDefault());
|
|
|
|
|
return inst;
|
|
|
|
|
}
|