38 bool controller_found =
false;
42 Console.WriteLine(
"Searching...");
47 foreach (
string request
in requests)
49 Console.WriteLine(request);
52 }
while (requests.Count() < 1);
54 foreach (
string request
in requests)
56 string[] controller_params = request.Split(
new string[] {
", " }, StringSplitOptions.None);
61 if (controller_params.Count() < 5)
63 Console.WriteLine(
"Unexpected controller format");
67 string mac = controller_params[2];
68 string ip = controller_params[4];
71 if (serial_num == controller_params[1])
73 Console.WriteLine(
"Controller Match Found");
74 controller_found =
true;
77 string[] ip_bytes = ip.Split(
'.');
80 string new_ip = $
"{ip_bytes[0]}.{ip_bytes[1]}.{ip_bytes[2]}.{address}";
91 Console.WriteLine(
"IP Address assigned");
100 if (!controller_found)
101 Console.Write(
"No controller matched the entered serial number");
const int GALIL_EXAMPLE_OK
Examples success code.
const int GALIL_EXAMPLE_ERROR
Examples error code.
void GAssign(string ip, string mac)
Assigns IP address over the Ethernet to a controller at a given MAC address.
void GOpen(string address)
Used to open a connection to Galil hardware.
string GCommand(string Command, bool Trim=true)
Used for command-and-response transactions.
string GInfo()
Provides a useful connection string.
string[] GIpRequests()
Provides a list of all Galil controllers requesting IP addresses via BOOT-P or DHCP.
Provides a class that binds to gclib's unmanaged dll. Wraps each call and provides a more user-friend...
static int IP_Assigner(gclib gclib, string serial_num, byte address)
Assigns controller an IP Adress given a serial number and a 1 byte address.