1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #pragma once
- #include "../common/notifier.h"
- #include <thread>
- #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};
- //uint8_t RegCRC[2] = { 0xa5,0xf4 };
- uint16_t crc;
-
- };
- #pragma pack(1)
- struct Radar_Frame_CM
- {
- int8_t DLC;
- int32_t Addr;
- int8_t RegData[8];
- };
- #pragma pack(1)
- struct Radar_Frame_CM_Revice
- {
- int8_t DLC_radar1;
- int32_t Addr_radar1;
- int8_t RegData_radar1[8];
- int8_t DLC_radar2;
- int32_t Addr_radar2;
- int8_t RegData_radar2[8];
- };
- #pragma pack(1)
- struct Radar_Frame_Nl_Revice
- {
- int8_t DLC_Nl_radar;
- int32_t Addr_Nl_radar;
- uint8_t RegData_Nl_radar1[8];
- };
-
- class CMessageQueue;
-
- class CRadarSensor//:public ISensorNotify
- {
- public:
- CRadarSensor(CMessageQueue *q);
- void Notify(int8_t * buffer,int32_t size);
- //void SetSensorSocket(SensorSocket<CRadarSensor>* can);
- void SetSensorSocket(SensorSocket<CRadarSensor>* can);
- void Start();
- void Stop();
-
- // void PreProcess();
- private:
- void Run();
- uint16_t bcd2dec(const int8_t *data);
- unsigned int CRC16(uint8_t *buf, int len);
- void CRC_DYP(uint8_t *buf);
- private:
- CMessageQueue* _message;
- SensorSocket<CRadarSensor> * _socket;
- std::thread _thread;
- bool _run;
-
- int32_t _count=0;
- };
|