Changeset 14523
- Timestamp:
- 10/24/12 21:56:06 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/pwrctrl.cc
r14522 r14523 160 160 boost::asio::deadline_timer fKeepAlive; 161 161 162 void PostRequest(string cmd, const string &args="")163 {164 cmd += " "+fSite+" HTTP/1.1\r\n"165 //"Connection: Keep-Alive\r\n"166 ;167 168 ostringstream msg;169 msg << args.length();170 171 cmd += "Content-Length: ";172 cmd += msg.str();173 cmd += "\r\n";174 175 if (args.length()>0)176 cmd += "\r\n" + args + "\r\n";177 178 cmd += "\r\n";179 180 //cout << "Post: " << cmd << endl;181 PostMessage(cmd);182 }183 184 162 void HandleRequest(const bs::error_code &error) 185 163 { … … 260 238 void Request() 261 239 { 262 PostRequest("POST", fNextCommand); 240 string cmd = "GET " + fSite; 241 242 if (!fNextCommand.empty()) 243 cmd += "?" + fNextCommand; 244 245 cmd += " HTTP/1.1\r\n"; 246 cmd += "\r\n"; 247 248 PostMessage(cmd); 249 263 250 fNextCommand = ""; 264 251 … … 393 380 394 381 fLastCommand = Time(); 395 fPower.Post(evt.GetBool() ? "cam_on= " : "cam_off=");382 fPower.Post(evt.GetBool() ? "cam_on=Camera+ON" : "cam_off=Camera+OFF"); 396 383 return T::GetCurrentState(); 397 384 } … … 400 387 { 401 388 fLastCommand = Time(); 402 fPower.Post("dt= ");389 fPower.Post("dt=Drive+ON%2FOFF"); 403 390 return T::GetCurrentState(); 404 391 … … 463 450 464 451 // Verbosity commands 465 T::AddEvent("SET_VERBOSE", "B ")452 T::AddEvent("SET_VERBOSE", "B:1") 466 453 (bind(&StateMachinePowerControl::SetVerbosity, this, placeholders::_1)) 467 (" set verbosity state"454 ("Set verbosity state" 468 455 "|verbosity[bool]:disable or enable verbosity for interpreted data (yes/no)"); 469 456 470 T::AddEvent("SET_DEBUG_RX", "B ")457 T::AddEvent("SET_DEBUG_RX", "B:1") 471 458 (bind(&StateMachinePowerControl::SetDebugRx, this, placeholders::_1)) 472 (" set debux-rx state"459 ("Set debux-rx state" 473 460 "|debug[bool]:dump received text and parsed text to console (yes/no)"); 474 461 475 T::AddEvent("CAMERA_POWER", "B") 476 (bind(&StateMachinePowerControl::SetCameraPower, this, placeholders::_1)); 462 T::AddEvent("CAMERA_POWER", "B:1") 463 (bind(&StateMachinePowerControl::SetCameraPower, this, placeholders::_1)) 464 ("Switch camera power" 465 "|power[bool]:Switch camera power 'on' or 'off'"); 477 466 478 467 T::AddEvent("TOGGLE_DRIVE") 479 (bind(&StateMachinePowerControl::ToggleDrive, this)); 468 (bind(&StateMachinePowerControl::ToggleDrive, this)) 469 ("Toggle drive power"); 480 470 481 471 T::AddEvent("POST", "C")
Note:
See TracChangeset
for help on using the changeset viewer.