digi.xbee.profile module

class digi.xbee.profile.FirmwareBaudrate(value)[source]

Bases: enum.Enum

This class lists the available firmware baudrate options for XBee Profiles.

Inherited properties:
name (String): The name of this FirmwareBaudrate.
value (Integer): The ID of this FirmwareBaudrate.
Values:
FirmwareBaudrate.BD_1200 = (0, 1200)
FirmwareBaudrate.BD_2400 = (1, 2400)
FirmwareBaudrate.BD_4800 = (2, 4800)
FirmwareBaudrate.BD_9600 = (3, 9600)
FirmwareBaudrate.BD_19200 = (4, 19200)
FirmwareBaudrate.BD_38400 = (5, 38400)
FirmwareBaudrate.BD_57600 = (6, 57600)
FirmwareBaudrate.BD_115200 = (7, 115200)
FirmwareBaudrate.BD_230400 = (8, 230400)
FirmwareBaudrate.BD_460800 = (9, 460800)
FirmwareBaudrate.BD_921600 = (10, 921600)

classmethod get(index)[source]

Returns the FirmwareBaudrate for the given index.

Parameters

index (Integer) – Index of the FirmwareBaudrate to get.

Returns

FirmwareBaudrate with the given

index, None if there is not a FirmwareBaudrate with that index.

Return type

FirmwareBaudrate

classmethod get_by_baudrate(baudrate)[source]

Returns the FirmwareBaudrate for the given baudrate.

Parameters

baudrate (Integer) – Baudrate value of the FirmwareBaudrate to get.

Returns

FirmwareBaudrate with the given

baudrate, None if there is not a FirmwareBaudrate with that baudrate.

Return type

FirmwareBaudrate

property index

Returns the index of the FirmwareBaudrate element.

Returns

Index of the FirmwareBaudrate element.

Return type

Integer

property baudrate

Returns the baudrate of the FirmwareBaudrate element.

Returns

Baudrate of the FirmwareBaudrate element.

Return type

Integer

class digi.xbee.profile.FirmwareParity(value)[source]

Bases: enum.Enum

This class lists the available firmware parity options for XBee Profiles.

Inherited properties:
name (String): The name of this FirmwareParity.
value (Integer): The ID of this FirmwareParity.
Values:
FirmwareParity.NONE = (0, serial.PARITY_NONE)
FirmwareParity.EVEN = (1, serial.PARITY_EVEN)
FirmwareParity.ODD = (2, serial.PARITY_ODD)
FirmwareParity.MARK = (3, serial.PARITY_MARK)
FirmwareParity.SPACE = (4, serial.PARITY_SPACE)

classmethod get(index)[source]

Returns the FirmwareParity for the given index.

Parameters

index (Integer) – the index of the FirmwareParity to get.

Returns

FirmwareParity with the given index,

None if there is not a FirmwareParity with that index.

Return type

FirmwareParity

classmethod get_by_parity(parity)[source]

Returns the FirmwareParity for the given parity.

Parameters

parity (String) – Parity value of the FirmwareParity to get.

Returns

FirmwareParity with the given parity,

None if there is not a FirmwareParity with that parity.

Return type

FirmwareParity

property index

Returns the index of the FirmwareParity element.

Returns

Index of the FirmwareParity element.

Return type

Integer

property parity

Returns the parity of the FirmwareParity element.

Returns

Parity of the FirmwareParity element.

Return type

String

class digi.xbee.profile.FirmwareStopbits(value)[source]

Bases: enum.Enum

This class lists the available firmware stop bits options for XBee Profiles.

Inherited properties:
name (String): The name of this FirmwareStopbits.
value (Integer): The ID of this FirmwareStopbits.
Values:
FirmwareStopbits.SB_1 = (0, serial.STOPBITS_ONE)
FirmwareStopbits.SB_2 = (1, serial.STOPBITS_TWO)
FirmwareStopbits.SB_1_5 = (2, serial.STOPBITS_ONE_POINT_FIVE)

classmethod get(index)[source]

Returns the FirmwareStopbits for the given index.

Parameters

index (Integer) – Index of the FirmwareStopbits to get.

Returns

FirmwareStopbits with the given

index, None if there is not a FirmwareStopbits with that index.

Return type

FirmwareStopbits

classmethod get_by_stopbits(stopbits)[source]

Returns the FirmwareStopbits for the given number of stop bits.

Parameters

stopbits (Integer) – Stop bis value of the FirmwareStopbits to get.

Returns

FirmwareStopbits with the given stop

bits, None if there is not a FirmwareStopbits with that value.

Return type

FirmwareStopbits

property index

Returns the index of the FirmwareStopbits element.

Returns

Index of the FirmwareStopbits element.

Return type

Integer

property stop_bits

Returns the stop bits of the FirmwareStopbits element.

Returns

Stop bits of the FirmwareStopbits element.

Return type

Float

class digi.xbee.profile.FlashFirmwareOption(value)[source]

Bases: enum.Enum

This class lists the available flash firmware options for XBee Profiles.

