tool/Command.cpp
changeset 1166 006244d53f68
parent 1160 f02ff486b313
child 1199 30714bab3a04
equal deleted inserted replaced
1165:c5d6e28eec91 1166:006244d53f68
    38 /*****************************************************************************/
    38 /*****************************************************************************/
    39 
    39 
    40 void Command::setPosition(int p)
    40 void Command::setPosition(int p)
    41 {
    41 {
    42 	position = p;
    42 	position = p;
       
    43 };
       
    44 
       
    45 /*****************************************************************************/
       
    46 
       
    47 void Command::setDomain(int d)
       
    48 {
       
    49 	domain = d;
       
    50 };
       
    51 
       
    52 /*****************************************************************************/
       
    53 
       
    54 void Command::setDataType(const string &t)
       
    55 {
       
    56 	dataType = t;
       
    57 };
       
    58 
       
    59 /*****************************************************************************/
       
    60 
       
    61 void Command::setForce(bool f)
       
    62 {
       
    63 	force = f;
    43 };
    64 };
    44 
    65 
    45 /****************************************************************************/
    66 /****************************************************************************/
    46 
    67 
    47 bool Command::matchesSubstr(const string &cmd) const
    68 bool Command::matchesSubstr(const string &cmd) const
   224     return list;
   245     return list;
   225 }
   246 }
   226 
   247 
   227 /****************************************************************************/
   248 /****************************************************************************/
   228 
   249 
       
   250 Command::DomainList Command::selectedDomains(MasterDevice &m)
       
   251 {
       
   252 	ec_ioctl_domain_t d;
       
   253 	DomainList list;
       
   254 
       
   255     if (domain == -1) {
       
   256 		ec_ioctl_master_t master;
       
   257         unsigned int i;
       
   258 
       
   259         m.getMaster(&master);
       
   260 
       
   261         for (i = 0; i < master.domain_count; i++) {
       
   262 			m.getDomain(&d, i);
       
   263 			list.push_back(d);
       
   264         }
       
   265     } else {
       
   266 		m.getDomain(&d, domain);
       
   267 		list.push_back(d);
       
   268     }
       
   269 
       
   270 	return list;
       
   271 }
       
   272 
       
   273 /****************************************************************************/
       
   274 
   229 string Command::alStateString(uint8_t state)
   275 string Command::alStateString(uint8_t state)
   230 {
   276 {
   231     switch (state) {
   277     switch (state) {
   232         case 1: return "INIT";
   278         case 1: return "INIT";
   233         case 2: return "PREOP";
   279         case 2: return "PREOP";