123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- #pragma once
- #include "api.h"
- #include "message_queue.h"
- #include "PCANBasic.h"
- #define WM_NOTIFY_REP WM_APP+1
- #define WM_NOTIFY_ANSWER WM_APP+2
- //#define WM_NOTIFY_LEAVE WM_APP+3
- #define WM_NOTIFY_CANDIDATE WM_APP+4
- #define WM_NOTIFY_OFFER WM_APP+5
- #define WM_ASK_PING WM_APP+6
- #define WM_ASK_CHANNEL WM_APP+7
- #define WM_ASK_VIDEOREQ WM_APP+8
- class CPeerConnection;
- class IRender;
- class CEgoClient;
- class CCarSim;
- class CUdpSensor;
- class CControlSensor;
- enum ControlState
- {
- Check,
- Process,
- };
- class CEgoWindow : public CMessageQueue
- {
- public:
- CEgoWindow(CEgoClient* _egoclient,IRender * render,RenderPosition pos);
- //启动窗口
- virtual void Start() override;
- //处理,可能是处理缓存区数据的
- virtual void Process(CIOBuffer* pBuffer) override;
- //停止
- virtual void Stop() override;
- //空闲状态
- virtual void OnIdle() override;
- //发送消息,向窗口发送消息
- void PostMessage(int32_t type, int64_t l = 0, int64_t r = 0);
- //可能用于设置对等体标识
- void SetPeer(int32_t peer);
- //void CreateVideoReq();
- //void DelayNextVideoReq();
- //void DelayDataChannel();
- //void DelayStartPing();
- //发送数据
- void SendData(CIOBuffer& pBuffer);
- //可能用于设置对等体通知
- void SetPeerNotify();
- //virtual void WriteCanMessage(std::unordered_map<int32_t, cannet_frame>& node, bool bLidar) override;
- int32_t GetSteerAngle();
- //接收视频流数据,接入pbuffer接入函数
- void OnNotifyRep(int32_t peer);
- void OnNotifyAnswer(CIOBuffer* pBuffer);
- void OnNotifyLeave();
- void OnNotifyCandidate(CIOBuffer* pBuffer);
- void OnNotifyOffer(CIOBuffer* pBuffer);
- //这可能是帧回调函数
- static void FrameCallback(void* user_data,
- const uint8_t* yptr, int32_t strideY,
- const uint8_t* uptr, int32_t strideU,
- const uint8_t* vptr, int32_t strideV,
- const int32_t stride, const int frame_width,
- const int frame_height);
- //可能是ARGB32帧准备函数
- void OnArgb32FrameReady(const uint8_t* yptr, int32_t strideY, const uint8_t* uptr, int32_t strideU, const uint8_t* vptr, int32_t strideV, const int32_t stride, const int frame_width, const int frame_height);
- //设置窗口尺寸
- void SetSize(int32_t width, int32_t height);
- //视频请求函数,用于处理视频请求
- void OnAskVideoReq();
- //数据通道请求函数,用于处理数据通道请求
- void OnAskDataChannel();
- void OnAskPing();
- void StopPing();
- ControlState GetControlState();
- void SetControlState(ControlState state);
- CEgoClient* GetEgoClient();
- void SetReady(bool b);
- //显示雷达函数,用于显示雷达数据
- void DisplayRadar(int32_t radar0, int32_t radar1, int32_t radar2, int32_t radar3, int32_t radar4, int32_t radar5, int32_t radar6, int32_t radar7, int32_t radar8);
- void DisplayPing(int32_t temp,double temp1);
- void DisplayStatue(FeedData data);
- void WriteStatue(TPCANMsg* CANMsg);
- void WriteCan(CIOBuffer* pBuffer);
- private:
- void InitPeerConnection(int32_t peer);
- void SetRenderWindow(int32_t width, int32_t height);
- private:
- CControlSensor* _controlSensor;
- CEgoClient* _client;
- std::unique_ptr<CPeerConnection> _peerconnection;
- int32_t _peer;
- RenderPosition _pos;
- BITMAPINFO bmi_;
- //SocketClient* _client;
- bool start_;
- //bool _channelcreated;
- //std::mutex buffer_lock_;
- std::unique_ptr<uint8_t> image_;
- std::unique_ptr<uint8_t> _rotate;
- //std::thread _delayThread;
- IRender* _render;
- ControlState _control;
- //std::unique_ptr<IPeerNotify> _peerNotify;
- };
|