Changeset 13867 for trunk/FACT++/src
- Timestamp:
- 05/24/12 14:10:42 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/magicweather.cc
r13212 r13867 228 228 "Cache-Control: max-age=0\r\n" 229 229 "\r\n"; 230 230 231 PostMessage(cmd); 231 232 } … … 326 327 #include "DimDescriptionService.h" 327 328 328 class ConnectionDim Drive: public ConnectionWeather329 class ConnectionDimWeather : public ConnectionWeather 329 330 { 330 331 private: … … 339 340 340 341 public: 341 ConnectionDim Drive(ba::io_service& ioservice, MessageImp &imp) :342 ConnectionDimWeather(ba::io_service& ioservice, MessageImp &imp) : 342 343 ConnectionWeather(ioservice, imp), 343 344 fDimWeather("MAGIC_WEATHER/DATA", "S:1;F:1;F:1;F:1;F:1;F:1;F:1;F:1", … … 357 358 358 359 template <class T, class S> 359 class StateMachineDrive : public T, public ba::io_service, public ba::io_service::work 360 { 361 int Wrap(boost::function<void()> f) 362 { 363 f(); 364 return T::GetCurrentState(); 365 } 366 367 boost::function<int(const EventImp &)> Wrapper(boost::function<void()> func) 368 { 369 return bind(&StateMachineDrive::Wrap, this, func); 370 } 371 360 class StateMachineWeather : public T, public ba::io_service, public ba::io_service::work 361 { 372 362 private: 373 363 S fWeather; … … 441 431 442 432 public: 443 StateMachine Drive(ostream &out=cout) :433 StateMachineWeather(ostream &out=cout) : 444 434 T(out, "MAGIC_WEATHER"), ba::io_service::work(static_cast<ba::io_service&>(*this)), 445 435 fWeather(*this, *this) … … 464 454 // Verbosity commands 465 455 T::AddEvent("SET_VERBOSE", "B") 466 (bind(&StateMachine Drive::SetVerbosity, this, placeholders::_1))456 (bind(&StateMachineWeather::SetVerbosity, this, placeholders::_1)) 467 457 ("set verbosity state" 468 458 "|verbosity[bool]:disable or enable verbosity for received data (yes/no), except dynamic data"); … … 470 460 // Conenction commands 471 461 AddEvent("DISCONNECT") 472 (bind(&StateMachine Drive::Disconnect, this))462 (bind(&StateMachineWeather::Disconnect, this)) 473 463 ("disconnect from ethernet"); 474 464 475 465 AddEvent("RECONNECT", "O") 476 (bind(&StateMachine Drive::Reconnect, this, placeholders::_1))466 (bind(&StateMachineWeather::Reconnect, this, placeholders::_1)) 477 467 ("(Re)connect ethernet connection to FTM, a new address can be given" 478 468 "|[host][string]:new ethernet address in the form <host:port>"); 479 469 */ 480 fWeather.StartConnect();481 }482 483 void SetEndpoint(const string &url)484 {485 fWeather.SetEndpoint(url);486 470 } 487 471 … … 492 476 fWeather.SetDebugTx(conf.Get<bool>("debug-tx")); 493 477 fWeather.SetSite(conf.Get<string>("url")); 494 495 SetEndpoint(conf.Get<string>("addr")); 496 478 fWeather.SetEndpoint(conf.Get<string>("addr")); 479 fWeather.StartConnect(); 497 480 498 481 return -1; … … 508 491 int RunShell(Configuration &conf) 509 492 { 510 return Main::execute<T, StateMachine Drive<S, R>>(conf);493 return Main::execute<T, StateMachineWeather<S, R>>(conf); 511 494 } 512 495 513 496 void SetupConfiguration(Configuration &conf) 514 497 { 515 po::options_description control(" Drivecontrol options");498 po::options_description control("MAGIC weather control options"); 516 499 control.add_options() 517 500 ("no-dim,d", po_switch(), "Disable dim services") … … 538 521 { 539 522 cout << 540 "The drivectrl is an interface to cosy.\n"523 "The magicweather is an interface to the MAGIC weather data.\n" 541 524 "\n" 542 525 "The default is that the program is started without user intercation. " … … 545 528 "help message about the usuage can be brought to the screen.\n" 546 529 "\n" 547 "Usage: drivectrl[-c type] [OPTIONS]\n"548 " or: drivectrl[OPTIONS]\n";530 "Usage: magicweather [-c type] [OPTIONS]\n" 531 " or: magicweather [OPTIONS]\n"; 549 532 cout << endl; 550 533 } … … 590 573 return RunShell<LocalStream, StateMachine, ConnectionWeather>(conf); 591 574 else 592 return RunShell<LocalStream, StateMachineDim, ConnectionDim Drive>(conf);575 return RunShell<LocalStream, StateMachineDim, ConnectionDimWeather>(conf); 593 576 } 594 577 // Cosole access w/ and w/o Dim … … 603 586 { 604 587 if (conf.Get<int>("console")==0) 605 return RunShell<LocalShell, StateMachineDim, ConnectionDim Drive>(conf);588 return RunShell<LocalShell, StateMachineDim, ConnectionDimWeather>(conf); 606 589 else 607 return RunShell<LocalConsole, StateMachineDim, ConnectionDim Drive>(conf);590 return RunShell<LocalConsole, StateMachineDim, ConnectionDimWeather>(conf); 608 591 } 609 592 }
Note:
See TracChangeset
for help on using the changeset viewer.