Added octet_string as an SDO data type. stable-1.4
authorFlorian Pose <fp@igh-essen.com>
Mon, 19 Jan 2009 10:23:26 +0000
branchstable-1.4
changeset 1695 69a948e240df
parent 1694 fe4c953b7a70
child 1696 c9bfe98e00d5
Added octet_string as an SDO data type.
tool/CommandDownload.cpp
tool/CommandUpload.cpp
tool/SdoCommand.cpp
--- a/tool/CommandDownload.cpp	Mon Jan 19 08:17:30 2009 +0000
+++ b/tool/CommandDownload.cpp	Mon Jan 19 10:23:26 2009 +0000
@@ -37,7 +37,8 @@
 		<< "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
@@ -191,6 +192,14 @@
                 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;
--- a/tool/CommandUpload.cpp	Mon Jan 19 08:17:30 2009 +0000
+++ b/tool/CommandUpload.cpp	Mon Jan 19 10:23:26 2009 +0000
@@ -37,7 +37,8 @@
         << "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
@@ -182,6 +183,10 @@
             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;
--- a/tool/SdoCommand.cpp	Mon Jan 19 08:17:30 2009 +0000
+++ b/tool/SdoCommand.cpp	Mon Jan 19 10:23:26 2009 +0000
@@ -57,14 +57,15 @@
 /****************************************************************************/
 
 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},
     {}
 };