Brian Silverman | 26e4e52 | 2015-12-17 01:56:40 -0500 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 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 | |
| 11 | NetworkButton::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 | |
| 16 | NetworkButton::NetworkButton(std::shared_ptr<ITable> table, const std::string &field) |
| 17 | : m_netTable(table), m_field(field) {} |
| 18 | |
| 19 | bool 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 | } |