EgoInterface.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. class IEgoNotify
  45. {
  46. public:
  47. virtual void OnRobot(std::unique_ptr<UserCamera>& info) = 0;
  48. virtual void OnSigin(bool bRet) = 0;
  49. virtual void OnNotifyDel(int32_t peer) = 0;
  50. virtual void OnNotifyKickOff() = 0;
  51. virtual void OnNotifyRadar(int32_t r0, int32_t r1, int32_t r2, int32_t r3, int32_t r4, int32_t r5,int32_t r6) = 0;
  52. virtual void OnNotifyEncode(int32_t left, int32_t right) = 0;
  53. virtual void OnNotifyLeave(int32_t peer) = 0;
  54. virtual void OnNotifyPing(int32_t value, double temp) = 0;
  55. virtual void OnNotifyState(int32_t uid, UserState state) = 0;
  56. virtual void OnNotifyVideoFail(int32_t uid) = 0;
  57. virtual void OnNotifyFeed(const FeedData& data) = 0;
  58. virtual void OnNotifyMoveEnd(int32_t rid, WorkArea area, int32_t no) = 0;
  59. virtual void OnNotifyMoveRet(MoveDesc desc) = 0;
  60. virtual void OnNDTPos(Position* pos) = 0;
  61. //virtual void OpenFullView(const char* viewurl) = 0;
  62. //virtual void CloseFullView() = 0;
  63. /*
  64. virtual void OnEmergency(bool enable, bool motor, bool gear, bool turnl, bool turnR) = 0;
  65. virtual void OnAccel(int16_t accel,bool onoff) = 0;
  66. virtual void OnSteer(uint64_t steer) = 0;
  67. virtual void OnArm(int16_t flip, int16_t armL, int16_t armR, bool onoff) = 0;
  68. */
  69. };
  70. enum ControlStatus
  71. {
  72. Ok,
  73. GearNotN,
  74. Startup,//�����
  75. Emergency,
  76. };
  77. class IEgoControl
  78. {
  79. public:
  80. virtual void Login(std::string account, std::string pass) = 0;
  81. virtual void Start(std::array<IRender*, RenderPosition::ALL>& ar) = 0;
  82. virtual void ReqCarList() = 0;
  83. virtual void OnCarConnect(int32_t peer) = 0;
  84. virtual void OnCarLeave() = 0;
  85. virtual void OnMoveBegin(int32_t rid,WorkArea area, int32_t no) = 0;
  86. //virtual void SwitchDriver(int32_t id) = 0;
  87. virtual ControlStatus CheckStatus() = 0;
  88. virtual std::string GetAccount() = 0;
  89. virtual std::string GetPassword() = 0;
  90. virtual std::string GetName() = 0;
  91. //virtual bool IsAutoClose() = 0;
  92. virtual void ChangeState(UserState state) = 0;
  93. virtual void SetReady(bool b) = 0;
  94. //virtual void SetCurrentPage(PageProp prop) = 0;
  95. };
  96. EGODLL_API IEgoControl* GetEgoController(IEgoNotify* n);