gclib  1.36.3
Communications API for Galil controllers and PLCs
examples.cs
Go to the documentation of this file.
1 
14 using System;
15 
16 namespace examples
17 {
26 
27  public static partial class Examples
28  {
29  public const int GALIL_EXAMPLE_OK = 0;
30  public const int GALIL_EXAMPLE_ERROR = -100;
31 
39  public static void PrintError(gclib gclib, Exception ex)
40  {
41  Console.WriteLine(ex.Message);
42 
43  //If exception was not a GOpen() exception, safe to query
44  //the controller for a human readable error string
45  if(!ex.Message.Contains("-1101"))
46  Console.WriteLine(gclib.GCommand("TC 1"));
47  }
48  }
50 }
static void PrintError(gclib gclib, Exception ex)
Prints the exception to the console and queries the controller for the most recent error message.
Definition: examples.cs:39
const int GALIL_EXAMPLE_OK
Examples success code.
Definition: examples.cs:29
const int GALIL_EXAMPLE_ERROR
Examples error code.
Definition: examples.cs:30