HardFOC Core
API reference
Loading...
Searching...
No Matches
Classes | Namespaces
LinuxSocketCanPort.h File Reference

ICanPort over a Linux SocketCAN interface (can0, vcan0). Linux only. More...

#include <atomic>
#include <cstdint>
#include <mutex>
#include <string>
#include <thread>
#include "HfCanPort.h"

Go to the source code of this file.

Classes

class  hf::can::LinuxSocketCanPort
 
struct  hf::can::LinuxSocketCanPort::Options
 

Namespaces

namespace  hf
 
namespace  hf::can
 

Detailed Description

ICanPort over a Linux SocketCAN interface (can0, vcan0). Linux only.

Raw CAN socket in non-blocking mode. Send writes one frame; a full socket queue (EAGAIN / ENOBUFS) answers QueueFull and the reader thread reports TX-done as soon as the socket is writable again. Error frames (controller warning / passive, bus-off, restarted, and the TEC/REC bytes when the kernel provides them) drive Status(). Bus-off recovery is the kernel's job (ip link set canX type can restart-ms N), so Recover() only reports whether the interface is still bus-off.

SPDX-License-Identifier: GPL-3.0-or-later