#aquiroz-terminal

1 messages ยท Page 1 of 1 (latest)

prisma yarrow
#

hi! hmm, to be clear and restate things, the actual problem is your callback to terminal.discoverReaders is called with an empty list of discovered readers, would that be accurate?

tall kelp
#

If it is correct, no reader can be found when there are more than 1 in my location.

prisma yarrow
#

that's not true, it should definitely work

#

what's the location tml_xxx you're passing to the code?

tall kelp
#

this is the location code tml_ErajRwUGslkbJj

prisma yarrow
#

can you share the full code you're using? specifically including where you call terminal.discoverReaders

tall kelp
#

ok a minute

prisma yarrow
#

what is the value of discoverResult when you log that?

#

like presumably else if (discoverResult.discoveredReaders.length === 0) is not being executed right, which means there are some readers being returned?

#

I don't understand what that AJAX call to your backend is for also , can you explain that and what it does?

#

I'd overall suggest adding some logs and breakpoints, my guess is our terminal.discoverReaders() function correctly returns some readers, but you're losing the values in your own code and your global discoveredReaders variable gets set to undefined/null somewhere in your code

tall kelp
#

With that ajax, what I do is that when I receive the payment as a success, I save this data in my database.

prisma yarrow
#

not sure what you mean, I mean the AJAX to discover_readers.php"

tall kelp
#

ok I understand this file is used to determine if it is online or not the reader returns a status

prisma yarrow
#

hmm why does that need to be a PHP script on the server? ๐Ÿ˜… you could just do that directly in Javascript

tall kelp
#

Well, believe me, I had no idea.

prisma yarrow
#

anyway that's probably not directly relevant , like I said, I assume terminal.discoverReaders() is giving you the right result but you're losing the state elsewhere in the code so you'd need to add some logging and breakpoints to trace what's happening

#

form what I can see, for tml_ErajRwUGslkbJj you have one reader registered now, and you're calling the API correctly, there's no reason for discoverReaders to not be returning that reader

tall kelp
#

I understand, if it is correct it gives me the result but when I enter more than one it does not work for me and the truth is that I have no idea.
The problem is that if I add another reader, it doesn't work for me.

prisma yarrow
#

The problem is that if I add another reader, it doesn't work for me.
what is the value of discoverResult in your code (line 38, after calling terminal.discoverReaders ) in that case? please add a console.log and check.