controller.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef CONTROLLER_H
  2. #define CONTROLLER_H
  3. #include "inputconvertnormal.h"
  4. #include "common.h"
  5. #include "keycodes.h"
  6. #include "controlmsg.h"
  7. #ifdef __cplusplus
  8. extern "C" {
  9. #endif
  10. #include "net.h"
  11. #ifdef __cplusplus
  12. };
  13. #endif
  14. struct TouchEvent;
  15. class ControlMsg;
  16. class InputConvertNormal;
  17. class Controller
  18. {
  19. public:
  20. Controller(char* gameScript = "");
  21. virtual ~Controller();
  22. void setControlSocket(socket_t controlSocket);
  23. void postControlMsg(ControlMsg* controlMsg);
  24. // turn the screen on if it was off, press BACK otherwise
  25. void postTurnOn();
  26. void postGoHome();
  27. void postGoMenu();
  28. void postGoBack();
  29. void postAppSwitch();
  30. void postPower();
  31. void postVolumeUp();
  32. void postVolumeDown();
  33. void setScreenPowerMode(ScreenPowerMode mode);
  34. void StartMirror(MirrorMode mode);
  35. void setVideoInfo(int VideoWidth, int VideoHeight, int ScreenWidth, int ScreenHeight);
  36. // for input convert
  37. void mouseEvent(const TouchEvent* from, const Size& frameSize, const Size& showSize);
  38. bool sendControl(/*const QByteArray& buffer*/const uint8_t *buffer);
  39. protected:
  40. //bool event(QEvent *event);
  41. private:
  42. void postKeyCodeClick(AndroidKeycode keycode);
  43. private:
  44. socket_t m_controlSocket = NULL;
  45. InputConvertNormal* m_inputConvert = NULL;
  46. };
  47. #endif // CONTROLLER_H