gotthardp / python-mercuryapi

Python wrapper for the ThingMagic Mercury API
MIT License
123 stars 63 forks source link

Unable to get_temperature() while start_reading() #92

Closed HanYangZhao closed 4 years ago

HanYangZhao commented 5 years ago

Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "./thingMagicRead2.py", line 48, in heartbeat temp = reader.get_temperature() RuntimeError: Unimplemented feature

I'm assuming this is an error returned from the MercuryAPI?

gotthardp commented 5 years ago

Yes. It is likely not supported by your reader, or the reader is in some state in which it is not allowed to call that function. I cannot do much about that.

natcl commented 5 years ago

Seems to be a duplicate of #71

HanYangZhao commented 5 years ago

That's interesting because with the Universal Reader Assistant software, I was able to get the temperature while the reader is in continuous read

HanYangZhao commented 5 years ago

I dug a bit further with the URA assistant by printing the serial log and was able to see the temperature being sent by the reader. So I went to check the doc and found the following temprature_status

gotthardp commented 5 years ago

Does this suggest something?

HanYangZhao commented 5 years ago

statusListener

From what I understand, the temperature is collected by the statusListener, It seems to be similar to the ReadListener used for tag reading. I was however unable to find the format of the data that's being passed(something similar to TMR_TagReadData). Seems to be this TMR_Reader_StatsFlag or TMR_Reader_StatsValues

gotthardp commented 5 years ago

Yeah, it seems that TMR_addStatsListener could be used, but it is not implemented right now. Contributions are welcome :)

HanYangZhao commented 5 years ago

I have attempted to add the TMR_addStatsListener on my fork. So far it doesn't return any error, but the callback doesn't seem to get called. Maybe you have some insights?

gotthardp commented 5 years ago

Unfortunatelly not.

gotthardp commented 4 years ago

This was fixed by @HanYangZhao in https://github.com/gotthardp/python-mercuryapi/commit/7f493198056824cba9f8b11e89eadf46c4720de2. Function enable_stats may now be used to retrieve temp (and other stats) during reading. Thanks a lot again!