Motion Master 6.0.0-alpha.50
Next-generation motion control software
Loading...
Searching...
No Matches
sdo_abort_codes.h
Go to the documentation of this file.
1#pragma once
2
3#include <algorithm>
4#include <array>
5#include <cstdint>
6#include <nlohmann/json_fwd.hpp>
7#include <string_view>
8
9namespace mm::comm {
10
13 uint32_t code = 0;
14 std::string_view description;
15};
16
21void to_json(nlohmann::json& j, const SdoAbortCode& e);
22
30inline constexpr auto kSdoAbortCodes = std::to_array<SdoAbortCode>({
31 {0x05030000, "Toggle bit not changed"},
32 {0x05040000, "SDO protocol timeout"},
33 {0x05040001, "Client/Server command specifier not valid or unknown"},
34 {0x05040005, "Out of memory"},
35 {0x06010000, "Unsupported access to an object"},
36 {0x06010001, "Attempt to read a write-only object"},
37 {0x06010002, "Attempt to write a read-only object"},
38 {0x06010003, "Subindex cannot be written; SI0 must be 0 for write access"},
39 {0x06010004, "SDO Complete Access not supported for variable-length objects such as ENUM"},
40 {0x06010005, "Object length exceeds mailbox size"},
41 {0x06010006, "Object mapped to RxPDO, SDO download blocked"},
42 {0x06020000, "The object does not exist in the object dictionary"},
43 {0x06040041, "The object cannot be mapped into the PDO"},
44 {0x06040042, "The number and length of the objects to be mapped would exceed the PDO length"},
45 {0x06040043, "General parameter incompatibility reason"},
46 {0x06040047, "General internal incompatibility in the device"},
47 {0x06060000, "Access failed due to a hardware error"},
48 {0x06070010, "Data type mismatch: length of service parameter does not match"},
49 {0x06070012, "Data type mismatch: length of service parameter too high"},
50 {0x06070013, "Data type mismatch: length of service parameter too low"},
51 {0x06090011, "Subindex does not exist"},
52 {0x06090030, "Value range of parameter exceeded (write access only)"},
53 {0x06090031, "Value of parameter written too high"},
54 {0x06090032, "Value of parameter written too low"},
55 {0x06090036, "Maximum value is less than minimum value"},
56 {0x08000000, "General error"},
57 {0x08000020, "Data cannot be transferred or stored to the application"},
58 {0x08000021,
59 "Data cannot be transferred or stored to the application because of local control"},
60 {0x08000022,
61 "Data cannot be transferred or stored to the application because of the present device state"},
62 {0x08000023, "Object dictionary dynamic generation failed or no object dictionary is present"},
63});
64
67constexpr std::string_view sdoAbortCodeDescription(uint32_t code) {
68 const auto it = std::find_if(kSdoAbortCodes.begin(), kSdoAbortCodes.end(),
69 [code](const SdoAbortCode& e) { return e.code == code; });
70 return it != kSdoAbortCodes.end() ? it->description : std::string_view{};
71}
72
73} // namespace mm::comm
Definition al_status_codes.cc:5
void to_json(nlohmann::json &j, const AlStatusCode &c)
Serialises an AlStatusCode to JSON.
Definition al_status_codes.cc:7
constexpr std::string_view sdoAbortCodeDescription(uint32_t code)
Returns the description of code, or an empty view if code is not a known SDO abort code (vendor-speci...
Definition sdo_abort_codes.h:67
constexpr auto kSdoAbortCodes
Catalogue of CoE SDO abort codes.
Definition sdo_abort_codes.h:30
Metadata for a single CoE SDO abort code entry.
Definition sdo_abort_codes.h:12
std::string_view description
Human-readable meaning of the abort.
Definition sdo_abort_codes.h:14
uint32_t code
32-bit code from the Abort SDO Transfer request.
Definition sdo_abort_codes.h:13