Brian Silverman | 425492b | 2015-12-30 15:23:55 -0800 | [diff] [blame] | 1 | #ifndef FRC971_WPILIB_PDP_FETCHER_H_ |
| 2 | #define FRC971_WPILIB_PDP_FETCHER_H_ |
| 3 | |
| 4 | #include <memory> |
| 5 | #include <atomic> |
| 6 | |
Brian Silverman | 425492b | 2015-12-30 15:23:55 -0800 | [diff] [blame] | 7 | #include "PowerDistributionPanel.h" |
| 8 | |
| 9 | namespace frc971 { |
| 10 | namespace wpilib { |
| 11 | |
| 12 | // Handles fetching values from the PDP. This is slow, so it has to happen in a |
| 13 | // separate thread. |
| 14 | class PDPFetcher { |
| 15 | public: |
Brian Silverman | 425492b | 2015-12-30 15:23:55 -0800 | [diff] [blame] | 16 | void Quit() { run_ = false; } |
| 17 | |
Brian Silverman | 425492b | 2015-12-30 15:23:55 -0800 | [diff] [blame] | 18 | // To be called by a ::std::thread. |
| 19 | void operator()(); |
| 20 | |
| 21 | private: |
Brian Silverman | 425492b | 2015-12-30 15:23:55 -0800 | [diff] [blame] | 22 | ::std::atomic<bool> run_{true}; |
| 23 | }; |
| 24 | |
| 25 | } // namespace wpilib |
| 26 | } // namespace frc971 |
| 27 | |
| 28 | #endif // FRC971_WPILIB_PDP_FETCHER_H_ |