Exemple #1
0
    description = property(__get_description)
    """String. The IO line description."""

    index = property(__get_index)
    """Integer. The IO line index."""

    at_command = property(__get_at_command)
    """String. The IO line AT command."""

    pwm_at_command = property(__get_pwm_command)
    """String. The IO line PWM AT command."""


IOLine.lookupTable = {x.index: x for x in IOLine}
IOLine.__doc__ += utils.doc_enum(IOLine)


@unique
class IOValue(Enum):
    """
    Enumerates the possible values of a :class:`.IOLine` configured as digital I/O.
    """

    LOW = 4
    HIGH = 5

    def __init__(self, code):
        self.__code = code

    def __get_code(self):
Exemple #2
0
        """
        return self.__description

    @classmethod
    def get(cls, code):
        """
        Retrieves the api frame type associated to the given ID.

        Args:
            code (Integer): the code of the API frame type to get.

        Returns:
            :class:`.ApiFrameType`: the API frame type associated to the given code or ``UNKNOWN`` if
                the given code is not a valid ApiFrameType code.
        """
        try:
            return cls.lookupTable[code]
        except KeyError:
            return ApiFrameType.UNKNOWN

    code = property(__get_code)
    """Integer. The API frame type code."""

    description = property(__get_description)
    """String. The API frame type description."""


# Dictionary<Integer, ApiFrameType: Used to determine the ApiFrameType from Integer.
ApiFrameType.lookupTable = {x.code: x for x in ApiFrameType}
ApiFrameType.__doc__ += utils.doc_enum(ApiFrameType)
Exemple #3
0
                HardwareVersion.XBEE3, HardwareVersion.XBEE3_SMT,
                HardwareVersion.XBEE3_TH
        ]:
            return XBeeProtocol.ZIGBEE

        return XBeeProtocol.ZIGBEE

    code = property(__get_code)
    """Integer. XBee protocol code."""

    description = property(__get_description)
    """String. XBee protocol description."""


XBeeProtocol.lookupTable = {x.code: x for x in XBeeProtocol}
XBeeProtocol.__doc__ += utils.doc_enum(XBeeProtocol)


@unique
class IPProtocol(Enum):
    """
    Enumerates the available network protocols.

    | Inherited properties:
    |     **name** (String): the name (id) of this IPProtocol.
    |     **value** (String): the value of this IPProtocol.
    """

    UDP = (0, "UDP")
    TCP = (1, "TCP")
    TCP_SSL = (4, "TCP SSL")
Exemple #4
0
    NK = "NK"
    ZU = "ZU"
    ZV = "ZV"
    CC = "CC"

    def __init__(self, command):
        self.__command = command

    def __get_command(self):
        return self.__command

    command = property(__get_command)
    """String. AT Command alias."""


ATStringCommand.__doc__ += utils.doc_enum(ATStringCommand)


@unique
class SpecialByte(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.
    """

    ESCAPE_BYTE = 0x7D
    HEADER_BYTE = 0x7E
Exemple #5
0
        Args:
            index (Integer): Returns the :class:`.IOLine` for the given index.

        Returns:
            :class:`.IOLine`: :class:`.IOLine` with the given code, `None` if
                there is not any line with that index.
        """
        try:
            return cls.lookupTable[index]
        except KeyError:
            return None


IOLine.lookupTable = {x.index: x for x in IOLine}
IOLine.__doc__ += utils.doc_enum(IOLine)


@unique
class IOValue(Enum):
    """
    Enumerates the possible values of a :class:`.IOLine` configured as digital I/O.
    """

    LOW = 4
    HIGH = 5

    def __init__(self, code):
        self.__code = code

    @property
    @property
    def description(self):
        """
        Returns the description of the WiFiEncryptionType element.

        Returns:
            String: the description of the WiFiEncryptionType element.
        """
        return self.__description

    @classmethod
    def get(cls, code):
        """
        Returns the Wi-Fi encryption type for the given code.

        Args:
            code (Integer): the code of the Wi-Fi encryption type to get.

        Returns:
            :class:`.WiFiEncryptionType`: the WiFiEncryptionType with the given
                code, `None` if not found.
        """
        for enc_type in cls:
            if enc_type.code == code:
                return enc_type
        return None


WiFiEncryptionType.__doc__ += utils.doc_enum(WiFiEncryptionType)
Exemple #7
0
    Transmission is performed using repeater mode.

    Only valid for DigiMesh 868/900 and Point-to-Multipoint 868/900
    protocols.
    """

    DIGIMESH_MODE = 0xC0
    """
    Transmission is performed using DigiMesh mode.

    Only valid for DigiMesh 868/900 and Point-to-Multipoint 868/900
    protocols.
    """


ReceiveOptions.__doc__ += utils.doc_enum(ReceiveOptions)


class TransmitOptions(Enum):
    """
    This class lists all the possible options that can be set while
    transmitting an XBee packet.

    The transmit options are usually set as a bitfield meaning that the options
    can be combined using the '|' operand.

    Not all options are available for all cases, that's why there are different
    names with same values. In each moment, you must be sure that the option
    your are going to use, is a valid option in your context.
    """
