3 - Connection Types
DynaPro Go| Handheld PIN Pad Device with MSR/Contact/Contactless | Programmer’s Manual (COMMANDS)
Page 28 of 247 (
D998200136-31
)
3.1.3
How to Send Commands On the USB Connection
Because some of the devices documented here support connection types beyond USB, this documentation
abstracts host-device communication by referring to
Commands
, which are often a pairing of a
Request
from the host and a corresponding
Response
from the device. This section explains how these terms
apply when using the USB HID connection.
When the device is connected to the host via USB, the host generally sends a
Set Feature Report
to the
device to send the requests for commands, and sends a
Get Feature Report
to the device to retrieve
status, and then synchronous response data when appropriate. The host should send both Feature Report
types using the default Control pipe using a blocking call to the operating system’s native USB libraries.
The device NAKs the Status page of a
Set Feature Report
until it finishes the requested operation, and if
it does not respond, the operating system will generally time out and report failure. This method ensures
that as soon as the device has fulfilled the command request embedded in the
Set Feature Report
, the
host software can immediately call a follow-up
Get Feature Report
to retrieve the command status and
then the device response, if one is required, and that the host software will not hang on a blocking call
indefinitely. In some cases, the host may simply send a
Get Feature Report
directly (“call the command
in Get mode”) without a preceding
Set Feature Report
; the command documentation is specifically
explains these cases.
The host should follow this general sequence to send a command request, determine status, and retrieve
response data from the device when appropriate:
1)
Choose the command to invoke from section
. Every command has a corresponding
Command Number
listed in the header of its documentation section. The host should use that
command number as the report’s
Feature ID
.
2)
Determine whether the command should be called in
Set
mode or
Get
mode. If the command
documentation does not explicit state it, assume Set mode.
3)
If the command should be called in Set mode:
a)
Construct and send a
Set Feature Report
using the Usage / Request table in the command
documentation.
b)
Construct and send a
Get Feature Report
. The report
includes the command number being acknowledged and a one-byte status indicating whether the
device accepted the command.
c)
If the command documentation states the command should then be called in Get mode to retrieve
the device’s response, the host must send a followup
Get Feature Report
for the original
command. The response is formatted per the Get Mode / Response table in the command
documentation. For some commands, the host should instead listen for the device to send an
asynchronous response via an HID
Input Report
using a USB Interrupt IN transaction when the
command finishes executing. For other commands, no follow-up to get response data is required.
4)
If the documentation specifies the command should be called in Get mode, simply construct and send
a
Get Feature Report
, and interpret the device’s response using the Usage / Response table in the
command documentation.