#include #include #ifndef WIN32 #include #endif using namespace std; #include class ErrorHandler : public DimErrorHandler { void errorHandler(int severity, int code, char *msg) { int index = 0; char **services; if(code){} cout << severity << " " << msg << endl; services = DimServer::getClientServices(); cout<< "from "<< DimServer::getClientName() << " services:" << endl; while(services[index]) { cout << services[index] << endl; index++; } } public: ErrorHandler() {DimServer::addErrorHandler(this);} }; class ExitHandler : public DimExitHandler { void exitHandler(int code) { cout << "exit code " << code << endl; } public: ExitHandler() {DimServer::addExitHandler(this);} }; class CmndServ : public DimCommand, public DimTimer { DimService servstr; void commandHandler() { int index = 0; char **services; cout << "Command " << getString() << " received" << endl; servstr.updateService(getString()); services = DimServer::getClientServices(); cout<< "from "<< DimServer::getClientName() << " services:" << endl; while(services[index]) { cout << services[index] << endl; index++; } } public : CmndServ() : DimCommand("TEST/CMND","C"), servstr("TEST/STRVAL","empty") {}; /* void handleIt() { int index = 0; char **services; dim_print_date_time(); cout << "Command " << getString() << " received" << endl; cout << "time: "<setQuality(1); servp->updateService(arr[i]); // DimServer::start("TEST"); sprintf(str,"CommandManyTest/%05d",i); cmndp = new CmndServMany(str); // DimServer::start("TEST"); } */ while(1) { sleep(5); /* while(cmdsvr.hasNext()) { cmdsvr.getNext(); cmdsvr.handleIt(); } */ s1 = "hello1"; if(!boolval) boolval = 1; else boolval = 0; ival++; bool_serv[1]->updateService(); int inCallback = DimServer::inCallback(); cout << "main: In callback "<< inCallback << endl; servint.updateService(); if(extraDns) new_servint->updateService(); } return 0; }