Go to the documentation of this file.
26 *(uint32_t*)
this = val;
52 if(expedited && size_indicated)
return 4-num;
53 else if(!expedited && size_indicated)
return payload[0] | (payload[3]<<8);
57 size_t size = buffer.size();
61 payload[0] = size & 0xFF;
62 payload[3] = (size >> 8) & 0xFF;
68 memcpy(payload, buffer.data(), size);
91 size_t size = buffer.size() - offset;
92 if(size > 7) size = 7;
95 memcpy(payload, buffer.data() + offset, size);
101 static const uint8_t command = 1;
104 data.command = command;
105 data.index = entry.
index;
107 offset = data.apply_buffer(buffer);
113 static const uint8_t command = 3;
128 static const uint8_t command = 0;
133 data.command = command;
134 data.toggle = toggle?1:0;
135 offset = data.apply_buffer(buffer, offset);
140 static const uint8_t command = 1;
157 static const uint8_t command = 2;
159 data.command = command;
160 data.index = entry.
index;
167 static const uint8_t command = 2;
172 size_t ds = data.data_size();
173 if(ds == 0 || size == 0 || ds >= size) {
174 if(!data.expedited || (ds <= 4 && size <= 4))
return true;
184 if(data.size_indicated && total == 0){
185 total = data.data_size();
186 buffer.resize(total);
189 memcpy(&buffer.front(), data.payload, buffer.size());
190 offset = buffer.size();
197 static const uint8_t command = 3;
199 data.command = command;
200 data.toggle = toggle?1:0;
206 static const uint8_t command = 0;
221 uint32_t n = data.data_size();
223 buffer.resize(offset + n);
225 if(offset + n <= buffer.size()){
226 memcpy(&buffer[offset], data.payload, n);
243 case 0x05030000:
return "Toggle bit not alternated.";
244 case 0x05040000:
return "SDO protocol timed out.";
245 case 0x05040001:
return "Client/server command specifier not valid or unknown.";
246 case 0x05040002:
return "Invalid block size (block mode only).";
247 case 0x05040003:
return "Invalid sequence number (block mode only).";
248 case 0x05040004:
return "CRC error (block mode only).";
249 case 0x05040005:
return "Out of memory.";
250 case 0x06010000:
return "Unsupported access to an object.";
251 case 0x06010001:
return "Attempt to read a write only object.";
252 case 0x06010002:
return "Attempt to write a read only object.";
253 case 0x06020000:
return "Object does not exist in the object dictionary.";
254 case 0x06040041:
return "Object cannot be mapped to the PDO.";
255 case 0x06040042:
return "The number and length of the objects to be mapped would exceed PDO length.";
256 case 0x06040043:
return "General parameter incompatibility reason.";
257 case 0x06040047:
return "General internal incompatibility in the device.";
258 case 0x06060000:
return "Access failed due to an hardware error.";
259 case 0x06070010:
return "Data type does not match, length of service parameter does not match";
260 case 0x06070012:
return "Data type does not match, length of service parameter too high";
261 case 0x06070013:
return "Data type does not match, length of service parameter too low";
262 case 0x06090011:
return "Sub-index does not exist.";
263 case 0x06090030:
return "Invalid value for parameter (download only).";
264 case 0x06090031:
return "Value of parameter written too high (download only).";
265 case 0x06090032:
return "Value of parameter written too low (download only).";
266 case 0x06090036:
return "Maximum value is less than minimum value.";
267 case 0x060A0023:
return "Resource not available: SDO connection";
268 case 0x08000000:
return "General error";
269 case 0x08000020:
return "Data cannot be transferred or stored to the application.";
270 case 0x08000021:
return "Data cannot be transferred or stored to the application because of local control.";
271 case 0x08000022:
return "Data cannot be transferred or stored to the application because of the present device state.";
272 case 0x08000023:
return "Object dictionary dynamic generation fails or no object dictionary is present (e.g.object dictionary is generated from file and generation fails because of an file error).";
273 case 0x08000024:
return "No data available";
274 default:
return "Abort code is reserved";
280 static const uint8_t command = 4;
283 data.command = command;
285 data.sub_index = sub_index;
286 data.reason = reason;
299 if(msg.
dlc != 8)
return false;
302 switch(msg.
data[0] >> 5){
413 boost::this_thread::disable_interruption di;
432 if(result) *result=
buffer;
437 boost::timed_mutex::scoped_lock lock(
mutex, boost::chrono::seconds(2));
445 boost::timed_mutex::scoped_lock lock(
mutex, boost::chrono::seconds(2));
UploadSegmentRequest(const can::Frame &f)
UploadSegmentRequest(const Header &h, bool toggle)
UploadSegmentResponse(const can::Frame &f)
void listen(CommInterfaceSharedPtr interface)
DownloadSegmentResponse(const can::Frame &f)
const uint8_t INITIATE_UPLOAD_RESPONSE
static const uint8_t command
const uint8_t INITIATE_DOWNLOAD_REQUEST
bool processFrame(const can::Frame &msg)
bool test(const can::Frame &msg, uint32_t &reason)
const uint8_t INITIATE_DOWNLOAD_RESPONSE
static const uint8_t command
bool read(can::Frame *msg, const DurationType &duration)
bool test(const can::Frame &msg, uint32_t &reason)
can::BufferedReader reader_
DownloadInitiateRequest(const can::Frame &f)
const uint8_t ABORT_TRANSFER_REQUEST
bool test(const can::Frame &msg, uint32_t &reason)
const uint8_t INITIATE_UPLOAD_REQUEST
size_t apply_buffer(const String &buffer)
const can::CommInterfaceSharedPtr interface_
void read(const canopen::ObjectDict::Entry &entry, String &data)
static const uint8_t command
bool test(const can::Frame &msg, size_t size, uint32_t &reason)
DownloadSegmentRequest(const Header &h, bool toggle, const String &buffer, size_t &offset)
void abort(uint32_t reason)
AbortTranserRequest(const Header &h, uint16_t index, uint8_t sub_index, uint32_t reason)
#define ROSCANOPEN_ERROR(name, args)
static const uint8_t command
static const uint8_t command
UploadInitiateRequest(const can::Frame &f)
bool read_data(String &buffer, size_t &offset, const size_t &total)
std::array< value_type, 8 > data
AbortTranserRequest(const can::Frame &f)
DownloadInitiateRequest(const Header &h, const canopen::ObjectDict::Entry &entry, const String &buffer, size_t &offset)
static const uint8_t command
static const uint8_t command
const uint8_t UPLOAD_SEGMENT_REQUEST
static const uint8_t command
#define THROW_WITH_KEY(e, k)
UploadInitiateRequest(const Header &h, const canopen::ObjectDict::Entry &entry)
static const uint8_t command
const uint8_t DOWNLOAD_SEGMENT_REQUEST
const canopen::ObjectDict::Entry * current_entry
DownloadInitiateResponse(const can::Frame &f)
const uint8_t COMMAND_MASK
size_t apply_buffer(const String &buffer, const size_t offset)
void transmitAndWait(const canopen::ObjectDict::Entry &entry, const String &data, String *result)
const ObjectStorageSharedPtr storage_
DownloadSegmentRequest(const can::Frame &f)
bool read_data(String &buffer, size_t &offset, size_t &total)
void write(const canopen::ObjectDict::Entry &entry, const String &data)
UploadInitiateResponse(const can::Frame &f)
const uint8_t DOWNLOAD_SEGMENT_RESPONSE
const uint8_t UPLOAD_SEGMENT_RESPONSE
canopen_master
Author(s): Mathias Lüdtke
autogenerated on Wed Mar 2 2022 00:52:26