As with any new technology, the first thing to do is to create a Hello World! application to ensure get to grips with the basics.
This assumes the following:
In order to connect to any PIXL on the network a Channel is required. A Channel is used for all communications with the PIXL, and can be created with the GetPIXLChannel method of the PIXLClient class.
Get a gRPC channel for the PIXL |
Copy Code
|
---|---|
var channel = PIXLClient.GetPIXLChannel();
|
Alternatively, in order to connect to a specific PIXL two pieces of information are required:
Both the host and the port are displayed on the 'Settings/API' panel of the PIXL UI software. From the host and port we can determine a Channel.
Get a gRPC channel for the PIXL (assuming an IP address of 127.0.0.1 and gRPC port 50052) |
Copy Code
|
---|---|
var channel = PIXLClient.GetPIXLChannel("127.0.0.1", 50052); |
With the channel we can create a new instance of the PIXLClient class.
Creating an instance of the PIXLClient class |
Copy Code
|
---|---|
var pixl = new PIXLClient(channel); |
This will open a connection to the PIXL at the provided IP address and gRPC port. To test the connection we can read the Serial Number from the PIXL and display it on the Console.
Displaying the PIXL's Serial Number on the Console. |
Copy Code
|
---|---|
Console.WriteLine(pixl.SerialNumber); |
To summarise the code should look like this:
Full example |
Copy Code
|
---|---|
var channel = PIXLClient.GetPIXLChannel("127.0.0.1", 50052); var pixl = new PIXLClient(channel); Console.WriteLine(pixl.SerialNumber); |
So far we have created a channel from an IP address and gRPC port, instantiated a new instance of the PIXLClient class and read the PIXL's serial number. This is the equivalent of the PIXL saying Hello World!