ControllerHandler.h 960 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #pragma once
  2. //
  3. // Created by janco on 5/23/16.
  4. //
  5. #define BasestationBaudrate 115200
  6. #include <thread>
  7. #ifdef WIN32
  8. #include "include/serial.h"
  9. #else
  10. #include "lib/serial/include/serial.h"
  11. #endif
  12. #include "Controller.h"
  13. class ControllerHandler{
  14. public:
  15. ControllerHandler();
  16. Controller* getLeftController(void);
  17. Controller* getRightController(void);
  18. void rumble(int idController, int duration, int power);
  19. private:
  20. void SearchBasestation(void);
  21. void BasestationReader(void);
  22. bool basestationFound;
  23. serial::Serial *baseStation;
  24. std::thread readthread;
  25. Controller* controllers[4];
  26. //Command functions
  27. void commandDebug(std::vector<std::string> data);
  28. void commandControllerData(std::vector<std::string> data);
  29. void commandControllerEvent(std::vector<std::string> data);
  30. void commandControllerList(std::vector<std::string> data);
  31. //void(*commandList [1])(std::vector<std::string> data);
  32. };