KaCanOpen
 All Classes Functions Variables Typedefs Enumerations Pages
Classes | Public Member Functions | List of all members
kaco::PDO Class Reference

This class implements the CanOpen PDO protocol. More...

#include <pdo.h>

Classes

struct  PDOReceivedCallback
 A PDO message receiver function together with it's COB-ID Important: Never call add_pdo_received_callback or process_incoming_message from within (-> deadlock)! More...
 

Public Member Functions

 PDO (Core &core)
 Constructor. More...
 
 PDO (const PDO &)=delete
 Copy constructor deleted because of mutexes.
 
void process_incoming_message (const Message &message) const
 Handler for an incoming PDO message. More...
 
void send (uint16_t cob_id, const std::vector< uint8_t > &data)
 Sends a PDO message. More...
 
void add_pdo_received_callback (uint16_t cob_id, PDOReceivedCallback::Callback callback)
 Adds a callback which will be called when a PDO has been received with the given COB-ID. More...
 

Detailed Description

This class implements the CanOpen PDO protocol.

All methods are thread-safe.

Definition at line 51 of file pdo.h.

Constructor & Destructor Documentation

kaco::PDO::PDO ( Core core)

Constructor.

Parameters
coreReference to the Core

Definition at line 41 of file pdo.cpp.

Member Function Documentation

void kaco::PDO::add_pdo_received_callback ( uint16_t  cob_id,
PDOReceivedCallback::Callback  callback 
)

Adds a callback which will be called when a PDO has been received with the given COB-ID.

Parameters
cob_idCOB-ID to listen for
callbackCallback function, which takes a const Message reference as argument.
Todo:
Rename this to add_tpdo_received_callback() and add add_rpdo_received_callback()
Remarks
thread-safe

Definition at line 102 of file pdo.cpp.

void kaco::PDO::process_incoming_message ( const Message message) const

Handler for an incoming PDO message.

Parameters
messageThe message from the network
Todo:
Rename this to process_incoming_tpdo() and add process_incoming_rpdo()
Remarks
thread-safe

Definition at line 45 of file pdo.cpp.

void kaco::PDO::send ( uint16_t  cob_id,
const std::vector< uint8_t > &  data 
)

Sends a PDO message.

Parameters
cob_idCOB-ID of the message to send
dataA vector containing the data bytes to send. PDOs can have most 8 bytes!
Remarks
thread-safe

Definition at line 83 of file pdo.cpp.


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