digi.xbee.models.atcomm module

class digi.xbee.models.atcomm.ATStringCommand(value)[source]

Bases: enum.Enum

This class represents basic AT commands.

Inherited properties:
name (String): name (ID) of this ATStringCommand.
value (String): value of this ATStringCommand.
Values:
ATStringCommand.AC = (‘AC’, ‘Apply changes’)
ATStringCommand.AG = (‘AG’, ‘Aggregator support’)
ATStringCommand.AI = (‘AI’, ‘Association indication’)
ATStringCommand.AO = (‘AO’, ‘API options’)
ATStringCommand.AP = (‘AP’, ‘API enable’)
ATStringCommand.AR = (‘AR’, ‘Many-to-one route broadcast time’)
ATStringCommand.AS = (‘AS’, ‘Active scan’)
ATStringCommand.BD = (‘BD’, ‘UART baudrate’)
ATStringCommand.BI = (‘BI’, ‘Bluetooth identifier’)
ATStringCommand.BL = (‘BL’, ‘Bluetooth address’)
ATStringCommand.BP = (‘BP’, ‘Bluetooth advertisement power’)
ATStringCommand.BT = (‘BT’, ‘Bluetooth enable’)
ATStringCommand.BR = (‘BR’, ‘RF data rate’)
ATStringCommand.C0 = (‘C0’, ‘Source port’)
ATStringCommand.C8 = (‘C8’, ‘Compatibility mode’)
ATStringCommand.CC = (‘CC’, ‘Command sequence character’)
ATStringCommand.CE = (‘CE’, ‘Device role’)
ATStringCommand.CH = (‘CH’, ‘Channel’)
ATStringCommand.CK = (‘CK’, ‘Configuration checksum’)
ATStringCommand.CM = (‘CM’, ‘Channel mask’)
ATStringCommand.CN = (‘CN’, ‘Exit command mode’)
ATStringCommand.DA = (‘DA’, ‘Force Disassociation’)
ATStringCommand.DB = (‘DB’, ‘RSSI’)
ATStringCommand.DD = (‘DD’, ‘Device type’)
ATStringCommand.DH = (‘DH’, ‘Destination address high’)
ATStringCommand.DJ = (‘DJ’, ‘Disable joining’)
ATStringCommand.DL = (‘DL’, ‘Destination address low’)
ATStringCommand.DM = (‘DM’, ‘Disable device functionality’)
ATStringCommand.DO = (‘DO’, ‘Device options’)
ATStringCommand.D0 = (‘D0’, ‘DIO0 configuration’)
ATStringCommand.D1 = (‘D1’, ‘DIO1 configuration’)
ATStringCommand.D2 = (‘D2’, ‘DIO2 configuration’)
ATStringCommand.D3 = (‘D3’, ‘DIO3 configuration’)
ATStringCommand.D4 = (‘D4’, ‘DIO4 configuration’)
ATStringCommand.D5 = (‘D5’, ‘DIO5 configuration’)
ATStringCommand.D6 = (‘D6’, ‘RTS configuration’)
ATStringCommand.D7 = (‘D7’, ‘CTS configuration’)
ATStringCommand.D8 = (‘D8’, ‘DIO8 configuration’)
ATStringCommand.D9 = (‘D9’, ‘DIO9 configuration’)
ATStringCommand.EE = (‘EE’, ‘Encryption enable’)
ATStringCommand.EO = (‘EO’, ‘Encryption options’)
ATStringCommand.FN = (‘FN’, ‘Find neighbors’)
ATStringCommand.FR = (‘FR’, ‘Software reset’)
ATStringCommand.FS = (‘FS’, ‘File system’)
ATStringCommand.GW = (‘GW’, ‘Gateway address’)
ATStringCommand.GT = (‘GT’, ‘Guard times’)
ATStringCommand.HV = (‘HV’, ‘Hardware version’)
ATStringCommand.HP = (‘HP’, ‘Preamble ID’)
ATStringCommand.IC = (‘IC’, ‘Digital change detection’)
ATStringCommand.ID = (‘ID’, ‘Network PAN ID/Network ID/SSID’)
ATStringCommand.IR = (‘IR’, ‘I/O sample rate’)
ATStringCommand.IS = (‘IS’, ‘Force sample’)
ATStringCommand.JN = (‘JN’, ‘Join notification’)
ATStringCommand.JV = (‘JV’, ‘Join verification’)
ATStringCommand.KY = (‘KY’, ‘Link/Encryption key’)
ATStringCommand.MA = (‘MA’, ‘IP addressing mode’)
ATStringCommand.MK = (‘MK’, ‘IP address mask’)
ATStringCommand.MP = (‘MP’, ‘16-bit parent address’)
ATStringCommand.MY = (‘MY’, ‘16-bit address/IP address’)
ATStringCommand.M0 = (‘M0’, ‘PWM0 configuration’)
ATStringCommand.M1 = (‘M1’, ‘PWM1 configuration’)
ATStringCommand.NB = (‘NB’, ‘Parity’)
ATStringCommand.NI = (‘NI’, ‘Node identifier’)
ATStringCommand.ND = (‘ND’, ‘Node discover’)
ATStringCommand.NJ = (‘NJ’, ‘Join time’)
ATStringCommand.NK = (‘NK’, ‘Trust Center network key’)
ATStringCommand.NO = (‘NO’, ‘Node discover options’)
ATStringCommand.NR = (‘NR’, ‘Network reset’)
ATStringCommand.NS = (‘NS’, ‘DNS address’)
ATStringCommand.NP = (‘NP’, ‘Maximum number of transmission bytes’)
ATStringCommand.NT = (‘NT’, ‘Node discover back-off’)
ATStringCommand.N_QUESTION = (‘N?’, ‘Network discovery timeout’)
ATStringCommand.OP = (‘OP’, ‘Operating extended PAN ID’)
ATStringCommand.OS = (‘OS’, ‘Operating sleep time’)
ATStringCommand.OW = (‘OW’, ‘Operating wake time’)
ATStringCommand.PK = (‘PK’, ‘Passphrase’)
ATStringCommand.PL = (‘PL’, ‘TX power level’)
ATStringCommand.PP = (‘PP’, ‘Output power’)
ATStringCommand.PS = (‘PS’, ‘MicroPython auto start’)
ATStringCommand.P0 = (‘P0’, ‘DIO10 configuration’)
ATStringCommand.P1 = (‘P1’, ‘DIO11 configuration’)
ATStringCommand.P2 = (‘P2’, ‘DIO12 configuration’)
ATStringCommand.P3 = (‘P3’, ‘UART DOUT configuration’)
ATStringCommand.P4 = (‘P4’, ‘UART DIN configuration’)
ATStringCommand.P5 = (‘P5’, ‘DIO15 configuration’)
ATStringCommand.P6 = (‘P6’, ‘DIO16 configuration’)
ATStringCommand.P7 = (‘P7’, ‘DIO17 configuration’)
ATStringCommand.P8 = (‘P8’, ‘DIO18 configuration’)
ATStringCommand.P9 = (‘P9’, ‘DIO19 configuration’)
ATStringCommand.RE = (‘RE’, ‘Restore defaults’)
ATStringCommand.RR = (‘RR’, ‘XBee retries’)
ATStringCommand.R_QUESTION = (‘R?’, ‘Region lock’)
ATStringCommand.SB = (‘SB’, ‘Stop bits’)
ATStringCommand.SC = (‘SC’, ‘Scan channels’)
ATStringCommand.SD = (‘SD’, ‘Scan duration’)
ATStringCommand.SH = (‘SH’, ‘Serial number high’)
ATStringCommand.SI = (‘SI’, ‘Socket info’)
ATStringCommand.SL = (‘SL’, ‘Serial number low’)
ATStringCommand.SM = (‘SM’, ‘Sleep mode’)
ATStringCommand.SN = (‘SN’, ‘Sleep count’)
ATStringCommand.SO = (‘SO’, ‘Sleep options’)
ATStringCommand.SP = (‘SP’, ‘Sleep time’)
ATStringCommand.SS = (‘SS’, ‘Sleep status’)
ATStringCommand.ST = (‘ST’, ‘Wake time’)
ATStringCommand.TP = (‘TP’, ‘Temperature’)
ATStringCommand.VH = (‘VH’, ‘Bootloader version’)
ATStringCommand.VR = (‘VR’, ‘Firmware version’)
ATStringCommand.WR = (‘WR’, ‘Write’)
ATStringCommand.DOLLAR_S = (‘$S’, ‘SRP salt’)
ATStringCommand.DOLLAR_V = (‘$V’, ‘SRP salt verifier’)
ATStringCommand.DOLLAR_W = (‘$W’, ‘SRP salt verifier’)
ATStringCommand.DOLLAR_X = (‘$X’, ‘SRP salt verifier’)
ATStringCommand.DOLLAR_Y = (‘$Y’, ‘SRP salt verifier’)
ATStringCommand.PERCENT_C = (‘%C’, ‘Hardware/software compatibility’)
ATStringCommand.PERCENT_P = (‘%P’, ‘Invoke bootloader’)
ATStringCommand.PERCENT_U = (‘%U’, ‘Recover’)
ATStringCommand.PERCENT_V = (‘%V’, ‘Supply voltage’)

