diff --git a/tool/CommandDownload.cpp b/tool/CommandDownload.cpp index 02c94f20fd0217584b390169dcb888dabb5dbbd1..0c0fc1d2517d796a222cf73d1ee1db24dc8071d2 100644 --- a/tool/CommandDownload.cpp +++ b/tool/CommandDownload.cpp @@ -36,7 +36,8 @@ string CommandDownload::helpString() const << "the --type option is mandatory." << endl << endl << "These are the valid SDO entry data types:" << endl - << " int8, int16, int32, uint8, uint16, uint32, string." << endl + << " int8, int16, int32, uint8, uint16, uint32, string," << endl + << " octet_string." << endl << endl << "Arguments:" << endl << " INDEX is the SDO index and must be an unsigned" << endl @@ -190,6 +191,14 @@ void CommandDownload::execute(MasterDevice &m, const StringVector &args) data.data_size = strValue.str().size(); strValue >> (char *) data.data; break; + case 0x000a: // octet_string + if (strValue.str().size() >= data.data_size) { + err << "String too large"; + throwCommandException(err); + } + data.data_size = strValue.str().size(); + strValue >> (char *) data.data; + break; default: delete [] data.data; diff --git a/tool/CommandUpload.cpp b/tool/CommandUpload.cpp index 3dea460f848df6a4752e1a270191c752eb145fdd..1bea8eb99eedbd545b6977c8bde0277621916d13 100644 --- a/tool/CommandUpload.cpp +++ b/tool/CommandUpload.cpp @@ -36,7 +36,8 @@ string CommandUpload::helpString() const << "the --type option is mandatory." << endl << endl << "These are the valid SDO entry data types:" << endl - << " int8, int16, int32, uint8, uint16, uint32, string." << endl + << " int8, int16, int32, uint8, uint16, uint32, string," << endl + << " octet_string." << endl << endl << "Arguments:" << endl << " INDEX is the SDO index and must be an unsigned" << endl @@ -181,6 +182,10 @@ void CommandUpload::execute(MasterDevice &m, const StringVector &args) cout << string((const char *) data.target, data.data_size) << endl; break; + case 0x000a: // octet_string + cout << string((const char *) data.target, data.data_size) + << endl; + break; default: printRawData(data.target, data.data_size); // FIXME break; diff --git a/tool/SdoCommand.cpp b/tool/SdoCommand.cpp index 56d68c0428cfad3bc306df8b7afa649a5768ba11..25028990e21467977e557e3f6a182cd12941e0c5 100644 --- a/tool/SdoCommand.cpp +++ b/tool/SdoCommand.cpp @@ -57,14 +57,15 @@ const char *SdoCommand::abortText(uint32_t abortCode) /****************************************************************************/ const SdoCommand::DataType SdoCommand::dataTypes[] = { - {"int8", 0x0002, 1}, - {"int16", 0x0003, 2}, - {"int32", 0x0004, 4}, - {"uint8", 0x0005, 1}, - {"uint16", 0x0006, 2}, - {"uint32", 0x0007, 4}, - {"string", 0x0009, 0}, - {"raw", 0xffff, 0}, + {"int8", 0x0002, 1}, + {"int16", 0x0003, 2}, + {"int32", 0x0004, 4}, + {"uint8", 0x0005, 1}, + {"uint16", 0x0006, 2}, + {"uint32", 0x0007, 4}, + {"string", 0x0009, 0}, + {"octet_string", 0x000a, 0}, + {"raw", 0xffff, 0}, {} };