The Sample program demonstrates the main functionality of the OTX-Runtime API. It can be used as a reference for the expected runtime behavior of the API and the source code below is like a reference guide about the proper programming of the API.
Code snippet of the OTX-Runtime API Sample Program.
10 using System.Collections.Generic;
11 using System.Diagnostics;
15 using System.Threading;
16 using System.Threading.Tasks;
17 using System.Windows.Forms;
20 namespace OpenTestSystem.Otx.Runtime2.Api.DotNet.Sample
22 public partial class SampleForm : Form
24 private const int VALUE_STRING_MAX_LENGTH = 1024;
26 private UserSettings userSettings = UserSettings.Default;
29 private List<IRuntimeContext> runtimeContexts =
new List<IRuntimeContext>();
30 private Dictionary<IRuntimeContext, DateTime> runtimeContextsExecutionStartTime =
new Dictionary<IRuntimeContext, DateTime>();
32 private IProject project =
null;
33 private IPlayerProject playerProject =
null;
34 private IProcedure procedureToExecute =
null;
36 private TreeNode startupNode =
null;
38 private IRuntimeManager globalRuntimeManager =
null;
40 private HmiWindow hmiWindow;
42 private DateTime lastTime = DateTime.Now;
44 private DefaultCustomScreenImplementation customScreenImplementation;
45 private ContextVariableImplementation contextVariableImplementation;
47 private StateVariableImplementation stateVariableImplementation;
48 private DefaultMeasureImplementation measureImplementation;
49 private DefaultExternalServiceProviderImplementation serviceProviderImplementation;
51 private BasicScreenOutputImpl basicScreenOutputImpl;
52 private CustomScreenOutputImpl customScreenOutputImpl;
53 private LoggingOutputImpl loggingOutputImpl;
54 private ContextVariableOutputImpl contextVariableOutputImpl;
56 private StateVariableOutputImpl stateVariableOutputImpl;
57 private MeasureOutputImpl measureOutputImpl;
58 private I18nOutputImpl i18NOutputImpl;
59 private ExternalServiceProviderOutputImpl serviceProviderOutputImpl;
61 private SqlOutputImpl sqlOutputImpl;
62 private CommonDialogsOutputImpl commonDialogsOutputImpl;
64 private SampleForm creatorForm;
66 private string runtimeContextName;
67 private long procedureExecutionCount;
68 private long cyclicExecutionCount;
70 private static string fileVersion;
72 private static int defaultPollingTime = 500;
73 private static int defaultBatteryVoltageThreshold = 6000;
74 private bool useConnectionState =
false;
75 private bool? KL15State =
null;
78 private bool isLoadding =
false;
80 private ushort defaultDiagPort = SampleConstants.DEFAULT_DM_PORT;
81 private ushort defaultRuntimePort = SampleConstants.DEFAULT_RT_PORT;
82 private string defaultDiagPipeName = SampleConstants.DEFAULT_DM_PIPE_NAME;
83 private string defaultRuntimePipeName = SampleConstants.DEFAULT_RT_PIPE_NAME;
85 private readonly
object printTextLock =
new object();
86 private readonly
object eventListenerLock =
new object();
88 private bool cyclicExecuteAsyncIsProcessing =
false;
89 private System.Windows.Forms.Timer webServerTimer =
new System.Windows.Forms.Timer();
93 LicenseManager.SetLicenseKey(SampleConstants.LICENSE_KEY);
94 fileVersion = RuntimeConfig.Instance.Version;
97 public SampleForm(
string title = SampleConstants.MAIN_INSTANCE_NAME, SampleForm creatorForm =
null)
100 this.creatorForm = creatorForm;
102 this.webServerTimer.Interval = 1000;
103 this.webServerTimer.Enabled =
true;
104 this.webServerTimer.Tick += WebServerTimer_Tick;
106 InitializeComponent();
108 PrintText(
"Application started");
111 private void SampleForm_Load(
object sender, EventArgs e)
113 PrintText(
"Start Initialization...");
116 InitializeSampleDefaultValues();
117 this.UpdateWebServerButton();
119 if (this.creatorForm !=
null)
121 this.checkBoxStartAllParents.Visible =
true;
122 this.checkBoxStartAllParents.Checked = this.creatorForm.checkBoxStartAllParents.Checked;
125 SetRuntimeContextName();
126 SetTitle(this.title);
127 SetLocation(this.creatorForm);
129 this.toolTip1.SetToolTip(labelProcedureExecutionTimes,
"Total procedure execution time.");
130 this.toolTip1.SetToolTip(textBoxTimeout,
"Timeout for procedure execution in milliseconds. The default value 0 means without timeout.");
131 this.toolTip1.SetToolTip(checkBoxUseConnectionState,
"Use expected connection state during procedure execution.");
132 this.toolTip1.SetToolTip(labelBatteryState,
"State of the battery (KL 30)");
133 this.toolTip1.SetToolTip(checkBoxIgnition,
"Expected ignition (KL 15) state during procedure execution");
134 this.toolTip1.SetToolTip(labelIgnitionState,
"State of the ignition (KL 15)");
135 this.toolTip1.SetToolTip(buttonCheckBatteryIgnition,
"Check current battery (KL30) and ignition (KL15) state.");
136 this.toolTip1.SetToolTip(textBoxPollingTime,
"Time in milliseconds between the next check of the connection state during the procedure execution (Polling). The default value is 500 ms.");
137 this.toolTip1.SetToolTip(textBoxVoltageThreshold,
"Voltage threshold in millivolt from which the battery voltage, see GetBatteryVoltage is enough for KL30 = On. The default value is 6000 mV.");
139 PrintText(
"... Initialization finished.");
142 private void SampleForm_Shown(
object sender, EventArgs e)
144 this.cbFilePath.SelectionLength = 0;
147 private void SetRuntimeContextName()
149 if (this.creatorForm !=
null && !String.IsNullOrEmpty(
this.creatorForm.runtimeContextName))
151 System.Text.RegularExpressions.Match regExpMatch = System.Text.RegularExpressions.Regex.Match(this.creatorForm.runtimeContextName,
@"\d*$");
153 if (
int.TryParse(regExpMatch.Value, out number))
156 this.textBoxRuntimeContextName.Text = this.creatorForm.runtimeContextName.Substring(0, regExpMatch.Index) + number.ToString();
161 private void SetTitle(
string title)
163 if (String.IsNullOrWhiteSpace(title))
164 title = SampleConstants.MAIN_INSTANCE_NAME;
166 bool runningAsAdmin = System.Security.Principal.WindowsIdentity.GetCurrent().Owner.IsWellKnown(System.Security.Principal.WellKnownSidType.BuiltinAdministratorsSid);
168 this.Text = String.Format(
169 "emotive OTX-Runtime API for DotNet - Reference Application - Version {0} - {1} Bit - {2} - Thread-ID {3}{4}",
171 Environment.Is64BitProcess ?
"64" :
"32",
173 Thread.CurrentThread.ManagedThreadId,
174 runningAsAdmin ?
" - Administrator" :
string.Empty
177 if (!String.IsNullOrEmpty(
this.cbFilePath.Text))
178 this.Text = this.Text +
" - " + Path.GetFileName(this.cbFilePath.Text);
180 if (!String.IsNullOrEmpty(
this.runtimeContextName))
181 this.Text = this.Text +
" - " + this.runtimeContextName;
184 private const int FORM_OFFSET = 25;
186 private void SetLocation(SampleForm creatorForm)
188 if (creatorForm !=
null)
190 int xOffset = FORM_OFFSET;
191 int yOffset = FORM_OFFSET;
193 if (creatorForm.creatorForm !=
null)
195 xOffset = creatorForm.Location.X - creatorForm.creatorForm.Location.X;
196 yOffset = creatorForm.Location.Y - creatorForm.creatorForm.Location.Y;
199 this.Location =
new Point(creatorForm.Location.X + xOffset, creatorForm.Location.Y + yOffset);
200 this.Size = creatorForm.Size;
204 private void CreateCustomImpl()
206 CreateDefaultCustomImpl();
207 CreateOutputWindowCustomImpl();
210 private void CreateDefaultCustomImpl()
212 PrintText(
"Create default custom implementation");
214 customScreenImplementation =
new DefaultCustomScreenImplementation();
215 customScreenImplementation.KeyDown += CustomScreenImplementation_KeyDown;
217 contextVariableImplementation =
new ContextVariableImplementation();
218 contextVariableImplementation.ContextVariableRead += ContextVariableRead;
220 stateVariableImplementation =
new StateVariableImplementation();
221 stateVariableImplementation.StateVariableValueChanged += StateVariableValueChanged;
223 measureImplementation =
new DefaultMeasureImplementation();
224 serviceProviderImplementation =
new DefaultExternalServiceProviderImplementation();
227 private void CreateOutputWindowCustomImpl()
229 PrintText(
"Create output window custom implementation");
231 basicScreenOutputImpl =
new BasicScreenOutputImpl();
232 customScreenOutputImpl =
new CustomScreenOutputImpl();
233 loggingOutputImpl =
new LoggingOutputImpl();
234 contextVariableOutputImpl =
new ContextVariableOutputImpl();
236 stateVariableOutputImpl =
new StateVariableOutputImpl();
237 measureOutputImpl =
new MeasureOutputImpl();
238 i18NOutputImpl =
new I18nOutputImpl();
239 serviceProviderOutputImpl =
new ExternalServiceProviderOutputImpl();
241 sqlOutputImpl =
new SqlOutputImpl();
242 commonDialogsOutputImpl =
new CommonDialogsOutputImpl();
244 basicScreenOutputImpl.LogEvent += PrintText;
245 customScreenOutputImpl.LogEvent += PrintText;
246 loggingOutputImpl.LogEvent += PrintText;
247 contextVariableOutputImpl.LogEvent += PrintText;
249 stateVariableOutputImpl.LogEvent += PrintText;
250 measureOutputImpl.LogEvent += PrintText;
251 i18NOutputImpl.LogEvent += PrintText;
252 serviceProviderOutputImpl.LogEvent += PrintText;
254 sqlOutputImpl.LogEvent += PrintText;
255 commonDialogsOutputImpl.LogEvent += PrintText;
258 private void InitializeSampleDefaultValues()
260 PrintText(
"Initialize default values");
262 this.comboBoxTraceLevel.Items.AddRange(Enum.GetNames(typeof(TraceLevels)));
265 treeViewOtxProject.ImageList = imageList1;
267 textBoxRtPortPipe.Name = SampleConstants.RT_PORT_PIPE_TEXT_BOX_NAME;
268 textBoxDiagPortPipe.Name = SampleConstants.DM_PORT_PIPE_TEXT_BOX_NAME;
272 this.EnableConnectionState();
275 private void LoadSetting()
277 SaveSettingUtil.Reload();
280 cbFilePath.Text = userSettings.Ptx_Ppx_Directory;
281 cbFilePath.Text = userSettings.Ptx_Ppx_Directory;
282 if (!String.IsNullOrEmpty(userSettings.Ptx_Ppx_DirectoryList))
284 this.cbFilePath.Items.AddRange(userSettings.Ptx_Ppx_DirectoryList.Split(
';'));
286 AddComboBoxFileOrPath(this.cbFilePath);
290 SetupTraceFileMaxCountAndSize();
293 SetupDefaultPortAndPipeName();
295 SetupCustomImplType();
297 SetupWindowLocation();
299 checkBoxAsyncExecution.Checked = userSettings.Asynchron;
300 checkBoxCyclicExecution.Checked = userSettings.Cyclic;
301 checkBoxCyclicReload.Checked = userSettings.CyclicReload;
302 checkBoxNewRuntimeManager.Checked = userSettings.NewRunTimeManager;
303 checkBoxAdd2Output.Checked = userSettings.AddMessageToOutput;
304 checkBoxStartAllParents.Checked = userSettings.StartAllParents;
307 checkBoxUseConnectionState.Checked = userSettings.ConnectionState;
308 checkBoxIgnition.CheckState = userSettings.Ignition == 1 ? CheckState.Checked : (userSettings.Ignition == 0 ? CheckState.Unchecked : CheckState.Indeterminate);
310 SetupVoltageThreshold();
312 this.textBoxRuntimeContextName.Text = userSettings.RuntimeContextName.ToString();
314 catch (System.Exception e)
316 PrintText(e.Message);
317 userSettings.Reset();
321 bool isPathChanging =
false;
322 private void AddComboBoxFileOrPath(ComboBox comboBox)
324 if (comboBox !=
null && !isPathChanging)
326 isPathChanging =
true;
328 string path = comboBox.Text;
330 if (Directory.Exists(path) || File.Exists(path))
332 while (comboBox.Items.Contains(path))
334 comboBox.Items.Remove(path);
337 while (comboBox.Items.Contains(path.TrimEnd(
new char[] {
'/',
'\\' })))
339 comboBox.Items.Remove(path.TrimEnd(
new char[] {
'/',
'\\' }));
342 path = path.TrimEnd(
new char[] {
'/',
'\\' });
344 comboBox.Items.Insert(0, path);
345 comboBox.Text = path;
346 comboBox.SelectAll();
349 isPathChanging =
false;
353 private void SetupTraceFileMaxCountAndSize()
355 textBoxTraceFileMaxCount.Text = userSettings.TraceFileMaxCount.ToString();
356 textBoxTraceFileMaxSize.Text = userSettings.TraceFileMaxSize.ToString();
359 private void SetupDefaultPortAndPipeName()
361 defaultDiagPort = userSettings.DiagManagerPort;
362 defaultRuntimePort = userSettings.RuntimePort;
364 defaultDiagPipeName = userSettings.DiagManagerPipeName;
365 defaultRuntimePipeName = userSettings.RuntimePipeName;
367 IpcTypes ipcTypes = IpcTypes.SOCKET;
368 Enum.TryParse<IpcTypes>(userSettings.IpcType, out ipcTypes);
370 if (comboBoxIpcType.Items.Count == 0)
372 comboBoxIpcType.Items.Add(IpcTypes.SOCKET);
373 comboBoxIpcType.Items.Add(IpcTypes.PIPE);
376 comboBoxIpcType.SelectedItem = ipcTypes;
379 private void SetupTraceLevel()
381 RuntimeConfig.Instance.TraceLevel = userSettings.TraceLevels;
382 comboBoxTraceLevel.SelectedItem = RuntimeConfig.Instance.TraceLevel.ToString();
385 private void SetupTraceFolder()
387 if (userSettings.TracingDirectory !=
string.Empty)
388 RuntimeConfig.Instance.TraceFolder = userSettings.TracingDirectory;
390 textBoxTraceFolder.Text = RuntimeConfig.Instance.TraceFolder;
393 private void SetupCustomImplType()
395 if (userSettings.CustomImplTypes == CustomImplTypes.OutputImpl)
397 radioButtonOuputWindow.Checked =
true;
399 else if (userSettings.CustomImplTypes == CustomImplTypes.NoCustom)
401 radioButtonNoCustomImplementation.Checked =
true;
405 radioButtonDefaultImplementation.Checked =
true;
409 private void SetupWindowSize()
411 int width = userSettings.WindowWidth;
412 int height = userSettings.WindowHeight;
413 this.Size =
new Size(width, height);
416 private void SetupWindowLocation()
418 int locationX = userSettings.WindowLocationX;
419 int locationY = userSettings.WindowLocationY;
420 Point location =
new Point(locationX, locationY);
422 if (CheckFormIsInBound(location))
424 this.Location = location;
428 this.CenterToScreen();
431 private bool CheckFormIsInBound(Point location)
435 Screen formContainScreens = Screen.AllScreens.Where(screen => screen.Bounds.Contains(location) ==
true).FirstOrDefault();
437 return formContainScreens !=
null;
439 catch (System.Exception)
445 private void SetupTimeOut()
447 string timeOutString = userSettings.TimeOut.ToString();
448 this.textBoxTimeout.Text = timeOutString;
451 private void SetupPollingTime()
453 string pollingTimeString = userSettings.PollingTime.ToString();
454 this.textBoxPollingTime.Text = pollingTimeString;
457 private void SetupVoltageThreshold()
459 string voltageThreshold = userSettings.VoltageThreshold.ToString();
460 this.textBoxVoltageThreshold.Text = voltageThreshold;
463 private void comboBoxIpcType_SelectedValueChanged(
object sender, EventArgs e)
466 textBoxDiagPortPipe.TextChanged -= textBoxPortPipe_TextChanged;
467 var ipcType = (IpcTypes)comboBoxIpcType.SelectedItem;
471 case IpcTypes.SOCKET:
473 portPipeLabel.Text =
"Runner / DiagManager Ports";
475 textBoxDiagPortPipe.Text = defaultDiagPort.ToString();
476 textBoxDiagPortPipe.TextChanged += textBoxPortPipe_TextChanged;
478 textBoxRtPortPipe.Text = defaultRuntimePort.ToString();
483 portPipeLabel.Text =
"Runner / DiagManager Pipes";
485 textBoxDiagPortPipe.Text = defaultDiagPipeName;
486 textBoxDiagPortPipe.TextChanged += textBoxPortPipe_TextChanged;
488 textBoxRtPortPipe.Text = defaultRuntimePipeName;
496 private void textBoxPortPipe_TextChanged(
object sender, EventArgs e)
498 PrintText(
"Create RuntimeManager...");
502 this.globalRuntimeManager = CreateRuntimeManager();
504 catch (System.Exception ex)
506 switch ((sender as TextBox).Name)
508 case SampleConstants.RT_PORT_PIPE_TEXT_BOX_NAME:
510 PrintText(String.Format(
"Invalid Otx Runtime {0}", IpcPortPipeString()));
513 case SampleConstants.DM_PORT_PIPE_TEXT_BOX_NAME:
515 PrintText(String.Format(
"Invalid Diag Manager {0}", IpcPortPipeString()));
523 PrintText(
"No RuntimeManager created");
526 if (this.globalRuntimeManager ==
null)
528 PrintText(
"RuntimeManager is null.");
532 private IRuntimeManager CreateRuntimeManager()
534 IRuntimeManager runtimeManager =
null;
538 switch ((IpcTypes)comboBoxIpcType.SelectedItem)
540 case IpcTypes.SOCKET:
542 runtimeManager = CreateSocketRuntimeManager();
548 runtimeManager = CreatePipeRuntimeManager();
553 PrintText($
"... {ipcType} RuntimeManager created (MinBinVersion: {RuntimeConfig.Instance.MinBinVersion})");
555 InitializeRuntimeEvents(runtimeManager);
556 SetCustomImplementation(runtimeManager);
558 catch (InvalidLicenseException ex)
561 PrintText(
"... No RuntimeManager created.");
563 return runtimeManager;
566 return runtimeManager;
569 private string IpcPortPipeString()
571 switch ((IpcTypes)comboBoxIpcType.SelectedItem)
573 case IpcTypes.SOCKET:
574 return SampleConstants.PORT_STRING;
576 return SampleConstants.PIPE_STRING;
583 private IRuntimeManager CreateSocketRuntimeManager()
585 ushort rtPort = Convert.ToUInt16(textBoxRtPortPipe.Text);
589 return RuntimeManagerFactory.CreateSocketRuntimeManager(rtPort);
593 ushort diagPort = Convert.ToUInt16(textBoxDiagPortPipe.Text);
594 return RuntimeManagerFactory.CreateSocketRuntimeManager(rtPort, diagPort);
598 private IRuntimeManager CreatePipeRuntimeManager()
602 return RuntimeManagerFactory.CreatePipeRuntimeManager(textBoxRtPortPipe.Text);
606 return RuntimeManagerFactory.CreatePipeRuntimeManager(textBoxRtPortPipe.Text, textBoxDiagPortPipe.Text);
610 private bool NoDiag()
612 return String.IsNullOrWhiteSpace(textBoxDiagPortPipe.Text);
615 private void InitializeRuntimeEvents(IRuntimeManager runtimeManager)
617 if (runtimeManager ==
null)
620 runtimeManager.ProcedurePending -= ProcedurePending;
621 runtimeManager.ProcedureStarted -= ProcedureStarted;
622 runtimeManager.ProcedurePaused -= ProcedurePaused;
623 runtimeManager.ProcedureContinued -= ProcedureContinued;
624 runtimeManager.ProcedureFinished -= ProcedureFinished;
625 runtimeManager.ProcedureAborted -= ProcedureAborted;
626 runtimeManager.ProcedureStopped -= ProcedureStopped;
627 runtimeManager.ProcedureTimeout -= ProcedureTimeout;
628 runtimeManager.DiagConnectionStateChanged -= DiagConnectionStateChanged;
629 runtimeManager.InOutParameterValueChanged -= InOutParameterValueChanged;
631 runtimeManager.ProcedurePending += ProcedurePending;
632 runtimeManager.ProcedureStarted += ProcedureStarted;
633 runtimeManager.ProcedurePaused += ProcedurePaused;
634 runtimeManager.ProcedureContinued += ProcedureContinued;
635 runtimeManager.ProcedureFinished += ProcedureFinished;
636 runtimeManager.ProcedureAborted += ProcedureAborted;
637 runtimeManager.ProcedureStopped += ProcedureStopped;
638 runtimeManager.ProcedureTimeout += ProcedureTimeout;
639 runtimeManager.DiagConnectionStateChanged += DiagConnectionStateChanged;
640 runtimeManager.InOutParameterValueChanged += InOutParameterValueChanged;
642 PrintText(
"Initialization of runtime events finished");
645 private void radioButtonCustomImpl_CheckedChanged(
object sender =
null, System.EventArgs e =
null)
647 if (this.globalRuntimeManager ==
null)
650 if (sender !=
null && (sender as RadioButton).Checked ==
false)
653 this.SetCustomImplementation(this.globalRuntimeManager);
656 private void SetCustomImplementation(IRuntimeManager runtimeManager)
658 if (runtimeManager ==
null)
661 var currentCustomImpl = GetCurrentCustomImpl();
663 switch (currentCustomImpl)
665 case CustomImplTypes.OutputImpl:
667 SetOutputWindowImplementation(runtimeManager);
670 case CustomImplTypes.DefaultCustomImpl:
672 SetDefaultCustomImplementation(runtimeManager);
675 case CustomImplTypes.NoCustom:
677 RemoveCustomImplementation(runtimeManager);
684 if (currentCustomImpl != CustomImplTypes.None)
686 PrintText(
"Set up custom implementation finished");
690 private CustomImplTypes GetCurrentCustomImpl()
692 if (radioButtonOuputWindow.Checked)
693 return CustomImplTypes.OutputImpl;
694 else if (radioButtonDefaultImplementation.Checked)
695 return CustomImplTypes.DefaultCustomImpl;
696 else if (radioButtonNoCustomImplementation.Checked)
697 return CustomImplTypes.NoCustom;
699 return CustomImplTypes.None;
702 private void SetOutputWindowImplementation(IRuntimeManager runtimeManager)
704 if (runtimeManager ==
null)
707 runtimeManager.SetCustomImplementation(basicScreenOutputImpl);
708 runtimeManager.SetCustomImplementation(customScreenOutputImpl);
709 runtimeManager.SetCustomImplementation(loggingOutputImpl);
710 runtimeManager.SetCustomImplementation(contextVariableOutputImpl);
712 runtimeManager.SetCustomImplementation(stateVariableOutputImpl);
713 runtimeManager.SetCustomImplementation(measureOutputImpl);
714 runtimeManager.SetCustomImplementation(i18NOutputImpl);
715 runtimeManager.SetCustomImplementation(serviceProviderOutputImpl);
717 runtimeManager.SetCustomImplementation((ISqlImplementation)
null);
718 runtimeManager.SetCustomImplementation(commonDialogsOutputImpl);
721 private void SetDefaultCustomImplementation(IRuntimeManager runtimeManager)
723 if (runtimeManager ==
null)
726 runtimeManager.SetCustomImplementation((IBasicScreenImplementation)
null);
727 runtimeManager.SetCustomImplementation(customScreenImplementation);
728 runtimeManager.SetCustomImplementation((ILoggingImplementation)
null);
729 runtimeManager.SetCustomImplementation(contextVariableImplementation);
731 runtimeManager.SetCustomImplementation(stateVariableImplementation);
732 runtimeManager.SetCustomImplementation(measureImplementation);
733 runtimeManager.SetCustomImplementation((Ii18nImplementation)
null);
734 runtimeManager.SetCustomImplementation(serviceProviderImplementation);
736 runtimeManager.SetCustomImplementation(sqlOutputImpl);
737 runtimeManager.SetCustomImplementation((ICommonDialogsImplementation)
null);
740 private void RemoveCustomImplementation(IRuntimeManager runtimeManager)
742 if (runtimeManager ==
null)
745 runtimeManager.SetCustomImplementation((IBasicScreenImplementation)
null);
746 runtimeManager.SetCustomImplementation((ICustomScreenImplementation)
null);
747 runtimeManager.SetCustomImplementation((ILoggingImplementation)
null);
748 runtimeManager.SetCustomImplementation((IContextVariableImplementation)
null);
750 runtimeManager.SetCustomImplementation((IStateVariableImplementation)
null);
751 runtimeManager.SetCustomImplementation((IMeasureImplementation)
null);
752 runtimeManager.SetCustomImplementation((Ii18nImplementation)
null);
753 runtimeManager.SetCustomImplementation((IExternalServiceProviderImplementation)
null);
755 runtimeManager.SetCustomImplementation((ISqlImplementation)
null);
756 runtimeManager.SetCustomImplementation((ICommonDialogsImplementation)
null);
759 private void ProcedurePending(IRuntimeContext context)
763 Invoke(
new MethodInvoker(delegate ()
765 ProcedurePending(context);
770 lock (eventListenerLock)
772 this.PrintText(
string.Format(
"Event ProcedurePending occurred - {0} - ExecutionState = {1}", context.Procedure.FullName, context.ExecutionState.ToString()));
773 UpdateExecutionState(context);
774 ShowConnectionStateMessage(context);
778 private void ProcedureStarted(IRuntimeContext context)
782 Invoke(
new MethodInvoker(delegate ()
784 ProcedureStarted(context);
789 lock (eventListenerLock)
791 this.PrintText(
string.Format(
"Event ProcedureStarted occurred - {0} - ExecutionState = {1} - RuntimeId = {2} - ProcessId = {3}", context.Procedure.FullName, context.ExecutionState.ToString(), context.RuntimeId, context.ProcessId));
792 UpdateExecutionState(context);
796 private void ProcedurePaused(IRuntimeContext context, ExecutionStateChangeReason reason)
800 Invoke(
new MethodInvoker(delegate ()
802 ProcedurePaused(context, reason);
807 lock (eventListenerLock)
809 this.PrintText(
string.Format(
"Event ProcedurePaused occurred - {0} - ExecutionState = {1} - ExecutionStateChangeReason = {2}", context.Procedure.FullName, context.ExecutionState.ToString(), reason.ToString()));
810 UpdateExecutionState(context);
813 ShowConnectionStateMessage(context);
818 private void ProcedureContinued(IRuntimeContext context)
822 Invoke(
new MethodInvoker(delegate ()
824 ProcedureContinued(context);
829 lock (eventListenerLock)
831 this.PrintText(
string.Format(
"Event ProcedureContinued occurred - {0} - ExecutionState = {1}", context.Procedure.FullName, context.ExecutionState.ToString()));
832 UpdateExecutionState(context);
836 private void ProcedureStopped(IRuntimeContext context)
840 Invoke(
new MethodInvoker(delegate ()
842 ProcedureStopped(context);
847 lock (eventListenerLock)
849 this.PrintText(
string.Format(
"Event ProcedureStopped occurred - {0} - ExecutionState = {1}", context.Procedure.FullName, context.ExecutionState.ToString()));
850 UpdateExecutionState(context);
854 private void ProcedureTimeout(IRuntimeContext context)
858 Invoke(
new MethodInvoker(delegate ()
860 ProcedureTimeout(context);
865 lock (eventListenerLock)
867 cyclicExecuteAsyncIsProcessing =
false;
868 this.PrintText(
string.Format(
"Event ProcedureTimeout occurred - {0} - ExecutionState = {1}", context.Procedure.FullName, context.ExecutionState.ToString()));
869 UpdateExecutionState(context);
873 private void DiagConnectionStateChanged(ClampState batteryState, ClampState ignitionState)
877 Invoke(
new MethodInvoker(delegate ()
879 DiagConnectionStateChanged(batteryState, ignitionState);
884 lock (eventListenerLock)
886 this.PrintText(
string.Format(
"Event DiagConnectionStateChanged occurred - BatteryState = {0}, IgnitionState = {1}", batteryState.ToString(), ignitionState.ToString()));
887 System.Media.SystemSounds.Beep.Play();
889 SetBatteryIgnitionState(batteryState, ignitionState);
894 private void ProcedureFinished(IRuntimeContext context)
898 Invoke(
new MethodInvoker(delegate ()
900 ProcedureFinished(context);
905 lock (eventListenerLock)
907 IProcedureParameter procedureParameter;
908 string procedureName = context.Procedure.FullName;
909 string parameterOuput;
911 for (
int i = 0; i < context.Procedure.Parameters.Count(); i++)
913 procedureParameter = context.Procedure.Parameters.ElementAt(i);
914 parameterOuput =
"Parameter Changed - " + procedureParameter.Name +
"(" + procedureParameter.DataType +
") = ";
916 if (procedureParameter.Value !=
null)
918 parameterOuput += ShortenedValueString(procedureParameter);
922 parameterOuput +=
null;
925 this.PrintText(parameterOuput);
928 UpdateGridviewParameter(context.Procedure);
930 this.PrintText(
string.Format(
"ProcedureFinished({0}) ExecutionState({1}) - Execution duration {2} - Running time {3} - Used memory {4})",
931 context.Procedure.FullName,
932 context.ExecutionState.ToString(),
933 (DateTime.Now -
this.runtimeContextsExecutionStartTime[context]).ToString(
"mm':'ss','fff"),
934 TimeSpan.FromMilliseconds(context.ExecutionTime).ToString(
"mm':'ss','fff"),
935 string.Format(
"{0:0,0} kB", context.ProcessMemory / 1024))
938 UpdateExecutionState(context);
940 cyclicExecuteAsyncIsProcessing =
false;
944 private void ProcedureAborted(IRuntimeContext context)
948 Invoke(
new MethodInvoker(delegate ()
950 ProcedureAborted(context);
955 this.PrintText(
string.Format(
"ProcedureAborted({0}) ExecutionState({1})", context.Procedure.FullName, context.ExecutionState.ToString()));
957 if (context.HasRuntimeException)
959 PrintException(context.RuntimeException,
"Reason: API ");
962 if (context.HasOtxException)
964 PrintException(context.OtxException,
"Reason: OTX ");
966 cyclicExecuteAsyncIsProcessing =
false;
967 UpdateExecutionState(context);
970 private void UpdateExecutionState(IRuntimeContext context)
974 switch (context.ExecutionState)
978 this.procedureExecutionCount++;
980 AddRuntimeContext(context);
981 DisplayProcedureExecutionState(context);
983 this.buttonExecuteMain.Enabled = checkBoxAsyncExecution.Checked;
984 this.buttonExecuteSelectedProcedure.Enabled = checkBoxAsyncExecution.Checked;
986 UpdateExecutionStateButtons(
true);
987 UpdatePauseButton(
true);
993 this.procedureExecutionCount--;
994 DisplayProcedureExecutionState(context);
995 UpdatePauseButton(
false);
1001 DisplayProcedureExecutionState(context);
1002 UpdateExecutionStateButtons(
true);
1003 UpdatePauseButton(
true,
false);
1009 this.procedureExecutionCount--;
1011 RemoveRuntimeContext(context);
1012 DisplayProcedureExecutionState(context);
1014 this.buttonExecuteMain.Enabled = !checkBoxCyclicExecution.Checked;
1015 this.buttonExecuteSelectedProcedure.Enabled = !checkBoxCyclicExecution.Checked;
1017 UpdateExecutionStateButtons(
false);
1018 UpdatePauseButton(
true,
false);
1020 this.labelBatteryState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconBattery16;
1021 this.labelIgnitionState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconIgnition16;
1027 this.procedureExecutionCount--;
1029 RemoveRuntimeContext(context);
1030 DisplayProcedureExecutionState(context);
1032 this.buttonExecuteMain.Enabled =
true;
1033 this.buttonExecuteSelectedProcedure.Enabled =
true;
1035 UpdateExecutionStateButtons(
false);
1036 UpdatePauseButton(
true,
false);
1038 this.labelBatteryState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconBattery16;
1039 this.labelIgnitionState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconIgnition16;
1045 this.procedureExecutionCount--;
1047 RemoveRuntimeContext(context);
1048 DisplayProcedureExecutionState(context);
1050 this.buttonExecuteMain.Enabled =
true;
1051 this.buttonExecuteSelectedProcedure.Enabled =
true;
1053 UpdateExecutionStateButtons(
false);
1054 UpdatePauseButton(
true,
false);
1056 this.labelBatteryState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconBattery16;
1057 this.labelIgnitionState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconIgnition16;
1062 System.Media.SystemSounds.Hand.Play();
1064 this.procedureExecutionCount--;
1066 RemoveRuntimeContext(context);
1067 DisplayProcedureExecutionState(context);
1069 this.buttonExecuteMain.Enabled =
true;
1070 this.buttonExecuteSelectedProcedure.Enabled =
true;
1072 UpdateExecutionStateButtons(
false);
1073 UpdatePauseButton(
true,
false);
1075 this.labelBatteryState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconBattery16;
1076 this.labelIgnitionState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconIgnition16;
1081 StartStopUpdateGuiTimer();
1085 private void StartStopUpdateGuiTimer()
1087 if (this.procedureExecutionCount <= 0)
1089 this.updateGuiTimer.Enabled =
false;
1090 this.labelSeparator1.Visible =
false;
1091 this.labelProcedureExecutionTimes.Visible =
false;
1093 else if (!this.updateGuiTimer.Enabled)
1095 this.updateGuiTimer.Enabled =
true;
1099 private void updateGuiTimer_Tick(
object sender, EventArgs e)
1101 DisplayProcedureExecutionTimes();
1104 private void DisplayProcedureExecutionTimes()
1106 string text =
string.Empty;
1108 if (this.runtimeContextsExecutionStartTime.Count > 0)
1110 foreach (var item
in this.runtimeContextsExecutionStartTime)
1112 var duration = DateTime.Now - item.Value;
1113 text +=
string.Format(
"{0}: {1} | ", item.Key.Procedure.Name, duration.ToString(
"mm':'ss"));
1115 text = text.TrimEnd(
new char[] {
' ',
'|' });
1118 this.labelProcedureExecutionTimes.Text = text;
1119 this.labelSeparator1.Visible =
true;
1120 this.labelProcedureExecutionTimes.Visible =
true;
1123 private void InOutParameterValueChanged(IRuntimeContext context, IProcedureInOutParameter parameter)
1127 Invoke(
new MethodInvoker(delegate ()
1129 InOutParameterValueChanged(context, parameter);
1134 lock (eventListenerLock)
1138 string valueStr = ShortenedValueString(parameter);
1139 string message = String.Format(
"Parameter '{0}' new value = {1}", parameter.Name, valueStr);
1141 UpdateGridviewParameter(parameter);
1143 catch (InvalidCastException ex)
1145 PrintText(ex.Message);
1150 private static string ShortenedValueString(IProcedureParameter parameter)
1152 var valueStr = ValueConverter.Value2String(parameter.Value);
1153 if (valueStr.Length > VALUE_STRING_MAX_LENGTH)
1154 return valueStr.Substring(0, VALUE_STRING_MAX_LENGTH) +
"...";
1159 private void UpdatePauseButton(
bool pauseAvailable,
bool enabled =
true)
1161 this.buttonPause.Enabled = enabled;
1162 this.buttonPause.Checked = !pauseAvailable;
1163 this.buttonPause.Image = pauseAvailable
1164 ? global::OpenTestSystem.Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.Pause
1165 : global::OpenTestSystem.Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.Continue;
1168 private void UpdateExecutionStateButtons(
bool wasExecuted)
1170 if (this.useConnectionState)
1172 this.labelTimeout.Enabled = !wasExecuted;
1173 this.textBoxTimeout.Enabled = !wasExecuted;
1174 this.checkBoxUseConnectionState.Enabled = !wasExecuted;
1175 this.labelExpectedState.Enabled = !wasExecuted;
1176 this.checkBoxIgnition.Enabled = !wasExecuted;
1177 this.labelPollingTime.Enabled = !wasExecuted;
1178 this.textBoxPollingTime.Enabled = !wasExecuted;
1179 this.labelVoltageThreshold.Enabled = !wasExecuted;
1180 this.textBoxVoltageThreshold.Enabled = !wasExecuted;
1185 if (checkBoxAsyncExecution.Checked ==
false)
1187 this.buttonExecuteMain.Enabled =
false;
1188 this.buttonExecuteSelectedProcedure.Enabled =
false;
1191 this.buttonStop.Enabled =
true;
1195 if (project !=
null && project.MainProcedure !=
null)
1197 this.buttonExecuteMain.Enabled =
true;
1200 this.buttonExecuteSelectedProcedure.Enabled =
true;
1202 this.buttonStop.Enabled =
false;
1206 private void DisplayProcedureExecutionState(IRuntimeContext context,
string errorMessage =
"")
1208 if (
string.IsNullOrEmpty(errorMessage))
1210 this.labelIconProcedureExecutionState.Image = global::OpenTestSystem.Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.Info16;
1212 if (this.procedureExecutionCount <= 0)
1214 this.procedureExecutionCount = 0;
1217 this.labelProcedureExecutionState.Text =
"Execution is paused, click \"Continue\"...";
1221 this.labelProcedureExecutionState.Text =
"Select a procedure and click \"Start\"...";
1224 else if (this.procedureExecutionCount == 1)
1226 this.labelProcedureExecutionState.Text =
"1 Procedure is running";
1230 this.labelProcedureExecutionState.Text =
string.Format(
"{0} Procedures are running", this.procedureExecutionCount);
1235 this.labelIconProcedureExecutionState.Image = global::OpenTestSystem.Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.Error16;
1236 this.labelProcedureExecutionState.Text = errorMessage;
1239 private void SyncWithParent(
object parentControl,
object control =
null,
bool newThread =
false)
1241 if (parentControl !=
null)
1243 if (this.creatorForm !=
null && this.checkBoxStartAllParents.Checked)
1245 if (parentControl is Button)
1249 ThreadPool.QueueUserWorkItem(state => ParentButtonClick(parentControl as Button));
1253 ParentButtonClick(parentControl as Button);
1256 else if (parentControl is TextBox && control !=
null)
1258 string text = (control as TextBox).Text;
1261 ThreadPool.QueueUserWorkItem(state => ParentTextBoxSetText(parentControl as TextBox, text));
1265 ParentTextBoxSetText(parentControl as TextBox, text);
1268 else if (parentControl is CheckBox && control !=
null)
1270 CheckState checkState = (control as CheckBox).CheckState;
1273 ThreadPool.QueueUserWorkItem(state => ParentCheckBoxSetCheckState(parentControl as CheckBox, checkState));
1277 ParentCheckBoxSetCheckState(parentControl as CheckBox, checkState);
1280 else if (parentControl is ComboBox && control !=
null)
1282 int index = (control as ComboBox).SelectedIndex;
1285 ThreadPool.QueueUserWorkItem(state => ParentComboBoxSetIndex(parentControl as ComboBox, index));
1289 ParentComboBoxSetIndex(parentControl as ComboBox, index);
1292 else if (parentControl is NumericUpDown && control !=
null)
1294 int value = decimal.ToInt32((control as NumericUpDown).Value);
1296 ThreadPool.QueueUserWorkItem(state => ParentNumericUpDownSetValue(parentControl as NumericUpDown, value));
1298 ParentNumericUpDownSetValue(parentControl as NumericUpDown, value);
1304 private void ParentButtonClick(Button button)
1306 if (button.InvokeRequired)
1308 this.creatorForm.Invoke(
new Action(() => button.PerformClick()));
1312 button.PerformClick();
1316 private void ParentTextBoxSetText(TextBox textBox,
string text)
1318 if (textBox.InvokeRequired)
1320 this.creatorForm.Invoke(
new Action(() => textBox.Text = text));
1324 textBox.Text = text;
1328 private void ParentCheckBoxSetCheckState(CheckBox checkBox, CheckState checkState)
1330 if (checkBox.InvokeRequired)
1332 this.creatorForm.Invoke(
new Action(() => checkBox.CheckState = checkState));
1336 checkBox.CheckState = checkState;
1340 private void ParentComboBoxSetIndex(ComboBox comboBox,
int index)
1342 if (comboBox.InvokeRequired)
1344 this.creatorForm.Invoke(
new Action(() => comboBox.SelectedIndex = index));
1348 comboBox.SelectedIndex = index;
1352 private void buttonBrowseTraceFolder_Click(
object sender, EventArgs e)
1354 folderBrowserDialog1.SelectedPath = this.textBoxTraceFolder.Text;
1355 folderBrowserDialog1.ShowNewFolderButton =
true;
1357 DialogResult result = folderBrowserDialog1.ShowDialog();
1358 if (result == DialogResult.OK)
1360 this.textBoxTraceFolder.Text = folderBrowserDialog1.SelectedPath;
1364 private void buttonOpenTraceFolder_Click(
object sender, EventArgs e)
1366 string path = this.textBoxTraceFolder.Text;
1367 if (Directory.Exists(path))
1369 Process.Start(path);
1374 private void textBoxTraceFolder_TextChanged(
object sender, EventArgs e)
1376 if (this.globalRuntimeManager ==
null)
1379 string path = this.textBoxTraceFolder.Text;
1381 if (path != RuntimeConfig.Instance.TraceFolder)
1383 if (Directory.Exists(path))
1385 RuntimeConfig.Instance.TraceFolder = textBoxTraceFolder.Text;
1386 this.buttonOpenTraceFolder.Enabled =
true;
1388 PrintText(
"Set trace folder to " + RuntimeConfig.Instance.TraceFolder);
1392 this.buttonOpenTraceFolder.Enabled =
false;
1397 this.buttonOpenTraceFolder.Enabled =
true;
1400 SyncWithParent(this.creatorForm?.textBoxTraceFolder, this.textBoxTraceFolder);
1404 private void comboBoxTraceLevel_SelectedValueChanged(
object sender, EventArgs e)
1406 if (this.globalRuntimeManager ==
null)
1409 var traceLevel = (
TraceLevels)comboBoxTraceLevel.SelectedIndex;
1410 if (traceLevel == RuntimeConfig.Instance.TraceLevel)
1413 RuntimeConfig.Instance.TraceLevel = traceLevel;
1414 PrintText(
"Updated trace level");
1417 private void buttonBrowseFile_Click(
object sender, EventArgs e)
1419 DialogResult result = openFileDialog1.ShowDialog();
1420 if (result == DialogResult.OK)
1422 cbFilePath.Text = openFileDialog1.FileName;
1424 this.buttonReload.PerformClick();
1428 private void cbFilePath_TextChanged(
object sender, EventArgs e)
1430 AddComboBoxFileOrPath(cbFilePath);
1432 if (String.IsNullOrWhiteSpace(cbFilePath.Text) || !File.Exists(cbFilePath.Text.Trim()))
1434 buttonReload.Enabled =
false;
1438 buttonReload.Enabled =
true;
1441 SyncWithParent(this.creatorForm?.cbFilePath, this.cbFilePath);
1444 private void cbFilePath_SelectedValueChanged(
object sender, EventArgs e)
1446 if (String.IsNullOrWhiteSpace(cbFilePath.Text) || !File.Exists(cbFilePath.Text.Trim()))
1448 buttonReload.Enabled =
false;
1452 buttonReload.Enabled =
true;
1453 this.buttonReload.PerformClick();
1456 SyncWithParent(this.creatorForm?.cbFilePath, this.cbFilePath);
1459 private void buttonReload_Click(
object sender, EventArgs e)
1461 this.LoadContextFile(this.globalRuntimeManager);
1463 SyncWithParent(this.creatorForm?.buttonReload);
1466 private void LoadContextFile(IRuntimeManager runtimeManager)
1468 PrintText(
"Load '" + cbFilePath.Text +
"'...");
1470 if (runtimeManager ==
null)
1472 PrintText(
"... No RuntimeManager exists!");
1476 if (String.IsNullOrWhiteSpace(cbFilePath.Text.Trim()))
1478 PrintText(
"... wrong file name.");
1482 SetTitle(this.title);
1487 this.isLoadding =
true;
1488 this.playerProject =
null;
1489 this.project =
null;
1490 this.contextVariableImplementation.ResetAllValues();
1491 this.stateVariableImplementation.ResetAllValues();
1494 if (Path.GetExtension(cbFilePath.Text.Trim()).Contains(
"ptx"))
1496 this.project = LoadPtx(runtimeManager);
1498 if (this.project !=
null)
1500 PrintText(
"... Project '" + project.Name +
"' successfully loaded.");
1502 ClearCustomImplemetationCaches();
1504 this.LoadPackage(this.project);
1506 ReadSettings(this.project.Settings);
1508 this.isLoadding =
false;
1512 else if (Path.GetExtension(cbFilePath.Text.Trim()).Contains(
"ppx"))
1514 this.playerProject = LoadPpx(runtimeManager);
1516 if (this.playerProject !=
null)
1518 ClearCustomImplemetationCaches();
1520 PrintText(
"... Player '" + playerProject.Name +
"' successfully loaded.");
1522 foreach (IProject item
in this.playerProject.Projects)
1525 this.LoadPackage(item);
1528 ReadSettings(this.playerProject.Settings);
1530 this.isLoadding =
false;
1535 catch (System.Exception ex)
1540 this.isLoadding =
false;
1543 private void ClearSampleGUI()
1545 this.treeViewOtxProject.Nodes.Clear();
1546 this.gridViewParameter.Rows.Clear();
1547 this.gridViewContext.Rows.Clear();
1548 this.gridViewState.Rows.Clear();
1549 this.gridViewSettings.Rows.Clear();
1552 private void ClearCustomImplemetationCaches()
1554 if (this.contextVariableImplementation !=
null)
1555 this.contextVariableImplementation.ResetAllValues();
1557 if (this.contextVariableOutputImpl !=
null)
1558 this.contextVariableOutputImpl.ResetAllValues();
1560 if (this.stateVariableImplementation !=
null)
1561 this.stateVariableImplementation.ResetAllValues();
1567 private IProject LoadPtx(IRuntimeManager runtimeManager)
1569 IProject project =
null;
1571 if (runtimeManager.IsProtected(cbFilePath.Text))
1573 project = runtimeManager.LoadPtx(cbFilePath.Text, txtPassword.Text.Trim());
1577 project = runtimeManager.LoadPtx(cbFilePath.Text);
1580 if (project.MainProcedure !=
null)
1582 buttonExecuteMain.Enabled =
true;
1589 private IPlayerProject LoadPpx(IRuntimeManager runtimeManager)
1591 IPlayerProject playerProject =
null;
1593 if (runtimeManager.IsProtected(cbFilePath.Text))
1595 playerProject = runtimeManager.LoadPpx(cbFilePath.Text, txtPassword.Text.Trim());
1599 playerProject = runtimeManager.LoadPpx(cbFilePath.Text);
1602 return playerProject;
1606 private void LoadPackage(IProject project)
1608 PrintText(
"Browse project...");
1610 IPackage[] packages = project.Packages;
1611 if (packages ==
null)
1613 IDocument document = project.StartupDocument;
1614 this.treeViewOtxProject.Nodes.Add(CreateDocumentNode(document));
1618 string treeNodeText = project.Name;
1619 if (!String.IsNullOrWhiteSpace(project.Version))
1620 treeNodeText = String.Format(
"{0} ({1})", treeNodeText, project.Version);
1622 TreeNode root =
new TreeNode(treeNodeText);
1623 root.ImageKey = root.SelectedImageKey =
"ODFProject.bmp";
1624 foreach (IPackage pack
in packages)
1626 root.Nodes.Add(this.CreatePackageNode(pack));
1629 this.treeViewOtxProject.Nodes.Add(root);
1632 this.treeViewOtxProject.Enabled = this.gridViewParameter.Enabled =
true;
1633 this.treeViewOtxProject.ExpandAll();
1634 this.treeViewOtxProject.SelectedNode = startupNode;
1635 this.treeViewOtxProject.Focus();
1637 PrintText(
"... project browsing finished.");
1641 private TreeNode CreateDocumentNode(IDocument doc)
1643 TreeNode documentNode =
new TreeNode(doc.Name);
1644 documentNode.Tag = doc;
1645 documentNode.ImageKey = documentNode.SelectedImageKey =
"DocumentOTX16.bmp";
1648 documentNode.Text +=
" (StartUp)";
1651 foreach (IProcedure p
in doc.Procedures)
1653 TreeNode procedureNode = CreateProcedureNode(p);
1654 documentNode.Nodes.Add(procedureNode);
1655 if (doc.IsStartup && p.Name ==
"main")
1657 startupNode = procedureNode;
1658 buttonExecuteMain.Enabled =
true;
1660 else if (startupNode ==
null)
1662 startupNode = procedureNode;
1666 return documentNode;
1670 private TreeNode CreateProcedureNode(IProcedure procedure)
1672 if (checkBoxCyclicReload.Checked &&
1673 procedureToExecute !=
null &&
1674 procedureToExecute.FullName == procedure.FullName)
1676 procedureToExecute = procedure;
1679 TreeNode procedureNode =
new TreeNode(procedure.Name);
1680 procedureNode.ImageKey = procedureNode.SelectedImageKey =
"Procedure.bmp";
1681 procedureNode.Tag = procedure;
1682 return procedureNode;
1686 private TreeNode CreatePackageNode(IPackage pack)
1688 TreeNode packageNode =
new TreeNode(pack.Name);
1689 packageNode.Tag = pack;
1690 packageNode.ImageKey = packageNode.SelectedImageKey =
"Package.bmp";
1692 List<IDocument> documents = pack.Documents.ToList();
1693 foreach (IDocument doc
in documents)
1695 packageNode.Nodes.Add(CreateDocumentNode(doc));
1698 foreach (IPackage package
in pack.Packages)
1700 packageNode.Nodes.Add(this.CreatePackageNode(package));
1707 private void gridView_CellValueChanged(
object sender, DataGridViewCellEventArgs e)
1709 DataGridView gridView = sender as DataGridView;
1710 if (!this.isLoadding && gridView !=
null &&
1711 e.RowIndex >= 0 && e.ColumnIndex == 2 &&
1713 gridView.Rows[e.RowIndex].Cells[2] is DataGridViewCheckBoxCell ||
1714 gridView.Rows[e.RowIndex].Cells[2] is DataGridViewComboBoxCell
1719 this.Validate(
false);
1724 void gridViewParameter_CellValidated(
object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
1726 DataGridView gridView = sender as DataGridView;
1727 if (!this.isLoadding && gridView !=
null && e.RowIndex >= 0 && e.ColumnIndex == 2)
1729 IProcedureParameter parameter = gridView.Rows[e.RowIndex].Tag as IProcedureParameter;
1730 if (parameter.Value !=
null)
1732 gridView.Rows[e.RowIndex].Cells[2].Value = ValueConverter.Value2String(parameter.Value);
1739 void gridViewParameter_CellValidating(
object sender, System.Windows.Forms.DataGridViewCellValidatingEventArgs e)
1741 DataGridView gridView = sender as DataGridView;
1742 if (!this.isLoadding && gridView !=
null && e.RowIndex >= 0 &&
1743 e.ColumnIndex == 2 &&
1744 !gridView.Rows[e.RowIndex].ReadOnly &&
1745 e.FormattedValue !=
null)
1747 IProcedureParameter parameter = gridView.Rows[e.RowIndex].Tag as IProcedureParameter;
1748 object value =
null;
1752 value = ValueConverter.String2Value(e.FormattedValue.ToString(), parameter.DataType);
1754 catch (System.Exception ex)
1767 System.Media.SystemSounds.Exclamation.Play();
1771 gridView.Rows[e.RowIndex].Cells[1].ErrorText =
string.Empty;
1772 if (parameter is IProcedureInParameter)
1773 (parameter as IProcedureInParameter).Value = value;
1774 else if (parameter is IProcedureInOutParameter)
1775 (parameter as IProcedureInOutParameter).Value = value;
1786 void gridViewContextVariable_CellValidated(
object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
1788 DataGridView gridView = sender as DataGridView;
1789 if (!this.isLoadding && gridView !=
null &&
1793 IContextVariable context = gridView.Rows[e.RowIndex].Tag as IContextVariable;
1794 if (gridView.Rows[e.RowIndex].Cells[2].Tag !=
null)
1796 gridView.Rows[e.RowIndex].Cells[2].Value = ValueConverter.Value2String(gridView.Rows[e.RowIndex].Cells[2].Tag);
1802 void gridViewContextVariable_CellValidating(
object sender, System.Windows.Forms.DataGridViewCellValidatingEventArgs e)
1804 DataGridView gridView = sender as DataGridView;
1805 if (!this.isLoadding && gridView !=
null &&
1807 e.ColumnIndex == 2 &&
1808 !gridView.Rows[e.RowIndex].ReadOnly &&
1809 e.FormattedValue !=
null)
1811 IContextVariable context = gridView.Rows[e.RowIndex].Tag as IContextVariable;
1812 object value =
null;
1816 value = ValueConverter.String2Value(e.FormattedValue.ToString(), context.DataType);
1818 catch (System.Exception ex)
1831 System.Media.SystemSounds.Exclamation.Play();
1837 string fullNameContextVariable = context.Document.FullName +
'.' + context.Name;
1838 this.contextVariableImplementation.SetValue(fullNameContextVariable, value);
1839 this.contextVariableOutputImpl.SetValue(fullNameContextVariable, value);
1840 gridView.Rows[e.RowIndex].Cells[2].Tag = value;
1841 gridView.Rows[e.RowIndex].Cells[1].ErrorText =
string.Empty;
1852 private void treeViewOtxProject_AfterSelect(
object sender, TreeViewEventArgs e)
1854 TreeNode node = e.Node;
1858 this.gridViewParameter.Rows.Clear();
1859 this.gridViewContext.Rows.Clear();
1860 this.gridViewState.Rows.Clear();
1862 if (node.Tag is IProcedure)
1864 IProcedure procedure = node.Tag as IProcedure;
1865 ClearCustomImplemetationCaches();
1866 UpdateGridview(procedure);
1868 buttonExecuteSelectedProcedure.Enabled =
true;
1869 this.project = GetProject(procedure);
1874 buttonExecuteSelectedProcedure.Enabled =
false;
1878 private IProject GetProject(IProcedure procedure)
1880 if (procedure !=
null)
1882 IPackage
package = procedure.Document.Package;
1883 if (package !=
null)
1885 while (package.Parent !=
null)
1887 package = package.Parent;
1890 return package.Project;
1896 private void treeViewOtxProject_DrawNode(
object sender, DrawTreeNodeEventArgs e)
1898 e.DrawDefault =
true;
1902 private void buttonReadSettings_Click(
object sender, EventArgs e)
1904 Dictionary<string, string> settings =
null;
1905 if (this.playerProject !=
null)
1907 settings = this.playerProject.Settings;
1909 else if (this.project !=
null)
1911 settings = this.project.Settings;
1913 ReadSettings(settings);
1916 private void ReadSettings(Dictionary<string, string> settings)
1918 if (settings !=
null)
1920 PrintText(
"Read settings");
1922 gridViewSettings.Rows.Clear();
1924 foreach (KeyValuePair<string, string> setting
in settings)
1926 object[] values =
new object[] { setting.Key, setting.Value };
1927 this.gridViewSettings.Rows.Add(values);
1933 private void buttonWriteSettings_Click(
object sender, EventArgs e)
1936 string valueSetting;
1937 int selectedSettingPosition = 0;
1938 Dictionary<string, string> newSettings =
new Dictionary<string, string>();
1940 if (this.gridViewSettings.SelectedRows.Count != 0)
1942 selectedSettingPosition = this.gridViewSettings.SelectedRows[0].Index;
1947 if (project !=
null || playerProject !=
null)
1949 foreach (DataGridViewRow row
in this.gridViewSettings.Rows)
1951 nameSetting = row.Cells[this.dataGridViewTextBoxColumnSettingName.Name].Value.ToString();
1952 valueSetting = row.Cells[this.dataGridViewTextBoxColumnSettingValue.Name].Value?.ToString();
1954 newSettings.Add(nameSetting, valueSetting);
1957 if (playerProject !=
null)
1959 playerProject.Settings = newSettings;
1960 ReadSettings(playerProject.Settings);
1964 project.Settings = newSettings;
1965 ReadSettings(project.Settings);
1968 this.gridViewSettings.Rows[selectedSettingPosition].Selected =
true;
1969 this.gridViewSettings.Rows[selectedSettingPosition].Cells[1].Selected =
true;
1971 PrintText(
"Write settings finished");
1974 catch (System.Exception ex)
1980 private void checkBoxCyclicExecution_CheckedChanged(
object sender, EventArgs e)
1982 this.checkBoxCyclicReload.Enabled = this.checkBoxNewRuntimeManager.Enabled = this.checkBoxCyclicExecution.Checked;
1984 if (!this.checkBoxCyclicExecution.Checked)
1986 this.checkBoxCyclicReload.Checked = this.checkBoxNewRuntimeManager.Checked =
false;
1989 SyncWithParent(this.creatorForm?.checkBoxCyclicExecution, this.checkBoxCyclicExecution);
1992 private void checkBoxAsyncExecution_CheckedChanged(
object sender, EventArgs e)
1994 SyncWithParent(this.creatorForm?.checkBoxAsyncExecution, this.checkBoxAsyncExecution);
1997 private void checkBoxNewRuntimeManager_CheckedChanged(
object sender, EventArgs e)
1999 if (this.checkBoxNewRuntimeManager.Checked)
2001 this.checkBoxCyclicReload.Checked =
true;
2004 SyncWithParent(this.creatorForm?.checkBoxNewRuntimeManager, this.checkBoxNewRuntimeManager);
2007 private void checkBoxCyclicReload_CheckedChanged(
object sender, EventArgs e)
2009 SyncWithParent(this.creatorForm?.checkBoxCyclicReload, this.checkBoxCyclicReload);
2013 private void buttonExecuteSelectedProcedure_Click(
object sender, EventArgs e)
2017 if (treeViewOtxProject.SelectedNode !=
null && treeViewOtxProject.SelectedNode.Tag is IProcedure)
2019 IDocument document = treeViewOtxProject.SelectedNode.Parent.Tag as IDocument;
2020 List<string> listItemsReviewed =
new List<string>();
2022 this.procedureToExecute = treeViewOtxProject.SelectedNode.Tag as IProcedure;
2023 this.ExecuteProcedure();
2027 PrintText(
"Please select Procedure to execute");
2031 catch (System.Exception ex)
2036 SyncWithParent(this.creatorForm?.buttonExecuteSelectedProcedure,
null,
true);
2041 private void buttonExecuteMain_Click(
object sender, EventArgs e)
2045 treeViewOtxProject.SelectedNode = startupNode;
2046 this.procedureToExecute = project.MainProcedure;
2047 this.ExecuteProcedure();
2049 catch (System.Exception ex)
2054 SyncWithParent(this.creatorForm?.buttonExecuteMain,
null,
true);
2058 private async
void ExecuteProcedure()
2060 PrintText(
"Start procedure execution...");
2062 if (checkBoxAsyncExecution.Checked ==
false)
2064 this.buttonExecuteMain.Enabled =
false;
2065 this.buttonExecuteSelectedProcedure.Enabled =
false;
2070 if (this.globalRuntimeManager !=
null && procedureToExecute !=
null)
2072 this.buttonStop.Enabled =
true;
2074 CheckBatteryIgnitionState(this.globalRuntimeManager);
2076 if (checkBoxCyclicExecution.Checked)
2078 ThreadPool.QueueUserWorkItem(state => DoCyclic());
2083 if (checkBoxAsyncExecution.Checked)
2085 this.globalRuntimeManager.ExecuteAsync(textBoxRuntimeContextName.Text.Trim(), procedureToExecute,
this.expectedConnectionState, (ulong)Convert.ToInt32(
this.textBoxTimeout.Text));
2089 await Task.Run(() => this.globalRuntimeManager.Execute(textBoxRuntimeContextName.Text.Trim(), procedureToExecute,
this.expectedConnectionState, (ulong)Convert.ToInt32(
this.textBoxTimeout.Text)));
2094 catch (System.Exception ex)
2098 UpdateButtonStateAfterThrowException();
2102 private void UpdateButtonStateAfterThrowException()
2104 this.buttonExecuteMain.Enabled = !checkBoxCyclicExecution.Checked;
2105 this.buttonExecuteSelectedProcedure.Enabled = !checkBoxCyclicExecution.Checked;
2107 UpdateExecutionStateButtons(
false);
2108 UpdatePauseButton(
true,
false);
2110 this.labelBatteryState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconBattery16;
2111 this.labelIgnitionState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconIgnition16;
2115 private void DoCyclic()
2117 DateTime startTime = DateTime.Now;
2122 while (checkBoxCyclicExecution.Checked)
2124 IRuntimeManager runtimeManager =
null;
2125 IRuntimeContext runtimeContext =
null;
2128 this.cyclicExecutionCount++;
2130 if (this.checkBoxNewRuntimeManager.Checked)
2132 runtimeManager = CreateRuntimeManager();
2136 runtimeManager = this.globalRuntimeManager;
2139 CheckCyclicReloadOrNewRuntimeManager(runtimeManager);
2141 cyclicExecuteAsyncIsProcessing =
true;
2142 CheckBatteryIgnitionState(this.globalRuntimeManager);
2144 if (this.checkBoxAsyncExecution.Checked)
2146 runtimeContext = runtimeManager.ExecuteAsync(textBoxRuntimeContextName.Text.Trim(), procedureToExecute,
this.expectedConnectionState, (ulong)Convert.ToInt32(
this.textBoxTimeout.Text));
2147 if (runtimeContext !=
null)
2150 Application.DoEvents();
2156 runtimeContext = runtimeManager.Execute(textBoxRuntimeContextName.Text.Trim(), procedureToExecute,
this.expectedConnectionState, (ulong)Convert.ToInt32(
this.textBoxTimeout.Text));
2161 this.cyclicExecutionCount = 0;
2166 catch (System.Exception ex)
2170 UpdateButtonStateAfterThrowException();
2174 Invoke(
new MethodInvoker(delegate ()
2176 if (this.checkBoxNewRuntimeManager.Checked)
2178 LoadContextFile(this.globalRuntimeManager);
2182 PrintText(
"Cyclic execution finished");
2184 var duration = DateTime.Now - startTime;
2185 string text = String.Format(
"Execution Statistics: Duration {0} (hh:mm:ss) with {1} cycles and {2:0} ms per cycle", duration.ToString(
@"hh\:mm\:ss"), cyclic, duration.TotalMilliseconds / cyclic);
2187 this.cyclicExecutionCount -= cyclic;
2188 if (this.cyclicExecutionCount < 0)
2190 this.cyclicExecutionCount = 0;
2193 if (this.checkBoxAdd2Output.Checked)
2199 MessageBox.Show(text);
2203 private void CheckCyclicReloadOrNewRuntimeManager(IRuntimeManager runtimeMgr)
2205 Invoke(
new MethodInvoker(delegate ()
2207 if (this.checkBoxCyclicReload.Checked ||
this.checkBoxNewRuntimeManager.Checked)
2210 while (cyclicExecuteAsyncIsProcessing)
2213 Application.DoEvents();
2216 LoadContextFile(runtimeMgr);
2219 if (this.checkBoxCyclicExecution.Checked)
2221 this.checkBoxCyclicExecution.Text =
"Cyclic (" + this.cyclicExecutionCount +
")";
2225 this.checkBoxCyclicExecution.Text =
"Cyclic";
2231 private void buttonStop_Click(
object sender, EventArgs e)
2233 if (this.globalRuntimeManager !=
null)
2235 PrintText(String.Format(
"Try to stop all running procedures..."));
2236 this.globalRuntimeManager.StopAll();
2237 this.procedureExecutionCount = 0;
2241 this.checkBoxCyclicExecution.Checked =
false;
2243 SyncWithParent(this.creatorForm?.buttonStop);
2246 private void PrintException(System.Exception ex,
string additionalText =
"")
2248 PrintText(String.Format(
"!!! {2}{0}: {1}", ex.GetType().Name, ex.Message, additionalText));
2249 System.Media.SystemSounds.Hand.Play();
2252 private void PrintText(
string text)
2256 this.Invoke(
new Action(() => PrintText(text)));
2260 if (!this.checkBoxAdd2Output.Checked)
2266 lock (printTextLock)
2268 if (this.listBoxOuput.Items.Count >= 10000)
2270 buttonClearOutput_Click(
null,
null);
2273 string prefixString = GetTimeAndDurationStringSinceLastTimeAndUpdateLastTime();
2274 string itemToAdd = prefixString + text +
"\t\t";
2276 this.listBoxOuput.Items.Add(itemToAdd);
2277 this.listBoxOuput.SelectedItems.Clear();
2278 this.listBoxOuput.TopIndex = listBoxOuput.Items.Count - 1;
2280 if (this.listBoxOuput.Items.Count >= 7500)
2282 this.labelOutputOverflow.Visible =
true;
2287 Application.DoEvents();
2291 private string GetTimeAndDurationStringSinceLastTimeAndUpdateLastTime()
2293 DateTime now = DateTime.Now;
2294 var duration = now - this.lastTime;
2296 this.lastTime = now;
2298 string timeDurationString = String.Format(
"{0:HH:mm:ss.fff} {1,6:#,##0} ms ", now, duration.TotalMilliseconds);
2299 return timeDurationString;
2302 private void buttonCopyRow_Click(
object sender, EventArgs e)
2304 if (this.listBoxOuput.SelectedItems !=
null)
2306 string text =
string.Empty;
2307 foreach (
string row
in this.listBoxOuput.SelectedItems)
2309 text += row.Trim(
'\t') +
"\n";
2312 Clipboard.SetText(text);
2316 private void buttonClearOutput_Click(
object sender, EventArgs e)
2318 this.listBoxOuput.Items.Clear();
2319 this.labelOutputOverflow.Visible =
false;
2320 this.buttonCopyRow.Enabled =
false;
2324 private void UpdateGridview(IProcedure procedure)
2326 if (procedure ==
null ||
2327 procedure.Parameters ==
null)
2332 UpdateGridviewParameter(procedure);
2334 IDocument document = procedure.Document;
2335 if (document !=
null)
2337 List<string> listItemsReviewed =
new List<string>();
2338 UpdateGridViewContextVariable(document,
false, listItemsReviewed);
2340 listItemsReviewed.Clear();
2341 UpdateGridViewStateVariable(document,
false, listItemsReviewed);
2345 private void UpdateGridviewParameter(IProcedure procedure)
2347 foreach (IProcedureParameter param
in procedure.Parameters)
2349 UpdateGridviewParameter(param);
2354 private void UpdateGridviewParameter(IProcedureParameter parameter)
2356 if (parameter ==
null)
2361 bool bValueWasSet =
false;
2364 string collumnName = dataGridViewTextBoxColumnName.Name;
2365 string collumnValue = dataGridViewTextBoxColumnValue.Name;
2366 foreach (DataGridViewRow row
in this.gridViewParameter.Rows)
2368 if (row.Cells[collumnName].Value.Equals(parameter.Name))
2372 if (parameter.Value !=
null)
2374 row.Cells[collumnValue].Value = ValueConverter.Value2String(parameter.Value);
2377 catch (System.Exception ex)
2379 row.Cells[collumnValue].ErrorText = ex.Message;
2382 bValueWasSet =
true;
2390 object[] values =
new object[] { parameter.Name, parameter.DataType };
2391 int index = this.gridViewParameter.Rows.Add(values);
2393 this.gridViewParameter.Rows[index].Tag = parameter;
2395 this.gridViewParameter.Rows[index].ReadOnly = parameter is IProcedureOutParameter || parameter.InitValue ==
null;
2397 if (parameter.DataType.Equals(
"Boolean"))
2399 gridViewParameter.Rows[index].Cells[collumnValue] =
new DataGridViewCheckBoxCell();
2400 DataGridViewCheckBoxCell cell = gridViewParameter.Rows[index].Cells[collumnValue] as DataGridViewCheckBoxCell;
2401 cell.Value = ValueConverter.Value2String(parameter.Value);
2407 if (parameter.Value !=
null)
2409 gridViewParameter.Rows[index].Cells[collumnValue].Value = ValueConverter.Value2String(parameter.Value);
2412 catch (System.Exception ex)
2414 gridViewParameter.Rows[index].Cells[collumnValue].ErrorText = ex.Message;
2421 private void UpdateGridViewContextVariable(IDocument document,
bool withPrefix, List<string> listItemsReviewed)
2423 string @
namespace = string.Concat(document.Package.Name, ".", document.Name);
2424 if (listItemsReviewed.Contains(@
namespace))
2429 listItemsReviewed.Add(@
namespace);
2430 foreach (IContextVariable contextVariable
in document.ContextVariables)
2432 if (contextVariable ==
null)
2437 bool bValueWasSet =
false;
2440 foreach (DataGridViewRow row
in this.gridViewContext.Rows)
2442 if (row.Cells[
this.dataGridViewTextBoxColumnContextName.Name].Value !=
null && row.Cells[
this.dataGridViewTextBoxColumnContextName.Name].Value.Equals(withPrefix ? (document.Package.FullName +
"." + document.Name +
"." + contextVariable.Name) : contextVariable.Name))
2444 if (radioButtonDefaultImplementation.Checked)
2446 object contextVariableValue = this.contextVariableImplementation.GetValue(
null, contextVariable,
null);
2447 row.Cells[this.dataGridViewTextBoxColumnContextValue.Name].Value = contextVariableValue !=
null ? ValueConverter.Value2String(contextVariableValue) :
null;
2451 row.Cells[this.dataGridViewTextBoxColumnContextValue.Name].Value = contextVariable.InitValue !=
null ? ValueConverter.Value2String(contextVariable.InitValue) :
null;
2454 bValueWasSet =
true;
2462 object[] values =
null;
2463 values =
new object[] { withPrefix ? (document.Package.FullName +
"." + document.Name +
"." + contextVariable.Name) : contextVariable.Name, contextVariable.DataType };
2464 int index = this.gridViewContext.Rows.Add(values);
2466 object contextVariableValue = contextVariable.InitValue;
2468 this.gridViewContext.Rows[index].Tag = contextVariable;
2469 this.gridViewContext.Rows[index].ReadOnly = contextVariable.InitValue ==
null;
2470 this.gridViewContext.Rows[index].Cells[2].Tag = contextVariable.InitValue;
2471 if (contextVariable.DataType.Equals(
"Boolean"))
2473 gridViewContext.Rows[index].Cells[dataGridViewTextBoxColumnContextValue.Name] =
new DataGridViewCheckBoxCell();
2474 DataGridViewCheckBoxCell cell = gridViewContext.Rows[index].Cells[dataGridViewTextBoxColumnContextValue.Name] as DataGridViewCheckBoxCell;
2475 cell.Value = ValueConverter.Value2String(contextVariableValue);
2481 if (contextVariableValue !=
null)
2483 gridViewContext.Rows[index].Cells[dataGridViewTextBoxColumnContextValue.Name].Value = ValueConverter.Value2String(contextVariableValue);
2487 gridViewContext.Rows[index].Cells[dataGridViewTextBoxColumnContextValue.Name].Value =
null;
2490 catch (System.Exception ex)
2492 gridViewContext.Rows[index].Cells[dataGridViewTextBoxColumnContextValue.Name].ErrorText = ex.Message;
2500 foreach (IDocument importDoc
in document.Imports)
2502 UpdateGridViewContextVariable(importDoc,
true, listItemsReviewed);
2505 catch (System.Exception ex)
2512 private void StateVariableValueChanged(IStateVariable stateVariable,
object value)
2514 if (this.InvokeRequired)
2516 this.Invoke(
new Action(() => StateVariableValueChanged(stateVariable, value)));
2520 string mappingStr = String.Format(
"[MappedTo: {0}{1}]",
2521 stateVariable.MappingName,
2522 (stateVariable.MappingIndex > -1 ?
"[" + stateVariable.MappingIndex +
"]" : String.Empty));
2523 string strValue =
"null";
2526 strValue = ValueConverter.Value2String(value);
2532 string outputLog = String.Format(
"StateVariableChanged({0} {1}.{2}{3} = {4})",
2533 stateVariable.DataType,
2534 stateVariable.Document.FullName,
2538 PrintText(outputLog);
2539 UpdateGridViewStateVariable(stateVariable);
2542 private void ContextVariableRead(IContextVariable contextVariable,
object value)
2544 if (this.InvokeRequired)
2546 this.Invoke(
new Action(() => ContextVariableRead(contextVariable, value)));
2550 string mappingStr = String.Format(
"[MappedTo: {0}{1}]",
2551 contextVariable.MappingName,
2552 (contextVariable.MappingIndex > -1 ?
"[" + contextVariable.MappingIndex +
"]" : String.Empty));
2553 string strValue =
"null";
2556 strValue = ValueConverter.Value2String(value);
2561 string outputLog = String.Format(
"ContextVariableRead({0} {1}.{2}{3} = {4})",
2562 contextVariable.DataType,
2563 contextVariable.Document.FullName,
2564 contextVariable.Name,
2568 PrintText(outputLog);
2571 private void UpdateGridViewStateVariable(IDocument document,
bool withPrefix, List<string> listItemsReviewed)
2573 string @
namespace = string.Concat(document.Package.Name, ".", document.Name);
2574 if (listItemsReviewed.Contains(@
namespace))
2579 listItemsReviewed.Add(@
namespace);
2580 foreach (IStateVariable stateVariable
in document.StateVariables)
2582 object[] values =
null;
2583 values =
new object[] { withPrefix ? (document.Package.FullName +
"." + document.Name +
"." + stateVariable.Name) : stateVariable.Name, stateVariable.DataType };
2584 int index = this.gridViewState.Rows.Add(values);
2586 this.gridViewState.Rows[index].Tag = stateVariable;
2588 if (stateVariable.DataType.Equals(
"Boolean"))
2590 gridViewState.Rows[index].Cells[dataGridViewTextBoxColumnStateValue.Name] =
new DataGridViewCheckBoxCell();
2591 DataGridViewCheckBoxCell cell = gridViewState.Rows[index].Cells[dataGridViewTextBoxColumnStateValue.Name] as DataGridViewCheckBoxCell;
2592 cell.Value = ValueConverter.Value2String(stateVariable.InitValue);
2598 if (stateVariable.InitValue !=
null)
2600 gridViewState.Rows[index].Cells[dataGridViewTextBoxColumnStateValue.Name].Value = ValueConverter.Value2String(stateVariable.InitValue);
2603 catch (System.Exception ex)
2605 gridViewState.Rows[index].Cells[dataGridViewTextBoxColumnStateValue.Name].ErrorText = ex.Message;
2612 foreach (IDocument importDoc
in document.Imports)
2614 UpdateGridViewStateVariable(importDoc,
true, listItemsReviewed);
2617 catch (System.Exception ex)
2625 private void UpdateGridViewStateVariable(IStateVariable stateVar)
2627 if (stateVar ==
null)
2633 foreach (DataGridViewRow row
in this.gridViewState.Rows)
2635 if (row.Cells[
this.dataGridViewTextBoxColumnStateName.Name].Value !=
null && row.Tag == stateVar)
2637 object stateVariableValue =
null;
2639 if (radioButtonDefaultImplementation.Checked)
2640 stateVariableValue = this.stateVariableImplementation.GetValue(stateVar);
2642 stateVariableValue = stateVar.InitValue;
2644 if (stateVariableValue !=
null)
2648 if (stateVariableValue !=
null)
2650 row.Cells[this.dataGridViewTextBoxColumnStateValue.Name].Value = ValueConverter.Value2String(stateVariableValue);
2653 catch (System.Exception ex)
2655 row.Cells[this.dataGridViewTextBoxColumnStateValue.Name].ErrorText = ex.Message;
2659 row.Cells[this.dataGridViewTextBoxColumnStateValue.Name].Value =
null;
2664 Application.DoEvents();
2667 private void buttonNewInstance_Click(
object sender, EventArgs e)
2669 Form form =
new SampleForm(SampleConstants.CHILD_INSTANCE_NAME,
this);
2673 private void buttonNewInstanceNewThread_Click(
object sender, EventArgs e)
2675 Thread thread =
new Thread(
new ThreadStart(NewInstanceInThread));
2676 thread.SetApartmentState(ApartmentState.STA);
2680 private void NewInstanceInThread()
2682 Application.Run(
new SampleForm(SampleConstants.CHILD_INSTANCE_NAME,
this));
2685 private void buttonHmi_Click(
object sender, EventArgs e)
2687 if (this.buttonHmi.Checked)
2689 hmiWindow =
new HmiWindow();
2690 hmiWindow.FormClosing += HmiWindow_FormClosing;
2691 hmiWindow.SizeChanged += HmiWindow_SizeChanged;
2692 hmiWindow.Activated += HmiWindow_Activated;
2695 hmiWindow.Size =
new Size(userSettings.HmiWindowWidth, userSettings.HmiWindowHeight);
2696 hmiWindow.Location =
new Point(this.Location.X +
this.Size.Width,
this.Location.Y);
2697 if (this.creatorForm !=
null && this.creatorForm.hmiWindow !=
null)
2699 this.hmiWindow.Size = this.creatorForm.hmiWindow.Size;
2702 hmiWindow.BringToFront();
2704 customScreenImplementation.HmiScreenContainer = this.hmiWindow.HmiControl;
2706 else if (this.hmiWindow !=
null)
2708 this.hmiWindow.Close();
2711 SyncWithParent(this.creatorForm?.buttonHmi, this.buttonHmi);
2714 private void HmiWindow_FormClosing(
object sender, FormClosingEventArgs e)
2716 customScreenImplementation.HmiScreenContainer =
null;
2717 this.hmiWindow =
null;
2719 this.buttonHmi.Checked =
false;
2722 private void HmiWindow_Activated(
object sender, EventArgs e)
2724 if (customScreenImplementation !=
null)
2726 customScreenImplementation.ActivateHmiScreen();
2730 private void HmiWindow_SizeChanged(
object sender, EventArgs e)
2732 userSettings.HmiWindowWidth = this.hmiWindow.Width;
2733 userSettings.HmiWindowHeight = this.hmiWindow.Height;
2735 if (customScreenImplementation !=
null)
2737 customScreenImplementation.RefreshHmiScreen();
2741 private void CustomScreenImplementation_KeyDown(Runtime.Api.Custom.KeyEventArgs e)
2743 string key =
"Unknown";
2744 if (e is WpfKeyEventArgs)
2746 WpfKeyEventArgs wpfArgs = e as WpfKeyEventArgs;
2747 key = wpfArgs.Key.ToString();
2748 if (wpfArgs.ModifierKey == System.Windows.Input.ModifierKeys.Alt &&
2749 wpfArgs.Key == System.Windows.Input.Key.F4)
2753 else if (wpfArgs.Key == System.Windows.Input.Key.F10 || wpfArgs.Key == System.Windows.Input.Key.LeftAlt || wpfArgs.Key == System.Windows.Input.Key.RightAlt)
2758 else if (e is FormKeyEventArgs)
2760 FormKeyEventArgs formArgs = e as FormKeyEventArgs;
2761 if (formArgs.ModifierKey == Keys.Alt &&
2762 formArgs.Key == Keys.F4)
2766 else if (formArgs.Key == Keys.F10 || formArgs.Key == Keys.Alt)
2770 key = formArgs.Key.ToString();
2773 this.PrintText(
"CustomScreenImplementation_KeyDown(" + key +
")");
2777 private void SampleForm_FormClosing(
object sender, FormClosingEventArgs e)
2780 if (this.globalRuntimeManager !=
null)
2782 this.globalRuntimeManager.StopAll();
2783 this.globalRuntimeManager.ProcedurePending -= ProcedurePending;
2784 this.globalRuntimeManager.ProcedureStarted -= ProcedureStarted;
2785 this.globalRuntimeManager.ProcedurePaused -= ProcedurePaused;
2786 this.globalRuntimeManager.ProcedureContinued -= ProcedureContinued;
2787 this.globalRuntimeManager.ProcedureFinished -= ProcedureFinished;
2788 this.globalRuntimeManager.ProcedureStopped -= ProcedureStopped;
2789 this.globalRuntimeManager.ProcedureAborted -= ProcedureAborted;
2790 this.globalRuntimeManager.InOutParameterValueChanged -= InOutParameterValueChanged;
2793 this.stateVariableImplementation.StateVariableValueChanged -= StateVariableValueChanged;
2795 basicScreenOutputImpl.LogEvent -= PrintText;
2796 customScreenOutputImpl.LogEvent -= PrintText;
2797 loggingOutputImpl.LogEvent -= PrintText;
2798 contextVariableOutputImpl.LogEvent -= PrintText;
2800 stateVariableOutputImpl.LogEvent -= PrintText;
2801 measureOutputImpl.LogEvent -= PrintText;
2802 i18NOutputImpl.LogEvent -= PrintText;
2803 serviceProviderOutputImpl.LogEvent -= PrintText;
2805 sqlOutputImpl.LogEvent -= PrintText;
2806 commonDialogsOutputImpl.LogEvent -= PrintText;
2811 private void SaveSettings()
2813 if (this.creatorForm ==
null)
2816 userSettings.Ptx_Ppx_Directory = cbFilePath.Text.Trim();
2817 userSettings.Ptx_Ppx_DirectoryList =
string.Join(
";", this.cbFilePath.Items.Cast<Object>().Select(item => item.ToString()).ToArray());
2819 userSettings.TraceFileMaxCount = Convert.ToInt32(this.textBoxTraceFileMaxCount.Text.Trim());
2820 userSettings.TraceFileMaxSize = Convert.ToInt32(this.textBoxTraceFileMaxSize.Text.Trim());
2821 userSettings.TraceLevels = RuntimeConfig.Instance.TraceLevel;
2822 userSettings.TracingDirectory = textBoxTraceFolder.Text.Trim();
2824 userSettings.WindowWidth = this.Size.Width;
2825 userSettings.WindowHeight = this.Size.Height;
2826 userSettings.WindowLocationX = this.Location.X;
2827 userSettings.WindowLocationY = this.Location.Y;
2828 userSettings.CustomImplTypes = GetCurrentCustomImpl();
2829 SaveSocketPortOrPipeName();
2831 userSettings.Asynchron = checkBoxAsyncExecution.Checked;
2832 userSettings.Cyclic = checkBoxCyclicExecution.Checked;
2833 userSettings.CyclicReload = checkBoxCyclicReload.Checked;
2834 userSettings.NewRunTimeManager = checkBoxNewRuntimeManager.Checked;
2835 userSettings.AddMessageToOutput = checkBoxAdd2Output.Checked;
2836 userSettings.StartAllParents = checkBoxStartAllParents.Checked;
2838 userSettings.TimeOut = (ulong)Convert.ToInt32(
this.textBoxTimeout.Text.Trim());
2839 userSettings.ConnectionState = checkBoxUseConnectionState.Checked;
2840 userSettings.Ignition = checkBoxIgnition.CheckState == CheckState.Checked ? 1 : (checkBoxIgnition.CheckState == CheckState.Unchecked ? 0 : -1);
2841 userSettings.PollingTime = Convert.ToInt32(this.textBoxPollingTime.Text.Trim());
2842 userSettings.VoltageThreshold = Convert.ToInt32(this.textBoxVoltageThreshold.Text.Trim());
2844 userSettings.RuntimeContextName = this.textBoxRuntimeContextName.Text.Trim();
2846 SaveSettingUtil.Save();
2850 private void SaveSocketPortOrPipeName()
2852 var ipcType = (IpcTypes)comboBoxIpcType.SelectedItem;
2856 case IpcTypes.SOCKET:
2860 userSettings.DiagManagerPort = Convert.ToUInt16(textBoxDiagPortPipe.Text.Trim());
2861 userSettings.RuntimePort = Convert.ToUInt16(textBoxRtPortPipe.Text.Trim());
2862 userSettings.IpcType = IpcTypes.SOCKET.ToString();
2864 catch (System.Exception)
2866 userSettings.DiagManagerPort = SampleConstants.DEFAULT_DM_PORT;
2867 userSettings.RuntimePort = SampleConstants.DEFAULT_RT_PORT;
2874 string diagManagerPipeName = textBoxDiagPortPipe.Text.Trim();
2875 string runtimePipeName = textBoxRtPortPipe.Text.Trim();
2877 userSettings.DiagManagerPipeName = (diagManagerPipeName !=
string.Empty) ? diagManagerPipeName : SampleConstants.DEFAULT_DM_PIPE_NAME;
2878 userSettings.RuntimePipeName = (runtimePipeName !=
string.Empty) ? runtimePipeName : SampleConstants.DEFAULT_RT_PIPE_NAME;
2879 userSettings.IpcType = IpcTypes.PIPE.ToString();
2888 private void textBoxRuntimeContextName_TextChanged(
object sender, EventArgs e)
2890 this.runtimeContextName = this.textBoxRuntimeContextName.Text = this.textBoxRuntimeContextName.Text.Trim();
2891 SetTitle(this.title);
2894 private void listBoxOuput_SelectedIndexChanged(
object sender, EventArgs e)
2896 this.buttonCopyRow.Enabled = this.listBoxOuput.SelectedItems.Count > 0;
2899 private void buttonPause_Click(
object sender, EventArgs e)
2901 lock (this.runtimeContexts)
2903 if (this.buttonPause.Checked)
2905 foreach (IRuntimeContext runtimeContext
in this.runtimeContexts)
2909 runtimeContext.Pause();
2915 foreach (IRuntimeContext runtimeContext
in this.runtimeContexts)
2919 runtimeContext.Continue();
2925 SyncWithParent(this.creatorForm?.buttonPause, this.buttonPause);
2928 private void AddRuntimeContext(IRuntimeContext context)
2930 lock (this.runtimeContexts)
2932 if (!this.runtimeContexts.Contains(context))
2934 this.runtimeContexts.Add(context);
2937 if (!runtimeContextsExecutionStartTime.ContainsKey(context))
2939 runtimeContextsExecutionStartTime.Add(context, DateTime.Now);
2944 private void RemoveRuntimeContext(IRuntimeContext context)
2946 lock (this.runtimeContexts)
2948 if (this.runtimeContexts.Contains(context))
2950 this.runtimeContexts.Remove(context);
2953 if (runtimeContextsExecutionStartTime.ContainsKey(context))
2955 runtimeContextsExecutionStartTime.Remove(context);
2960 private bool IsPauseEnabled()
2962 lock (this.runtimeContexts)
2964 foreach (IRuntimeContext runtimeContext
in this.runtimeContexts)
2976 private bool IsContinueEnable()
2978 lock (this.runtimeContexts)
2980 foreach (IRuntimeContext runtimeContext
in this.runtimeContexts)
2992 private void SetExpectedState()
2994 if (this.useConnectionState)
2996 if (this.KL15State ==
null)
3000 else if (this.KL15State.Value)
3015 private void checkBoxUseConnectionState_CheckedChanged(
object sender, EventArgs e)
3017 this.useConnectionState = this.checkBoxUseConnectionState.Checked;
3018 this.EnableConnectionState();
3019 this.SetExpectedState();
3021 this.labelBatteryState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconBattery16;
3022 this.labelIgnitionState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconIgnition16;
3024 SyncWithParent(this.creatorForm?.checkBoxUseConnectionState, this.checkBoxUseConnectionState);
3027 private void CheckBoxKL15_CheckStateChanged(
object sender, System.EventArgs e)
3029 switch (this.checkBoxIgnition.CheckState)
3031 case CheckState.Checked:
3032 this.KL15State =
true;
3034 case CheckState.Unchecked:
3035 this.KL15State =
false;
3038 this.KL15State =
null;
3042 this.SetExpectedState();
3044 SyncWithParent(this.creatorForm?.checkBoxIgnition, this.checkBoxIgnition);
3047 private void EnableConnectionState()
3049 this.labelExpectedState.Enabled = this.useConnectionState;
3050 this.labelBatteryState.Enabled = this.useConnectionState;
3051 this.checkBoxIgnition.Enabled = this.useConnectionState;
3052 this.labelPollingTime.Enabled = this.useConnectionState;
3053 this.textBoxPollingTime.Enabled = this.useConnectionState;
3054 this.labelVoltageThreshold.Enabled = this.useConnectionState;
3055 this.textBoxVoltageThreshold.Enabled = this.useConnectionState;
3056 this.buttonCheckBatteryIgnition.Enabled = this.useConnectionState;
3059 private void buttonCheckBatteryIgnition_Click(
object sender, EventArgs e)
3061 CheckBatteryIgnitionState(this.globalRuntimeManager);
3063 SyncWithParent(this.creatorForm?.buttonCheckBatteryIgnition, this.buttonCheckBatteryIgnition);
3066 private void textBoxPollingTime_TextChanged(
object sender, EventArgs e)
3070 if (Convert.ToInt32(
this.textBoxPollingTime.Text) <= 0)
3072 this.textBoxPollingTime.Text = defaultPollingTime.ToString();
3077 this.textBoxPollingTime.Text = defaultPollingTime.ToString();
3080 SyncWithParent(this.creatorForm?.textBoxPollingTime, this.textBoxPollingTime);
3083 private void textBoxBatteryVoltageThreshold_TextChanged(
object sender, EventArgs e)
3087 if (Convert.ToInt32(
this.textBoxVoltageThreshold.Text) <= 0)
3089 this.textBoxVoltageThreshold.Text = defaultBatteryVoltageThreshold.ToString();
3094 this.textBoxVoltageThreshold.Text = defaultBatteryVoltageThreshold.ToString();
3097 SyncWithParent(this.creatorForm?.textBoxVoltageThreshold, this.textBoxVoltageThreshold);
3100 private void CheckBatteryIgnitionState(IRuntimeManager runtimeManager)
3102 if (this.useConnectionState)
3104 runtimeManager.DiagConnectionState.PollingTime = Convert.ToInt32(this.textBoxPollingTime.Text);
3105 runtimeManager.DiagConnectionState.BatteryVoltageThreshold = Convert.ToInt32(this.textBoxVoltageThreshold.Text);
3106 ClampState batteryState = runtimeManager.DiagConnectionState.BatteryState;
3107 ClampState ignitionState = runtimeManager.DiagConnectionState.IgnitionState;
3109 SetBatteryIgnitionState(batteryState, ignitionState);
3111 PrintText(
"Check DiagConnection State - BatteryState = " + batteryState.ToString() +
", IgnitionState = " + ignitionState.ToString());
3115 private void SetBatteryIgnitionState(ClampState batteryState, ClampState ignitionState)
3117 switch (batteryState)
3120 this.labelBatteryState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconBatteryNotAvailable16;
3123 this.labelBatteryState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconBatteryOff16;
3126 this.labelBatteryState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconBatteryOn16;
3130 switch (ignitionState)
3133 this.labelIgnitionState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconIgnitionNotAvailable16;
3136 this.labelIgnitionState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconIgnitionOff16;
3139 this.labelIgnitionState.Image =
OpenTestSystem.
Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.IconIgnitionOn16;
3144 private void ShowConnectionStateMessage(IRuntimeContext runtimeContext)
3146 if (runtimeContext !=
null)
3148 System.Media.SystemSounds.Beep.Play();
3150 switch (this.expectedConnectionState)
3153 this.PrintText(
"----------------------------------------------------------------------------------------------------------------------------------------------");
3154 this.PrintText(
"-- Not expected connection state: Either it is not possible to communicate with the VCI or the battery is not connected. Please connect it! --");
3155 this.PrintText(
"----------------------------------------------------------------------------------------------------------------------------------------------");
3158 this.PrintText(
"------------------------------------------------------------------------------------");
3159 this.PrintText(
"-- Not expected connection state: The ignition must be OFF. Please switch it OFF! --");
3160 this.PrintText(
"------------------------------------------------------------------------------------");
3163 this.PrintText(
"----------------------------------------------------------------------------------");
3164 this.PrintText(
"-- Not expected connection state: The ignition must be ON. Please switch it ON! --");
3165 this.PrintText(
"----------------------------------------------------------------------------------");
3173 private void checkBoxAdd2Output_CheckedChanged(
object sender, EventArgs e)
3175 SyncWithParent(this.creatorForm?.checkBoxAdd2Output, this.checkBoxAdd2Output);
3178 private void ParentNumericUpDownSetValue(NumericUpDown numericUpDown,
int value)
3180 var action =
new Action(() => numericUpDown.Value = value);
3181 if (numericUpDown.InvokeRequired)
3182 this.creatorForm.Invoke(action);
3187 private void comboBoxTraceLevel_SelectedIndexChanged(
object sender, EventArgs e)
3189 SyncWithParent(this.creatorForm?.comboBoxTraceLevel, this.comboBoxTraceLevel);
3191 private void txtPassword_TextChanged(
object sender, EventArgs e)
3193 SyncWithParent(this.creatorForm?.txtPassword, this.txtPassword);
3196 private void textBoxTimeout_TextChanged(
object sender, EventArgs e)
3198 SyncWithParent(this.creatorForm?.textBoxTimeout, this.textBoxTimeout);
3201 private void textBoxTraceFileMaxSize_TextChanged(
object sender, EventArgs e)
3203 if (globalRuntimeManager ==
null)
3206 PrintText(
"Set TraceFileMaxSize to " + this.textBoxTraceFileMaxSize.Text);
3210 RuntimeConfig.Instance.TraceFileMaxSize = Convert.ToInt32(this.textBoxTraceFileMaxSize.Text);
3211 SyncWithParent(this.creatorForm?.textBoxTraceFileMaxSize, this.textBoxTraceFileMaxSize);
3214 catch (System.Exception ex)
3217 this.textBoxTraceFileMaxSize.Text = RuntimeConfig.Instance.TraceFileMaxSize.ToString();
3221 private void textBoxTraceFileMaxCount_TextChanged(
object sender, EventArgs e)
3223 if (globalRuntimeManager ==
null)
3226 PrintText(
"Set TraceFileMaxCount to " + this.textBoxTraceFileMaxCount.Text);
3230 RuntimeConfig.Instance.TraceFileMaxCount = Convert.ToInt32(this.textBoxTraceFileMaxCount.Text);
3231 SyncWithParent(this.creatorForm?.textBoxTraceFileMaxCount, this.textBoxTraceFileMaxCount);
3233 catch (System.Exception ex)
3236 this.textBoxTraceFileMaxCount.Text = RuntimeConfig.Instance.TraceFileMaxCount.ToString();
3240 private void WebServerTimer_Tick(
object sender, EventArgs e)
3242 this.UpdateWebServerButton();
3245 int isStartWebSever = -1;
3246 private void UpdateWebServerButton()
3248 if (this.InvokeRequired)
3250 this.Invoke(
new Action(() => UpdateWebServerButton()));
3254 if (customScreenImplementation ==
null)
3256 this.buttonStartStopWebServer.Enabled =
false;
3260 this.buttonStartStopWebServer.Enabled =
true;
3261 if (DefaultCustomScreenImplementation.IsStartedHtmlWebserver())
3263 if (isStartWebSever == 1)
3268 this.buttonStartStopWebServer.Image = global::OpenTestSystem.Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.StopWebServer;
3269 isStartWebSever = 1;
3273 if (isStartWebSever == 0)
3278 this.buttonStartStopWebServer.Image = global::OpenTestSystem.Otx.Runtime2.Api.DotNet.Sample.Properties.Resources.StartWebServer;
3279 isStartWebSever = 0;
3283 private void buttonStartStopWebServer_Click(
object sender, EventArgs e)
3285 if (this.InvokeRequired)
3287 this.Invoke(
new Action(() => buttonStartStopWebServer_Click(sender, e)));
3291 if (customScreenImplementation ==
null)
3296 if (!DefaultCustomScreenImplementation.IsStartedHtmlWebserver())
3298 customScreenImplementation.StartHtmlWebServer();
3302 customScreenImplementation.StopHtmlWebServer();
Namespace containing all interfaces for custom implementations
Definition: IBasicScreenImplementation.cs:7
Namespace which contains all supported data types
Definition: BlackBox.cs:5
Namespace containing exceptions
Definition: ConnectionStateException.cs:7
Namespace containing all objects related to licensing
Definition: IpcLicenseCheckerBase.cs:10
Namespace for browsing at OTX data structure.
Definition: IContextVariable.cs:5
Namespace containing main entries: IProject and IPlayerProject.
Definition: IPlayerProject.cs:5
Namespace containing the programming interface for browsing and execution of OTX procedures in own ap...
Definition: ApiConstants.cs:5
ExecutionStateChangeReason
Reason, why a procedure execution state was changed, e.g. Paused or Running
Definition: ExecutionStateChangeReason.cs:13
TraceLevels
Enumeration of TraceLevels.
Definition: TraceLevels.cs:8
ClampState
Contains the state of a clamp
Definition: ClampState.cs:13
ExecutionState
Contains the state of the runtime context.
Definition: ExecutionState.cs:7
ExpectedState
Contains the expected state of the diagnostic connection
Definition: ExpectedState.cs:13
Namespace containing all objects for browsing and execution of OTX procedures
Definition: ApiConstants.cs:5
Namespace containing all objects which are standardized according to ISO 13209 (OTX)
Namespace containing all objects related to testing inside automotive industry