Click or drag to resize

Tutorial

This tutorials will give you straight-and-simple 1-2-3 style operations about the usage of SDK library.

This article don't involve too much details. If you need comprehensive understanding, please read the complete manual topic, and not just the tutorial.

Get available ports in local host

The port is the interface where device connects. Using GetPortName methods of Host class to list all available ports in the local host (computer).

Below sample code lists all available ports.

C#
for (i = 0; i <= (_host.GetPortCount() - 1); i++)
{
    debug.print(_host.GetPortName(i));
}
Connect to Device (USB/COM/TCP/BLE)

Using Connect method to open the port where device connects for subsequent APIs calling.

You can get all available port name by using GetPortCount and GetPortName APIs. The port name contains the interface name (COM/USB/TCP/BLE) and relevant required parameter (port number,IP-address or MAC address).

For the USB interface, the port name will start with "USB" or "COM".

For the TCP interface, the port name will start with "TCP".

For the BLE interface, the port name will start with "BLE".

port List

Below sample code shows using Connect method to connect to device. The second parameter baudrate is only used for COM port interface, for the other interface, the baudrate will be ignored.

C#
_uhf.Connect("USB1","AUTO");
C#
_uhf.Connect("TCP:TS100A_4669BD:1001 [IP:192.168.100.150]","AUTO");
C#
_uhf.Connect("BLE3 (0c:d2:92:3e:1e:70-18:7a:93:4c:1c:3d)","AUTO");
Start Inventory

Using StartInventory method to start the process of an inventory round.

Some devices (TS800) may need call SetTriggerType method to indicate the way of triggering the inventory round.

You can get the inventory tag data (EPC/TID) from the OnTagPresented event.

Below sample code shows using StartInventory method and indicates the return data format is PC+EPC+TID.

C#
_uhf.StartInventory(TagPresetnedType.PC_EPC_TID);
Stop Inventory

Using StopInventory method to stop the process of inventory round.

Below sample code shows using StopInventory method.

C#
_uhf.StopInventory();
Adjust RF Power

Increase the RF output power may increase the reading tag distance. Using SetRfPower method to adjust the RF output power.

Below sample code shows using SetRfPower method to adjust the RF output stregth (19 dbm).

C#
if ((_uhf.SetRfPower(false, 19))) {
    MsgBox("Set RF Power Successful.");
}

The first parameter indicates if you want to save the change to EEPROM.

Read Tag Data

Using ReadTag method to read the tag data.

Below sample code shows using ReadTag method to read your wanted memory bank data.

C#
dataByteArray = _uhf.ReadTag("00000000", UHF.MemoryBank.EPC, 0, 0);
if (dataByteArray != null) {
    // read OK
} else {
    //read failed
}
Write Tag Data

Using WriteTag method to write the data to tag memory.

Below sample code shows using WriteTag method to write binary data to the given memory bank.

C#
result = _uhf.WriteTag("00000000", UHF.MemoryBank.EPC, 2, writeDataByteArray);

if (result==true) {
    MsgBox("Write Successful.");
} else {
    MsgBox("Write Failed.");
}