mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[wpilib] Add metadata to all dashboard ".type" entries (#6799)
This commit is contained in:
@@ -4,8 +4,12 @@
|
||||
|
||||
#include "frc/shuffleboard/ShuffleboardLayout.h"
|
||||
|
||||
#include <wpi/json.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
static constexpr std::string_view kSmartDashboardType = "ShuffleboardLayout";
|
||||
|
||||
ShuffleboardLayout::ShuffleboardLayout(ShuffleboardContainer& parent,
|
||||
std::string_view title,
|
||||
std::string_view type)
|
||||
@@ -20,7 +24,9 @@ void ShuffleboardLayout::BuildInto(
|
||||
std::shared_ptr<nt::NetworkTable> metaTable) {
|
||||
BuildMetadata(metaTable);
|
||||
auto table = parentTable->GetSubTable(GetTitle());
|
||||
table->GetEntry(".type").SetString("ShuffleboardLayout");
|
||||
table->GetEntry(".type").SetString(kSmartDashboardType);
|
||||
table->GetEntry(".type").GetTopic().SetProperty("SmartDashboard",
|
||||
kSmartDashboardType);
|
||||
for (auto& component : GetComponents()) {
|
||||
component->BuildInto(table, metaTable->GetSubTable(component->GetTitle()));
|
||||
}
|
||||
|
||||
@@ -4,8 +4,12 @@
|
||||
|
||||
#include "frc/shuffleboard/ShuffleboardTab.h"
|
||||
|
||||
#include <wpi/json.h>
|
||||
|
||||
using namespace frc;
|
||||
|
||||
static constexpr std::string_view kSmartDashboardType = "ShuffleboardLayout";
|
||||
|
||||
ShuffleboardTab::ShuffleboardTab(ShuffleboardRoot& root, std::string_view title)
|
||||
: ShuffleboardValue(title), ShuffleboardContainer(title), m_root(root) {}
|
||||
|
||||
@@ -16,7 +20,9 @@ ShuffleboardRoot& ShuffleboardTab::GetRoot() {
|
||||
void ShuffleboardTab::BuildInto(std::shared_ptr<nt::NetworkTable> parentTable,
|
||||
std::shared_ptr<nt::NetworkTable> metaTable) {
|
||||
auto tabTable = parentTable->GetSubTable(GetTitle());
|
||||
tabTable->GetEntry(".type").SetString("ShuffleboardTab");
|
||||
tabTable->GetEntry(".type").SetString(kSmartDashboardType);
|
||||
tabTable->GetEntry(".type").GetTopic().SetProperty("SmartDashboard",
|
||||
kSmartDashboardType);
|
||||
for (auto& component : GetComponents()) {
|
||||
component->BuildInto(tabTable,
|
||||
metaTable->GetSubTable(component->GetTitle()));
|
||||
|
||||
Reference in New Issue
Block a user