Package Structure

The BrainStem package consists of a number of modules, which together form the BrainStem python API.

brainstem.module

A module that provides base classes for BrainStem Modules and Entities.

The Module and Entity classes are designed to be extended for specific types of BraiStem Modules and Entities. For more information about Brainstem Modules and Entities, please see the Terminology section of the Acroname BrainStem Reference

brainstem.stem

Provides specific module instances, and entity functionality.

The Module and Entity classes contained in this module provide the core API functionality for all of the Brainstem modules. For more information about possible entities please see the Entity section of the Acroname BrainStem Reference

brainstem.discover

A module that provides methods for discovering brainstem modules over USB and TPCIP.

The discovery module provides an interface for locating BrainStem modules accross multiple transports. It provides a way to find all modules for a give transport as well as specific modules by serial number, or first found. The result of a call to one of the discovery functions is either a list of brainstem.link.Spec objects, or a single brainstem.link.Spec.

The Discovery module allows users to find specific brainstem devices via their serial number, or a list of all devices connected to the host via usb or on the same subnet via TCP/IP. In all cases a Spec object is returned with connection details for the device. In addition do connection details, the BrainStem model is returned. This model is one of a list of BrainStem device model numbers which are accessible via the defs module.

A typical interactive python session finding all connected USB modules might look like the following.

>> import brainstem >> module_list = brainstem.discover.findAllModules(brainstem.link.Spec.USB) >> print [str(s) for s in module_list] [‘Model: 4 LinkType: USB(serial: 0xCB4A3B25, module: 0)’, ‘Model: 13 LinkType: USB(serial: 0x40F5849A, module: 0)’]

For an overview of links, discovery and the Brainstem network see the Acroname BrainStem Reference

brainstem.defs

A module that provides defines and constants useful for working with the python library.

brainstem.result

A module that provides a result class for returning results of UEI commands.

Results consist of an error attribute and a value attribute. If the error attribute is set to NO_ERROR, then the result value is the response to the UEI command that was sent.

For more information about return values for commands and UEI’s see the Acroname BrainStem Reference

brainstem.version

Provides version access utilities.