cthuun / python-xbee

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

api_response structs: type 0x82, request to include sample header values #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

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

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

xbee 1.9.0
XP sp3

Please provide any additional information below.

the static method, "parse_samples_header(data)" returns 3 values that would be 
nice if they were included in the packet type 0x82 (line input states): 

  sample quantity, adc & dio channel indicators

due to the diff in offsets between series I & series 2.5 TX requests this may 
not be feasible. but thought i would ask.

tia

Original issue reported on code.google.com by G2subsPstLC@gmail.com on 17 Jul 2010 at 7:27

GoogleCodeExporter commented 9 years ago
This support is already implemented. If an API response with id '\x82' is 
received during a wait_read_frame() call, the resulting data dictionary 
returned will include a field called 'samples' which contains pin states and a 
list of samples.

Unfortunately, documentation for this project is still quite sparse, so my 
recommendation would be to set up a device to send samples, read them with 
wait_read_frame(), and print them to the console to see what they look like 
(see the included example code). I'll paste an example set of data here when I 
get a chance.

Original comment by pmalms...@gmail.com on 4 Aug 2010 at 7:53

GoogleCodeExporter commented 9 years ago
Here is a sample frame which you may receive from wait_read_frame() which 
includes sample data. You will find that the sample quantity, adc statuses, and 
dio statuses are all either directly or indirectly included in the resulting 
dictionary.

This data is also included in the method 
xbee.tests.test_impl.TestReadFromDevice.test_read_io_data.

expected_info = {'id':'rx_io_data',
                 'source_addr':'\x00\x01',
                 'rssi':'\x28',
                 'options':'\x00',
                 'samples': [{'dio-1':True,
                              'dio-3':True,
                              'dio-5':True,
                              'dio-7':True,
                              'adc-0':255}]
                 }

Original comment by pmalms...@gmail.com on 11 Aug 2010 at 9:24