#manuel_best-practices

1 messages ยท Page 1 of 1 (latest)

sweet pewterBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1463645984558157868

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

south moon
#

Good question. Looking in to this and will get back to you. For some extra context, what reader type are you using here? I don't think that will change the API shape but sometimes that info can still be helpful

tacit tree
#

Thank you! Card Reader M2

south moon
#

Still looking. Out of curiosity, are the devices otherwise connecting and able to make payments?

tacit tree
#

Yes, is working correctly. Also I can see logs with the software version after the connection.

sweet pewterBOT
fervent bear
#

Hi there - taking over for Pompey, who has to go

#

I'm not super familiar with the Terminal android SDK - let me see if I can find a colleague who knows more about this.

tacit tree
#

Hi! I believe it's possible to use the onConnectionStatusChange callback function to get an early software version.

#

After the status is CONNECTED

fervent bear
#

Does this happen with all your readers?

tacit tree
#

I just debugged in this callback and I can see the software version in this case

fervent bear
#

That's to say you think that's the way you're supposed to access that property?

#

I assumed you are talking about the ReaderCallback in Terminal.getInstance().connectReader()

tacit tree
#

The problem is that in this method (onSuccess callback) the software version is "unknown", but in override fun onConnectionStatusChange(status: ConnectionStatus) when the status is CONNECTED the version appear with correct value:

#

So I assume now that this is the correct moment to get this information without calling the terminal from my code

kind matrix
#

hi! fyi i'm jumping in to help out here

#

i can't remember off the top of my head when this becomes available but it sounds like you're on the right track. let me look at my own test app to double check some things

#

hmmmmm when i run my test app in a simulator at least, i am seeing the software version

#

are you using a similator or an actual device?

#

here's all i'm doing in my app

        Terminal.getInstance().connectReader(
            reader,
            connectionConfig,
            onConnectReader()
        )
    }

...

    private fun onConnectReader(): ReaderCallback {
        return object : ReaderCallback {
            override fun onSuccess(reader: Reader) {
                val readerEmitSuccess = _connectReaderFlow.tryEmit(reader)
                val connectionInProgressEmitSuccess = _connectInProgressFlow.tryEmit(false)
                val errorEmitSuccess = _connectErrorFlow.tryEmit(null)
                if (!readerEmitSuccess || !connectionInProgressEmitSuccess || !errorEmitSuccess) {
                    Log.w(TAG, "Failed to emit reader to flow, buffer might be full or no active collectors.")
                } else {
                    Log.d(TAG, "Reader emitted to flow.")
                    Log.d(TAG, "READER SOFTWARE VERSION")
                    Log.d(TAG, reader.softwareVersion)
                }
            }
...```
#

and then i see this in my logs:

READER SOFTWARE VERSION
1.00.03.32-SZZZ_Generic_v36-580001```
tacit tree
#

real device in staging

#

perhaps in simulator we have this value at the moment

kind matrix
#

can you try with a simulated device real quick? i can grab my actual device and test there too but it might take me a bit

tacit tree
#

which SDK version are you using?

kind matrix
#

good question, lemme double check

#

this app is running 4.7.2, and yours?

#

i can try on a different version if needed

#

also working on getting my physical test device set up now

tacit tree
#

4.6.0

kind matrix
#

ok yep, i'm getting the same thing on my physical device

tacit tree
#

you have the same delay?

kind matrix
#

let me see if i can test on 4.6.0 without breaking things

#

no sorry, i am seeing it log as soon as the onConnectReader callback is hit

tacit tree
#

ok, ok

kind matrix
#

let me try on 4.6.0 โฑ๏ธ

#

hmm yep it's working for me on 4.6.0 too

#

can you share your code where you're calling Terminal.getInstance().connectReader as well as where you define the callback?

#

also can you confirm if you'll be able to test it out with a simulated terminal device instead of the actual M2? i'm curious if the results will be different at all

tacit tree
#

how can I setup the simulated terminal?

kind matrix
#

it's in the discovery config, 1 sec

#

here's what it looks like in my app. for yours you can literally just add isSimulated = true to your BluetoothDiscoveryConfiguration

            timeout = timeout,
            isSimulated = simulated
        )
...
        discoverCancelable = Terminal.getInstance().discoverReaders(
            config,
            this,
            onDiscoveryComplete()
        )```
kind matrix
# tacit tree

what happens if you just log out reader.softwareVersion in your onSucess?

tacit tree
#

with simulation is working correctly

kind matrix
#

well that's very odd

#

do you have any other M2 readers you can test with?

tacit tree
#

not, just one

kind matrix
#

i wonder if there's something about the device itself or the softwareVersion it's on that's resulting in it showing null

#

is it fully updated?

tacit tree
#

the QA team report the same issue

#

with theirs M2s

kind matrix
#

where are you actually logging out the reader.softwareVersion in your code? i don't see it in the ReaderCallback

tacit tree
#

I added the log after I sent you the code

#

override fun onSuccess(connectedReader: Reader) {
connectivityLogStatus("[Connection] connectReader success: ${reader.serialNumber}")
Log.e("TAG", "${reader.softwareVersion}")
val readerModel =
StripeReaderModel.fromReader(reader = reader, connectionType = connectionType)
val response = StripeReaderResponseModel(reader = readerModel)
cardReaderManager.callbackResponse(CB_CONNECT_READER_RESULT, response.toJson() ?: "")
}

#

here I have the log

kind matrix
#

gotcha, and when you run that exact code with the actual M2 reader you're still seeing unknown in the reader.softwareVersion line?

tacit tree
#

exactly

#

I think I will use the onConnectionStatusChange callback to manage this information

#

is ok, is just to show the version

kind matrix
#

yeah, if that's working for you it should be fine to rely on that

tacit tree
#

sounds good

#

thank you for your help!

kind matrix
#

my curiosity still wants to get to the bottom of it ๐Ÿ˜›

#

but yeah no worries!

tacit tree
#

I will try tomorrow a bit more

kind matrix
#

๐Ÿซก

tacit tree
#

Now I have curiosity because is working in your enviroment ๐Ÿ˜…

kind matrix
#

yeah same ๐Ÿ˜… my best guess is that there's something about our individual readers that's different

#

because our code is pretty much functionally the same