Monday, March 5, 2012

Advanced General Purpose Output (GPO)

Have you ever wanted a way to easily program indicators, such as a stack light, to notify when the Speedway Revolution reader has lost Ethernet connection, is inventorying tags and/or reading tags, or is even functioning (perhaps power unplugged)? How about setting a pulsed duration of the GPO event(i.e. reading and/or encoding tags on a conveyor belt)?

If so, then Advanced GPO functionality is what you are looking for!
You can control the advanced GPO feature of Speedway Revolution readers using this custom parameter.

When set to Normal (default) the GPO is set via the regular LLRP SET_READER_CONFIG
message.
When set to Pulsed, the GPO changes state based on the SET_READER_CONFIG
message, and will change to the opposite state after GPOPulseDurationMSec milliseconds.
When set to "Reader_Operational_Status‟, "LLRP_Connection_Status", "Reader_Inventory_Status‟, "Network_Connection_Status‟ or "Reader_Inventory_Tags_Status‟ the GPO status acts like a Boolean value. When high (true, 1), the corresponding status is true, meaning the reader is operating, has a LLRP connection, is inventorying, has a network connection or tags are being singulated (respectively).
When low (false, 0), the opposite is the case.

The following code sample shows to configure advanced GPO using the LLRP Toolkit (LTK). The method below creates a SET_READER_CONFIG message on the reader that allows for "Reader_Operational_Status‟, "LLRP_Connection_Status", "Reader_Inventory_Status‟, "Network_Connection_Status‟ or "Reader_Inventory_Tags_Status‟ property to be enabled.

Be sure to send the message: msg.AddCustomParameter(GPO) and to do error checking/handling using MSG_SET_READER_CONFIG_RESPONSE.

private void button4_Click(object sender, EventArgs e)
{
if (btnOpen.Text == "Close")
{

MSG_SET_READER_CONFIG msg = new MSG_SET_READER_CONFIG();

PARAM_ImpinjAdvancedGPOConfiguration GPO = new PARAM_ImpinjAdvancedGPOConfiguration();
GPO.GPOPortNum = 1;
GPO.GPOMode = new ENUM_ImpinjAdvancedGPOMode();
if (rbNormal.Checked == true)
{
GPO.GPOMode = ENUM_ImpinjAdvancedGPOMode.Normal;
}
else if (rbLLRP.Checked == true)
{
GPO.GPOMode = ENUM_ImpinjAdvancedGPOMode.LLRP_Connection_Status;
}
else if (rbPulsed.Checked == true)
{
GPO.GPOMode = ENUM_ImpinjAdvancedGPOMode.Pulsed;
GPO.GPOPulseDurationMSec = 2000;
}
else if (rbInventory.Checked == true)
{
GPO.GPOMode = ENUM_ImpinjAdvancedGPOMode.Reader_Inventory_Status;
}
else if (rbOperatioinal.Checked == true)
{
GPO.GPOMode = ENUM_ImpinjAdvancedGPOMode.Reader_Operational_Status;
}

else if (rbITS.Checked == true)
{
GPO.GPOMode = ENUM_ImpinjAdvancedGPOMode.Reader_Inventory_Tags_Status;
}
else if (rbNCS.Checked == true)
{
GPO.GPOMode = ENUM_ImpinjAdvancedGPOMode.Network_Connection_Status;
}
else MessageBox.Show("Error setting GPO Mode");


msg.AddCustomParameter(GPO);

MSG_SET_READER_CONFIG_RESPONSE rsp = reader.SET_READER_CONFIG(msg, out msg_err, 12000);

if (rsp != null)
{
textBox2.Text = rsp.ToString();
}
else if (msg_err != null)
{
textBox2.Text = rsp.ToString();
}
else
textBox2.Text = "Commmand time out!";
}
else MessageBox.Show("Please Open Reader and continue");

}


Here is a video showing Advanced GPO in action!