BrainStem 2.3.0 Release

2016 July 18

 

Get it while its hot off the presses at acroname.com/software

The 2.3 release is made up of two parts:

  1. Simple name changes in order to align the C++ and Python API's.  These changes can be found below.  Additionally, a few methods were added and a few were removed in order to work with the link management changes which are described next.
  2. Stream object are no longer required to create their own link objects. The link is now managed so that only a single link is created to communicate to any device. Communications to other devices routed via the I2C BrainStem network all use the same link to the router. This link is also now responsible for managing the stream for both USB and TCPIP devices, thus allowing multiple clients to access the same device.

C++:

  • Added - Link::discover()
  • Added - Link::getStatus()
  • Changed - uint8_t Link::getModuleAddress(void) -> aErr Link::getModuleAddress(uint8_t *)
  • Removed - Module::setLink()
  • Removed - Module::clearLink()
  • Added - Module::getStatus()
  • Added - Module::reconnect()
  • Added - Module::connectThroughLinkModule(Module *)
  • Changed - Module::linkConnect() -> connect(type, serial_number)
  • Changed - Module::linkConnect() -> connectFromSpec()
  • Changed - Module::linkDiscoverAndConnect() -> Module::discoverAndConnect()
  • Changed - Module::linkIsConnected() -> Module::isConnected()
  • Changed - Module::linkDisconnect() -> Module::disconnect()
  • Changed - Module::getAddress() -> Module::getModuleAddress()

 

Python:

  • Changed - connect_from_spec() -> connectFromSpec()
  • Changed - connect_through_link_module() -> connectThroughLinkModule()
  • Changed - is_connected() -> isConnected()
  • Changed - get_status() -> getStatus()
  • Changed - link_discover_and_connect() -> discoverAndConnect()
  • Changed - find_all() -> findAllModules()
  • Changed - find_first_module() -> findFirstModule()
  • Changed - find_module() -> findModule()

Brief Example 2.3.0 changes:
===============================================================================

Pre/Post 2.3.0 C++


// Pre 2.3.0

int main(int argc, const char * argv[]) {
    // Create USBStem object and connect
    a40PinModule stem;
    aErr err = stem.linkDiscoverAndConnect(USB);
    if (err == aErrNone) {
        printf("Connected to BrainStem module.\n");
        // Toggle the user LED
        for (int i = 0; i < 10; i++) {
            stem.system.setLED( i%2 );
            aTime_MSSleep(1000);
        }
        // Disconnect from the module
        stem.linkDisconnect();
    }
    else{
        printf("Error %d while connecting\n", err);
        return 1;
    }
    return 0;
}

// Version 2.3.0

int main(int argc, const char * argv[]) {
    // Create USBStem object and connect
    a40PinModule stem;
    aErr err = stem.discoverAndConnect(USB);
    if (err == aErrNone) {
        printf("Connected to BrainStem module.\n");
        // Toggle the user LED
        for (int i = 0; i < 10; i++) {
            stem.system.setLED( i%2 );
            aTime_MSSleep(1000);
        }
        // Disconnect from the module
        stem.disconnect();
    }
    else{
        printf("Error %d while connecting\n", err);
        return 1;
    }
    return 0;
}

Pre/Post 2.3.0 Python


# Pre 2.3.0

# Create USB object and connect
# to the first module found
print 'Creating USB stem and connecting to first module found'
stem = USBStem()
spec = discover.find_first_module(Spec.USB)
if spec is not None:
    print "Connecting to Module with serial number: 0x%08X" % spec.serial_number
    stem.connect_from_spec(spec)
    # Flash the LED
    print 'Flashing the user LED'
    for i in range(1, 11):
        stem.system.setLED(i % 2)
        sleep(0.5)
else:
    print 'Could not find a module.'

# Version 2.3.0

# Create USB object and connect
# to the first module found
print 'Creating USB stem and connecting to first module found'
stem = USBStem()
stem.discoverAndConnect(Spec.USB)
if stem.isConnected():
    # Flash the LED
    print 'Flashing the user LED'
    for i in range(1, 11):
        stem.system.setLED(i % 2)
        sleep(0.5)
else:
    print 'Could not find a module.'


BrainStem 2.3.0 Features 
===============================================================================

* Improved Link management.
* Fixed memory leak in Link class.
* Aligned C++ and Python naming conventions (Breaks backwards compatibility).
* Removed the presence of "Link" in most cases from the C++ and python API layers.
* Updated examples and documentation to reflect API changes.