Inherited properties:
name (String): The name of this FlashFirmwareOption.
value (Integer): The ID of this FlashFirmwareOption.
Values:
FlashFirmwareOption.FLASH_ALWAYS = (0, ‘Flash always’)
FlashFirmwareOption.FLASH_DIFFERENT = (1, ‘Flash firmware if it is different’)
FlashFirmwareOption.DONT_FLASH = (2, ‘Do not flash firmware’)

classmethod get(code)[source]

Returns the FlashFirmwareOption for the given code.

Parameters

code (Integer) – Code of the flash firmware option to get.

Returns

FlashFirmwareOption with the

given code, None if there is not a FlashFirmwareOption with that code.

Return type

FlashFirmwareOption

property code

Returns the code of the FlashFirmwareOption element.

Returns

Code of the FlashFirmwareOption element.

Return type

Integer

property description

Returns the description of the FlashFirmwareOption element.

Returns

Description of the FlashFirmwareOption element.

Return type

String

class digi.xbee.profile.XBeeSettingType(value)[source]

Bases: enum.Enum

This class lists the available firmware setting types.

Inherited properties:
name (String): The name of this XBeeSettingType.
value (Integer): The ID of this XBeeSettingType.
Values:
XBeeSettingType.NUMBER = (‘number’, ‘Number’)
XBeeSettingType.COMBO = (‘combo’, ‘Combo’)
XBeeSettingType.TEXT = (‘text’, ‘Text’)
XBeeSettingType.BUTTON = (‘button’, ‘Button’)
XBeeSettingType.NO_TYPE = (‘none’, ‘No type’)

classmethod get(tag)[source]

Returns the XBeeSettingType for the given tag.

Parameters

tag (String) – Tag of the XBeeSettingType to get.

Returns

XBeeSettingType with the given tag,

None if there is not a XBeeSettingType with that tag.

Return type

XBeeSettingType

property tag

Returns the tag of the XBeeSettingType element.

Returns

Tag of the XBeeSettingType element.

Return type

String

property description

Returns the description of the XBeeSettingType element.

Returns

Description of the XBeeSettingType element.

Return type

String

class digi.xbee.profile.XBeeSettingFormat(value)[source]

Bases: enum.Enum

This class lists the available text firmware setting formats.

Inherited properties:
name (String): The name of this XBeeSettingFormat.
value (Integer): The ID of this XBeeSettingFormat.
Values:
XBeeSettingFormat.HEX = (‘HEX’, ‘Hexadecimal’)
XBeeSettingFormat.ASCII = (‘ASCII’, ‘ASCII’)
XBeeSettingFormat.IPV4 = (‘IPV4’, ‘IPv4’)
XBeeSettingFormat.IPV6 = (‘IPV6’, ‘IPv6’)
XBeeSettingFormat.PHONE = (‘PHONE’, ‘phone’)
XBeeSettingFormat.NO_FORMAT = (‘none’, ‘No format’)

classmethod get(tag)[source]

Returns the XBeeSettingFormat for the given tag.

Parameters

tag (String) – Tag of the XBeeSettingFormat to get.

Returns

XBeeSettingFormat with the given

tag, None if there is not a XBeeSettingFormat with that tag.

Return type

XBeeSettingFormat

property tag

Returns the tag of the XBeeSettingFormat element.

Returns

Tag of the XBeeSettingFormat element.

Return type

String

property description

Returns the description of the XBeeSettingFormat element.

Returns

Description of the XBeeSettingFormat element.

Return type

String

class digi.xbee.profile.XBeeProfileSetting(name, setting_type, setting_format, value)[source]

Bases: object

This class represents an XBee profile setting and provides information like the setting name, type, format and value.

Class constructor. Instantiates a new XBeeProfileSetting with the given parameters.

Parameters
  • name (String) – Setting name.

  • setting_type (XBeeSettingType) – Setting type.

  • setting_format (XBeeSettingType) – Setting format.

  • value (String) – Setting value.

property name

Returns the XBee setting name.

Returns

XBee setting name.

Return type

String

property type

Returns the XBee setting type.

Returns

XBee setting type.

Return type

XBeeSettingType

property format

Returns the XBee setting format.

Returns

XBee setting format.

Return type

XBeeSettingFormat

property value

Returns the XBee setting value as string.

Returns

XBee setting value as string.

Return type

String

property bytearray_value

Returns the XBee setting value as bytearray to be set in the device.

Returns

XBee setting value as bytearray to be set in the device.

Return type

Bytearray

exception digi.xbee.profile.ReadProfileException[source]

Bases: digi.xbee.exception.XBeeException

This exception will be thrown when any problem reading the XBee profile occurs.

All functionality of this class is the inherited from Exception.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception digi.xbee.profile.UpdateProfileException[source]

Bases: digi.xbee.exception.XBeeException

This exception will be thrown when any problem updating the XBee profile into a device occurs.

All functionality of this class is the inherited from Exception.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class digi.xbee.profile.XBeeProfile(profile_file)[source]

