digi.xbee.io module¶
-
class
digi.xbee.io.IOLine(value)[source]¶ Bases:
enum.EnumEnumerates the different IO lines that can be found in the XBee devices.
Depending on the hardware and firmware of the device, the number of lines that can be used as well as their functionality may vary. Refer to the product manual to learn more about the IO lines of your XBee device.
Values:IOLine.DIO0_AD0 = (‘DIO0/AD0’, 0, ‘D0’)IOLine.DIO1_AD1 = (‘DIO1/AD1’, 1, ‘D1’)IOLine.DIO2_AD2 = (‘DIO2/AD2’, 2, ‘D2’)IOLine.DIO3_AD3 = (‘DIO3/AD3’, 3, ‘D3’)IOLine.DIO4_AD4 = (‘DIO4/AD4’, 4, ‘D4’)IOLine.DIO5_AD5 = (‘DIO5/AD5’, 5, ‘D5’)IOLine.DIO6 = (‘DIO6’, 6, ‘D6’)IOLine.DIO7 = (‘DIO7’, 7, ‘D7’)IOLine.DIO8 = (‘DIO8’, 8, ‘D8’)IOLine.DIO9 = (‘DIO9’, 9, ‘D9’)IOLine.DIO10_PWM0 = (‘DIO10/PWM0’, 10, ‘P0’, ‘M0’)IOLine.DIO11_PWM1 = (‘DIO11/PWM1’, 11, ‘P1’, ‘M1’)IOLine.DIO12 = (‘DIO12’, 12, ‘P2’)IOLine.DIO13 = (‘DIO13’, 13, ‘P3’)IOLine.DIO14 = (‘DIO14’, 14, ‘P4’)IOLine.DIO15 = (‘DIO15’, 15, ‘P5’)IOLine.DIO16 = (‘DIO16’, 16, ‘P6’)IOLine.DIO17 = (‘DIO17’, 17, ‘P7’)IOLine.DIO18 = (‘DIO18’, 18, ‘P8’)IOLine.DIO19 = (‘DIO19’, 19, ‘P9’)-
property
description¶ Returns the description of the IOLine element.
- Returns
The description of the IOLine element.
- Return type
String
-
property
index¶ Returns the index of the IOLine element.
- Returns
The index of the IOLine element.
- Return type
Integer
-
property
at_command¶ Returns the AT command of the IOLine element.
- Returns
The AT command of the IOLine element.
- Return type
String
-
property
pwm_at_command¶ Returns the PWM AT command associated to the IOLine element.
- Returns
- The PWM AT command associated to the IO line, None if
the IO line does not have a PWM AT command associated.
- Return type
String
-
property
-
class
digi.xbee.io.IOValue(value)[source]¶ Bases:
enum.EnumEnumerates the possible values of a
IOLineconfigured as digital I/O.Values:IOValue.LOW = 4IOValue.HIGH = 5-
property
code¶ Returns the code of the IOValue element.
- Returns
The code of the IOValue element.
- Return type
String
-
property
-
class
digi.xbee.io.IOSample(io_sample_payload)[source]¶ Bases:
objectThis class represents an IO Data Sample. The sample is built using the the constructor. The sample contains an analog and digital mask indicating which IO lines are configured with that functionality.
Depending on the protocol the XBee device is executing, the digital and analog masks are retrieved in separated bytes (2 bytes for the digital mask and 1 for the analog mask) or merged contained (digital and analog masks are contained in 2 bytes).
Digital and analog channels masks Indicates which digital and ADC IO lines are configured in the module. Each bit corresponds to one digital or ADC IO line on the module:
bit 0 = DIO01 bit 1 = DIO10 bit 2 = DIO20 bit 3 = DIO31 bit 4 = DIO40 bit 5 = DIO51 bit 6 = DIO60 bit 7 = DIO70 bit 8 = DIO80 bit 9 = AD00 bit 10 = AD11 bit 11 = AD21 bit 12 = AD30 bit 13 = AD40 bit 14 = AD50 bit 15 = NA0 Example: mask of 0x0C29 means DIO0, DIO3, DIO5, AD1 and AD2 enabled. 0 0 0 0 1 1 0 0 0 0 1 0 1 0 0 1
Digital Channel Mask Indicates which digital IO lines are configured in the module. Each bit corresponds to one digital IO line on the module:
bit 0 = DIO0AD0 bit 1 = DIO1AD1 bit 2 = DIO2AD2 bit 3 = DIO3AD3 bit 4 = DIO4AD4 bit 5 = DIO5AD5ASSOC bit 6 = DIO6RTS bit 7 = DIO7CTS bit 8 = DIO8DTRSLEEP_RQ bit 9 = DIO9ON_SLEEP bit 10 = DIO10PWM0RSSI bit 11 = DIO11PWM1 bit 12 = DIO12CD bit 13 = DIO13 bit 14 = DIO14 bit 15 = NA Example: mask of 0x040B means DIO0, DIO1, DIO2, DIO3 and DIO10 enabled. 0 0 0 0 0 1 0 0 0 0 0 0 1 0 1 1
Analog Channel Mask Indicates which lines are configured as ADC. Each bit in the analog channel mask corresponds to one ADC line on the module.
bit 0 = AD0DIO0 bit 1 = AD1DIO1 bit 2 = AD2DIO2 bit 3 = AD3DIO3 bit 4 = AD4DIO4 bit 5 = AD5DIO5ASSOC bit 6 = NA bit 7 = Supply Voltage Value Example: mask of 0x03 means AD0, and AD1 enabled. 0 0 0 0 0 0 1 1
Class constructor. Instantiates a new
IOSampleobject with the provided parameters.- Parameters
io_sample_payload (Bytearray) – The payload corresponding to an IO sample.
- Raises
ValueError – If io_sample_payload length is less than 5.
-
static
min_io_sample_payload()[source]¶ Returns the minimum IO sample payload length.
- Returns
The minimum IO sample payload length.
- Return type
Integer
-
property
digital_hsb_mask¶ Returns the High Significant Byte (HSB) of the digital mask.
- Returns
The HSB of the digital mask.
- Return type
Integer
-
property
digital_lsb_mask¶ Returns the Low Significant Byte (HSB) of the digital mask.
- Returns
The LSB of the digital mask.
- Return type
Integer
-
property
digital_mask¶ Returns the combined (HSB + LSB) of the digital mask.
- Returns
The digital mask.
- Return type
Integer
-
property
digital_values¶ Returns the digital values map.
To verify if this sample contains a valid digital values, use the method
IOSample.has_digital_values().- Returns
The digital values map.
- Return type
Dictionary
-
property
analog_mask¶ Returns the analog mask.
- Returns
the analog mask.
- Return type
Integer
-
property
analog_values¶ Returns the analog values map.
To verify if this sample contains a valid analog values, use the method
IOSample.has_analog_values().- Returns
The analog values map.
- Return type
Dictionary
-
property
power_supply_value¶ Returns the value of the power supply voltage.
To verify if this sample contains the power supply voltage, use the method
IOSample.has_power_supply_value().- Returns
- The power supply value, None if the sample does not
contain power supply value.
- Return type
Integer
-
has_digital_values()[source]¶ Checks whether the IOSample has digital values or not.
- Returns
True if the sample has digital values, False otherwise.
- Return type
Boolean
-
has_digital_value(io_line)[source]¶ Returns whether th IO sample contains a digital value for the provided IO line or not.
- Parameters
io_line (
IOLine) – The IO line to check if it has a digital value.- Returns
- True if the given IO line has a digital value, False
otherwise.
- Return type
Boolean
-
has_analog_value(io_line)[source]¶ Returns whether the given IOLine has an analog value or not.
- Returns
- True if the given IOLine has an analog value, False
otherwise.
- Return type
Boolean
-
has_analog_values()[source]¶ Returns whether the {@code IOSample} has analog values or not.
- Returns
Boolean. True if there are analog values, False otherwise.
-
has_power_supply_value()[source]¶ Returns whether the IOSample has power supply value or not.
- Returns
- Boolean. True if the given IOLine has a power supply value,
False otherwise.
-
get_digital_value(io_line)[source]¶ Returns the digital value of the provided IO line.
To verify if this sample contains a digital value for the given
IOLine, use the methodIOSample.has_digital_value().
-
get_analog_value(io_line)[source]¶ Returns the analog value of the provided IO line.
To verify if this sample contains an analog value for the given
IOLine, use the methodIOSample.has_analog_value().- Parameters
io_line (
IOLine) – The IO line to get its analog value.- Returns
- The analog value of the given IO line or None if the IO
sample does not contain an analog value for the given IO line.
- Return type
Integer
See also
-
class
digi.xbee.io.IOMode(value)[source]¶ Bases:
enum.EnumEnumerates the different Input/Output modes that an IO line can be configured with.
-
DISABLED= 0¶ Disabled
-
SPECIAL_FUNCTIONALITY= 1¶ Firmware special functionality
-
PWM= 2¶ PWM output
-
ADC= 2¶ Analog to Digital Converter
-
DIGITAL_IN= 3¶ Digital input
-
DIGITAL_OUT_LOW= 4¶ Digital output, Low
-
DIGITAL_OUT_HIGH= 5¶ Digital output, High
-
I2C_FUNCTIONALITY= 6¶ I2C functionality
-