fp@1184: /***************************************************************************** fp@1184: * fp@1184: * $Id$ fp@1184: * fp@1184: ****************************************************************************/ fp@1184: fp@1184: #include "SdoCommand.h" fp@1184: fp@1184: /*****************************************************************************/ fp@1184: fp@1184: SdoCommand::SdoCommand(const string &name, const string &briefDesc): fp@1184: Command(name, briefDesc) fp@1184: { fp@1184: } fp@1184: fp@1184: /****************************************************************************/ fp@1184: fp@1184: const SdoCommand::DataType *SdoCommand::findDataType(const string &str) fp@1184: { fp@1184: const DataType *d; fp@1184: fp@1184: for (d = dataTypes; d->name; d++) fp@1184: if (str == d->name) fp@1184: return d; fp@1184: fp@1184: return NULL; fp@1184: } fp@1184: fp@1184: /****************************************************************************/ fp@1184: fp@1184: const SdoCommand::DataType *SdoCommand::findDataType(uint16_t code) fp@1184: { fp@1184: const DataType *d; fp@1184: fp@1184: for (d = dataTypes; d->name; d++) fp@1184: if (code == d->coeCode) fp@1184: return d; fp@1184: fp@1184: return NULL; fp@1184: } fp@1184: fp@1184: /****************************************************************************/ fp@1184: fp@1184: const char *SdoCommand::abortText(uint32_t abortCode) fp@1184: { fp@1184: const AbortMessage *abortMsg; fp@1184: fp@1184: for (abortMsg = abortMessages; abortMsg->code; abortMsg++) { fp@1184: if (abortMsg->code == abortCode) { fp@1184: return abortMsg->message; fp@1184: } fp@1184: } fp@1184: fp@1184: return "???"; fp@1184: } fp@1184: fp@1184: /****************************************************************************/ fp@1184: fp@1184: const SdoCommand::DataType SdoCommand::dataTypes[] = { fp@1710: {"int8", 0x0002, 1}, fp@1710: {"int16", 0x0003, 2}, fp@1710: {"int32", 0x0004, 4}, fp@1710: {"uint8", 0x0005, 1}, fp@1710: {"uint16", 0x0006, 2}, fp@1710: {"uint32", 0x0007, 4}, fp@1710: {"string", 0x0009, 0}, fp@1710: {"octet_string", 0x000a, 0}, fp@1710: {"raw", 0xffff, 0}, fp@1184: {} fp@1184: }; fp@1184: fp@1184: /*****************************************************************************/ fp@1184: fp@1686: /** SDO abort messages. fp@1184: * fp@1686: * The "Abort SDO transfer request" supplies an abort code, which can be fp@1184: * translated to clear text. This table does the mapping of the codes and fp@1184: * messages. fp@1184: */ fp@1184: const SdoCommand::AbortMessage SdoCommand::abortMessages[] = { fp@1184: {0x05030000, "Toggle bit not changed"}, fp@1686: {0x05040000, "SDO protocol timeout"}, fp@1184: {0x05040001, "Client/Server command specifier not valid or unknown"}, fp@1184: {0x05040005, "Out of memory"}, fp@1184: {0x06010000, "Unsupported access to an object"}, fp@1184: {0x06010001, "Attempt to read a write-only object"}, fp@1184: {0x06010002, "Attempt to write a read-only object"}, fp@1184: {0x06020000, "This object does not exist in the object directory"}, fp@1686: {0x06040041, "The object cannot be mapped into the PDO"}, fp@1184: {0x06040042, "The number and length of the objects to be mapped would" fp@1686: " exceed the PDO length"}, fp@1184: {0x06040043, "General parameter incompatibility reason"}, fp@1184: {0x06040047, "Gerneral internal incompatibility in device"}, fp@1184: {0x06060000, "Access failure due to a hardware error"}, fp@1184: {0x06070010, "Data type does not match, length of service parameter does" fp@1184: " not match"}, fp@1184: {0x06070012, "Data type does not match, length of service parameter too" fp@1184: " high"}, fp@1184: {0x06070013, "Data type does not match, length of service parameter too" fp@1184: " low"}, fp@1184: {0x06090011, "Subindex does not exist"}, fp@1184: {0x06090030, "Value range of parameter exceeded"}, fp@1184: {0x06090031, "Value of parameter written too high"}, fp@1184: {0x06090032, "Value of parameter written too low"}, fp@1184: {0x06090036, "Maximum value is less than minimum value"}, fp@1184: {0x08000000, "General error"}, fp@1184: {0x08000020, "Data cannot be transferred or stored to the application"}, fp@1184: {0x08000021, "Data cannot be transferred or stored to the application" fp@1184: " because of local control"}, fp@1184: {0x08000022, "Data cannot be transferred or stored to the application" fp@1184: " because of the present device state"}, fp@1184: {0x08000023, "Object dictionary dynamic generation fails or no object" fp@1184: " dictionary is present"}, fp@1184: {} fp@1184: }; fp@1184: fp@1184: /****************************************************************************/