62 #include "rnr/rnrconfig.h" 82 static const char *SubSysName =
"Product";
84 static string ProdSN(
"??????");
87 static map<string, string> ProdEnv;
94 size_t snlen =
sizeof(buf) - 1;
98 printSubHdr(
"Reading Serial Number");
101 if( (fp = fopen(
"/usr/local/share/misc/.sn",
"r")) == NULL )
103 printTestResult(FailTag,
"%s: Find serial number.", SubSysName);
105 else if( fread(buf,
sizeof(
char), snlen, fp) < snlen )
107 printTestResult(FailTag,
"%s: Read serial number.", SubSysName);
113 printTestResult(PassTag,
"%s: Read serial number %s.", SubSysName, buf);
134 if( (rc = xml.
load(ProdDesc, LaeSysCfgPath, LaeEtcCfg)) != LAE_OK )
136 printTestResult(FailTag,
"%s: Load and parse file %s.",
137 SubSysName, LaeEtcCfg);
141 printTestResult(PassTag,
"%s: Load and parse file %s.",
142 SubSysName, LaeEtcCfg);
150 printTestResult(FailTag,
"%s: Description complete.", SubSysName);
154 printTestResult(PassTag,
"%s: Description complete.", SubSysName);
169 if( (rc = xml.
load(ProdTunes, LaeSysCfgPath, LaeEtcTune)) != LAE_OK )
171 printTestResult(FailTag,
"%s: Load and parse file %s.",
172 SubSysName, LaeEtcCfg);
176 printTestResult(PassTag,
"%s: Load and parse file %s.",
177 SubSysName, LaeEtcCfg);
186 const char *EnvName[] =
188 "ROS_DISTRO",
"ROS_ETC_DIR",
"ROS_MASTER_URI",
"ROS_PACKAGE_PATH",
197 for(i = 0; i < arraysize(EnvName); ++i)
201 if( (sVal = getenv(EnvName[i])) != NULL )
203 ProdEnv[EnvName[i]] = sVal;
207 printTestResult(sTag,
"%s: getenv(%s).", SubSysName, EnvName[i]);
213 static void printResults()
215 map<string, string>::iterator iter;
218 printf(
"Laelaps Product Summary:\n");
220 printf(
" Serial Number: %s\n", ProdSN.c_str());
229 for(iter = ProdEnv.begin(); iter != ProdEnv.end(); ++iter)
231 printf(
"%18s: %s\n", iter->first.c_str(), iter->second.c_str());
242 printHdr(
"Product Diagnostics");
247 if( !statsTotal.fatal )
249 statsTest = readProdSN();
251 printSubTotals(statsTest);
253 statsTotal += statsTest;
259 if( !statsTotal.fatal )
261 statsTest = readProdDesc();
263 printSubTotals(statsTest);
265 statsTotal += statsTest;
271 if( !statsTotal.fatal )
273 statsTest = readProdTunes();
275 printSubTotals(statsTest);
277 statsTotal += statsTest;
283 if( !statsTotal.fatal )
285 statsTest = readProdEnv();
287 printSubTotals(statsTest);
289 statsTotal += statsTest;
295 printTotals(statsTotal);
Laelaps tuning data class.
LaeXmlTune <b><i>Laelaps</i></b> XML tuning class.
Laelaps robotic mobile platform full description class.
void print(int indent=0)
Print out tuning parameters to stdout.
<b><i>Laelaps</i></b> XML tuning class interface.
virtual int load(LaeTunes &tunes, const std::string &strSearchPath=LaeSysCfgPath, const std::string &strXmlFileName=LaeEtcTune, bool bAllInstances=false)
Load XML file into DOM and set the <b><i>Laelaps</i></b> tuning parameters.
The <b><i>Laelaps</i></b> namespace encapsulates all <b><i>Laelaps</i></b> related constructs...
Laelaps robotic base mobile platform description class interface.
Simple diagnostics statistics class.
Laelaps common utilities.
int markAsDescribed()
Mark <b><i>Laelaps</i></b> hardware as fully described.
<b><i>Laelaps</i></b> XML configuration class interface.
virtual int load(LaeDesc &desc, const std::string &strSearchPath, const std::string &strXmlFileName, bool bAllInstances=false)
Load XML file into DOM and set the <b><i>Laelaps</i></b> description.
void print(int indent=0)
Print out description to stdout.
Top-level package include file.
LaeXmlCfg <b><i>Laelaps</i></b> XML configuration class.