Line data Source code
1 : /* 2 : parent class for CAN transports in ArduPilot SITL 3 : */ 4 : #pragma once 5 : 6 : #include "AP_HAL_SITL.h" 7 : 8 : #if HAL_NUM_CAN_IFACES 9 : 10 : #include <AP_HAL/CANIface.h> 11 : 12 : class CAN_Transport { 13 : public: 14 0 : virtual ~CAN_Transport() {} 15 : virtual bool init(uint8_t instance) = 0; 16 : virtual bool send(const AP_HAL::CANFrame &frame) = 0; 17 : virtual bool receive(AP_HAL::CANFrame &frame) = 0; 18 : virtual int get_read_fd(void) const = 0; 19 : 20 5 : void set_event_handle(AP_HAL::BinarySemaphore *handle) { 21 5 : sem_handle = handle; 22 5 : } 23 : 24 : protected: 25 : AP_HAL::BinarySemaphore *sem_handle; 26 : }; 27 : 28 : #endif // HAL_NUM_CAN_IFACES