mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Update wpilibc to use new NetworkTables package and interfaces.
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <llvm/raw_ostream.h>
|
||||
|
||||
#include "networktables/NetworkTable.h"
|
||||
#include "networktables/NetworkTableInstance.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
@@ -33,8 +34,10 @@ LiveWindow* LiveWindow::GetInstance() {
|
||||
* Allocate the necessary tables.
|
||||
*/
|
||||
LiveWindow::LiveWindow() : m_scheduler(Scheduler::GetInstance()) {
|
||||
m_liveWindowTable = NetworkTable::GetTable("LiveWindow");
|
||||
m_liveWindowTable =
|
||||
nt::NetworkTableInstance::GetDefault().GetTable("LiveWindow");
|
||||
m_statusTable = m_liveWindowTable->GetSubTable("~STATUS~");
|
||||
m_enabledEntry = m_statusTable->GetEntry("LW Enabled");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,7 +64,7 @@ void LiveWindow::SetEnabled(bool enabled) {
|
||||
m_scheduler->SetEnabled(true);
|
||||
}
|
||||
m_enabled = enabled;
|
||||
m_statusTable->PutBoolean("LW Enabled", m_enabled);
|
||||
m_enabledEntry.SetBoolean(m_enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -228,13 +231,13 @@ void LiveWindow::InitializeLiveWindowComponents() {
|
||||
LiveWindowComponent c = elem.second;
|
||||
std::string subsystem = c.subsystem;
|
||||
std::string name = c.name;
|
||||
m_liveWindowTable->GetSubTable(subsystem)->PutString("~TYPE~",
|
||||
"LW Subsystem");
|
||||
std::shared_ptr<ITable> table(
|
||||
m_liveWindowTable->GetSubTable(subsystem)->GetEntry("~TYPE~").SetString(
|
||||
"LW Subsystem");
|
||||
std::shared_ptr<NetworkTable> table(
|
||||
m_liveWindowTable->GetSubTable(subsystem)->GetSubTable(name));
|
||||
table->PutString("~TYPE~", component->GetSmartDashboardType());
|
||||
table->PutString("Name", name);
|
||||
table->PutString("Subsystem", subsystem);
|
||||
table->GetEntry("~TYPE~").SetString(component->GetSmartDashboardType());
|
||||
table->GetEntry("Name").SetString(name);
|
||||
table->GetEntry("Subsystem").SetString(subsystem);
|
||||
component->InitTable(table);
|
||||
if (c.isSensor) {
|
||||
m_sensors.push_back(component);
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2012-2017 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "LiveWindow/LiveWindowStatusListener.h"
|
||||
|
||||
#include "Commands/Scheduler.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
void LiveWindowStatusListener::ValueChanged(ITable* source, llvm::StringRef key,
|
||||
std::shared_ptr<nt::Value> value,
|
||||
bool isNew) {}
|
||||
Reference in New Issue
Block a user