37class SdoErrcCategory :
public ::std::error_category {
40 name() const noexcept
override {
44 ::std::error_condition default_error_condition(
int ev)
const
51 message(
int ev)
const override {
57SdoErrcCategory::default_error_condition(
int ev)
const noexcept {
58 switch (
static_cast<SdoErrc>(ev)) {
60 return ::std::errc::protocol_error;
62 return ::std::errc::timed_out;
66 return ::std::errc::protocol_error;
68 return ::std::errc::illegal_byte_sequence;
70 return ::std::errc::not_enough_memory;
74 return ::std::errc::permission_denied;
76 return ::std::errc::no_such_file_or_directory;
80 return ::std::errc::invalid_argument;
82 return ::std::errc::no_such_device_or_address;
84 return ::std::errc::io_error;
88 return ::std::errc::invalid_argument;
90 return ::std::errc::no_such_file_or_directory;
92 return ::std::errc::invalid_argument;
96 return ::std::errc::result_out_of_range;
98 return ::std::errc::protocol_not_supported;
101 return ::std::errc::io_error;
104 return ::std::errc::device_or_resource_busy;
107 return ::std::errc::no_message_available;
109 return ::std::error_condition(ev, *
this);
114SdoWhat(uint8_t netid, uint8_t
id, uint16_t idx, uint8_t subidx,
115 ::std::error_code ec, const ::std::string& what_arg =
"") {
116 ::std::stringstream ss;
117 ss << ::std::uppercase << ::std::setfill(
'0') << ::std::hex;
118 if (!what_arg.empty()) ss << what_arg <<
':';
119 ss << ::std::setw(2) << int(netid) <<
':' << int(
id) <<
':';
120 ss << ::std::setw(4) << idx <<
':' << ::std::setw(2) << int(subidx) <<
": ";
122 ss <<
" (" << ::std::setw(8) << uint32_t(ec.value()) <<
')';
128SdoError::SdoError(uint8_t netid, uint8_t
id, uint16_t idx, uint8_t subidx,
129 ::std::error_code ec)
130 : ::
std::runtime_error(SdoWhat(netid, id, idx, subidx, ec)),
137SdoError::SdoError(uint8_t netid, uint8_t
id, uint16_t idx, uint8_t subidx,
138 ::std::error_code ec, const ::std::string& what_arg)
139 : ::
std::runtime_error(SdoWhat(netid, id, idx, subidx, ec, what_arg)),
146SdoError::SdoError(uint8_t netid, uint8_t
id, uint16_t idx, uint8_t subidx,
147 ::std::error_code ec,
const char* what_arg)
148 : ::
std::runtime_error(SdoWhat(netid, id, idx, subidx, ec, what_arg)),
155SdoError::SdoError(uint8_t netid, uint8_t
id, uint16_t idx, uint8_t subidx,
156 int ev,
const char* what_arg)
157 : SdoError(netid, id, idx, subidx, ::
std::error_code(ev,
SdoCategory()),
160SdoError::SdoError(uint8_t netid, uint8_t
id, uint16_t idx, uint8_t subidx,
162 : SdoError(netid, id, idx, subidx, ::
std::error_code(ev,
SdoCategory())) {}
164const ::std::error_category&
166 static const SdoErrcCategory category;
175::std::error_condition
This header file is part of the CANopen library; it contains the Service Data Object (SDO) declaratio...
const char * co_sdo_ac2str(co_unsigned32_t ac)
Returns a string describing an SDO abort code.
const ::std::error_category & SdoCategory() noexcept
Returns a reference to the error category object for SDO abort codes.
SdoErrc
The SDO abort codes.
@ TIMEOUT
SDO protocol timed out.
@ BLK_SIZE
Invalid block size (block mode only).
@ NO_CS
Client/server command specifier not valid or unknown.
@ TYPE_LEN_LO
Data type does not match, length of service parameter too low.
@ TOGGLE
Toggle bit not altered.
@ PARAM_VAL
Invalid value for parameter (download only).
@ PARAM
General parameter incompatibility reason.
@ NO_VAL
No data available. (NO_DATA is a macro defined in <netdb.h>)
@ NO_SUB
Sub-index does not exist.
@ PARAM_LO
Value of parameter written too low (download only).
@ BLK_SEQ
Invalid sequence number (block mode only).
@ DATA_DEV
Data cannot be transferred or stored to the application because of the present device state.
@ HARDWARE
Access failed due to a hardware error.
@ BLK_CRC
CRC error (block mode only).
@ PARAM_HI
Value of parameter written too high (download only).
@ TYPE_LEN
Data type does not match, length of service parameter does not match.
@ PARAM_RANGE
Maximum value is less than minimum value (download only).
@ COMPAT
General internal incompatibility in the device.
@ NO_OBJ
Object does not exist in the object dictionary.
@ NO_WRITE
Attempt to write a read only object.
@ NO_SDO
Resource not available: SDO connection.
@ DATA_CTL
Data cannot be transferred or stored to the application because of local control.
@ TYPE_LEN_HI
Data type does not match, length of service parameter too high.
@ NO_ACCESS
Unsupported access to an object.
@ DATA
Data cannot be transferred or stored to the application.
@ NO_READ
Attempt to read a write only object.
::std::error_condition make_error_condition(SdoErrc e) noexcept
Creates an error condition corresponding to an SDO abort code.
::std::error_code make_error_code(SdoErrc e) noexcept
Creates an error code corresponding to an SDO abort code.
Global namespace for the Lely Industries N.V. libraries.
This header file is part of the C++ CANopen application library; it contains the SDO error declaratio...
This is the internal header file of the C++ CANopen application library.