How to send more than 20 bytes data over ble in android?

Nik

I am trying to send more than 33 bytes using simple loops, Is anybody has idea how to send more than 20 bytes data over android ble.

if(!mConnected) return;
        for (int i = 0; i<str.length;i++) {
            if(str[i] == str[str.length -1]){
                 val = str[i]+"\n";
            }else {
                val = str[i] + "_";
            }
            System.out.println(val);
            mBluetoothLeService.WriteValue(val);
        }
Brock Amhurst

Sending more than 20 bytes via BLE is easily achievable by splitting your data into 20 byte packets and implementing a short delay (i.e. using sleep()) between sending each packet.

Here's a short snippet of code from a project I'm working on that takes data in the form of byte[] and splits it into an array of the same, ( byte[][] ), in 20 byte chunks, and then sends it to another method that transmits each packet one by one.

    int chunksize = 20;
    byte[][] packets = new byte[packetsToSend][chunksize]; 
    int packetsToSend = (int) Math.ceil( byteCount / chunksize);

    for(int i = 0; i < packets.length; i++) {
        packets[i] = Arrays.copyOfRange(source,start, start + chunksize);
        start += chunksize;
    }

    sendSplitPackets(packets);

Here are two other very good explanations of how to achieve this:

(Stackoverflow) Android: Sending data >20 bytes by BLE

(Nordic Semi) Dealing Large Data Packets Through BLE

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Android: Sending data >20 bytes by BLE

From Dev

How to send data over a Bluetooth Low Energy (BLE) link?

From Dev

Android to BLE write fails when writing more than a few bytes in quick succession

From Dev

How can malloc take more number of bytes of data than assigned

From Dev

how to handle big integer data more than 8 byte or more than 20 digits in c++

From Dev

Android BLE: writing >20 bytes characteristics missing the last byte array

From Dev

How to send more than 2083 characters of data to a URL?

From Dev

Android ByteArrayBuffer holds more bytes than capacity

From Dev

Connect BLE device to Android an Send Data (nUART)

From Dev

How to send bytes over a socket in python?

From Dev

How to config wget to retry more than 20?

From Dev

Send random data over TCP for a while, and count how many bytes were sent

From Dev

Send more data than what can be stored in send buffer

From Dev

How to send push notification to more than 1000 users using firebase in Android?

From Dev

How can a 32 bytes address represent more than 32 characters?

From Dev

How can mmap allocate more than 20Gb?

From Dev

How create an Rcpp NumericVector with more than 20 entries?

From Dev

How to check if a folder has more than 20 files in it in batch?

From Dev

To send more than 256 byte data via push notification

From Dev

send data from more than one activity to the one activity?

From Dev

How to send data via BLE using ionic 3 and angular 4?

From Dev

How to send more than one column in NSMUtableArray and how to implement it

From Dev

Send a Android BLE GATT Notification

From Dev

Output 20 More data

From Dev

How to do more than one level projection in query over?

From Dev

How to return more than one value over multiple lines

From Dev

How to send the data over broadcast address?

From Dev

PyZMQ how to send None data over ZeroMQ

From Dev

MVC 5 - how can I send a SelectList from a controller to a dropdownlist and show the data text field with more than one property

Related Related

  1. 1

    Android: Sending data >20 bytes by BLE

  2. 2

    How to send data over a Bluetooth Low Energy (BLE) link?

  3. 3

    Android to BLE write fails when writing more than a few bytes in quick succession

  4. 4

    How can malloc take more number of bytes of data than assigned

  5. 5

    how to handle big integer data more than 8 byte or more than 20 digits in c++

  6. 6

    Android BLE: writing >20 bytes characteristics missing the last byte array

  7. 7

    How to send more than 2083 characters of data to a URL?

  8. 8

    Android ByteArrayBuffer holds more bytes than capacity

  9. 9

    Connect BLE device to Android an Send Data (nUART)

  10. 10

    How to send bytes over a socket in python?

  11. 11

    How to config wget to retry more than 20?

  12. 12

    Send random data over TCP for a while, and count how many bytes were sent

  13. 13

    Send more data than what can be stored in send buffer

  14. 14

    How to send push notification to more than 1000 users using firebase in Android?

  15. 15

    How can a 32 bytes address represent more than 32 characters?

  16. 16

    How can mmap allocate more than 20Gb?

  17. 17

    How create an Rcpp NumericVector with more than 20 entries?

  18. 18

    How to check if a folder has more than 20 files in it in batch?

  19. 19

    To send more than 256 byte data via push notification

  20. 20

    send data from more than one activity to the one activity?

  21. 21

    How to send data via BLE using ionic 3 and angular 4?

  22. 22

    How to send more than one column in NSMUtableArray and how to implement it

  23. 23

    Send a Android BLE GATT Notification

  24. 24

    Output 20 More data

  25. 25

    How to do more than one level projection in query over?

  26. 26

    How to return more than one value over multiple lines

  27. 27

    How to send the data over broadcast address?

  28. 28

    PyZMQ how to send None data over ZeroMQ

  29. 29

    MVC 5 - how can I send a SelectList from a controller to a dropdownlist and show the data text field with more than one property

HotTag

Archive