MainDlg.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 CMainDlg : public CDialogImpl<CMainDlg>,public IEgoNotify
  26. {
  27. public:
  28. enum { IDD = IDD_MAINDLG };
  29. BEGIN_MSG_MAP_EX(CMainDlg)
  30. MSG_WM_INITDIALOG(OnInitDialog)
  31. MSG_WM_DESTROY(OnDestroy)
  32. MSG_WM_NOTIFYCONNECTED(OnNotifyConnected)
  33. MSG_WM_NOTIFYSIGIN(OnNotifySigin)
  34. //MSG_STOP_ACK(OnStopAck)
  35. //MSG_WM_NOTIFYREADY(OnNotifyReady)
  36. //MSG_WM_NOTIFYCONNECT(OnNotifyConnect)
  37. //MSG_WM_NOTIFYDISCONNECT(OnNotifyDisconnect)
  38. //MSG_WM_NOTIFYSTOP(OnNotifyStop)
  39. //MSG_WM_NOTIFY_STATE(OnNotifyState)
  40. //MSG_WM_NOTIFY_REP(OnNotifyRep)
  41. COMMAND_ID_HANDLER_EX(IDC_CARDISCONNECT, OnCarLeave)
  42. COMMAND_ID_HANDLER_EX(IDC_CARCONNECT, OnCarConnect)
  43. COMMAND_ID_HANDLER_EX(IDCANCEL, OnCancel)
  44. END_MSG_MAP()
  45. // Handler prototypes (uncomment arguments if needed):
  46. // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
  47. // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
  48. // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)
  49. LRESULT OnInitDialog(HWND,LPARAM);
  50. void OnCancel(WORD /*wNotifyCode*/, WORD wID, HWND );
  51. virtual void OnRobot(std::unique_ptr<UserCamera>& info) override;
  52. virtual void OnSigin(bool bRet) override;
  53. virtual void OnNotifyDel(int32_t peer) override;
  54. virtual void OnNotifyKickOff() override;
  55. virtual void OnNotifyRadar(int32_t r0, int32_t r1, int32_t r2, int32_t r3, int32_t r4, int32_t r5) override;
  56. void OnNotifySigin(bool bRet);
  57. virtual void OnNotifyPing(int32_t value) override;
  58. void OnDestroy(void);
  59. virtual void OnNotifyImu(int32_t x, int32_t y) override;
  60. //void OnStopAck(void);
  61. void OnNotifyConnected(bool bRet);
  62. void OnCarConnect(WORD, WORD, HWND);
  63. void OnCarLeave(WORD, WORD, HWND);
  64. private:
  65. std::vector<std::unique_ptr<UserCamera> > _userInfo;
  66. std::vector<std::unique_ptr<CRenderWindow>> _WindowArray;
  67. IEgoControl* _control;
  68. std::string _name;
  69. std::string _account;
  70. std::string _password;
  71. int32_t _carpeer = -1;
  72. };