Brian Silverman | f7f267a | 2017-02-04 16:16:08 -0800 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 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 | |
| 12 | using namespace frc; |
| 13 | |
| 14 | NetworkButton::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 | |
| 20 | NetworkButton::NetworkButton(std::shared_ptr<ITable> table, |
| 21 | const std::string& field) |
| 22 | : m_netTable(table), m_field(field) {} |
| 23 | |
| 24 | bool 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 | } |