M
M
MGriboedoff2015-08-20 16:18:03
Android
MGriboedoff, 2015-08-20 16:18:03

Android, bluetooth, HEX, How to get bytes from background stream?

I'm trying to establish data exchange between an android application and a bluetooth device.
Input data:
Packages with a maximum length of 32 bytes (or less or more, the point is that the package can be divided because there are not enough bytes).
The first byte of useful information.
Useful information N- bytes.
Checksum byte.
And stop byte.
The idea is to organize the entire exchange of information in the service.
I figured out how to send a package, but how else can I listen to what comes to me?
Ideally, listen constantly, filter out garbage and add the received bytes for further processing. Or you can even process them in the same place by taking out the parameters I need from the packages.
But I don’t even understand how easy it is to listen to everything that arrives constantly? and Organize access to this... I would be very grateful for any help.
So far, I realized that I need synchronized methods ... but so far everything is crashing))

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question