This class implements the CanOpen SDO protocol. More...
#include <sdo.h>
Public Types | |
| using | SDOReceivedCallback = std::function< void(SDOResponse) > |
| Type of a sdo message receiver function Important: Never call send_sdo_and_wait or process_incoming_message from within (-> deadlock)! | |
Public Member Functions | |
| SDO (Core &core) | |
| Constructor. More... | |
| SDO (const SDO &)=delete | |
| Copy constructor deleted because of mutexes. | |
| void | download (uint8_t node_id, uint16_t index, uint8_t subindex, uint32_t size, const std::vector< uint8_t > &bytes) |
| SDO download: Write value into remote device's object dictionary. More... | |
| std::vector< uint8_t > | upload (uint8_t node_id, uint16_t index, uint8_t subindex) |
| SDO download: Get value from remote device's object dictionary. More... | |
| void | process_incoming_message (const Message &message) |
| Process incoming SDO message. More... | |
| SDOResponse | send_sdo_and_wait (uint8_t command, uint8_t node_id, uint16_t index, uint8_t subindex, const std::array< uint8_t, 4 > &data) |
| Sends an SDO message and waits for the response. More... | |
This class implements the CanOpen SDO protocol.
Add add_client_sdo_callback(SDOReceivedCallback) (callback signature void(const SDOResponse&)) and/or add_request_callback(node_id, SDORequestCallback) (listening only for SDOs with slave's own node_id, callback signature void(index, subindex)).
Add send_response(node_id, index, subindex, vector<uint8_t> data) (chooses segmented/expedited transfer on it's own).
Add abort_transfer(node_id, index, subindex, errorcode).
All methods are thread-safe.
| kaco::SDO::SDO | ( | Core & | core | ) |
| void kaco::SDO::download | ( | uint8_t | node_id, |
| uint16_t | index, | ||
| uint8_t | subindex, | ||
| uint32_t | size, | ||
| const std::vector< uint8_t > & | bytes | ||
| ) |
SDO download: Write value into remote device's object dictionary.
| node_id | Node id of remote device |
| index | Dictionary index |
| subindex | Subindex |
| size | Size of the entry/value in bytes |
| bytes | Vector containing the data bytes of the value in little-endian order. Vector size must be equal to size argument. |
| void kaco::SDO::process_incoming_message | ( | const Message & | message | ) |
| SDOResponse kaco::SDO::send_sdo_and_wait | ( | uint8_t | command, |
| uint8_t | node_id, | ||
| uint16_t | index, | ||
| uint8_t | subindex, | ||
| const std::array< uint8_t, 4 > & | data | ||
| ) |
| std::vector< uint8_t > kaco::SDO::upload | ( | uint8_t | node_id, |
| uint16_t | index, | ||
| uint8_t | subindex | ||
| ) |
SDO download: Get value from remote device's object dictionary.
| node_id | Node id of remote device |
| index | Dictionary index |
| subindex | Subindex |
1.8.7