tool/CommandData.cpp
changeset 1804 742607c464c4
parent 1373 e651000f1ff1
child 1826 ec6223c3b7ec
equal deleted inserted replaced
1803:5b04770444df 1804:742607c464c4
    44 string CommandData::helpString() const
    44 string CommandData::helpString() const
    45 {
    45 {
    46     stringstream str;
    46     stringstream str;
    47 
    47 
    48     str << getName() << " [OPTIONS]" << endl
    48     str << getName() << " [OPTIONS]" << endl
    49     	<< endl
    49         << endl
    50     	<< getBriefDescription() << endl
    50         << getBriefDescription() << endl
    51         << endl
    51         << endl
    52         << "Data of multiple domains are concatenated." << endl
    52         << "Data of multiple domains are concatenated." << endl
    53     	<< endl
    53         << endl
    54     	<< "Command-specific options:" << endl
    54         << "Command-specific options:" << endl
    55     	<< "  --domain -d <index>  Positive numerical domain index." << endl
    55         << "  --domain -d <index>  Positive numerical domain index." << endl
    56     	<< "                       If omitted, data of all domains" << endl
    56         << "                       If omitted, data of all domains" << endl
    57     	<< "                       are output." << endl
    57         << "                       are output." << endl
    58     	<< endl
    58         << endl
    59 		<< numericInfo();
    59         << numericInfo();
    60 
    60 
    61 	return str.str();
    61     return str.str();
    62 }
    62 }
    63 
    63 
    64 /****************************************************************************/
    64 /****************************************************************************/
    65 
    65 
    66 void CommandData::execute(MasterDevice &m, const StringVector &args)
    66 void CommandData::execute(MasterDevice &m, const StringVector &args)
    67 {
    67 {
    68 	DomainList domains;
    68     DomainList domains;
    69 	DomainList::const_iterator di;
    69     DomainList::const_iterator di;
    70 	
    70 
    71     if (args.size()) {
    71     if (args.size()) {
    72         stringstream err;
    72         stringstream err;
    73         err << "'" << getName() << "' takes no arguments!";
    73         err << "'" << getName() << "' takes no arguments!";
    74         throwInvalidUsageException(err);
    74         throwInvalidUsageException(err);
    75     }
    75     }
    76 
    76 
    77     m.open(MasterDevice::Read);
    77     m.open(MasterDevice::Read);
    78 	domains = selectedDomains(m);
    78     domains = selectedDomains(m);
    79 
    79 
    80 	for (di = domains.begin(); di != domains.end(); di++) {
    80     for (di = domains.begin(); di != domains.end(); di++) {
    81 		outputDomainData(m, *di);
    81         outputDomainData(m, *di);
    82 	}
    82     }
    83 }
    83 }
    84 
    84 
    85 /****************************************************************************/
    85 /****************************************************************************/
    86 
    86 
    87 void CommandData::outputDomainData(
    87 void CommandData::outputDomainData(
    88 		MasterDevice &m,
    88         MasterDevice &m,
    89 		const ec_ioctl_domain_t &domain
    89         const ec_ioctl_domain_t &domain
    90 		)
    90         )
    91 {
    91 {
    92     ec_ioctl_domain_data_t data;
    92     ec_ioctl_domain_data_t data;
    93     unsigned char *processData;
    93     unsigned char *processData;
    94     unsigned int i;
    94     unsigned int i;
    95     
    95