25int main(
int argc,
char **argv)
40 JParser<> zap(
"Auxiliary program to print firmware vesion.");
42 zap[
's'] =
make_field(server) = getServernames();
46 zap[
'D'] =
make_field(
id,
"detector identifier") =
"";
52 catch(
const exception &error) {
53 FATAL(error.what() << endl);
58 JDB::reset(usr, pwd, cookie);
60 catch(
const exception& error) {
61 FATAL(error.what() << endl);
64 const string detid = getDetector<string>(
id);
72 if (! (rs >> clbmap)) {
78 catch(
const exception& error) {
79 FATAL(
"Detector " << detid <<
" - " << error.what() << endl);
83 FATAL(
"Detector " << detid <<
" - " <<
" no data." << endl);
97 sort(clbmap.begin(), clbmap.end(), compare);
100 for (
const auto& i : clbmap) {
102 string version =
"?";
106 JSelector selection(&JDatalogNumbers::SOURCE_NAME, i.UPI.toString());
110 ResultSet& rs = getResultSet(getTable<JDatalogNumbers>(), selection);
114 const int value = (int) parameters.DATA_VALUE;
118 const size_t pos = parameters.PARAMETER_NAME.find(
"BUILD");
120 if (pos != string::npos) {
122 const size_t ls[] = {
123 parameters.PARAMETER_NAME.find(
'['),
124 parameters.PARAMETER_NAME.find(
']')
131 istringstream(parameters.PARAMETER_NAME.substr(
ls[0] + 1,
ls[1] -
ls[0] + 1)) >> index;
133 if (version.size() <= index) {
134 version.append(index - version.size() + 1,
' ');
137 DEBUG(parameters.PARAMETER_NAME <<
' ' <<
ls[0] <<
' ' <<
ls[1] <<
' ' << index <<
' ' << value << endl);
139 version[index] = (char) value;
147 catch(
const exception& error) {
148 FATAL(error.what() << endl);
151 cout <<
"Firmware: " <<
FILL(4,
'0') << i.DUID <<
'.' <<
FILL(2,
'0') << i.FLOORID <<
" " << setw(24) << left << i.UPI <<
" \"" << version <<
"\"" << right << endl;