123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #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[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;
- vehicle_status can_status;
- };
|