Jens
Jens

Reputation: 47

Problem receiving data from bluetooth LE device in android 7 application

I have an android 7 device, on which I am developing an application. Furthermore, I have a radiowave scanner, that functions as a bluetooth keyboard (it scans a tag, and transfers the data via bluetooth, and if the user has some writing application open, and is paired with the scanner, it should write the data inside that application).

Inside my app on my android 7 device, I have an input field, which I want the scanner to write into, when something has been scanned. Best case would be that the scanner just worked, without me having to code anything, like with my Galaxy s10 phone (here the scanner works seamlessly after they have been paired), but since the device is running android 7, I understand that there is some bluetooth handling that is not done automatically, and hence I must connect to the scanner via bluetooth from inside the application I'm developing.

When I connect to the scanner through my app, using BluetoothGatt, I can see, using discoverServices(), that the scanner has 2 available services:

"00001800-0000-1000-8000-00805f9b34fb" (Generic Access) and "00001801-0000-1000-8000-00805f9b34fb" (Generic Attribute)

The first service contains 5 characteristics:

And the second service contains 0 characteristics.

I simply just want to get a hold on the data from the scanner, when it has scanned something.

I have tried to read from all five characteristics, but as their names suggests, they seem to have to do with information on the scanner, rather than the data that has been scanned.

Is there any way to see the data, that the scanner contains beside these characteristics? I thought that maybe the data would be inside the second service, but since it contains no characteristics I can't seem to do anything with it, is there possibly another way that the data could be stored inside the scanner?

Link to a short manual for the scanner. It is not very thorough, but unfortunately the only documentation I can find (section 3.3 describes bluetooth): http://en.cmrfid.org/wp-content/uploads/2018/10/user-manual-Electronic-ear-bar-reader.pdf

Upvotes: 0

Views: 142

Answers (1)

Jens
Jens

Reputation: 47

Early in the process, I tried pairing the android device with the scanner over and over, and tried forgetting the scanner and delete bluetooth cache and network data, in an attempt to make them connect. I think this might resulted in the scanner remembering the android device somehow and refusing to pair with it.

After renaming the android device I was able to successfully pair them again. The android device still wont receive data automatically, but now I'm able to discover more services and characteristics, and have found the one holding the scanned data.

Upvotes: 0

Related Questions