blob: 72f67456bd052ec929800a0086c7642139b339e1 [file] [log] [blame]
Brian Silverman425492b2015-12-30 15:23:55 -08001#ifndef FRC971_WPILIB_PDP_FETCHER_H_
2#define FRC971_WPILIB_PDP_FETCHER_H_
3
Brian Silverman425492b2015-12-30 15:23:55 -08004#include <atomic>
Parker Schuhd3b7a8872018-02-19 16:42:27 -08005#include <memory>
Brian Silverman425492b2015-12-30 15:23:55 -08006
Alex Perrycb7da4b2019-08-28 19:35:56 -07007#include "aos/events/event_loop.h"
Austin Schuh217a9782019-12-21 23:02:50 -08008#include "aos/events/shm_event_loop.h"
Alex Perrycb7da4b2019-08-28 19:35:56 -07009#include "frc971/wpilib/pdp_values_generated.h"
Austin Schuh0b545432019-05-12 15:46:12 -070010
Austin Schuhbd1fe9c2019-06-29 16:35:48 -070011namespace frc {
12class PowerDistributionPanel;
13} // namespace frc
14
Brian Silverman425492b2015-12-30 15:23:55 -080015namespace frc971 {
16namespace wpilib {
17
Austin Schuhbd1fe9c2019-06-29 16:35:48 -070018// Handles fetching values from the PDP.
Brian Silverman425492b2015-12-30 15:23:55 -080019class PDPFetcher {
20 public:
Austin Schuh217a9782019-12-21 23:02:50 -080021 PDPFetcher(::aos::ShmEventLoop *event_loop);
Austin Schuh0b545432019-05-12 15:46:12 -070022
Austin Schuhbd1fe9c2019-06-29 16:35:48 -070023 ~PDPFetcher();
Brian Silverman425492b2015-12-30 15:23:55 -080024
25 private:
Austin Schuhbd1fe9c2019-06-29 16:35:48 -070026 void Loop(int iterations);
27
Austin Schuh0b545432019-05-12 15:46:12 -070028 ::aos::EventLoop *event_loop_;
29
30 ::aos::Sender<::frc971::PDPValues> pdp_values_sender_;
31
Austin Schuhbd1fe9c2019-06-29 16:35:48 -070032 ::std::unique_ptr<::frc::PowerDistributionPanel> pdp_;
Brian Silverman425492b2015-12-30 15:23:55 -080033};
34
35} // namespace wpilib
36} // namespace frc971
37
38#endif // FRC971_WPILIB_PDP_FETCHER_H_