C API Reference

This section of the Acroname BrainStem Reference covers the lower level C programming interface. This reference assumes that you understand the BrainStem system. If you would like to get started using BrainStem, please see the following sections of the Reference documentation.

Most users will want to begin with the C++ API or Python libraries, but for some specialized applications, or applications that must be ANSI C only, the C API provides access a little closer to the metal than the other APIs. To use the C api effectivley you will need to understand a little more about the BrainStem protocol, and particularly about UEI’s and their significance.


Modules

group aDefs

Acroname Specific Universal Defines and includes.

The C-Interface requires some specific defines for cross platform compatibility. The aDefs.h file contains those defines and includes that are necessary at a global level across platforms.

Things like a cross platform way to specify line endings, safe c-string copy and concatenation operations, and boolean typedefs when they are not defined by default.

We rely on the following std headers:

  • assert.h

  • stddef.h

  • stdint.h

  • stdbool.h

  • string.h

  • stdio.h

  • stdlib.h

group aDiscovery

Link Discovery Interface.

aDiscovery.h 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.

group aErrors

Unified list of Error codes for BrainStem module Interation.

aError.h provides a unified list of error codes. These error codes apply accross all API’s. Library functions will return one of these error codes when appropriate.

group aFile

Platform Independent File Access Interface.

aFile.h provides a platform independent interface for opening, reading, and writing files.

group aLink

BrainStem Link Interface.

aLink.h provides the interface for creating and maintaining the link to a BrainStem module, and the BrainStem network. It includes facilities for starting and stopping links, as well as sending and receiving BrainStem protocol packets.

group aMutex

Platform Independent Synchronization Primitive.

aMutex.h Provides a platform independent synchronization mechanism. The link interface and the packe fifos both use this interface for synchronization between threads. Includes facilities for creating, locking and unlocking mutex primitives.

group aPacket

BrainStem Packet.

aPacket.h Provides and interface for creating and destroying BrainStem Protocol packets.

group aProtocoldefs

BrainStem Protocol Definitions.

aProtocoldefs.h Provides protocol and BrainStem specific defines for entities, communication, and protocol specifics.

group aStream

Platform Independent Stream Abstraction.

aStream.h provides a platform independent stream abstraction for common I/O streams. Provides facilities for creating and destroying as well as writing and reading from streams.

group aTime

Basic Time procedures Sleep and Get process tics.

aTime.h provides a platform independent interface for millisecond sleep, and for getting process tics.

group aVersion

Library version interface.

aVersion.h Provides version information for the BrainStem2 library.

group aUEI

UEI Utilities.

aUEI.h Provides structs and utilities for working with UEIs.