mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Use new NetworkTables across WPILib (C++ and Java).
Also make sure table listeners stop listening in their destructors. This might be better handled by moving the table itself into ITableListener and providing cleanup functionality there. A submodule is used to pull in ntcore. Change-Id: I3031c1a768595cf0f8754c47e15cd423e2dbcce5
This commit is contained in:
committed by
Brad Miller (WPI)
parent
f65e697107
commit
f89c5e150f
@@ -43,6 +43,7 @@ Relay::Relay(uint32_t channel, Relay::Direction direction)
|
||||
Relay::~Relay()
|
||||
{
|
||||
impl->Set(0);
|
||||
if (m_table != nullptr) m_table->RemoveTableListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,11 +141,12 @@ Relay::Value Relay::Get() const {
|
||||
}
|
||||
}
|
||||
|
||||
void Relay::ValueChanged(std::shared_ptr<ITable> source, const std::string& key, EntryValue value, bool isNew) {
|
||||
std::string *val = (std::string *) value.ptr;
|
||||
if (*val == "Off") Set(kOff);
|
||||
else if (*val == "Forward") Set(kForward);
|
||||
else if (*val == "Reverse") Set(kReverse);
|
||||
void Relay::ValueChanged(ITable* source, llvm::StringRef key,
|
||||
std::shared_ptr<nt::Value> value, bool isNew) {
|
||||
if (!value->IsString()) return;
|
||||
if (value->GetString() == "Off") Set(kOff);
|
||||
else if (value->GetString() == "Forward") Set(kForward);
|
||||
else if (value->GetString() == "Reverse") Set(kReverse);
|
||||
}
|
||||
|
||||
void Relay::UpdateTable() {
|
||||
|
||||
Reference in New Issue
Block a user