Exemple #8
0
            :class:`.ATCommandStatus`: the AT command status with the given code.
        """
        try:
            return cls.lookupTable[code]
        except KeyError:
            return ATCommandStatus.UNKNOWN

    code = property(__get_code)
    """Integer. The AT command status code."""

    description = property(__get_description)
    """String. The AT command status description."""


ATCommandStatus.lookupTable = {x.code: x for x in ATCommandStatus}
ATCommandStatus.__doc__ += utils.doc_enum(ATCommandStatus)


@unique
class DiscoveryStatus(Enum):
    """
    This class lists all the possible states of the discovery process.

    | Inherited properties:
    |     **name** (String): The name of the DiscoveryStatus.
    |     **value** (Integer): The ID of the DiscoveryStatus.
    """
    NO_DISCOVERY_OVERHEAD = (0x00, "No discovery overhead")
    ADDRESS_DISCOVERY = (0x01, "Address discovery")
    ROUTE_DISCOVERY = (0x02, "Route discovery")
    ADDRESS_AND_ROUTE = (0x03, "Address and route")
Exemple #9
0
            :class:`.OperatingMode`: the OperatingMode with the given code.
        """
        try:
            return cls.lookupTable[code]
        except KeyError:
            return OperatingMode.UNKNOWN

    code = property(__get_code)
    """Integer. The operating mode code."""

    description = property(__get_description)
    """String: The operating mode description."""


OperatingMode.lookupTable = {x.code: x for x in OperatingMode}
OperatingMode.__doc__ += utils.doc_enum(OperatingMode)


@unique
class APIOutputMode(Enum):
    """
    Enumerates the different API output modes. The API output mode establishes
    the way data will be output through the serial interface of an XBee device.

    | Inherited properties:
    |     **name** (String): the name (id) of this OperatingMode.
    |     **value** (String): the value of this OperatingMode.
    """

    NATIVE = (0x00, "Native")
    EXPLICIT = (0x01, "Explicit")
Exemple #10
0
    @property
    def letter(self):
        """
        Returns the letter of the LegacyHardwareVersion element.

        Returns:
            String: the letter of the LegacyHardwareVersion element.
        """
        return self.__letter

    @classmethod
    def get_by_letter(cls, letter):
        """
        Returns the LegacyHardwareVersion for the given letter.

        Args:
            letter (String): the letter of the legacy hardware version to get.

        Returns:
            :class:`LegacyHardwareVersion`: the LegacyHardwareVersion with the
                given letter, `None` if not found.
        """
        for version in cls:
            if version.letter == letter:
                return version
        return None


HardwareVersion.__doc__ += utils.doc_enum(HardwareVersion)
LegacyHardwareVersion.__doc__ += utils.doc_enum(LegacyHardwareVersion)
Exemple #11
0
        return self.__description

    @classmethod
    def get(cls, code):
        """
        Returns the HardwareVersion for the given code.

        Args:
            code (Integer): the code of the hardware version to get.

        Returns:
            :class:`HardwareVersion`: the HardwareVersion with the given code, ``None`` if there is not a
                HardwareVersion with that code.
        """
        try:
            return cls.lookupTable[code]
        except KeyError:
            return None

    code = property(__get_code)
    """Integer. The hardware version code."""

    description = property(__get_description)
    """String. The hardware version description."""


# Class variable of HardwareVersion. Dictionary <Integer, HardwareVersion> for
# search HardwareVersion by code.
HardwareVersion.lookupTable = {x.code: x for x in HardwareVersion}
HardwareVersion.__doc__ += utils.doc_enum(HardwareVersion)
Exemple #12
0
    APS_ENCRYPTED = 0x20
    """
    Packet encrypted with APS encryption.
    
    Only valid for ZigBee XBee protocol.
    """

    SENT_FROM_END_DEVICE = 0x40
    """
    Packet was sent from an end device (if known).
    
    Only valid for ZigBee XBee protocol.
    """


ReceiveOptions.__doc__ += utils.doc_enum(ReceiveOptions)


class TransmitOptions(Enum):
    """
    This class lists all the possible options that can be set while 
    transmitting an XBee packet.

    The transmit options are usually set as a bitfield meaning that the options 
    can be combined using the '|' operand.
    
    Not all options are available for all cases, that's why there are different 
    names with same values. In each moment, you must be sure that the option 
    your are going to use, is a valid option in your context.
    """
Exemple #13
0
        """
        Returns the OperatingMode for the given code.

        Args:
            code (Integer): the code corresponding to the operating mode to get.

        Returns:
            :class:`.OperatingMode`: the OperatingMode with the given code.
        """
        for mode in cls:
            if mode.code == code:
                return mode
        return OperatingMode.UNKNOWN


OperatingMode.__doc__ += utils.doc_enum(OperatingMode)


@unique
class APIOutputMode(Enum):
    """
    Enumerates the different API output modes. The API output mode establishes
    the way data will be output through the serial interface of an XBee device.

    | Inherited properties:
    |     **name** (String): the name (id) of this OperatingMode.
    |     **value** (String): the value of this OperatingMode.
    """

    NATIVE = (0x00, "Native")
    EXPLICIT = (0x01, "Explicit")