digi.xbee.profile module

class digi.xbee.profile.FirmwareBaudrate(index, baudrate)[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)

index

Returns the index of the FirmwareBaudrate element.

Returns:Index of the FirmwareBaudrate element.
Return type:Integer
baudrate

Returns the baudrate of the FirmwareBaudrate element.

Returns:Baudrate of the FirmwareBaudrate element.
Return type:Integer
class digi.xbee.profile.FirmwareParity(index, parity)[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, <sphinx.ext.autodoc.importer._MockObject object at 0x7ff1c168ded0>)
FirmwareParity.EVEN = (1, <sphinx.ext.autodoc.importer._MockObject object at 0x7ff1c2c49310>)
FirmwareParity.ODD = (2, <sphinx.ext.autodoc.importer._MockObject object at 0x7ff1c27feed0>)
FirmwareParity.MARK = (3, <sphinx.ext.autodoc.importer._MockObject object at 0x7ff1c27fe7d0>)
FirmwareParity.SPACE = (4, <sphinx.ext.autodoc.importer._MockObject object at 0x7ff1c15246d0>)

index

Returns the index of the FirmwareParity element.

Returns:Index of the FirmwareParity element.
Return type:Integer
parity

Returns the parity of the FirmwareParity element.

Returns:Parity of the FirmwareParity element.
Return type:String
class digi.xbee.profile.FirmwareStopbits(index, stop_bits)[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, <sphinx.ext.autodoc.importer._MockObject object at 0x7ff1c222f650>)
FirmwareStopbits.SB_2 = (1, <sphinx.ext.autodoc.importer._MockObject object at 0x7ff1c1920690>)
FirmwareStopbits.SB_1_5 = (2, <sphinx.ext.autodoc.importer._MockObject object at 0x7ff1c1c04190>)

index

Returns the index of the FirmwareStopbits element.

Returns:Index of the FirmwareStopbits element.
Return type:Integer
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(code, description)[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’)

code

Returns the code of the FlashFirmwareOption element.

Returns:Code of the FlashFirmwareOption element.
Return type:Integer
description

Returns the description of the FlashFirmwareOption element.

Returns:Description of the FlashFirmwareOption element.
Return type:String
class digi.xbee.profile.XBeeSettingType(tag, description)[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’)

tag

Returns the tag of the XBeeSettingType element.

Returns:Tag of the XBeeSettingType element.
Return type:String
description

Returns the description of the XBeeSettingType element.

Returns:Description of the XBeeSettingType element.
Return type:String
class digi.xbee.profile.XBeeSettingFormat(tag, description)[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’)

tag

Returns the tag of the XBeeSettingFormat element.

Returns:Tag of the XBeeSettingFormat element.
Return type:String
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.
name

Returns the XBee setting name.

Returns:XBee setting name.
Return type:String
type

Returns the XBee setting type.

Returns:XBee setting type.
Return type:XBeeSettingType
format

Returns the XBee setting format.

Returns:XBee setting format.
Return type:XBeeSettingFormat
value

Returns the XBee setting value as string.

Returns:XBee setting value as string.
Return type:String
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
profile_file

Returns the profile file.

Returns:Profile file.
Return type:String
version

Returns the profile version.

Returns:Profile version.
Return type:String
flash_firmware_option

Returns the profile flash firmware option.

Returns:Profile flash firmware option.
Return type:FlashFirmwareOption
description

Returns the profile description.

Returns:Profile description.
Return type:String
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
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
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
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
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
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
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
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
firmware_version

Returns the compatible firmware version of the profile.

Returns:Compatible firmware version of the profile.
Return type:Integer
hardware_version

Returns the compatible hardware version of the profile.

Returns:Compatible hardware version of the profile.
Return type:Integer
compatibility_number

Returns the compatibility number of the profile.

Returns:The compatibility number, None if not defined.
Return type:Integer
region_lock

Returns the region lock of the profile.

Returns:The region lock, None if not defined.
Return type:Integer
profile_description_file

Returns the path of the profile description file.

Returns:Path of the profile description file.
Return type:String
firmware_description_file

Returns the path of the profile firmware description file.

Returns:Path of the profile firmware description file.
Return type:String
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
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
bootloader_file

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

Returns:Path of the profile bootloader file.
Return type:String
protocol

Returns the profile XBee protocol.

Returns:Profile XBee protocol.
Return type:XBeeProtocol
class digi.xbee.profile.ProfileUpdateTask(xbee, profile_path, timeout=None, progress_cb=None)[source]

Bases: object

This class represents a profile update process for a given XBee.

Class constructor. Instantiates a new ProfileUpdateTask object.

Parameters:
  • xbee (String or 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 read operations while applying the profile.
  • progress_cb (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 device or the profile path are None or invalid.

xbee

Gets the XBee for this task.

Returns:The XBee to update.
Return type:AbstractXBeeDevice
profile_path

Gets the *.xpro file path.

Returns:The profile path for the update task.
Return type:String
timeout

Gets the maximum time to wait for read operations.

Returns:The maximum time to wait for read operations.
Return type:Integer
callback

Returns the function to receive progress status information.

Returns:
The callback method to received progress information.
None if not registered.
Return type:Function
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.