niolabs / python-xbee

Python tools for working with XBee radios
MIT License
101 stars 45 forks source link

Added support for Route Record Indicator packets. #15

Closed jamesleesaunders closed 8 years ago

jamesleesaunders commented 8 years ago

Adds support for API Route Record Indicator packets (Type a1). Solves issue #14. Currently if a Route Record Indicator packet is received by an XBee then the Python XBee library would crash with error: "Unrecognized response packet with id byte \xa1"

Adding packet type to dictionary.

jamesleesaunders commented 8 years ago

Also consider whether it is necessary to 'break' (therefore hang the callback thread) if the library receives a packet type it does not recognise - should it rather just throw a warning (or something else more 'thread safe')? In the following section of code in base.py:

def run(self): """ run: None -> None

     This method overrides threading.Thread.run() and is automatically
     called when an instance is created with threading enabled.
     """
     while True:
         try:
             self._callback(self.wait_read_frame())
         except ThreadQuitException:
             # Expected termintation of thread due to self.halt()
             break
         except Exception as e:
             # Unexpected thread quit.
             if self._error_callback:
                 self._error_callback(e)
                 # break <---- is this necessary / appropriate?

Also see blog post here: http://axotron.se/blog/problems-with-python-xbee-2-2-3-package/

Jim

jamesleesaunders commented 8 years ago

Closing this PR as superseded by PR #16