Skip to content

Set up a protocol stack in your application

To be able to communicate with the reader via the SDK, set up a protocol stack object. In short, this means defining the parameters of the physical interface and adding upper layers such as authenticated and encrypted communication. You can use this object to connect to the reader and exchange BRP commands.

Implement protocol life cycle

These are the phases of the protocol life cycle you need to implement in your application.

Create

  • Run brp_create() to create the protocol stack object.

  • Run brp_set_io() to assign a physical interface (I/O) object to the protocol stack. To create a physical interface object (including matching set of communication parameters), do the following depending on your interface:

  • To set up authenticated and encrypted communication, run the required commands for AES or PKI respectively.

Connect

  • Run brp_open() to create a physical connection to the reader. This has the following effects:
    • The library provides exclusive access to the reader and performs all operations necessary to set up a session.
    • The protocol state machine of the reader is kept in sync with the protocol state machine of the library.

Communicate

Now you can send your actual commands to the reader.

Multithreading not supported

The application must ensure that only 1 thread accesses a reader at a time. When communicating with multiple readers, each reader may be controlled by a separate thread (in this case, no synchronization is required).

There are 2 options to run a command:

  • Run API functions:
    If you develop in C, you can run any BALTECH API functions.

  • Send BRP commands:
    For all programming languages other than C, run brp_exec_cmd() and specify the appropriate command from the BRP commands reference as part of the function's arguments.

    Consider frame sizes

    All firmware versions support a minimum size of 128 byte for command and response frames combined. If you need more, please run Sys.GetBufferSize to check the maximum frame size supported by your readers' firmware version.

Which commands do I need to run?
Please refer to the Run commands section on your workflow overview page.

Disconnect

Run brp_close() to reset the reader to the state before you ran brp_open. This has the following effects:

  • The corresponding OS resource is released.
  • The reader can be accessed by a different application.

You can repeat the steps Connect, Communicate, and Disconnect as often as needed.

Destroy

Run brp_destroy() to end the lifecycle of the protocol stack. This will release the memory occupied by the physical interface and all protocols based on it. Thus, you don't need to separately destroy all protocols you have assigned using brp_set_io().

brp_destroy() implicitly executes brp_close() and thus ensures that all OS resources are released.

Try it out with our app notes

The following app notes in the SDK give you working examples of the implementation for the supported host interfaces.

  • USB HID: appnotes\usb_hid
  • RS-232/UART or virtual COM port: appnotes\usb_cdc
  • Ethernet:

Learn more about app notes

You're not interested in the source code, but need a connection to test reader interaction? Then we recommend the following:

  • Ethernet server: Run the precompiled app note \binaries\winXX\release\appnote_tcp_server.exe.
  • All others: Use the options Test Autoread Configuration and Test VHL File in BALTECH ID-engine Explorer. If you haven't installed it yet, you can download it here as part of BALTECH ToolSuite.
Title