1

i'm trying to receive advertising data without connect to ble sensor, i used onScanResult function. I logcat the result and then i get:

 ScanResult{mDevice=A4:34:F1:3A:AF:XX, mScanRecord=ScanRecord 
 [mAdvertiseFlags=6, mServiceUuids=null, mManufacturerSpecificData={}, 
 mServiceData={}, mTxPowerLevel=-2147483648, mDeviceName=XXXX], 
 mRssi=-67, mTimestampNanos=1445086508079000}

the mDevice and mDeviceName and mRssi is correct, then i try to get the mScanRecord, it in byte array format, i try to convert it to hex representation: then i have this result

02010606094D734F6E65000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000

the first problem that the data change just for first time and then stay like this, and the data that i received is not like the original data that i tested in RPI using python script , this is the result of scanning in RPI

a4:34:f1:3a:af:ab,54540400201818000e00000000000000,-74
a4:34:f1:3a:af:ab,5252040313061f015500050000020001,-84

thank you for helping me

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • Your problem can be anywhere really, i'd start with the source and make sure the packets being advertised are valid. You'd receive ADV packets when you're not paired with the device, see packet structure [here](http://microchipdeveloper.com/wireless:ble-link-layer-packet-types). Android libraries expects a valid structure and in my case our custom device was advertising wrong packet length. You should also provide more info like what's the source, which android version and library you are using, code snippet etc. There is very little info here to narrow down the problem. – Kerem Mar 08 '18 at 21:02

1 Answers1

0

The first thing I noticed is 6E in your packet says that ADV packet has 110 bytes of payload data, which is not technically possible or it does not make sense. That is assuming when 0201 is your header (2 bytes) and 0606094D734F is the device address (6 bytes) is correct. You can double check it by scanning your packet using another scanner like your raspberry pi.

See this answer for how; https://stackoverflow.com/a/22569917/1505341

Something is wrong with the received packet structure there. I'd also check it with a BLE scanner app on android or even on iOS as well just to be sure. Nordic had a good one as far as I can remember. Not sure what's the best app out there these days for scanning raw BLE packets.

Kerem
  • 2,867
  • 24
  • 35
  • thank for your answer, when i scanning with Linux i receive this data: HCI sniffer - Bluetooth packet analyzer ver 5.37 device: hci0 snap_len: 1500 filter: 0xffffffffffffffff < 01 1A 0C 01 02 > 04 0E 04 02 1A 0C 00 my sending and receiving devices are not the same version. the first is 5.0 and the last is 4.1. Is there any incompatibilities between them? as i heard that they don't use the same data packet length! is it true? thank you in advance. i using Android 7.0 as receiving device. – Mehdi Zaghouani Mar 12 '18 at 08:34