blob: a7581735eb1c9551439d1782d051c9e0f96d9f1a [file] [log] [blame]
Brian Silvermanda45b6c2014-12-28 11:36:50 -08001#ifndef FRC971_WPILIB_JOYSTICK_SENDER_H_
2#define FRC971_WPILIB_JOYSTICK_SENDER_H_
3
4#include <atomic>
5
Austin Schuhdf6cbb12019-02-02 13:46:52 -08006#include "aos/events/event-loop.h"
7#include "aos/robot_state/robot_state.q.h"
8
Brian Silvermanda45b6c2014-12-28 11:36:50 -08009namespace frc971 {
10namespace wpilib {
11
12class JoystickSender {
13 public:
Austin Schuhdf6cbb12019-02-02 13:46:52 -080014 JoystickSender(::aos::EventLoop *event_loop)
15 : event_loop_(event_loop),
16 joystick_state_sender_(event_loop_->MakeSender<::aos::JoystickState>(
17 ".aos.joystick_state")) {}
Brian Silvermanda45b6c2014-12-28 11:36:50 -080018 void operator()();
19
20 void Quit() { run_ = false; }
21
22 private:
Austin Schuhdf6cbb12019-02-02 13:46:52 -080023 ::aos::EventLoop *event_loop_;
24 ::aos::Sender<::aos::JoystickState> joystick_state_sender_;
Brian Silvermanda45b6c2014-12-28 11:36:50 -080025 ::std::atomic<bool> run_{true};
26};
27
28} // namespace wpilib
29} // namespace frc971
30
31#endif // FRC971_WPILIB_JOYSTICK_SENDER_H_