lhemmen / python-xbee

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

Misrepresentation of Information #53

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Send a command to the ZigBee
   ex.: xbee.send('at', frame_id='A', command='my')

What is the expected output? What do you see instead?

The expected output is:
{'status': '\x00', 'frame_id': 'A', 'parameter': '\x53\xbf', 'command': 'my', 
'id': 'at_response'}

and the output is:
{'status': '\x00', 'frame_id': 'A', 'parameter': 'S\xbf', 'command': 'my', 
'id': 'at_response'}

As you can see, the element parameter is the discrepancy that I want to point. 
This is not a real problem, since i can use this information inside the program 
without problem. It just make me look for a couple minutes until i understand 
the meaning.
Other example that might cause confusion:

{'retries': '\x00', 'frame_id': 'B', 'deliver_status': '$', 'dest_addr': 
'\xff\xfd', 'discover_status': '\x02', 'id': 'tx_status'}
{'retries': '\x00', 'frame_id': 'B', 'deliver_status': '\x24', 'dest_addr': 
'\xff\xfd', 'discover_status': '\x02', 'id': 'tx_status'}

In this case the discrepancy is the 'deliver_status'.

What version of the product are you using? On what operating system?

I'm using:
XBee 2.1.1
Linux aldebaran 3.2.0-4-amd64 #1 SMP Debian 3.2.57-3+deb7u2 x86_64 GNU/Linux
Python 2.7.3 (default, Mar 13 2014, 11:03:55) 
[GCC 4.7.2] on linux2

Please provide any additional information below.

XBee PRO S2B

Original issue reported on code.google.com by will....@gmail.com on 3 Jul 2014 at 6:18

GoogleCodeExporter commented 9 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 15 Aug 2014 at 12:35