gclib  2.0.8
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
string GCommand(string Command, bool Trim=true)
Used for command-and-response transactions.
Definition: gclib.cs:257
Provides a class that binds to gclib's unmanaged dll. Wraps each call and provides a more user-friend...
Definition: gclib.cs:68
´╗┐partial Module Examples
Definition: Commands.vb:4