public void ExtractDataAndRaiseEvent(string data) { char[] seperator = {' '}; string[] cmd = data.Split(seperator, 5); string command = cmd[0]; string parameters = ""; if (cmd.Length > 1) parameters = cmd[1]; switch (command) { case Commands.CalibrationStart: if (OnStart != null) OnStart(Int32.Parse(parameters)); // Number of points break; case Commands.CalibrationAcceptPoint: // No returning parameter/data break; case Commands.CalibrationAbort: if (OnAbort != null) OnAbort(true); break; case Commands.CalibrationPointChange: //OnCalibrationPointChange(Int32.Parse(cmd[1])); // Next point number break; case Commands.CalibrationParameters: if (OnParameters != null) { var calParams = new CalibrationParameters(); calParams.ExtractParametersFromString(parameters); OnParameters(calParams); } break; case Commands.CalibrationAreaSize: break; case Commands.CalibrationDefault: break; case Commands.CalibrationEnd: if (OnEnd != null) OnEnd(Int32.Parse(parameters)); break; case Commands.CalibrationCheckLevel: if (OnCheckLevel != null) OnCheckLevel(Int32.Parse(parameters)); break; case Commands.CalibrationPoint: break; case Commands.CalibrationStartDriftCorrection: break; case Commands.CalibrationValidate: if (OnValidate != null) OnValidate(cmd[1], double.Parse(cmd[2]), double.Parse(cmd[3]), double.Parse(cmd[4])); break; } }
public void ExtractDataAndRaiseEvent(string data) { char[] seperator = { ' ' }; string[] cmd = data.Split(seperator, 5); string command = cmd[0]; string parameter1 = ""; string parameter2 = ""; if (cmd.Length == 2) { parameter1 = cmd[1]; } else { parameter1 = cmd[1]; parameter2 = cmd[2]; } switch (command) { case Commands.CalibrationStart: if (OnStart != null) { OnStart(Int32.Parse(parameter1)); // Number of points } break; case Commands.CalibrationAbort: if (OnAbort != null) { OnAbort(true); } break; case Commands.CalibrationPoint: if (OnPointChange != null) { OnPointChange(parameter1 + " " + parameter2); // Next point number } break; /*case Commands.CalibrationPointChange: * if (OnPointChange != null) * OnPointChange(parameter1 + " " + parameter2); // Next point number * break; */ case Commands.CalibrationParameters: if (OnParameters != null) { var calParams = new CalibrationParameters(); calParams.ExtractParametersFromString(parameter1); OnParameters(calParams); } break; case Commands.CalibrationEnd: if (OnEnd != null) { OnEnd(Int32.Parse(parameter1)); } break; case Commands.CalibrationCheckLevel: if (OnCheckLevel != null) { OnCheckLevel(Int32.Parse(parameter1)); } break; case Commands.CalibrationValidate: if (OnValidate != null) { OnValidate(cmd[1], double.Parse(cmd[2]), double.Parse(cmd[3]), double.Parse(cmd[4])); } break; } }
public void ExtractDataAndRaiseEvent(string data) { char[] seperator = { ' ' }; string[] cmd = data.Split(seperator, 5); string command = cmd[0]; string parameters = ""; if (cmd.Length > 1) { parameters = cmd[1]; } switch (command) { case Commands.CalibrationStart: if (OnStart != null) { OnStart(Int32.Parse(parameters)); // Number of points } break; case Commands.CalibrationAcceptPoint: // No returning parameter/data break; case Commands.CalibrationAbort: if (OnAbort != null) { OnAbort(true); } break; case Commands.CalibrationPointChange: //OnCalibrationPointChange(Int32.Parse(cmd[1])); // Next point number break; case Commands.CalibrationParameters: if (OnParameters != null) { var calParams = new CalibrationParameters(); calParams.ExtractParametersFromString(parameters); OnParameters(calParams); } break; case Commands.CalibrationAreaSize: break; case Commands.CalibrationDefault: break; case Commands.CalibrationEnd: if (OnEnd != null) { OnEnd(Int32.Parse(parameters)); } break; case Commands.CalibrationCheckLevel: if (OnCheckLevel != null) { OnCheckLevel(Int32.Parse(parameters)); } break; case Commands.CalibrationPoint: break; case Commands.CalibrationStartDriftCorrection: break; case Commands.CalibrationValidate: if (OnValidate != null) { OnValidate(cmd[1], double.Parse(cmd[2]), double.Parse(cmd[3]), double.Parse(cmd[4])); } break; } }
public void ExtractDataAndRaiseEvent(string data) { char[] seperator = {' '}; string[] cmd = data.Split(seperator, 5); string command = cmd[0]; string parameter1 = ""; string parameter2 = ""; string parameter3 = ""; if (cmd.Length == 2) parameter1 = cmd[1]; else if (cmd.Length == 3) { parameter1 = cmd[1]; parameter2 = cmd[2]; } else { parameter1 = cmd[1]; parameter2 = cmd[2]; parameter3 = cmd[3]; } switch (command) { case Commands.CalibrationStart: if (OnStart != null) OnStart(Int32.Parse(parameter1)); // Number of points break; case Commands.CalibrationAbort: if (OnAbort != null) OnAbort(true); break; case Commands.CalibrationQuality: if (OnQuality != null) OnQuality(Int32.Parse(parameter1)); break; case Commands.CalibrationPointChange: if (OnPointChange != null) OnPointChange(parameter1 + " " + parameter2 + " " + parameter3); // Calibration point: Number, X, Y break; case Commands.CalibrationParameters: if (OnParameters != null) { var calParams = new CalibrationParameters(); calParams.ExtractParametersFromString(parameter1); OnParameters(calParams); } break; case Commands.CalibrationEnd: if (OnEnd != null) OnEnd(Int32.Parse(parameter1)); break; case Commands.CalibrationCheckLevel: if (OnCheckLevel != null) OnCheckLevel(Int32.Parse(parameter1)); break; case Commands.CalibrationValidate: if (OnValidate != null) OnValidate(cmd[1], double.Parse(cmd[2]), double.Parse(cmd[3]), double.Parse(cmd[4])); break; } }
private void SendCommand(string command) { UpdateCommandLog(InstanceCommand); char[] seperator = {' '}; string[] cmds = command.Split(seperator, 2); string cmdStr = cmds[0]; string paramStr = ""; if (cmds.Length > 1) paramStr = cmds[1]; switch (cmdStr) { // Calibration case Commands.CalibrationStart: client.Calibration.Start(); WindowState = WindowState.Minimized; break; case Commands.CalibrationAbort: client.Calibration.Abort(); break; case Commands.CalibrationParameters: var calParams = new CalibrationParameters(); calParams.ExtractParametersFromString(paramStr); client.Calibration.CalibrationParameters(calParams); break; // Stream case Commands.StreamStart: client.Stream.StreamStart(); break; case Commands.StreamStop: client.Stream.StreamStop(); break; // Log case Commands.LogStart: client.Log.Start(); break; case Commands.LogStop: client.Log.Stop(); break; case Commands.LogPathSet: client.Log.SetLogPath(paramStr); break; case Commands.LogPathGet: client.Log.GetLogPath(); break; case Commands.LogWriteLine: client.Log.WriteLine(paramStr); break; // Camera case Commands.CameraParameters: client.Camera.ApplyParameters(paramStr); // available as override w/ string, eg. Brightness=100,Contrast=255 etc. break; // U.I case Commands.UIMinimize: client.UIControl.Minimize(); break; case Commands.UIRestore: client.UIControl.Restore(); break; case Commands.UISettings: client.UIControl.Settings(); break; case Commands.UISettingsCamera: client.UIControl.SettingsCamera(); break; // Mouse control case "MouseControl_Enable:": client.MouseControl.IsEnabled = true; break; case "MouseControl_Disable:": client.MouseControl.IsEnabled = false; break; } }