123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #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_frame* frames, int32_t count = 4);
- void Emergency();
-
- 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];
- 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远程
- int travelSpeed,gearStatus,fGear,bGear; //行驶速度,实际档位,前进,后退档
- vehicle_control_cv control_can;
- };
|