#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* can); void Start(); void Stop(); void OnMessage(cannet_frame* frames, int32_t count = 4); void Emergency(); private: void Run(); void CanSendProc(); void SendStatusToMSG(); private: CMessageQueue* _message; SensorCanBus * _canbus; bool _run; std::thread _can_thread; std::mutex _last_can_lock; // struct can_frame Sendframe[4]; struct can_frame Sendframe[5]; bool _front_view = true; int16_t Direction;//方向 int16_t Hand_Throttle;//手油门 int16_t Foot_Throttle;//脚油门 int16_t Brake;//刹车 int64_t count; FeedData _data; int model;//0本地,1远程 vehicle_control_cv control_can; };