property command

AT command alias

Returns

The AT command alias.

Return type

String

property description

AT command description.

Returns

The AT command description.

Return type

String

class digi.xbee.models.atcomm.SpecialByte(value)[source]

Bases: enum.Enum

Enumerates all the special bytes of the XBee protocol that must be escaped when working on API 2 mode.

Inherited properties:
name (String): name (ID) of this SpecialByte.
value (String): the value of this SpecialByte.
Values:
SpecialByte.ESCAPE_BYTE = 125
SpecialByte.HEADER_BYTE = 126
SpecialByte.XON_BYTE = 17
SpecialByte.XOFF_BYTE = 19

property code

Returns the code of the SpecialByte element.

Returns

the code of the SpecialByte element.

Return type

Integer

classmethod get(value)[source]

Returns the special byte for the given value.

Parameters

value (Integer) – value associated to the special byte.

Returns

SpecialByte with the given value.

Return type

SpecialByte

static escape(value)[source]

Escapes the byte by performing a XOR operation with 0x20 value.

Parameters

value (Integer) – value to escape.

Returns

value ^ 0x20 (escaped).

Return type

Integer

static is_special_byte(value)[source]

Checks whether the given byte is special or not.

Parameters

value (Integer) – byte to check.

Returns

True if value is a special byte, False in other case.

