blob: d0c5abf40349fa7b4cbd94aa9a02c55469ad20af [file] [log] [blame]
Brian Silvermanf7f267a2017-02-04 16:16:08 -08001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2011-2017. All Rights Reserved. */
3/* Open Source Software - may be modified and shared by FRC teams. The code */
4/* must be accompanied by the FIRST BSD license file in the root directory of */
5/* the project. */
6/*----------------------------------------------------------------------------*/
7
8#include "Buttons/NetworkButton.h"
9
10#include "networktables/NetworkTable.h"
11
12using namespace frc;
13
14NetworkButton::NetworkButton(const std::string& tableName,
15 const std::string& field)
16 : // TODO how is this supposed to work???
17 m_netTable(NetworkTable::GetTable(tableName)),
18 m_field(field) {}
19
20NetworkButton::NetworkButton(std::shared_ptr<ITable> table,
21 const std::string& field)
22 : m_netTable(table), m_field(field) {}
23
24bool NetworkButton::Get() {
25 /*if (m_netTable->isConnected())
26 return m_netTable->GetBoolean(m_field.c_str());
27 else
28 return false;*/
29 return m_netTable->GetBoolean(m_field, false);
30}