rtpavlovsk21 / python-xbee

Automatically exported from code.google.com/p/python-xbee
MIT License
0 stars 0 forks source link

Add support for ZigBee messages #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using a number of Digi XBee ZB modules and needed support for some of the 
API commands and responses that are specific to the ZigBee firmware.  This 
patch adds the "zb_tx_request" and "zb_explicit_tx_request" API commands and 
the "zb_tx_status", "zb_rx", "zb_explicit_rx", "zb_rx_io_data", 
"zb_rx_sensor_read" and  "zb_node_ident" API responses.  The IO packets have a 
different structure from the ones already implemented; they're close but 
different enough that the values were wrong. I implemented a new method to 
parse these packets (_parse_zb_samples) and a new flag in the structure dict 
(parse_as_zb_io_samples) to indicate that the packets should be parsed with 
this new routine.  I also added another option to the 'len' structure field; 
instead of None or an actual length in bytes, "null_terminated_string" is not 
an option. This is used for parsing the NI response, as the node identifier 
string is a null-terminated string embedded in the middle of the packet.  Quite 
annoying… :-)

Tests have also been implemented for the IO packet parsing and NI response 
packet.  

Original issue reported on code.google.com by bla...@bravo5.org on 30 Oct 2010 at 2:58

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Blalor,

Thank you for your contribution. Some work on this topic may have already been 
done; see issue # 11. When I get a chance, I'll look at what you've done and 
integrate your ideas.

Thanks,
~Paul Malmsten

Original comment by pmalms...@gmail.com on 15 Nov 2010 at 12:18

GoogleCodeExporter commented 9 years ago

Original comment by pmalms...@gmail.com on 15 Nov 2010 at 3:20

GoogleCodeExporter commented 9 years ago
Thanks, Paul.  I've made a few updates (normalizing the name of the source 
address parameter, plus a bug in my code); I'll get those to you tomorrow, 
hopefully.  

Brian

Original comment by bla...@bravo5.org on 15 Nov 2010 at 3:26

GoogleCodeExporter commented 9 years ago
Updated patch attached.

Original comment by bla...@bravo5.org on 16 Nov 2010 at 11:14

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Brian,

Thanks a bunch for your work. I loved how clean your code was; not only did I 
grab your null-terminated string stuff, but I also replaced the existing IO 
data processing logic with yours. I factored out the differences between the 
XBee IEEE version and the XBee ZigBee version into separate versions of the 
header processing code.

The latest code I've been working with is here: 
http://bombadier.homeftp.net/hg/projects/python-xbee/main/

If you would could test out the integration and make sure it works how you 
expect, that would be great. I haven't cut a release in a while, so the code 
will be a little unfamiliar. The ZigBee specific stuff is in a class called 
ZigBee in zigbee.py; just instantiate that class instead of XBee as you 
normally would.

Thanks,
~Paul Malmsten

Original comment by pmalms...@gmail.com on 19 Nov 2010 at 6:30

GoogleCodeExporter commented 9 years ago
Fixed as of version 2.0.0.

Original comment by pmalms...@gmail.com on 29 Dec 2010 at 10:03