I am using RxAndroidBle Library for my BLE application.
Like nrfConnect application I want to read RAW data from BLE device.
How to read RAW data from device?
I am using RxAndroidBle Library for my BLE application.
Like nrfConnect application I want to read RAW data from BLE device.
How to read RAW data from device?
To access raw bytes of the advertisement data using RxAndroidBle
you need to:
ScanResult
(RxBleClient#scanBleDevices(ScanSettings, ScanFilter...)
)ScanRecord
(ScanResult#getScanRecord
)byte[]
(ScanRecord#getBytes
)
The raw data you see are the hexadecimal values advertised by your bluetooth device.
Your app can read these data using
android.bluetooth.le.BluetoothLeScanner
's method:Here is a sample code of a
ScanCallback
implementation you can pass as parameter to read the advertisement data:In your case, the raw data only includes type 0xFF, which is the Manufacturer Specific Data type, on a length of 30 bytes. Your callback handling should search through raw data for the type identifier 0xFF, and decode the following bytes over the encoded packet length.
The types of data included in advertising data varies depending on the device manufacturer, but it should includes at least the Manufacturer Specific Data, which starts with two bytes for the company identifier.
There are other types of BLE advertising data, such as:
This page lists various types of BLE advertising data:
https://www.novelbits.io/bluetooth-low-energy-advertisements-part-1/