2020-12-26 14:31:24 -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.
|
2020-02-01 21:30:23 -08:00
|
|
|
|
2020-09-12 10:55:46 -07:00
|
|
|
#include "glass/networktables/NetworkTablesHelper.h"
|
2020-02-01 21:30:23 -08:00
|
|
|
|
2020-09-12 10:55:46 -07:00
|
|
|
using namespace glass;
|
2020-02-01 21:30:23 -08:00
|
|
|
|
2020-09-12 10:55:46 -07:00
|
|
|
NetworkTablesHelper::NetworkTablesHelper(NT_Inst inst)
|
|
|
|
|
: m_inst{inst}, m_poller{nt::CreateEntryListenerPoller(inst)} {}
|
2020-02-01 21:30:23 -08:00
|
|
|
|
2020-09-12 10:55:46 -07:00
|
|
|
NetworkTablesHelper::~NetworkTablesHelper() {
|
|
|
|
|
nt::DestroyEntryListenerPoller(m_poller);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool NetworkTablesHelper::IsConnected() const {
|
|
|
|
|
return nt::GetNetworkMode(m_inst) == NT_NET_MODE_SERVER ||
|
|
|
|
|
nt::IsConnected(m_inst);
|
|
|
|
|
}
|