123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #pragma once
- #include "../common/notifier.h"
- #include <thread>
- #include <unordered_map>
- #include <mutex>
- #pragma pack(1)
- struct Radar_Frame
- {
- uint8_t Addr=0x01;
- uint8_t Func=0x03;
- uint8_t RegAddr[2]={0x01,0x06};
- uint8_t RegData[2]={0x00,0x04};
- uint16_t crc;
-
- };
- struct Radar_Ret
- {
- uint8_t Addr=0x01;
- uint8_t Func=0x03;
- uint8_t RegAddr={0x06};
- uint8_t RegData[8];
- uint16_t crc;
- };
- #pragma pack()
-
-
- struct radar_node
- {
- // int32_t rid;
- uint32_t range;
- int64_t radar_tick=0;//std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();;
- };
- class CMessageQueue;
-
- class CRadarSensor//:public ISensorNotify
- {
- public:
- CRadarSensor(CMessageQueue *q);
- void Notify(int8_t * buffer,int32_t size);
- void SetSensorSocket(SensorSocket<CRadarSensor>* can);
- void Start();
- void Stop();
- void SetChannelReady(bool ret){_channelReady=ret;}
- const radar_node* GetRadarInfo(){ return _node;}
- private:
-
- private:
- CMessageQueue* _message;
- SensorSocket<CRadarSensor> * _socket;
- //std::mutex _lock;
- //int32_t _info[7]={-1,-1,-1,-1,-1,-1,-1};
- bool _channelReady;
- radar_node _node[7];
- int64_t _tick=0;
- int16_t mask=0x0;
- };
|