cogip::canpb::CanProtobuf Class Reference

Generic CAN Protobuf communication class. More...

Detailed Description

Generic CAN Protobuf communication class.

Definition at line 60 of file CanProtobuf.hpp.

#include <CanProtobuf.hpp>

+ Collaboration diagram for cogip::canpb::CanProtobuf:

Public Member Functions

 CanProtobuf (uint8_t can_interface_number)
 Class constructor. More...
 
bool init (struct can_filter *filter)
 Initialize CAN connection. More...
 
void start_reader ()
 Start thread waiting for incoming messages.
 
void can_rx_cb (uint8_t data)
 Function call for each incomming frame on CAN port. More...
 
void message_reader ()
 Wait and decode incoming Protobuf messages.
 
bool send_message (uuid_t uuid, const EmbeddedProto::MessageInterface *message=nullptr)
 Send CAN message. More...
 
void register_message_handler (uuid_t uuid, message_handler_t handler)
 Associate a message handle to a specific uuid. More...
 

Constructor & Destructor Documentation

◆ CanProtobuf()

cogip::canpb::CanProtobuf::CanProtobuf ( uint8_t  can_interface_number)
explicit

Class constructor.

Parameters
[in]can_interface_number[in] CAN device

Member Function Documentation

◆ can_rx_cb()

void cogip::canpb::CanProtobuf::can_rx_cb ( uint8_t  data)

Function call for each incomming frame on CAN port.

Parameters
[in]data[in] incoming data

◆ init()

bool cogip::canpb::CanProtobuf::init ( struct can_filter *  filter)

Initialize CAN connection.

Returns
true if CAN connection is initialized, false otherwise

◆ register_message_handler()

void cogip::canpb::CanProtobuf::register_message_handler ( uuid_t  uuid,
message_handler_t  handler 
)

Associate a message handle to a specific uuid.

Parameters
[in]uuid[in] message uuid
[in]handler[in] message handler

◆ send_message()

bool cogip::canpb::CanProtobuf::send_message ( uuid_t  uuid,
const EmbeddedProto::MessageInterface *  message = nullptr 
)

Send CAN message.

Returns
true if message was encoded and sent, false otherwise
Parameters
[in]uuid[in] message uuid
[in]message[in] message to send

The documentation for this class was generated from the following file: