equal
deleted
inserted
replaced
7 #include <iostream> |
7 #include <iostream> |
8 #include <iomanip> |
8 #include <iomanip> |
9 using namespace std; |
9 using namespace std; |
10 |
10 |
11 #include "CommandUpload.h" |
11 #include "CommandUpload.h" |
12 #include "coe_datatypes.h" |
|
13 #include "byteorder.h" |
12 #include "byteorder.h" |
14 |
13 |
15 /*****************************************************************************/ |
14 /*****************************************************************************/ |
16 |
15 |
17 CommandUpload::CommandUpload(): |
16 CommandUpload::CommandUpload(): |
18 Command("upload", "Read an Sdo entry from a slave.") |
17 SdoCommand("upload", "Read an Sdo entry from a slave.") |
19 { |
18 { |
20 } |
19 } |
21 |
20 |
22 /*****************************************************************************/ |
21 /*****************************************************************************/ |
23 |
22 |
64 SlaveList slaves; |
63 SlaveList slaves; |
65 stringstream err, strIndex, strSubIndex; |
64 stringstream err, strIndex, strSubIndex; |
66 int sval; |
65 int sval; |
67 ec_ioctl_slave_sdo_upload_t data; |
66 ec_ioctl_slave_sdo_upload_t data; |
68 unsigned int uval; |
67 unsigned int uval; |
69 const CoEDataType *dataType = NULL; |
68 const DataType *dataType = NULL; |
70 |
69 |
71 if (args.size() != 2) { |
70 if (args.size() != 2) { |
72 err << "'" << getName() << "' takes two arguments!"; |
71 err << "'" << getName() << "' takes two arguments!"; |
73 throwInvalidUsageException(err); |
72 throwInvalidUsageException(err); |
74 } |
73 } |
131 |
130 |
132 data.target = new uint8_t[data.target_size + 1]; |
131 data.target = new uint8_t[data.target_size + 1]; |
133 |
132 |
134 try { |
133 try { |
135 m.sdoUpload(&data); |
134 m.sdoUpload(&data); |
|
135 } catch (MasterDeviceSdoAbortException &e) { |
|
136 delete [] data.target; |
|
137 err << "Sdo transfer aborted with code 0x" |
|
138 << setfill('0') << hex << setw(8) << e.abortCode |
|
139 << ": " << abortText(e.abortCode); |
|
140 throwCommandException(err); |
136 } catch (MasterDeviceException &e) { |
141 } catch (MasterDeviceException &e) { |
137 delete [] data.target; |
142 delete [] data.target; |
138 throw e; |
143 throw e; |
139 } |
144 } |
140 |
145 |