Receiving Huge Data over Bluetooth

nirvana
Posts: 1
Joined: Mon Dec 20, 2021 7:36 am

Receiving Huge Data over Bluetooth

Postby nirvana » Mon Dec 20, 2021 8:32 am

Can I get 1mb of data at a time via bluetooth classic with SerialBluetooth library in Arduino?
Data is losing in my attempts with this codes.
If i try to upload more than "BUF_SIZE" it chrashed instantly. Even if this "BUF_SIZE" discard some bytes.

Code: Select all

 
 	static const int BUF_SIZE = 112640;
 	      
      	uint8_t* rxdata = (uint8_t*) malloc(BUF_SIZE + 1);
        while (1) {
            const int rxBytes = SerialBT.readBytes(rxdata, BUF_SIZE);
            if (rxBytes > 0) {
                rxdata[rxBytes] = 0;
                ESP_LOGI(btTAG, "Read %d bytes: '%s'", rxBytes, rxdata);
                Serial1.write(rxdata, rxBytes);
            }

Who is online

Users browsing this forum: No registered users and 53 guests