Return type

Boolean

class digi.xbee.models.atcomm.ATCommand(command, parameter=None)[source]

Bases: object

This class represents an AT command used to read or set different properties of the XBee device.

AT commands can be sent directly to the connected device or to remote devices and may have parameters.

After executing an AT Command, an AT Response is received from the device.

Class constructor. Instantiates a new ATCommand object with the provided parameters.

Parameters
  • command (String) – AT Command, must have length 2.

  • parameter (String or Bytearray, optional) – The AT parameter value. Defaults to None. Optional.

Raises

ValueError – if command length is not 2.

property command

Returns the AT command.

Returns

the AT command.

Return type

ATCommand

get_parameter_string()[source]

Returns this ATCommand parameter as a String.

Returns

this ATCommand parameter. None if there is no parameter.

Return type

String

property parameter

Returns the AT command parameter.

Returns

the AT command parameter.

None if there is no parameter.

Return type

Bytearray

class digi.xbee.models.atcomm.ATCommandResponse(command, response=None, status=<ATCommandStatus.OK: (0, 'Status OK')>)[source]

Bases: object

This class represents the response of an AT Command sent by the connected XBee device or by a remote device after executing an AT Command.

Class constructor.

Parameters
  • command (ATCommand) – The AT command that generated the response.

  • response (bytearray, optional) – The command response. Default to None.

  • status (ATCommandStatus, optional) – The AT command status. Default to ATCommandStatus.OK

property command

Returns the AT command.

Returns

the AT command.

Return type

ATCommand

property response

Returns the AT command response.

Returns

the AT command response.

Return type

Bytearray

property status

Returns the AT command response status.

Returns

The AT command response status.

Return type

ATCommandStatus