Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reader.start_reading #39

Closed
atlasagencyca opened this issue Nov 29, 2018 · 12 comments
Closed

reader.start_reading #39

atlasagencyca opened this issue Nov 29, 2018 · 12 comments
Labels

Comments

@atlasagencyca
Copy link

Im having issue running the reader.start_reading call function when setting the read plan to include for the bank arguments. For example when I set: reader.set_readplan([1], "GEN2", bank=["epc", "reserved"], read_power=1400), the reader.start_reading call returns nothing. When I get rid of the bank argument it starts to work however the bank arguments will print as "None" such as the reserved, tid etc.

@gotthardp
Copy link
Owner

Yeah. The bank retrieval is not supported for the continuous reading. This is how the MercuryAPI works. They assume the user first reads all tags (e.g. by the continuous reading) and then makes a targeted request to read the bank data. I think this is because the operation is quite time&energy consuming.

@atlasagencyca
Copy link
Author

I see, so what function should I use if I want to keep track of whats near the antenna every minute, should I use the reader.read() function or reader.start reading and run it for a quick second? What is their difference in terms of printout.

@gotthardp
Copy link
Owner

gotthardp commented Nov 29, 2018

The read() is synchronous and can read the bank data. The start_read() is asynchronous, so your python program can continue and do other tasks while scanning. If you don't need the asynchronicity, then the start_read() is of no use for you.

@rasidmusic
Copy link

@gotthardp Can you post a sample code on how to read user data with the bank parameter?
My Code returns EPC, despite setting the bank in the set_read_plan:

reader.set_read_plan([1], "GEN2", bank=["user"], read_power=1400)
allTags.extend(reader.read(timeout=450))

#49

@gotthardp
Copy link
Owner

The following works for me

#!/usr/bin/env python3
from __future__ import print_function
import mercury
reader = mercury.Reader("tmr://dev/ttyUSB0", baudrate=115200)

reader.set_region("EU3")
reader.set_read_plan(reader.get_antennas(), "GEN2", "user")
for tag in reader.read(timeout=450):
    print("EPC", tag.epc)
    print("Antenna", tag.antenna)
    print("Count", tag.read_count)
    print("RSSI", tag.rssi)
    print("user", tag.user_mem_data)

@rasidmusic
Copy link

Hey @gotthardp
I tried your code. Unfortunately I get the following results:

EPC b'E200001963020091231027DE'
Antenna 1
Count 7
RSSI -37
user bytearray(b'L18100117\r\n\x00\x00\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
EPC b'E2000017230C01961100AA8E'
Antenna 1
Count 7
RSSI -31
user None

As you can see, the second tag does not return user data. That is, if two tags are read at the same time. Both show the correct user data if read seperately.

@jhuncamit
Copy link

Hi can you post a sample code for the start_reading and what response are you getting? Thanks!

@gotthardp
Copy link
Owner

The https://github.com/gotthardp/python-mercuryapi/blob/master/test.py contains a sample start_reading code. Do you need something more?

@jhuncamit
Copy link

Yeah sorry, let me rephrase my question. Basically what I need is a fast continuous read from the m6e that returns tags and its rssi. Can you help me with that? Thanks!

@jhuncamit
Copy link

When I ran the test.py, I'm getting tag reads however it seems to be inconsistent and doesn't read all of the tags I placed on top of the antenna.

@gotthardp
Copy link
Owner

You may need more antennas or multiple read attempts if there are many tags. But this is beyond this library.

@gotthardp
Copy link
Owner

There was a bug fixed in the code, so the original issue has been addressed.
Please open a new issue (one ticket per issue) if you continue having troubles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants