From f0cc6232413414d2d1fbc1fcbdcbba5e8b92c9f5 Mon Sep 17 00:00:00 2001 From: Sam Carlberg Date: Wed, 11 Oct 2017 23:27:49 -0400 Subject: [PATCH] Change metadata format to dotfile, make certain entries metadata (#666) Sendable's "Name" is now ".name" Sendable's "Subsystem" is now ".subsystem" Command's "name" is now ".name" Command's "isParented" is now ".isParented" --- wpilibc/src/main/native/cpp/Commands/Command.cpp | 4 ++-- wpilibc/src/main/native/cpp/LiveWindow/LiveWindow.cpp | 8 ++++---- wpilibc/src/main/native/cpp/RobotBase.cpp | 2 +- .../main/native/cpp/SmartDashboard/SmartDashboard.cpp | 2 +- .../src/main/java/edu/wpi/first/wpilibj/RobotBase.java | 2 +- .../java/edu/wpi/first/wpilibj/command/Command.java | 4 ++-- .../edu/wpi/first/wpilibj/livewindow/LiveWindow.java | 10 +++++----- .../first/wpilibj/smartdashboard/SmartDashboard.java | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/wpilibc/src/main/native/cpp/Commands/Command.cpp b/wpilibc/src/main/native/cpp/Commands/Command.cpp index f6c8791c73..d9a10f16f1 100644 --- a/wpilibc/src/main/native/cpp/Commands/Command.cpp +++ b/wpilibc/src/main/native/cpp/Commands/Command.cpp @@ -17,9 +17,9 @@ using namespace frc; -static const std::string kName = "name"; +static const std::string kName = ".name"; static const std::string kRunning = "running"; -static const std::string kIsParented = "isParented"; +static const std::string kIsParented = ".isParented"; int Command::m_commandCounter = 0; diff --git a/wpilibc/src/main/native/cpp/LiveWindow/LiveWindow.cpp b/wpilibc/src/main/native/cpp/LiveWindow/LiveWindow.cpp index c34fbb117b..1442ae8250 100644 --- a/wpilibc/src/main/native/cpp/LiveWindow/LiveWindow.cpp +++ b/wpilibc/src/main/native/cpp/LiveWindow/LiveWindow.cpp @@ -36,7 +36,7 @@ LiveWindow* LiveWindow::GetInstance() { LiveWindow::LiveWindow() : m_scheduler(Scheduler::GetInstance()) { m_liveWindowTable = nt::NetworkTableInstance::GetDefault().GetTable("LiveWindow"); - m_statusTable = m_liveWindowTable->GetSubTable("~STATUS~"); + m_statusTable = m_liveWindowTable->GetSubTable(".status"); m_enabledEntry = m_statusTable->GetEntry("LW Enabled"); } @@ -231,12 +231,12 @@ void LiveWindow::InitializeLiveWindowComponents() { LiveWindowComponent c = elem.second; std::string subsystem = c.subsystem; std::string name = c.name; - m_liveWindowTable->GetSubTable(subsystem)->GetEntry("~TYPE~").SetString( + m_liveWindowTable->GetSubTable(subsystem)->GetEntry(".type").SetString( "LW Subsystem"); std::shared_ptr table( m_liveWindowTable->GetSubTable(subsystem)->GetSubTable(name)); - table->GetEntry("~TYPE~").SetString(component->GetSmartDashboardType()); - table->GetEntry("Name").SetString(name); + table->GetEntry(".type").SetString(component->GetSmartDashboardType()); + table->GetEntry(".name").SetString(name); table->GetEntry("Subsystem").SetString(subsystem); component->InitTable(table); if (c.isSensor) { diff --git a/wpilibc/src/main/native/cpp/RobotBase.cpp b/wpilibc/src/main/native/cpp/RobotBase.cpp index e526ef7cd5..087c33f53e 100644 --- a/wpilibc/src/main/native/cpp/RobotBase.cpp +++ b/wpilibc/src/main/native/cpp/RobotBase.cpp @@ -59,7 +59,7 @@ RobotBase::RobotBase() : m_ds(DriverStation::GetInstance()) { // First and one-time initialization inst.GetTable("LiveWindow") - ->GetSubTable("~STATUS~") + ->GetSubTable(".status") ->GetEntry("LW Enabled") .SetBoolean(false); diff --git a/wpilibc/src/main/native/cpp/SmartDashboard/SmartDashboard.cpp b/wpilibc/src/main/native/cpp/SmartDashboard/SmartDashboard.cpp index 2854f5a5c1..688be42d86 100644 --- a/wpilibc/src/main/native/cpp/SmartDashboard/SmartDashboard.cpp +++ b/wpilibc/src/main/native/cpp/SmartDashboard/SmartDashboard.cpp @@ -127,7 +127,7 @@ void SmartDashboard::PutData(llvm::StringRef key, Sendable* data) { return; } std::shared_ptr dataTable(s_table->GetSubTable(key)); - dataTable->GetEntry("~TYPE~").SetString(data->GetSmartDashboardType()); + dataTable->GetEntry(".type").SetString(data->GetSmartDashboardType()); data->InitTable(dataTable); s_tablesToData[dataTable] = data; } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java index dfe619157c..a5fa8a342c 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java @@ -61,7 +61,7 @@ public abstract class RobotBase { inst.setNetworkIdentity("Robot"); inst.startServer("/home/lvuser/networktables.ini"); m_ds = DriverStation.getInstance(); - inst.getTable("LiveWindow").getSubTable("~STATUS~").getEntry("LW Enabled").setBoolean(false); + inst.getTable("LiveWindow").getSubTable(".status").getEntry("LW Enabled").setBoolean(false); LiveWindow.setEnabled(false); } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Command.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Command.java index ff2efbb3cb..84c3d15b75 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Command.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Command.java @@ -575,8 +575,8 @@ public abstract class Command implements NamedSendable { } if (table != null) { m_runningEntry = table.getEntry("running"); - m_isParentedEntry = table.getEntry("isParented"); - table.getEntry("name").setString(getName()); + m_isParentedEntry = table.getEntry(".isParented"); + table.getEntry(".name").setString(getName()); m_runningEntry.setBoolean(isRunning()); m_isParentedEntry.setBoolean(m_parent != null); m_runningListener = m_runningEntry.addListener((event) -> { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java index c755fb2511..bd5c76695e 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java @@ -41,7 +41,7 @@ public class LiveWindow { private static void initializeLiveWindowComponents() { System.out.println("Initializing the components first time"); livewindowTable = NetworkTableInstance.getDefault().getTable("LiveWindow"); - statusTable = livewindowTable.getSubTable("~STATUS~"); + statusTable = livewindowTable.getSubTable(".status"); enabledEntry = statusTable.getEntry("LW Enabled"); for (Enumeration e = components.keys(); e.hasMoreElements(); ) { LiveWindowSendable component = (LiveWindowSendable) e.nextElement(); @@ -49,11 +49,11 @@ public class LiveWindow { String subsystem = liveWindowComponent.getSubsystem(); String name = liveWindowComponent.getName(); System.out.println("Initializing table for '" + subsystem + "' '" + name + "'"); - livewindowTable.getSubTable(subsystem).getEntry("~TYPE~").setString("LW Subsystem"); + livewindowTable.getSubTable(subsystem).getEntry(".type").setString("LW Subsystem"); NetworkTable table = livewindowTable.getSubTable(subsystem).getSubTable(name); - table.getEntry("~TYPE~").setString(component.getSmartDashboardType()); - table.getEntry("Name").setString(name); - table.getEntry("Subsystem").setString(subsystem); + table.getEntry(".type").setString(component.getSmartDashboardType()); + table.getEntry(".name").setString(name); + table.getEntry(".subsystem").setString(subsystem); component.initTable(table); if (liveWindowComponent.isSensor()) { sensors.addElement(component); diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java index e396ee11b1..df7744020e 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SmartDashboard.java @@ -51,7 +51,7 @@ public class SmartDashboard { */ public static void putData(String key, Sendable data) { NetworkTable dataTable = table.getSubTable(key); - dataTable.getEntry("~TYPE~").setString(data.getSmartDashboardType()); + dataTable.getEntry(".type").setString(data.getSmartDashboardType()); data.initTable(dataTable); tablesToData.put(dataTable, data); }