Bluetooth HID Mode
Introduction
The Bluetooth® module in some TSL® readers is able to present the reader to the host as an HID keyboard. In this mode the data read by the reader is sent to the host as if it were typed on the host’s keyboard. This mode has the advantage that the reader can be used with existing software without change. For instance connect to a windows PC via Bluetooth® HID mode, open MS Word and then everything that is read by the reader appears in the document as if it was typed. There are however some things to bear in mind. Bluetooth® HID mode data throughput is typically about 40 characters per second making the reading of large transponder populations slow. You are limited to two programmable read actions (single press and double press) so complex read operations are not possible. UHF transponders can cause problems if you only want to read a single transponder. Long read range, wide beam angle, variations in transponder performance, multi-path, local environment, etc. all combine to add uncertainty. The transponder immediately in front of the reader may not be the one the reader receives the strongest signal from.
Configuring a Reader
The HID mode settings, like all other settings of the UHF reader, are configured using command parameters. Once a parameter has been set it keeps that value until it is changed again or the reader powers down. To make a reader power on with parameters other than the default configuration a micro SD card needs to be installed into the reader and an auto-run file deployed to the card to setup the required parameters. Further information can be found in the application note on setting up an auto-run file. Examples of configurations can be found later in this document.
Pairing
Pairing is achieved in the normal manner for your device, if prompted the default pin is 0000. The reader will automatically disconnect if the trigger is not used for 60 seconds. (Configurable using the .st –h option). The reader will automatically try to reconnect to its paired device when it wakes. The reader can only be paired to one device, if you want to connect to a different device delete the pairing from the old device first.
Trigger Action
The trigger in HID mode has no auto-repeat facility. Pressing the trigger will perform one inventory/read/barcode action and stop until the trigger is released and pressed again.
HID ASCII Commands
There are two specific HID commands .hd and .hs these configure the HID mode configuration for the switch double press action and the switch single press action. The action that is performed by the each switch is controlled by the switch action command .sa Both the .hd and .hs commands operate in the same way but for the associated switch press action. The command controls the header (prefix) and termination (suffix) characters that are sent around the scanned data and also whether the transponder data is sent as ASCII Hex or just ASCII.
Header (Prefix) and Termination (Suffix) Key Codes
Each header (prefix) or terminator (suffix) is specified as up to two key presses. They are configured by specifying the two character hex code for each key press to be sent. ‘ff’ is used to specify to not send a key. As well as sending printable ASCII characters some non-printable key presses can also be sent (for example tab or cursor keys) the codes are available in the ASCII Protocol documentation along with HID commands. Some examples are provided in the table below:
Required key presses | Parameter value |
---|---|
‘A’ ‘B’ | ‘4142’ |
‘A’ ‘a’ | ‘4161’ |
‘z’ | ‘7aff’ |
{Cursor down} | ‘82ff’ |
‘,’ {tab} | ‘2c09’ |
‘@ ‘%’ | ‘4025’ |
Barcode
When a barcode is scanned there is an optional barcode header (-bh parameter) and optional barcode terminator (-bt parameter). When a barcode is scanned with a switch press it is sent in HID mode as
[Barcode header] [Barcode data] [Barcode terminator]
So if the barcode header is set to ‘B’ ‘>’ (‘663e’) and the terminator is set to {enter} (‘0aff’) and the barcode 123ABC was scanned the following key sequence is sent to the host ‘B>123ABC{enter}’
Transponder ASCII Mode
Transponder data is typically sent as hex ASCII using two ASCII characters per eight bits of the binary data. In some applications the transponder EPC or data stored in the transponder may be encoded as ASCII data (i.e. the binary data is actually a sequence of eight bit ASCII characters). If this is the case then the HID command can be used to specify to send transponder data as ASCII rather than ASCII HEX (-td parameter). When in ASCII mode and a non ASCII character is encountered then it is sent as a hex code in brackets.
Transponder data ‘414243444546303132333435’
ASCII mode ‘ABCDEF012345’
HEX mode ‘414243444546303132333435’
Transponder data ‘313233343536A041’
ASCII mode ‘123456[A0]A’
HEX mode ‘313233343536A041’
In the example above the non ASCII ‘A0’ is sent as ‘[A0]’
Transponders
When a transponder inventory or read operation is performed multiple transponders can be returned in one command. In addition to the header and terminator that are sent around transponder EPCs and transponder data read there is also a header and terminator for the entire inventory cycle or read cycle. When specified and the cycle is performed the cycle header and terminator are always sent even if no transponders are reported in the cycle.
Inventory cycle sequence for one transponder
[Inventory cycle header]
[Transponder EPC header] [Transponder EPC] [Transponder EPC terminator]
[Inventory cycle end]
Inventory cycle sequence for three transponders
[Inventory cycle header]
[Transponder EPC header] [Transponder EPC] [Transponder EPC terminator]
[Transponder EPC header] [Transponder EPC] [Transponder EPC terminator]
[Transponder EPC header] [Transponder EPC] [Transponder EPC terminator]
[Inventory cycle end]
Read cycle sequence for two read transponders
[Read cycle header]
[Transponder EPC header] [Transponder EPC] [Transponder EPC terminator]
[Transponder data header] [Transponder data] [Transponder data terminator]
[Transponder EPC header] [Transponder EPC] [Transponder EPC terminator]
[Transponder data header] [Transponder data] [Transponder data terminator]
[Read cycle end]
Inventory and Read Command HID Parameters
Two new parameters have been added to the inventory .iv and read transponder .rd commands to support HID mode. These parameters are include EPC (-ie) and filter to strongest transponder only (-fs)
Include EPC (-ie)
By default the include EPC parameter is on so that the EPC is sent for each transponder scanned. If you require to only send data read from the transponder without the EPC then you can set the include EPC parameter to off. In this way for each transponder only the read data is returned without the EPC.
Filter to Strongest (-fs)
By default the filter to strongest parameter is off, all transponders returned by the transponder command are returned to the host. In HID mode it may be desirable to send only one transponder, to behave more like a barcode replacement scanning mode. With the filter to strongest parameter set to on the transponder command will complete determining which transponder in the response had the strongest RSSI signal and only the one transponder is sent to the host.
Example Configurations
To provide the reader with a custom HID mode configuration requires a micro-SD card to be fitted to the reader. On the card place a file called ‘AUTO.TXT’ containing a sequence of configuration commands – this file will be executed each time the reader powers up. Note that many of the commands used in the examples rely on power up default parameter values.
The default for the reader in HID mode produces the following output when scanning transponders:
3038000000000000004B495A
54534C5F5461675F30303039
Default barcode output appears like this:
12345678
2112345678917
Some examples of configuration file content are provided in the following sections.
Specifying Data Type
Description:
To receive transponder data as ASCII we change the default single press trigger action
(.hs)
to return ASCII data (-td asc)
Autorun file contents:
.hs -td asc
Example output (1 ASCII EPC, 1 Hex EPC):
TSL_Tag_0007
08[00][00][00][00][00][00][00]KIZ
Changing Headers and Terminators
Description:
To receive each Inventory cycle on a separate line and separate each transponder by a comma and a space we can change the default single press trigger action (.hs) to precede each inventory cycle with a newline (-ih ff0d). For each transponder EPC identifier we set the header characters to nothing (-eh ffff) and the terminator (-et) to the ASCII characters for a comma (2c) and a space (20).
Autorun file contents:
.hs -ih ff0d -eh ffff -et 2c20
Example output
54534C5F5461675F30303039, 54534C5F5461675F30303033,
Description:
To place ‘/’ (ASCII character code 2f) around each transponder EPC we change the default single press trigger action (.hs) to use a header (-eh) of ‘/’ (2f) and no second character (ff). The terminator (-et) is set to ‘/’ (2f) and a newline character (0d).
Autorun file contents:
.hs -eh 2fff -et 2f0d
Example output
/54534C5F5461675F30303039/
/3038000000000000004B495A/
Changing Inventory Operation
Description:
Configure the inventory (.iv), which is the default single press trigger action, to read only the tag with the strongest response (-fs on). Reduce the antenna power to 10 dBm to limit the inventory range (-o 10). Use the no action flag (-n) to prevent execution and only set parameter values.
Autorun file contents:
.iv -n -fs on -o 10
Example output
3038000000000000004B495A
Using Multiple Commands
Description:
This configuration will output partial EPC identifiers onto separate lines. The command sequence is as follows: Configure (.sa) the single press trigger action to the read command (-s rd).
Configure the read command (.rd) to not return the normal EPC identifier (-ie off) but to extract a partial EPC from the tag EPC memory. Return as data 5 words of the EPC (-dl 05) starting at word 3 of the EPC memory (-do 0003). e.g. this returns the last 20 hex digits of a 96-bit EPC. Use the no action flag (-n) to prevent execution and only set parameter values.
Note: Both the –dl and –do parameters use hex numbers. The .rd command reads the EPC memory by default. EPC memory starts with the 16-bit CRC followed by the 16-bit Protocol Control (PC) value so the data for the EPC identifier starts at word offset 2.
Autorun file contents:
.sa -s rd
.rd -n -ie off –dl 05 –do 0003
Example output
4C5F5461675F30303039
000000000000004B495A
Description:
This configuration extracts the first 2 words of the TID memory bank and outputs, on a separate line for each transponder, the EPC identifier and the TID data, surrounded with ‘/’ characters. The command sequence is as follows:
Configure (.sa) the double press trigger action (-d) to read data from the tag (rd).
Configure the read command (.rd) to return 2 words (-dl02) from the start (-do0000) of the TID memory bank (-dbtid). Use the no action flag (-n) to prevent execution and only set parameter values.
For the double press trigger action (.hd) follow each transponder EPC response with comma and a space (-et 2c20) then precede TID data with a ‘/’ (-dh 2fff) - follow TID data with a ‘/’ and a newline character (-dt 2f0d) to place each transponder’s response on a separate line.
Autorun file contents:
.sa -d rd
.rd -n -dbtid -dl02 -do0000
.hd -et 2c20 -dh 2fff -dt 2f0d
Example output
54534C5F5461675F30303033, /E2801105/
3038000000000000004B495A, /E2006806/
Frequently Asked Questions
Why Are Keys Appearing So Slowly?
The rate at which keys are typed to a Bluetooth® host is dependent on the host. The key presses are requested by the host and the UHF reader returns the next keystroke from its buffer. The HID standard recommends that the host polls the ‘keyboard’ at a rate of about 80 per second. Each key press is sent as a key down followed by a key up which means that about 40 characters per second is a typical rate. In reality Bluetooth® host devices may request key strokes slower or faster than this.