#TomS

1 messages ยท Page 1 of 1 (latest)

jagged knotBOT
rain mesa
#

Hello ๐Ÿ‘‹
discoverReaders fetches the online and available readers. If the other reader is turned off then it should only show the one that's on.

pale mauve
#

Thanks for getting back to me! My readers are set up with two different location ID's. I assumed that is how I'm supposed to do that. In that method, if a reader isn't found using the first location ID, I'm trying to set a variable to false that will then hopefully tell it to try again with the other terminal ID

#

terminal.discoverReaders(config).then(function (discoverResult) {
if (discoverResult.error) {
isNotFound = true;
} else if (discoverResult.discoveredReaders.length === 0) {
isNotFound = true;
} else {
connectReader(discoverResult);
}
});

#

if (isNotFound) {
terminal.discoverReaders(configBackup).then(function (discoverResult) {
if (discoverResult.error) {
alert('Failed to discover: ', discoverResult.error);
} else if (discoverResult.discoveredReaders.length === 0) {
alert('No available readers.');
} else {
connectReader(discoverResult);
}
});
}

#

I've verified that it recognizes the second reader if I don't try having it check for the first, but when I use the above code, it doesn't find the reader. I'd like it so my staff doesn't have to do anything other than turn off one reader and turn on the other, and the app will just connect

#

This is how I'm setting the terminals:

#

const config = {
simulated: false, location: '123456789' //Production
};

const configBackup = {
simulated: false, location: '987654321' //Production backup
};

rain mesa
#

Oh so you have the readers registered to diff locations ๐Ÿค”

pale mauve
#

Yes. I don't have to do that, I wasn't sure how I supposed to set it up

#

We'll only be using 1 at a time and they're both at the same physical location

rain mesa
#

Gotcha. Then you should just register it to the same location.

#

As I mentioned earlier, discoverReader will only list the online and available readers

pale mauve
#

Ok, I'll give that a shot. I wasn't sure I could do it that way. Thanks again for your help!