tool/CommandUpload.cpp
changeset 1869 14f634f5b613
parent 1868 489ea0becd74
child 1870 0cee1fb7f0fd
equal deleted inserted replaced
1868:489ea0becd74 1869:14f634f5b613
    80 
    80 
    81 /****************************************************************************/
    81 /****************************************************************************/
    82 
    82 
    83 void CommandUpload::execute(const StringVector &args)
    83 void CommandUpload::execute(const StringVector &args)
    84 {
    84 {
       
    85 	MasterIndexList masterIndices;
    85     SlaveList slaves;
    86     SlaveList slaves;
    86     stringstream err, strIndex, strSubIndex;
    87     stringstream err, strIndex, strSubIndex;
    87     ec_ioctl_slave_sdo_upload_t data;
    88     ec_ioctl_slave_sdo_upload_t data;
    88     const DataType *dataType = NULL;
    89     const DataType *dataType = NULL;
    89     unsigned int uval;
    90     unsigned int uval;
   110         err << "Invalid SDO subindex '" << args[1] << "'!";
   111         err << "Invalid SDO subindex '" << args[1] << "'!";
   111         throwInvalidUsageException(err);
   112         throwInvalidUsageException(err);
   112     }
   113     }
   113     data.sdo_entry_subindex = uval;
   114     data.sdo_entry_subindex = uval;
   114 
   115 
   115     if (getMasterIndices().size() != 1) {
   116 	masterIndices = getMasterIndices();
       
   117     if (masterIndices.size() != 1) {
   116         err << getName() << " requires to select a single master!";
   118         err << getName() << " requires to select a single master!";
   117         throwInvalidUsageException(err);
   119         throwInvalidUsageException(err);
   118     }
   120     }
   119     MasterDevice m(getMasterIndices().front());
   121     MasterDevice m(masterIndices.front());
   120     m.open(MasterDevice::Read);
   122     m.open(MasterDevice::Read);
   121     slaves = selectedSlaves(m);
   123     slaves = selectedSlaves(m);
   122     if (slaves.size() != 1) {
   124     if (slaves.size() != 1) {
   123         throwSingleSlaveRequired(slaves.size());
   125         throwSingleSlaveRequired(slaves.size());
   124     }
   126     }