Python Wrapper (legacy)

Notice!

Our initial python library was actually what would best be described as a 'wrapper'. It simply wrapped our ASCII commands into a set of equivalent Python functions. This served as well, but was a temporary solution to buy us time to produce a much more powerful library. We highly encourage everyone to use our new Python package which is packed with features:
This page and the others in this section are left for historical purposes. This 'wrapper' library remains available and we'll continue to support customers using it, however all future improvements will be implemented only in our new library.

Documentation

The packaged releases contains two libraries:

binhoHostAdapter

This library is essentially a wrapper for all of the commands presented in the ASCII Command Set documentation. The library is written in such a way to support multiple devices as well as properly handling INTERRUPTS by making use of threads.

binhoUtilities

This library provides a handful of functions which aid in device management, as in identifying COM ports and Binho devices attached to the host computer.
Here's where the releases live on PyPi:
binho-host-adapter
PyPI

Installation

The officially-supported Python library can easily be installed using pip:
1
pip install binho-host-adapter
Copied!
This library is cross-platform and is intended for use with Python 3.x.

Example Usage

1
from binhoHostAdapter import binhoHostAdapter
2
from binhoHostAdapter import binhoUtilities
3
4
print("Demo Script with Binho Host Adapter Python Libraries")
5
print
6
7
utilities = binhoUtilities.binhoUtilities()
8
devices = utilities.listAvailableDevices()
9
10
if len(devices) == 0:
11
print("No Devices Found!")
12
exit()
13
14
elif len(devices) == 1:
15
COMPORT = devices[0]
16
print("Found 1 attached adapter @ " + devices[0])
17
print
18
else:
19
COMPORT = devices[0]
20
print("Found more than 1 attached adapter, using first device found on " + COMPORT)
21
print
22
23
print("Opening " + COMPORT + "...")
24
print
25
26
# create the binhoHostAdapter object
27
binho = binhoHostAdapter.binhoHostAdapter(COMPORT)
28
29
print("Connecting to host adapter...")
30
print(binho.getDeviceID())
31
print
Copied!
There are also many examples of the python libraries in action in the examples section of the support portal:

API Reference

The library contains two classes, each with a distinct purpose. Please see the following pages for the documentation on each of these classes.
Functions to connect to a host adapter and interact with it:
Utility functions for device discovery and management:
Last modified 7mo ago