12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #pragma once
- #include "../common/comm.h"
- #include "../common/notifier.h"
- #include "../common/iobuffer.h"
- #include "../common/sensor_socket.h"
- class CMessageQueue;
- class CCanBusSensor
- {
- public:
- CCanBusSensor(CMessageQueue *q);
- void Notify(struct can_frame *date);
-
- void SetCanBusSensor(SensorCanBus<CCanBusSensor>* can);
- void Start();
- void Stop();
- void OnMessage(cannet_busframe* frames, int32_t count = 5);
- void Emergency();
- void NoEmergency();
- void GetGearCurrent(uint8_t data);
- void SetGear_FR_Current(uint8_t data,uint8_t type);
-
- private:
- void Run();
- void CanSendProc();
- void SendStatusToMSG();
-
- private:
- CMessageQueue* _message;
- SensorCanBus<CCanBusSensor> * _canbus;
- bool _run;
- std::thread _can_thread;
- std::mutex _last_can_lock;
- struct can_frame Sendframe[4];
- bool _front_view;
- volatile int64_t _last_can_uptime = 0;
- bool halfautomatic;
- uint8_t Gear_position_now;//实际挡位从J1939获取
- uint8_t Gear_direction;//挡位方向,0,N,0x01,F,0x02,R
- uint8_t Gear_position_Set;//舱端设置挡位
- int64_t count;
- //FeedData _data;
- };
|