2023-08-25 21:52:28 -03:00
|
|
|
/*
|
|
|
|
parent class for CAN transports in ArduPilot SITL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "AP_HAL_SITL.h"
|
|
|
|
|
|
|
|
#if HAL_NUM_CAN_IFACES
|
|
|
|
|
|
|
|
#include <AP_HAL/CANIface.h>
|
|
|
|
|
|
|
|
class CAN_Transport {
|
|
|
|
public:
|
|
|
|
virtual ~CAN_Transport() {}
|
|
|
|
virtual bool init(uint8_t instance) = 0;
|
|
|
|
virtual bool send(const AP_HAL::CANFrame &frame) = 0;
|
|
|
|
virtual bool receive(AP_HAL::CANFrame &frame) = 0;
|
|
|
|
virtual int get_read_fd(void) const = 0;
|
2023-12-29 17:33:48 -04:00
|
|
|
|
|
|
|
void set_event_handle(AP_HAL::BinarySemaphore *handle) {
|
|
|
|
sem_handle = handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
AP_HAL::BinarySemaphore *sem_handle;
|
2023-08-25 21:52:28 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // HAL_NUM_CAN_IFACES
|