38 #include <unordered_map>
41 #include "sdo_response.h"
81 void download(uint8_t node_id, uint16_t index, uint8_t subindex, uint32_t size,
const std::vector<uint8_t>& bytes);
89 std::vector<uint8_t>
upload(uint8_t node_id, uint16_t index, uint8_t subindex);
109 enum Flag : uint8_t {
112 initiate_download_request = 0x20,
113 download_segment_request = 0x00,
114 initiate_upload_request = 0x40,
115 upload_segment_request = 0x60,
118 initiate_download_response = 0x60,
119 download_segment_response = 0x20,
120 initiate_upload_response = 0x40,
121 upload_segment_response = 0x00,
124 no_more_segments = 0x01,
125 size_indicated = 0x01,
126 expedited_transfer = 0x02,
132 static const bool debug =
false;
139 std::array<SDOReceivedCallback,256> m_send_and_wait_receivers;
142 mutable std::array<std::mutex,256> m_send_and_wait_receiver_mutexes;
146 mutable std::array<std::mutex,256> m_send_and_wait_mutex;
148 uint8_t size_flag(uint8_t size);
This class implements the CanOpen SDO protocol.
SDO(Core &core)
Constructor.
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.
This struct contains the response of a SDO request. Note that there are two types of response - segme...
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.
This class implements the Core of KaCanOpen It communicates with the CAN driver, sends CAN messages a...
void process_incoming_message(const Message &message)
Process incoming SDO message.
This struct represents a CANOpen message.
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.
std::function< void(SDOResponse) > SDOReceivedCallback
Type of a sdo message receiver function Important: Never call send_sdo_and_wait or process_incoming_m...