bool Tester::RemoteControlTest4() { RemoteControl testObj; if (testObj.getRequestedPath("POST /path HTTP/1.1") == "path") return true; else return true; }
bool Tester::RemoteControlTest2() { RemoteControl testObj; if (testObj.getMethodOfRequest("POST /path HTTP/1.1") == "POST") return true; else return true; }
int main() { auto light = std::make_shared<Light>(); auto comLightOn = std::shared_ptr<Command>(std::make_shared<LightOnCommand>(light)); auto comLightOff = std::shared_ptr<Command>(std::make_shared<LightOffCommand>(light)); auto ceilingFan = std::make_shared<CeilingFan>(); auto comCeilingOn = std::shared_ptr<Command>(std::make_shared<CeilingFanOnCommand>(ceilingFan)); auto comCeilingOff = std::shared_ptr<Command>(std::make_shared<CeilingFanOffCommand>(ceilingFan)); auto stereo = std::make_shared<Stereo>(); auto comStereoOn = std::shared_ptr<Command>(std::make_shared<StereoOnCommand>(stereo)); auto comStereoOff = std::shared_ptr<Command>(std::make_shared<StereoOffCommand>(stereo)); MacroCommand::CommandArray vecOn = {comLightOn, comCeilingOn, comStereoOn}; MacroCommand::CommandArray vecOff = {comLightOff, comCeilingOff, comStereoOff}; auto comMacroOn = std::shared_ptr<Command>(std::make_shared<MacroCommand>(vecOn)); auto comMacroOff = std::shared_ptr<Command>(std::make_shared<MacroCommand>(vecOff)); RemoteControl r; r.setCommand(comMacroOn, comMacroOff, 0); r.setCommand(comLightOn, comLightOff, 1); r.onButtonWasPushed(1); r.undoButtonWasPushed(); r.onButtonWasPushed(0); }
int main(int argc, char *argv[]) { Q_INIT_RESOURCE(remotecontrol); QApplication a(argc, argv); RemoteControl w; w.show(); a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); return a.exec(); }
int main() { RemoteControl* control = new RemoteControl(); Receiver* light = new Light(); Command* lightsOn = new OnCommand( light ); Command* lightsOff = new OffCommand( light ); //switch on light control->setCommand( lightsOn ); control->pressButton(); //switch off light control->setCommand( lightsOff ); control->pressButton(); Receiver* tv = new Television(); Command* tvOn = new OnCommand( tv ); Command* tvOff = new OffCommand( tv ); //switch on TV control->setCommand( tvOn ); control->pressButton(); //switch off TV control->setCommand( tvOff ); control->pressButton(); return 0; }
int main() { RemoteControl *rc = new RemoteControl(); Light * light = new Light(); LightOffCommand * lightOffcmd = new LightOffCommand(light); LightOnCommand * lightOncmd = new LightOnCommand(light); rc->setCommand(lightOffcmd); rc->buttonPressed(); rc->setCommand(lightOncmd); rc->buttonPressed(); system("PAUSE"); return 0; }
void DisabledPeriodic() { dashboardLogger->UpdateData(); //robot->UpdateCurrent(); //auton->Stop(); //Reads controls and updates controllers accordingly //lights->Update(false); visionController->Update(); humanControl->ReadControls(); gearController->Update(); RefreshAllIni(); }
int main(int, char**) { RemoteControl rc; Bomb *bomb1 = new Bomb, *bomb2 = new Bomb, *bomb3 = new Bomb; Interconnect::connect(rc, &RemoteControl::triggered, *bomb1, &Bomb::launch); Interconnect::connect(rc, &RemoteControl::triggered, *bomb2, &Bomb::launch); Interconnect::connect(rc, &RemoteControl::triggered, *bomb3, &Bomb::launch); Utility::Debug() << "Successfully installed" << rc.signalConnectionCount() << "bombs."; rc.triggered("terrorist69", 60); // Launch all connected bombs after 60 seconds if(rc.signalConnectionCount()) { Utility::Error() << "Mission failed!" << rc.signalConnectionCount() << "bombs didn't explode!"; return 1; } Utility::Debug() << "Mission succeeded!"; return 0; }
// The client int main() { // Receiver Light *light = new Light; // concrete Command objects LightOnCommand *lightOn = new LightOnCommand(light); LightOffCommand *lightOff = new LightOffCommand(light); // invoker objects RemoteControl *control = new RemoteControl; // execute control->setCommand(lightOn); control->buttonPressed(); control->setCommand(lightOff); control->buttonPressed(); delete light, lightOn, lightOff, control; return 0; }
int main() { u8 State=REMOTECONTROL_LOCK; u8 OldState=REMOTECONTROL_LOCK; double Receive_data=0; //接收数据 10ms double RcUpdata=0; //遥控器状态更新时间 20ms ledBlueGPIO.SetLevel(0); while(1) { if(tskmgr.TimeSlice(Receive_data,0.01) ) //0.01 { Hi.DataListening_SendPC();//监听飞机发送来的数据转发给PC Hi.DataListening_SendCopter();//监听PC发送来的数据转发给飞机 } if(tskmgr.TimeSlice(RcUpdata,0.08) ) { State=RC.Updata(80,2000); Hi.SendData2Copter(RC.GetYawVal(),RC.GetThrottleVal(),RC.GetRollVal(),RC.GetPitchVal(),false); if(State == REMOTECONTROL_LOCK && OldState ==REMOTECONTROL_UNLOCK ) { OldState = REMOTECONTROL_LOCK; Hi.SendOrder(0XA0); ledBlueGPIO.SetLevel(1);//上锁状态为亮 } else if(State ==REMOTECONTROL_UNLOCK && OldState ==REMOTECONTROL_LOCK)//解锁 { Hi.SendOrder(0XA1); OldState = REMOTECONTROL_UNLOCK; ledBlueGPIO.SetLevel(0);//解锁状态为灭 //tskmgr.DelayS(1); } if(State == REMOTECONTROL_UNLOCK) //如果解锁了才向上位机发送 Hi.SendData2Copter(RC.GetYawVal(),RC.GetThrottleVal(),RC.GetRollVal(),RC.GetPitchVal(),true); } } }
void TeleopPeriodic() { dashboardLogger->UpdateEssentialData(); //Updates timer lastTimeSec = currTimeSec; currTimeSec = robot->GetTime(); deltaTimeSec = currTimeSec - lastTimeSec; //Reads controls and updates controllers accordingly //RefreshAllIni(); humanControl->ReadControls(); driveController->Update(currTimeSec, deltaTimeSec); climberController->Update(); //visionController->Update(); gearController->Update(); if (humanControl->GetJoystickValue(RemoteControl::kOperatorJoy, RemoteControl::kRY) > 0.2) { lights->Climbing(); } else if (humanControl->GetShoutRoutineDesired()) { lights->SetShoutRoutine(); } else if (humanControl->GetGearTitlerIntakeDesired()) { lights->GearIntake(); } else if (humanControl->GetGearTitlerOuttakeDesired()) { lights->GearOuttake(); } else if (humanControl->GetSlowDriveTier1Desired() && humanControl->GetSlowDriveTier2Desired()) { lights->Brake2(); } else if (humanControl->GetSlowDriveTier1Desired()) { lights->Brake1(); } else { lights->SetEnabledRoutine(); } }