S
S
Sash0k_k2014-02-11 14:36:33
Android
Sash0k_k, 2014-02-11 14:36:33

Bluetooth file transfer from android to hc-05 device?

Hello, I got a problem while testing.
Maybe someone can give an idea of ​​what's going on.
I have my own device with a hc-05 bluetooth module, on which we upload files from android smartphones.
File loading is implemented by splitting it into pieces of N bytes and sequentially transferring them to the device, with confirmation of the acceptance of each block and a maximum waiting timeout.
The smartphone app is based on the standard bluetooth example.
We took N = 4096 (files are transferred in blocks of 4 kilobytes).
On some devices, everything works fine, but we have encountered the fact that the algorithm does not work on the Samsung GT-5830i LaFleur.
We look at the terminal: the first packet is almost never transmitted completely, very rarely the plugging occurs on the second packet. The smartphone sends a piece of data, and then it simply does nothing (the waiting timeout on the device does not have time to expire).
When the buffer is reduced to 1024 bytes, the smartphone starts to work stably, but the file transfer time increases.
Question: what is it and how to deal with it in addition to reducing the block size?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SFx, 2014-02-12
@SFx

Too the similar task soon threatens me, but not with files.
I think you should modify your protocol a little. Enter the header, packet size, and checksum into the data block. You can also add logic that increases and decreases the size of the transmission block depending on the loss, similar to what is done in TCP. If resources still remain, ReedSolomon error-correcting coding or similar can be implemented.
The reason for your problems may lie in wifi access points, interference on the air, a feature of the BT antenna in a particular phone (structurally unsuccessfully located)
In my practice, there were several BT devices that always worked well, but once I took a Samsung GT-6312, and the connection was constantly lost with it, so I think you should expand the fleet of phones for the test, since you can buy them with Android for less 100$.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question