public void SetCommand(CameraCommand _command, params System.Object[] _params) { switch(_command) { case CameraCommand.PostEffect_TwoScreen: if(mPostEffect != null) { PostEffect effect = mPostEffect.AddPostEffect(PostEffectType.TwoScreen); if(effect != null) { effect.SetTexture("_UpperTex", (Texture)_params[0]); effect.SetTexture("_DownTex", (Texture)_params[1]); } } break; case CameraCommand.PostEffect_BulletCurtain: if(mPostEffect != null) { PostEffect effect = mPostEffect.AddPostEffect(PostEffectType.BulletCurtain); if(effect != null) { effect.SetTexture("_BulletTex", (Texture)_params[0]); } } break; } }
/// <summary> /// Remove an object in a plan /// </summary> /// <param name="obj">Object from all type</param> public void RemoveObject(Object obj) { switch (obj) { case Segment s: _segments.Remove(s); break; case Area a: _areas.Remove(a); break; case HouseWindow w: this.RemoveWindow(w); break; case Door d: _doors.Remove(d); break; case System.Windows.Controls.Image i: CameraCommand.ResetIsAlreadyUsed(); break; default: Debug.WriteLine("<unknown shape>"); break; case null: throw new ArgumentNullException(nameof(obj)); } }
public async Task Control(CameraCommand command) { var queryParam = CommandsDictionary.Commands[command]; var endpoint = ApiUrl + queryParam; await GetRawWithBasicAuthAsync(endpoint); }
public static void SetCameraCommand(SceneControllerType _cameraType, CameraCommand _command, params System.Object[] _params) { if (Instance == null) return; ICamera cam = null; switch(_cameraType) { case SceneControllerType.Player: cam = Instance.mSceneFlowData.PlayerCam; break; case SceneControllerType.Enemy: cam = Instance.mSceneFlowData.EnemyCam; break; case SceneControllerType.Bullet: cam = Instance.mSceneFlowData.BulletCam; break; } if (cam == null) return; cam.SetCommand (_command, _params); }
public void SetCommand(CameraCommand _command, params System.Object[] _params) { switch(_command) { case CameraCommand.CameraType_Dive: SetCameraType(1); break; case CameraCommand.CameraType_Fight: SetCameraType(2); break; case CameraCommand.CameraType_Ready: SetCameraType(0); break; case CameraCommand.PostEffect_Shock: if(mPostEffect != null) { PostEffect effect = mPostEffect.AddPostEffect(PostEffectType.Shock); if(effect != null) { Vector4 screenPos = new Vector4((float)_params[0],(float)_params[1],(float)_params[2],(float)_params[3]); effect.SetVector("_ShockCenter", screenPos); } } break; } }
public void CreateCameraCommand_ValidCam2OffString_InitializesProperly() { string rawCommand = "<C2O>"; CameraCommand command = new CameraCommand(rawCommand); Assert.AreEqual(command.CameraIndex, 2); Assert.AreEqual(command.CameraStatus, true); }
public void CreateCameraCommand_ValidCam2OffString_InitializesProperly() { string rawCommand = "<C2O>"; CameraCommand command = new CameraCommand(rawCommand); Assert.AreEqual(command.CameraIndex, 2); Assert.AreEqual(command.CameraStatus, true); }
/// <summary> /// Clear all elements in the canavas. /// Create a new plan. /// Reinstanciate Invoker and Receiver /// Clear history /// </summary> public void ClearCanvas() { _mainWindow.canvas.Children.Clear(); _plan = new Plan(_mainWindow.gridGeometry.Bounds); _receiver = new Receiver(this); _invoker = new Invoker(); CameraCommand.ResetIsAlreadyUsed(); _stackHistory.Clear(); }
/// <summary> /// StringBuilder for the json command sent to the server. /// Commands supported by the class: session, login, logout, trigger, startrecording and stoprecording /// </summary> /// <param name="command">The command to use in the json sent to the server</param> /// <param name="session">The session withing which the command will be executed. If no session put an empty string.</param> /// <param name="cameraName">The name of the camera impacted by the command. If no camera name put an empty string.</param> /// <returns>The finished build json command that will be sent to the server.</returns> private string JsonStringBuilder(CameraCommand command, string cameraName) { StringBuilder json = new StringBuilder("{\"cmd\":"); string response = CalculateMD5Hash(_username + ":" + _session + ":" + _password); switch (command) { //Getting a session ID case CameraCommand.Session: json.Append("\"login\"}"); break; //Login to the server case CameraCommand.Login: json.Append("\"login\"," + "\"session\":\"" + _session + "\"," + "\"response\":\"" + response + "\"" + "}"); break; //Logout from the server case CameraCommand.Logout: json.Append("\"logout\"," + "\"session\":\"" + _session + "\"," + "\"response\":\"" + response + "\"" + "}"); break; //Trigger the camera. case CameraCommand.Trigger: json.Append("\"trigger\"," + "\"camera\":\"" + cameraName + "\"," + "\"session\":\"" + _session + "\"" + "}"); break; //Start recording on the camera case CameraCommand.StartRecording: json.Append("\"camconfig\"," + "\"camera\":\"" + cameraName + "\"," + "\"session\":\"" + _session + "\"," + "\"manrec\":\"" + true + "\"" + "}"); break; //Stop recording of the camera case CameraCommand.StopRecording: json.Append("\"camconfig\"," + "\"camera\":\"" + cameraName + "\"," + "\"session\":\"" + _session + "\"," + "\"manrec\":\"" + false + "\"" + "}"); break; //Get the list of all the cameras case CameraCommand.Camlist: json.Append("\"camlist\"," + "\"session\":\"" + _session + "\"}"); break; //Others querries not handled default: json.Append("COMMAND ERROR... PLEASE CHECK YOUR COMMAND"); break; } return(json.ToString()); }
public void SendCommand(UserCredentials userCredentials, CameraCommand command, int value = 0) { WebRequest request; switch (command) { case (CameraCommand.Stop): request = WebRequest.Create(_cameraUri + "cgi-bin/CGIProxy.fcgi?cmd=ptzStopRun&usr="******"&pwd=" + userCredentials.Password); break; case (CameraCommand.Up): request = WebRequest.Create(_cameraUri + "cgi-bin/CGIProxy.fcgi?cmd=ptzMoveUp&usr="******"&pwd=" + userCredentials.Password); break; case (CameraCommand.Down): request = WebRequest.Create(_cameraUri + "cgi-bin/CGIProxy.fcgi?cmd=ptzMoveDown&usr="******"&pwd=" + userCredentials.Password); break; case (CameraCommand.Left): request = WebRequest.Create(_cameraUri + "cgi-bin/CGIProxy.fcgi?cmd=ptzMoveLeft&usr="******"&pwd=" + userCredentials.Password); break; case (CameraCommand.Right): request = WebRequest.Create(_cameraUri + "cgi-bin/CGIProxy.fcgi?cmd=ptzMoveRight&usr="******"&pwd=" + userCredentials.Password); break; case (CameraCommand.SwitchInfraLedOn): request = WebRequest.Create(_cameraUri + "cgi-bin/CGIProxy.fcgi?cmd=openInfraLed&usr="******"&pwd=" + userCredentials.Password); break; case (CameraCommand.SwitchInfraLedOff): request = WebRequest.Create(_cameraUri + "cgi-bin/CGIProxy.fcgi?cmd=closeInfraLed&usr="******"&pwd=" + userCredentials.Password); break; case (CameraCommand.SetBrightness): request = WebRequest.Create(_cameraUri + "cgi-bin/CGIProxy.fcgi?cmd=setBrightness&brightness=" + value + "&usr="******"&pwd=" + userCredentials.Password); break; default: return; } request.GetResponse(); request.Abort(); }
private void updateProgramRunningStatus(program_status_message_t res) { if (runningProgram != null) { int line = res.line_num - 1; if (line >= 0 && line < runningProgram.commandList.Count) { CameraCommand item = runningProgram.commandList[line]; string cmd = item.Command.ToString(); string param = item.Parameter.ToString(); runningProgramStatusString = " Line " + line + ": " + cmd + " " + param; } else { runningProgramStatusString = ""; } updateProgramString(); } }
public ObservableCollection <ProgramInfo> parse() { ObservableCollection <ProgramInfo> programs = new ObservableCollection <ProgramInfo>(); XmlTextReader reader = new XmlTextReader(fileName); XmlDocument doc = new XmlDocument(); doc.Load(fileName); XmlNodeList nodes = doc.DocumentElement.SelectNodes("/Programs/Program"); foreach (XmlNode node in nodes) { List <CameraCommand> program = new List <CameraCommand>(); string name = node.Attributes["Name"].Value.ToString(); foreach (XmlNode camera in node.SelectNodes("Step")) { CameraCommand cam = new CameraCommand(); cam.Command = fromString(camera.SelectSingleNode("Command").InnerText); if (cam.Command == Cmd.OUTPUT) { cam.SelectedOutputCamera = camera.SelectSingleNode("Parameter").InnerText; } else if (cam.Command == Cmd.PRESET) { cam.SelectedPreset = camera.SelectSingleNode("Parameter").InnerText; } else { cam.WaitTime = Convert.ToDouble(camera.SelectSingleNode("Parameter").InnerText); } program.Add(cam); } ProgramInfo programInfo = new ProgramInfo() { ProgramName = name, commandList = program }; programs.Add(programInfo); } return(programs); }
public void SetCommand(CameraCommand _command, params System.Object[] _params) { switch(_command) { case CameraCommand.Bullet_PlayerShoot: CreatePlayerBullet((float)_params[0], (float)_params[1], (float)_params[2], (float)_params[3]); break; case CameraCommand.Bullet_EnemyShoot: CreateEnemyBullet ((float)_params[0], (float)_params[1], (float)_params[2], (float)_params[3]); break; } }
protected Task SendCommand(CameraCommand command, uint inParam = 0);