Bases: object

Helper class used to manage serial port break line in a parallel thread.

Class constructor. Instantiates a new XBeeProfile with the given parameters.

Parameters

profile_file (String) – Path of the ‘.xpro’ profile file.

Raises
  • ProfileReadException – If there is any error reading the profile file.

  • ValueError – If the provided profile file is not valid

open()[source]

Opens the profile so its components are accessible from properties firmware_description_file, file_system_path, remote_file_system_image, and bootloader_file.

The user is responsible for closing the profile when done with it.

Raises

ProfileReadException – If there is any error opening the profile.

See also

close()[source]

Closes the profile. Its components are no more accessible.

See also

is_open()[source]

Returns True if the profile is opened, False otherwise.

See also

get_setting_default_value(setting_name)[source]

Returns the default value of the given firmware setting.

Parameters

setting_name (String or ATStringCommand) – Name of the setting to retrieve its default value.

Returns

Default value of the setting, None if the setting is not

found or it has no default value.

Return type

String

property profile_file

Returns the profile file.

Returns

Profile file.

Return type

String

property version

Returns the profile version.

Returns

Profile version.

Return type

String

property flash_firmware_option

Returns the profile flash firmware option.

Returns

Profile flash firmware option.

Return type

FlashFirmwareOption

property description

Returns the profile description.

Returns

Profile description.

Return type

String

property reset_settings

Returns whether the settings of the XBee will be reset before applying the profile ones or not.

Returns

True if the settings of the XBee will be reset before

applying the profile ones, False otherwise.

Return type

Boolean

property has_local_filesystem

Returns whether the profile has local filesystem information or not.

Returns

True if the profile has local filesystem information,

False otherwise.

Return type

Boolean

property has_remote_filesystem

Returns whether the profile has remote filesystem information or not.

Returns

True if the profile has remote filesystem information,

False otherwise.

Return type

Boolean

property has_filesystem

Returns whether the profile has filesystem information (local or remote) or not.

Returns

True if the profile has filesystem information (local or

remote), False otherwise.

Return type

Boolean

property has_local_firmware_files

Returns whether the profile has local firmware binaries.

Returns

True if the profile has local firmware files,

False otherwise.

Return type

Boolean

property has_remote_firmware_files

Returns whether the profile has remote firmware binaries.

Returns

True if the profile has remote firmware files,

False otherwise.

Return type

Boolean

property has_firmware_files

Returns whether the profile has firmware binaries (local or remote).

Returns

True if the profile has local or remote firmware files,

False otherwise.

Return type

Boolean

property profile_settings

Returns all the firmware settings that the profile configures.

Returns

List with all the firmware settings that the profile

configures (XBeeProfileSetting).

Return type

Dict

property firmware_version

Returns the compatible firmware version of the profile.

Returns

Compatible firmware version of the profile.

Return type

Integer

property hardware_version

Returns the compatible hardware version of the profile.

Returns

Compatible hardware version of the profile.

Return type

Integer

property compatibility_number

Returns the compatibility number of the profile.

Returns

The compatibility number, None if not defined.

Return type

Integer

property region_lock

Returns the region lock of the profile.

Returns

The region lock, None if not defined.

Return type

Integer

property profile_description_file

Returns the path of the profile description file.

Returns

Path of the profile description file.

Return type

String

property firmware_description_file

Returns the path of the profile firmware description file.

Returns

Path of the profile firmware description file.

Return type

String

property file_system_path

Returns the profile file system path. None until the profile is extracted.

Returns

Path of the profile file system directory.

Return type

String

property remote_file_system_image

Returns the path of the remote OTA file system image. None until the profile is extracted.

Returns

Path of the remote OTA file system image.

Return type

String

property bootloader_file

Returns the profile bootloader file path. None until the profile is extracted.

Returns

Path of the profile bootloader file.

Return type

String

property protocol

Returns the profile XBee protocol.

Returns

Profile XBee protocol.

Return type

XBeeProtocol

digi.xbee.profile.apply_xbee_profile(target, profile_path, timeout=None, progress_callback=None)[source]

Applies the given XBee profile into the given XBee. If a serial port is provided as target, the XBee profile must include the firmware binaries, that are always programmed. In this case, a restore defaults is also performed before applying settings in the profile (no matter if the profile is configured to do so or not). If the value of ‘AP’ (operating mode) in the profile is not an API mode or it is not defined, XBee is configured to use API 1.

Parameters
  • target (String or AbstractXBeeDevice) – Target to apply profile to. String: serial port identifier. AbstractXBeeDevice: XBee to apply the profile.

  • profile_path (String) – path of the XBee profile file to apply.

  • timeout (Integer, optional) – Maximum time to wait for target read operations during the apply profile.

  • progress_callback (Function, optional) –

    Function to execute to receive progress information. Receives two arguments:

    • The current update task as a String

    • The current update task percentage as an Integer

Raises
  • ValueError – If the XBee profile or the XBee device is not valid.

  • UpdateProfileException – If there is any error during the update XBee profile operation.