Closed mazen2000 closed 2 years ago
Hey @mazen2000, the information you've provided (here and in the email) is not sufficient for me to look into this yet. What you are describing can be due to any number of reasons (such as, your application stopped calling osdp_cp_refresh()
briefly after every 30 minutes).
Please follow the instructions in https://libosdp.gotomain.io/libosdp/debugging.html and produce log files (as you find appropriate) and add them here.
I ran into what seems like the same issue. In my case, I tracked it down to an overflow in osdp_millis_now
/usec_now
on some platforms (I am running on Raspberry Pi, where the fields of struct timeval
and the constant 1000L
are 32-bit). I was able to work around it by providing a definition of osdp_millis_now
in my program and statically linking with libosdpstatic.a
and libutils.a
.
The problematic code is this line:
https://github.com/goToMain/c-utils/blob/9f2ea57abc8ed432b990a408d09468e6d4e62e2a/src/utils.c#L78
usec = tv.tv_sec * 1000L * 1000L + tv.tv_usec;
@katsl, You are right, usec_now()
can can overflow if struct timeval::tv_sec
and struct timeval::tv_usec
are only 32 bits wide. THB, I didn't know they could even be defined that way :). Thanks for letting us know.
Anyways, I have a fix for that situation by changing that line to:
usec = tv.tv_sec * 1000LL * 1000LL + tv.tv_usec;
@mazen2000, please check the most recent master and let us know if it fixes your issue.
I have implemented the libosdp on my gateController (cp mode). Communication is being established using SCBk, the problem is after specific time (30 minutes) The cp stop sending poll request to the reader, and so I can not get any event-callback. After other 30 minutes the connection work again and the cp back to send poll request and functions fine. I don't understand why cp stop communicate aftet 30 minutes expired and work again after othet 30 minutes? The debug log doesn't show any error.