WPILibC++  trunk
NetworkButton.cpp
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2011. 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 $(WIND_BASE)/WPILib. */
5 /*----------------------------------------------------------------------------*/
6 
7 #include "Buttons/NetworkButton.h"
8 #include "networktables/NetworkTable.h"
9 
10 NetworkButton::NetworkButton(const char *tableName, const char *field) ://TODO how is this supposed to work???
11  m_netTable(NetworkTable::GetTable(tableName)),
12  m_field(field)
13 {
14 }
15 
16 NetworkButton::NetworkButton(ITable *table, const char *field) :
17  m_netTable(table),
18  m_field(field)
19 {
20 }
21 
22 bool NetworkButton::Get()
23 {
24  /*if (m_netTable->isConnected())
25  return m_netTable->GetBoolean(m_field.c_str());
26  else
27  return false;*/
28  return m_netTable->GetBoolean(m_field);
29 }
Definition: ITable.h:26
virtual bool GetBoolean(std::string key)=0