Skip to content

Namespace nebula::drivers::connections

Namespace List > nebula > drivers > connections

Classes

Type Name
class CanSocket
A wrapper around a raw CAN socket (AF_CAN). Supports both standard CAN and CAN FD frames.
struct Endpoint
Represents an IP (v4) and port endpoint.
class HttpClient
A simple HTTP/1.1 client for GET and POST requests.
class SockFd
RAII wrapper for a file descriptor, ensuring it is closed when destroyed. Non-copyable, move-only.
class SocketError
Exception thrown when a socket operation fails (usually check errno).
class TcpSocket
A wrapper around a TCP socket (AF_INET, SOCK_STREAM). Supports both client and server functionality (though server part not fully shown here).
class UdpSocket
class UsageError
Exception thrown when the API is used incorrectly.

Public Functions

Type Name
util::expected< bool, int > is_socket_ready (int fd, int timeout_ms, int events=POLLIN)
Check if a file descriptor has data ready to read (using poll).
std::vector< can_filter > parse_can_filters (const std::string & filters_str)
Parse CAN filters from string format "id:mask,id:mask".
util::expected< in_addr, UsageError > parse_ip (const std::string & ip)
Parse a string IP address (dotted quad) into an in_addr.
util::expected< std::string, SocketError > to_string (const in_addr & addr)
Convert an in_addr to its string representation.

Public Functions Documentation

function is_socket_ready

Check if a file descriptor has data ready to read (using poll).

inline util::expected < bool, int > nebula::drivers::connections::is_socket_ready (
    int fd,
    int timeout_ms,
    int events=POLLIN
) 

Parameters:

  • fd The file descriptor.
  • timeout_ms Timeout in milliseconds.
  • events Events to check for (default POLLIN).

Returns:

True if data is ready, False if timeout. Error code (int) on failure.


function parse_can_filters

Parse CAN filters from string format "id:mask,id:mask".

inline std::vector< can_filter > nebula::drivers::connections::parse_can_filters (
    const std::string & filters_str
) 

For each filter: * If only ID is given, mask is auto-generated based on ID range (SFF vs EFF). * If ID > CAN_SFF_MASK (0x7FF), it's treated as an extended ID.

Parameters:

  • filters_str Comma-separated filter definitions (e.g., "0x123:0x7FF,0x456").

Returns:

Vector of can_filter structures.


function parse_ip

Parse a string IP address (dotted quad) into an in_addr.

inline util::expected < in_addr, UsageError > nebula::drivers::connections::parse_ip (
    const std::string & ip
) 

Parameters:

  • ip IP address string.

Returns:

in_addr on success, UsageError on failure.


function to_string

Convert an in_addr to its string representation.

inline util::expected < std::string, SocketError > nebula::drivers::connections::to_string (
    const in_addr & addr
) 

Parameters:

  • addr The address to convert.

Returns:

String representation (e.g., "192.168.1.1").



The documentation for this class was generated from the following file src/nebula_core/nebula_core_hw_interfaces/include/nebula_core_hw_interfaces/nebula_hw_interfaces_common/connections/can.hpp