EgoInterface.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #pragma once
  2. #ifdef EGODLL_EXPORTS
  3. #define EGODLL_API __declspec(dllexport)
  4. #else
  5. #define EGODLL_API __declspec(dllimport)
  6. #endif
  7. #include <stdint.h>
  8. #include <memory>
  9. #include <array>
  10. #include "../common/comm.h"
  11. struct PointXYZI ///< user defined point type
  12. {
  13. float x;
  14. float y;
  15. float z;
  16. uint8_t intensity;
  17. };
  18. struct Position
  19. {
  20. float x;
  21. float y;
  22. float z;
  23. float rx;
  24. float ry;
  25. float rz;
  26. float rw;
  27. };
  28. /*
  29. enum PageProp
  30. {
  31. WorkPage1,
  32. WorkPage2,
  33. EngineParameterPage,
  34. CalibrationPage,
  35. WarningPage
  36. };
  37. */
  38. class IRender
  39. {
  40. public:
  41. virtual void OnRender(std::unique_ptr<uint8_t>& pBuffer, int32_t width, int32_t height) = 0;
  42. virtual void Empty() = 0;
  43. };
  44. /*
  45. 一个抽象接口类
  46. 类中定义的纯虚函数需要在其派生类中实现
  47. */
  48. class IEgoNotify
  49. {
  50. public:
  51. virtual void OnRobot(std::unique_ptr<UserCamera>& info) = 0;
  52. virtual void OnSigin(bool bRet) = 0;
  53. virtual void OnNotifyDel(int32_t peer) = 0;
  54. virtual void OnNotifyKickOff() = 0;
  55. virtual void OnNotifyRadar(int32_t r0, int32_t r1, int32_t r2, int32_t r3, int32_t r4, int32_t r5,int32_t r6, int32_t r7) = 0;
  56. virtual void OnNotifyImu(float x, float y) = 0;
  57. virtual void OnNotifyEncode(int32_t left, int32_t right) = 0;
  58. virtual void OnNotifyLeave(int32_t peer) = 0;
  59. virtual void OnNotifyPing(int32_t value, double temp) = 0;
  60. virtual void OnNotifyState(int32_t uid, UserState state) = 0;
  61. virtual void OnNotifyVideoFail(int32_t uid) = 0;
  62. virtual void OnNotifyFeed(const FeedData& data) = 0;
  63. virtual void OnNotifyMoveEnd(int32_t rid, WorkArea area, int32_t no) = 0;
  64. virtual void OnNotifyMoveRet(MoveDesc desc) = 0;
  65. virtual void OnNDTPos(Position* pos) = 0;
  66. //add-wfg
  67. virtual void OnCautionLight(bool cautionLight) = 0;
  68. virtual void OnLightL(bool lightL) = 0;
  69. virtual void OnLightR(bool lightR) = 0;
  70. virtual void OnGearF(bool gearF) = 0;
  71. virtual void OnGearR(bool gearR) = 0;
  72. virtual void OnCarPark(bool carPark) = 0;
  73. virtual void OnBuzzerPlay(bool buzzerPlay) = 0;
  74. virtual void OnLightFront(bool lightFront) = 0;
  75. virtual void OnLightWork(bool lightWork) = 0;
  76. virtual void OnEmergency(bool emergency) = 0;
  77. //virtual void OpenFullView(const char* viewurl) = 0;
  78. //virtual void CloseFullView() = 0;
  79. /*
  80. virtual void OnEmergency(bool enable, bool motor, bool gear, bool turnl, bool turnR) = 0;
  81. virtual void OnAccel(int16_t accel,bool onoff) = 0;
  82. virtual void OnSteer(uint64_t steer) = 0;
  83. virtual void OnArm(int16_t flip, int16_t armL, int16_t armR, bool onoff) = 0;
  84. */
  85. };
  86. enum ControlStatus
  87. {
  88. Ok,
  89. GearNotN,
  90. Gear_D_d_1,
  91. BootStrap,//已加电
  92. Startup,//已启动
  93. Emergency,
  94. Steer,
  95. Throttle,
  96. Brake,
  97. ArmTriger,
  98. DircLightNotOff,//转向灯关闭
  99. };
  100. class IEgoControl
  101. {
  102. public:
  103. virtual void Login(std::string account, std::string pass) = 0;
  104. virtual void Start(std::array<IRender*, RenderPosition::ALL>& ar) = 0;
  105. virtual void ReqCarList() = 0;
  106. virtual void OnCarConnect(int32_t peer) = 0;
  107. virtual void OnCarLeave() = 0;
  108. virtual void OnMoveBegin(int32_t rid,WorkArea area, int32_t no) = 0;
  109. //virtual void SwitchDriver(int32_t id) = 0;
  110. virtual ControlStatus CheckStatus() = 0;
  111. virtual std::string GetAccount() = 0;
  112. virtual std::string GetPassword() = 0;
  113. virtual std::string GetName() = 0;
  114. //virtual bool IsAutoClose() = 0;
  115. virtual void ChangeState(UserState state) = 0;
  116. virtual void SetReady(bool b) = 0;
  117. //virtual void SetCurrentPage(PageProp prop) = 0;
  118. };
  119. EGODLL_API IEgoControl* GetEgoController(IEgoNotify* n);