MainDlg.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // MainDlg.h : interface of the CMainDlg class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4. #pragma once
  5. #include <thread>
  6. #include <functional>
  7. #include <vector>
  8. #include "EgoInterface.h"
  9. #define WM_NOTIFYCONNECTED WM_APP+100
  10. #define MSG_WM_NOTIFYCONNECTED(func) if(uMsg==WM_NOTIFYCONNECTED){SetMsgHandled(TRUE); func((bool)wParam); lResult = 0; if(IsMsgHandled()) return TRUE;}
  11. #define WM_NOTIFYSIGIN WM_APP+101
  12. #define MSG_WM_NOTIFYSIGIN(func) if(uMsg==WM_NOTIFYSIGIN){SetMsgHandled(TRUE); func((bool)wParam); lResult = 0; if(IsMsgHandled()) return TRUE;}
  13. #define WM_NOTIFYREADY WM_APP+102
  14. #define MSG_WM_NOTIFYREADY(func) if(uMsg==WM_NOTIFYREADY){SetMsgHandled(TRUE); func(); lResult = 0; if(IsMsgHandled()) return TRUE;}
  15. #define WM_NOTIFYSTOP WM_APP+103
  16. #define MSG_WM_NOTIFYSTOP(func) if(uMsg==WM_NOTIFYSTOP){SetMsgHandled(TRUE); func(); lResult = 0; if(IsMsgHandled()) return TRUE;}
  17. #define WM_NOTIFYCONNECT WM_APP+104
  18. #define MSG_WM_NOTIFYCONNECT(func) if(uMsg==WM_NOTIFYCONNECT){SetMsgHandled(TRUE); func((int32_t)wParam); lResult = 0; if(IsMsgHandled()) return TRUE;}
  19. #define WM_NOTIFYDISCONNECT WM_APP+105
  20. #define MSG_WM_NOTIFYDISCONNECT(func) if(uMsg==WM_NOTIFYDISCONNECT){SetMsgHandled(TRUE); func((int32_t)wParam); lResult = 0; if(IsMsgHandled()) return TRUE;}
  21. //#define IDC_STATETIMER 0x1002
  22. //#define WM_STOP_ACK WM_APP+106
  23. //#define MSG_STOP_ACK(func) if(uMsg==WM_STOP_ACK){SetMsgHandled(TRUE); func(); lResult = 0; if(IsMsgHandled()) return TRUE;}
  24. class CRenderWindow;
  25. class CFishEyeWindow;
  26. class CMainDlg : public CDialogImpl<CMainDlg>,public IEgoNotify
  27. {
  28. public:
  29. enum { IDD = IDD_MAINDLG };
  30. BEGIN_MSG_MAP_EX(CMainDlg)
  31. MSG_WM_INITDIALOG(OnInitDialog)
  32. MSG_WM_DESTROY(OnDestroy)
  33. MSG_WM_NOTIFYCONNECTED(OnNotifyConnected)
  34. MSG_WM_NOTIFYSIGIN(OnNotifySigin)
  35. //MSG_WM_TIMER(OnTimer)
  36. //MSG_STOP_ACK(OnStopAck)
  37. //MSG_WM_NOTIFYREADY(OnNotifyReady)
  38. //MSG_WM_NOTIFYCONNECT(OnNotifyConnect)
  39. //MSG_WM_NOTIFYDISCONNECT(OnNotifyDisconnect)
  40. //MSG_WM_NOTIFYSTOP(OnNotifyStop)
  41. //MSG_WM_NOTIFY_STATE(OnNotifyState)
  42. //MSG_WM_NOTIFY_REP(OnNotifyRep)
  43. COMMAND_ID_HANDLER_EX(IDC_CARDISCONNECT, OnCarLeave)
  44. COMMAND_ID_HANDLER_EX(IDC_CARCONNECT, OnCarConnect)
  45. COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel)
  46. END_MSG_MAP()
  47. // Handler prototypes (uncomment arguments if needed):
  48. // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
  49. // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
  50. // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
  51. LRESULT OnInitDialog(HWND,LPARAM);
  52. void OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND );
  53. virtual void OnRobot(std::unique_ptr<UserCamera>& info) override;
  54. virtual void OnSigin(bool bRet) override;
  55. virtual void OnNotifyDel(int32_t peer) override;
  56. virtual void OnNotifyKickOff() override;
  57. virtual void OnNotifyRadar(int32_t r0, int32_t r1, int32_t r2, int32_t r3, int32_t r4, int32_t r5) override;
  58. void OnNotifySigin(bool bRet);
  59. virtual void OnNotifyPing(int32_t value) override;
  60. void OnDestroy(void);
  61. //void OnStopAck(void);
  62. void OnTimer(UINT idEvent);
  63. void OnNotifyConnected(bool bRet);
  64. void OnCarConnect(WORD, WORD, HWND);
  65. void OnCarLeave(WORD, WORD, HWND);
  66. // virtual void OnEmergency(bool enable, bool motor, bool gear, bool turnl, bool turnR) override;
  67. // virtual void OnAccel(int16_t accel, bool onoff) override;
  68. // virtual void OnSteer(uint64_t steer) override;
  69. // virtual void OnArm(int16_t flip, int16_t armL, int16_t armR, bool onoff) override;
  70. virtual void OnLidarData(bool isLeft, bool isDense, int32_t seq, PointXYZI* data, int32_t length) override;
  71. virtual void OnNotifyFeed(const FeedData& data) override;
  72. virtual void OnNotifyLeave(int32_t peer) override;
  73. virtual void OnNotifyMoveEnd(int32_t rid, WorkArea area, int32_t no) override;
  74. private:
  75. std::vector<std::unique_ptr<UserCamera> > _userInfo;
  76. std::vector<std::unique_ptr<CRenderWindow>> _WindowArray;
  77. IEgoControl* _control;
  78. std::unique_ptr<CFishEyeWindow> _fishWindow;
  79. std::string _name;
  80. std::string _account;
  81. std::string _password;
  82. int32_t _carpeer = -1;
  83. bool _enable=false;
  84. bool _motor=false;
  85. bool _gear = false;
  86. bool _turnL = false;
  87. bool _turnR = false;
  88. int16_t _steer = 0;
  89. int16_t _accel = 0;
  90. bool _onoff = false;
  91. };