#pragma once #include "../common/comm.h" #include "../common/notifier.h" #include "../common/sensor_socket.h" #include #include class CEgoWindow; class CMessageQueue; enum Sensor_Collection { Sensor_None = 0x0, Sensor_ER = 0x1, //0x181 Sensor_Steer = 0x2, //0x185 Sensor_Signal = 0x4, //0x281 Sensor_Drive = 0x8, //0x381 Sensor_Arm =0x10 ,//0x481 //Sensor_Switch=0x20, Sensor_All = 0x1F }; enum OpSide { Empty, Arm, Bucket }; class CControlSensor { public: CControlSensor(CMessageQueue * window); bool Start(); void Stop(); void Notify(TPCANMsg& canmsg,uint64_t timestamp); void SetEngineRPM(int32_t rpm); ControlStatus CheckStatus(); private: void Run(); TPCANStatus ReadMessage(); //TPCANStatus ReadMessageFD(); void ReadMessages(); private: CEgoWindow* _window; Sensor_Collection _collection; TPCANHandle _handle=-1; bool _isFD; std::thread _thread; bool _run; int16_t _last_speed = 0xF000; int64_t _startup = 0; int32_t _rpm = 0; //bool _automous = false; /* bool _er_enabling = false; bool _er_motoring = false; bool _er_gear = false; bool _er_turnl = false; bool _er_turnr = false; bool _F1 = false; bool _F2 = false; bool _F3 = false; bool _F4 = false; bool _R1 = false; bool _R2 = false; bool _R3 = false; bool _R4 = false; bool _N1 = false; bool _N2 = false; bool _N3 = false; bool _N4 = false; bool _keycc = false; bool _keyC = false; bool _keyR = false; bool _switchF = false; bool _switchR = false; bool _startup=false; bool _horn = false; //À®°È bool _emergeny=false; //¼±Í£ bool _colddown = false; //ÀäÈ´ bool _firewarning = false; bool _hyp = false; //ҺѹʹÄÜ bool _flight = false; bool _blight = false; bool _beamlight = false; bool _nearlight = false; bool _smalllight = false; bool _leftturn = false; bool _rightturn = false; bool _louver_open = false; bool _louver_close = false; bool _lock_on_off = false; //ËøÏú bool _jar_on_off = false; //ÇÃ¹Þ bool _park_lift = false; bool _chain_lift = false; bool _enabling = false; bool _emergency = false; bool _resume=false; int16_t _gear = 1; int16_t _accel = 0; int16_t _steer = 0; int16_t _flip = 0; int16_t _armL = 0; int16_t _armR = 0; */ cannet_frame frames[6]; int32_t _old_steer = 0; uint64_t _old_timestamp = 0; bool isFront = false; bool isSliping = false; bool _remote_active = false; uint64_t _active_tick = 0; };