45 string CommandSiiRead::helpString() const |
45 string CommandSiiRead::helpString() const |
46 { |
46 { |
47 stringstream str; |
47 stringstream str; |
48 |
48 |
49 str << getName() << " [OPTIONS]" << endl |
49 str << getName() << " [OPTIONS]" << endl |
50 << endl |
50 << endl |
51 << getBriefDescription() << endl |
51 << getBriefDescription() << endl |
52 << endl |
52 << endl |
53 << "This command requires a single slave to be selected." << endl |
53 << "This command requires a single slave to be selected." << endl |
54 << endl |
54 << endl |
55 << "Without the --verbose option, binary SII contents are" << endl |
55 << "Without the --verbose option, binary SII contents are" << endl |
56 << "output." << endl |
56 << "output." << endl |
57 << endl |
57 << endl |
58 << "With the --verbose option given, a textual representation" << endl |
58 << "With the --verbose option given, a textual representation" << endl |
59 << "of the data is output, that is separated by SII category" << endl |
59 << "of the data is output, that is separated by SII category" << endl |
60 << "names." << endl |
60 << "names." << endl |
61 << endl |
61 << endl |
62 << "Command-specific options:" << endl |
62 << "Command-specific options:" << endl |
63 << " --alias -a <alias>" << endl |
63 << " --alias -a <alias>" << endl |
64 << " --position -p <pos> Slave selection. See the help of" << endl |
64 << " --position -p <pos> Slave selection. See the help of" << endl |
65 << " the 'slaves' command." << endl |
65 << " the 'slaves' command." << endl |
66 << " --verbose -v Output textual data with" << endl |
66 << " --verbose -v Output textual data with" << endl |
67 << " category names." << endl |
67 << " category names." << endl |
68 << endl |
68 << endl |
69 << numericInfo(); |
69 << numericInfo(); |
70 |
70 |
71 return str.str(); |
71 return str.str(); |
72 } |
72 } |
73 |
73 |
74 /****************************************************************************/ |
74 /****************************************************************************/ |
75 |
75 |
76 void CommandSiiRead::execute(MasterDevice &m, const StringVector &args) |
76 void CommandSiiRead::execute(MasterDevice &m, const StringVector &args) |
102 |
102 |
103 data.offset = 0; |
103 data.offset = 0; |
104 data.nwords = slave->sii_nwords; |
104 data.nwords = slave->sii_nwords; |
105 data.words = new uint16_t[data.nwords]; |
105 data.words = new uint16_t[data.nwords]; |
106 |
106 |
107 try { |
107 try { |
108 m.readSii(&data); |
108 m.readSii(&data); |
109 } catch (MasterDeviceException &e) { |
109 } catch (MasterDeviceException &e) { |
110 delete [] data.words; |
110 delete [] data.words; |
111 throw e; |
111 throw e; |
112 } |
112 } |
113 |
113 |
114 if (getVerbosity() == Verbose) { |
114 if (getVerbosity() == Verbose) { |
115 cout << "SII Area:" << hex << setfill('0'); |
115 cout << "SII Area:" << hex << setfill('0'); |
116 for (i = 0; i < min(data.nwords, 0x0040U) * 2; i++) { |
116 for (i = 0; i < min(data.nwords, 0x0040U) * 2; i++) { |
117 if (i % BreakAfterBytes) { |
117 if (i % BreakAfterBytes) { |