Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E/SumUp: (SourceFile:153)@main | onTransportError() CardReaderError{Name = TRANSPORT_ERROR mErrorCode=3} #150

Open
jordanscott1992 opened this issue Jan 28, 2021 · 6 comments

Comments

@jordanscott1992
Copy link

W/SumUp: (SourceFile:112)@BtSmart-Receiver | BluetoothAdapter not initialized
E/SumUp: (SourceFile:153)@main | onTransportError() CardReaderError{Name = TRANSPORT_ERROR mErrorCode=3}

Anyone have constant issues with Bluetooth connecting to the reader ?

@okirmis
Copy link

okirmis commented Mar 23, 2021

Hey @jordanscott1992 we are experiencing exactly the same issues. Sometimes it takes roughly 2 minutes until the customer is requested to enter the PIN and we're getting the same error message. Sometimes it fails completely. If I read the blinking LEDs on the SumUp Air Terminal correctly, it somehow communicates with the tablet.

SumUp team, anyone?

@jordanscott1992
Copy link
Author

I eventually ditched the sumup reader for the izettle reader and swapped the sdk out.. No more Bluetooth issues it just works thankfully.

Good luck getting a response, this is a known issue that involves clearing the Bluetooth cache on the device and resetting the reader.. Which makes it useless for my integration.

@okirmis
Copy link

okirmis commented Mar 23, 2021

Oh great, I'm looking forward to explaining that to our users. But thanks for responding so quickly!

@vladaman
Copy link

vladaman commented Jul 5, 2021

Yes, we are seeing something similar at #161

@dp-singh
Copy link

dp-singh commented Oct 5, 2021

We had a similar issue:

To replicate this issue (8 out of 10 times Android Version 9 and 10) .

  1. Power on Android Device andcard reader` and do not connect card reader to power.
  2. Connect app to card reader and do a transaction or cancel the transaction.
  3. Exit app and power off the tablet. Do nothing on the card reader; it will go into standby mode after 2 minutes.
  4. After card reader screen is blank (stand-by mode), power on tablet and try and do a transaction.
  5. Observe multiple times we will face the issue of card reader not responding. onTransportError() CardReaderError{Name = TRANSPORT_ERROR mErrorCode=3}

Stacktrace from nRG Connect app which manage software for Bluetooth Low Energy

image

Fix Validation

I started doing the refresh from nRG Connect app before connecting to the sumup sdk from our app. And sumup sdk started working as desired.

image

Fix code in the app.

On every app startup added code to refresh the BluetoothGatt cache using the https://github.com/Polidea/RxAndroidBle.

public class ClearCacheCustomOperation implements RxBleCustomOperation<Boolean> {
    @NonNull
    @Override
    public Observable<Boolean> asObservable(BluetoothGatt bluetoothGatt, RxBleGattCallback rxBleGattCallback, Scheduler scheduler) {
        return Observable.create(emitter -> {
            try {
                Method localMethod = bluetoothGatt.getClass().getMethod("refresh", new Class[0]);
                if (localMethod != null) {
                    boolean bool = (Boolean) localMethod.invoke(bluetoothGatt, new Object[0]);
                    emitter.onNext(bool);
                    emitter.onComplete();
                }
            } catch (Exception localException) {
                localException.printStackTrace();
                emitter.onNext(false);
            }
        });
    }
}
  private var scanDisposable: Disposable? = null
    private fun refreshBleDevice() {
        if (rxBleClient.isScanRuntimePermissionGranted) {
            scanBleDevices()
                .timeout(1, TimeUnit.MINUTES)
                .flatMap {
                    it.bleDevice
                        .establishConnection(false)
                        .flatMap { conn -> conn.queue(ClearCacheCustomOperation())}
                        .take(1)
                }
                .subscribe({Timber.d("Bluetooth config done")}, { Timber.e(it) })
                .let { scanDisposable = it }
        } 
    }

    private fun scanBleDevices(): Observable<ScanResult> {
        val scanSettings = ScanSettings.Builder()
            .setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
            .setCallbackType(ScanSettings.CALLBACK_TYPE_ALL_MATCHES)
            .build()

        val scanFilter = ScanFilter.Builder()
           .build()

        return rxBleClient.scanBleDevices(scanSettings, scanFilter)
    }

Hope that helps.

@adamschoenemann
Copy link

I'm having this issue as well! Very unfortunate. Will try the bluetooth cache refresh workaround, but it seems quite brittle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants