// Initialise and test the TMS system
BError tmsInit(TmsControl& tmsControl){
BError err;
ConfigInfo configInfo;
BIter i;
BList<BError> errorList;
BList<NameValue> nvList;
BString version;
// Get Version
if(err = tmsControl.getVersion(version)){
return err.set(1, BString("Error: initialising TMS: ") + err.getString());
}
cout << "Version: " << version << "\n";
// Initialise TMS system
if(err = tmsControl.init()){
return err.set(1, BString("Error: initialising TMS: ") + err.getString());
}
// Test TMS system
if(err = tmsControl.test(errorList)){
return err.set(1, BString("Error: testing TMS: ") + err.getString());
}
for(errorList.start(i); !errorList.isEnd(i); errorList.next(i)){
cout << "Warning: " << errorList[i].getString() << "\n";
}
// Get Status of TMS system
if(err = tmsControl.getStatus(nvList)){
return err.set(1, BString("Error: getting status: ") + err.getString());
}
for(nvList.start(i); !nvList.isEnd(i); nvList.next(i)){
cout << nvList[i].name << ":\t" << nvList[i].value << "\n";
}
return err;
}
int main(int argc, char** argv){
BError err;
BString host = "localhost";
TmsControl tmsControl;
TmsProcess tmsProcess;
if(argc == 2)
host = argv[1];
// Connect to the Control service