Version

Provides version access utilities.

brainstem.version.getMajor()[source]

Gets the major revision number for the software package.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

brainstem.version.getMinor()[source]

Gets the minor revision number for the software package.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

brainstem.version.getPatch()[source]

Gets the patch revision number for the software package.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

brainstem.version.get_version_string(packed_version=None, buffer_length=256)[source]

Gets the version string from a packed version.

Parameters:
  • packed_version (unsigned int) – If version is provided, it is unpacked and presented as the version string. Most useful for printing the firmware version currently installed on a module.

  • buffer_length (unsigned short) – The amount of C memory to allocate

Returns:

The library version as a string

Return type:

str

brainstem.version.isAtLeast(major, minor, patch)[source]

Check that the current software version is at least major.minor.patch

Parameters:
  • major (const unsigned byte) – The major revision level.

  • minor (const unsigned byte) – The minor revision level.

  • patch (const unsigned byte) – The patch revision level.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

brainstem.version.isAtleastCompare(major_lhs, minor_lhs, patch_lhs, major_rhs, minor_rhs, patch_rhs)[source]

Check that the supplied left hand side (lhs) version is at least (>=) the right hand side (rhs).

Parameters:
  • major_lhs (const unsigned byte) – The lhs major revision level.

  • minor_lhs (const unsigned byte) – The lhs minor revision level.

  • patch_lhs (const unsigned byte) – The lhs patch revision level.

  • major_rhs (const unsigned byte) – The rhs major revision level.

  • minor_rhs (const unsigned byte) – The rhs minor revision level.

  • patch_rhs (const unsigned byte) – The rhs patch revision level.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

brainstem.version.isLegacyFormat(packed_version)[source]

Check if the given build version is of the legacy packing format

Parameters:

packed_version (const unsigned int) – The packed version number returned from version.pack() or system.getVersion()

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

brainstem.version.pack(major, minor, patch)[source]

Packs the given version into a single integer

Parameters:
  • major (const unsigned byte) – The major revision level.

  • minor (const unsigned byte) – The minor revision level.

  • patch (const unsigned byte) – The patch revision level.

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

brainstem.version.parseMajor(packed_version)[source]

Parses the major revision level from the given build number.

Parameters:

packed_version (const unsigned int) – The packed version number returned from version.pack() or system.getVersion()

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

brainstem.version.parseMinor(packed_version)[source]

Parses the minor revision level from the given build number.

Parameters:

packed_version (const unsigned int) – The packed version number returned from version.pack() or system.getVersion()

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

brainstem.version.parsePatch(packed_version)[source]

Parses the revision patch level from the given build number.

Parameters:

packed_version (const unsigned int) – The packed version number returned from version.pack() or system.getVersion()

Returns:

Result object containing the requested value when the results error is set to NO_ERROR(0)

Return type:

Result

brainstem.version.unpack_version(packed_version)[source]

Unpacks a packed version.

Parameters:

packed_version (unsigned int) – The packed version number.

Returns:

Returns the library version as a 3-tuple (major, minor, patch)

Return type:

str