0

We are experimenting with a bunch of new tablets, and every one we tried is having issues with slow transfer rates with the RN4678 board. We currently use the Lenovo M10 FHD Plus. We tried a few such as the Teclast M40S, Nokia T20, and Samsung Galaxy Tab A8. The first two had horrible transfer rates, while the latter was okay but not ideal. We cannot use the Lenovo M10 Plus 3rd Gen because the buttons are too close to the corner to use with our tablet holders.

Here is my code:

public void SendMessage(BluetoothSocket socket, String msg) {
    OutputStream outStream;
    try {
        outStream = BluetoothConnectionService.outputStream;
        outStream.write("S".getBytes());
        Thread.sleep(4000);
        processThread = true;
        mApp.running = true;
        BluetoothSocketListener bsl = new BluetoothSocketListener(socket,
                CollectingDetail.this);
        Thread messageListener = new Thread(bsl);

        messageListener.start();
        timer = new CounterClass(remaingTime, 1000);
        timer.start();
        bt_stop.setText("Stop");

        IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED);
        filter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
        registerReceiver(bluetoothReceiver, filter);
        bluetoothReceiver.setRegistered(true);
    } catch (IOException | InterruptedException e) {
        Log.e("BLUETOOTH_COMMS", e.getMessage());

        connectSocket();
    } 
}

public static class BluetoothSocketListener implements Runnable {
    private final WeakReference<CollectingDetail> wrActivity;
    private BluetoothSocket socket;

    public BluetoothSocketListener(BluetoothSocket socket, CollectingDetail collectingDetail) {
        this.socket = socket;
        wrActivity = new WeakReference<CollectingDetail>(collectingDetail);
    }

    @Override
    public void run() {
        final CollectingDetail activity = wrActivity.get();
        if (activity != null) {
            activity.inStream = null;
            if (!Thread.currentThread().isInterrupted()) {
                int bufferSize = 512;
                byte[] buffer = new byte[bufferSize];
                Log.i("Bluetooth bytes", new String(buffer));
                activity.inStream = BluetoothConnectionService.inputStream;
                int availableBytes;
                int bytesRead = -1;
                String message = "";

                while (activity.processThread) {
                    message = "";
                    try {
                        availableBytes = activity.inStream.available();
                        if (availableBytes > 0) {
                            bytesRead = activity.inStream.read(buffer);
                            if (bytesRead != -1 && bytesRead < bufferSize) {
                                message = new String(buffer, 0, bytesRead);

                                if (activity.mainHandler != null) {
                                    activity.mainHandler.post(new MessagePoster(message, activity));

                                }


                            }
                        }
                    } catch (IOException e) {
                        Log.e("BLUETOOTH_COMMS", "Error reading bytes");
                        try {
                            socket.close();
                        } catch (IOException e1) {
                            Log.e("BLUETOOTH_COMMS", "Could not close socket");
                        }
                        activity.processThread = false;
                    }
                }
            }
        }
    }
}


public void seprateData(String message) {
    try {
        message = message.replaceAll("(\\r\\n|\\n|\\r)", ",");
        String[] a = message.split(",");
        boolean goodData = false;

        for (int i = 0; i < a.length; i++) {
            final String data = a[i];
            if (data.length() > 0 && !data.equals(" ")) {
                if (data.length() >= 10 && data.startsWith("5A")) {
                    al_sepratedMessageList.add(data);
                    goodData = true;

                }
            }
        }

        if (goodData) {
            calculation();
            if (ConnectThrough.equalsIgnoreCase("usb")) {
                UsbConnectionSerivce.sendMessage("K");
            } else {
                BluetoothConnectionService.sendMessage(socket, "K");
            }
        }

    } catch (Exception e) {
        Log.e("BiSym", "Error Parsing BiSym Data");
    }
}

Is there any way we can increase the transfer rate without changing the firmware? It appears others have faced similar problems, but none of the answers have a real solution. Could you please help me out. Thanks.

I fear this may not be software-solvable and may be an issue with BT hardware or firmware. How would I communicate with my boss about this?

Pink Jazz
  • 784
  • 4
  • 13
  • 34

2 Answers2

0

I fear this may not be software-solvable and may be an issue with BT hardware or firmware. How would I communicate with my boss about this?

The difference is in the quality of the filtering of the signal, a better filter, narrower bandwidth, means lower Signal to Noise Ratio. Lower SNR means faster transfer.

Better analog filters, mean more components and slightly more cost and loss, however, due to the wide-band nature of Bluetooth, most analog filters can only filter out of band signals (nearby AM/FM/TV broadcasters).

In addition to the analog filters, digital filters are applied to the signal to narrow the bandwidth within the band, this technique incurs little loss, but requires more processing power to be included in the chip, more transistors, more costs.

The order of the filter and the type FIR or IIR determine the characteristics of the filer.

Most designers will minimize the cost to meet the minimum specifications, some will balance the cost versus performance and go further, you never know.

You tell your boss, the the better platforms perform digital filtering well beyond what the Bluetooth specification requires.

  • I am willing to expand upon any questions, you may have. I can go expand each point ad nauseam. –  Dec 29 '22 at 04:51
  • Really? This is the answer. You were asking for? Was it not? –  Jan 03 '23 at 05:30
0

I just tested the Teclast M40 Plus which doesn't have this problem.

Something wants to make me believe it is an issue with the UNISOC Bluetooth stack. The Teclast M40 Plus has MediaTek which doesn't have this issue.

EDIT: Also tested on Lenovo M10 Plus 3rd Gen with MediaTek Helio G80, no issue. If we have to use it, we may need a new tablet holder.

Pink Jazz
  • 784
  • 4
  • 13
  • 34