blob: 858703cf49bbeb506deaba5c07423f01ece00284 [file] [log] [blame]
Brian Silverman26e4e522015-12-17 01:56:40 -05001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2011. All Rights Reserved.
3 */
4/* Open Source Software - may be modified and shared by FRC teams. The code */
5/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
6/*----------------------------------------------------------------------------*/
7
8#include "Buttons/NetworkButton.h"
9#include "networktables/NetworkTable.h"
10
11NetworkButton::NetworkButton(const std::string &tableName, const std::string &field)
12 : // TODO how is this supposed to work???
13 m_netTable(NetworkTable::GetTable(tableName)),
14 m_field(field) {}
15
16NetworkButton::NetworkButton(std::shared_ptr<ITable> table, const std::string &field)
17 : m_netTable(table), m_field(field) {}
18
19bool NetworkButton::Get() {
20 /*if (m_netTable->isConnected())
21 return m_netTable->GetBoolean(m_field.c_str());
22 else
23 return false;*/
24 return m_netTable->GetBoolean(m_field, false);
25}