vrajroham / python-xbee

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

wait read frame return incorrect value #46

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. manually set PAN ID of coordinator 
2. xbee.at(command='ID')
3. return value is not correct

What is the expected output? What do you see instead?
I set pan ID manually to 3332 but the return value from wait_read_frame is 
different (it was 32)

What version of the product are you using? On what operating system?
xbee 2.1, OS X 10.9.2

Please provide any additional information below.
return dictionary from wait_read_frame was somewhat weird:
{'status': '\x00', 'frame_id': '\x01', 'parameter': 
'\x00\x00\x00\x00\x00\x0032', 'command': 'ID', 'id': 'at_response'}

you can see parameter is weird -- it supposed to be 
\x00\x00\x00\x00\x00\x00\x33\x32.

I also noticed that return value from ND also contained weird value:
{'status': '\x00', 'frame_id': '\x01', 'parameter': {'status': '\x00', 
'source_addr': '\xda\x89', 'parent_address': '\xff\xfe', 'profile_id': 
'\xc1\x05', 'source_addr_long': '\x00\x13\xa2\x00@\xa93\x85', 'device_type': 
'\x01', 'node_identifier': 'XBEE2_MR', 'manufacturer': '\x10\x1e'}, 'command': 
'ND', 'id': 'at_response'}

@ mark in source addr long. 

Original issue reported on code.google.com by yakle1...@gmail.com on 6 Mar 2014 at 3:04

GoogleCodeExporter commented 8 years ago
This is a quirk with Python. Whenever you print a binary string to the console, 
it will interpret ASCII characters it finds within the string as their actual 
character values:

Python 2.7.2 (default, Oct 11 2012, 20:14:37) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> '\x33'
'3'
>>> '\x32'
'2'
>>> 

As a result, you may see random ASCII characters appear in your data when 
printed to the console; these will not be prefixed by '\x'.

I am closing this ticket as wontfix. If you find any other problems with your 
data, feel free to comment here or open a new ticket.

Original comment by pmalms...@gmail.com on 13 Mar 2014 at 3:51