Android Question BLE2 library / Advertising Message / manufacturer specific data

Szantoi Gyorgy

Member
Licensed User
Longtime User
Hi Erel,

could you help me, how can I catch the manufacturer specific data record
in BLE advertising message ? The AD type of this record is 0xff.
The Flags (0x01) and the local name (0x09) arrive well.

Thank you for your help.

Best Regards
Gyorgy
 

Attachments

  • MCP.jpg
    MCP.jpg
    198.2 KB · Views: 371

Szantoi Gyorgy

Member
Licensed User
Longtime User
Hi,

the raw adv data is :

0x02-01-05 : Flag
0x05-FF-59-00-65-00 : Manuf data
0x0A-09-42-6C-75-65-5F-53-31-33-30 : DevName : "Blue_S130"
 
Upvote 0

Szantoi Gyorgy

Member
Licensed User
Longtime User
Hi,

this is the LOG output of Log("AdvD:" & AdvertisingData) :

AdvD:(MyMap) {1=[B@a72b32b, -1=[B@3af9388, 9=[B@3e57121, 0=[B@1af6946}

Thanks and Happy New Year !!!
 
Upvote 0

Szantoi Gyorgy

Member
Licensed User
Longtime User
You can see in the log the manuf data, it is the "-1=....", but the GetRecordsFromAdvertisingData doesn't detect it.


Log("AdvD:" & AdvertisingData)

For Each k As Int In AdvertisingData.Keys
If k <> 0 Then
Dim b() As Byte = AdvertisingData.Get(k)
Log("Key: " & k & ", Value: " & BytesToString(b, 0, b.Length, "utf8"))
End If
Next

For Key = 0 To 255
If AdvertisingData.ContainsKey(Key) Then
For Each b() As Byte In manager.GetRecordsFromAdvertisingData(AdvertisingData, Key)
Log("Found K:" & Key & "h: " & bc.HexFromBytes(b))
Next
End If
Next


AdvD:(MyMap) {1=[B@a72b32b, -1=[B@3af9388, 9=[B@3e57121, 0=[B@1af6946}
Key: 1, Value:
Key: -1, Value: Y��e��
Key: 9, Value: Blue_S130
Found K:1h: 05
Found K:9h: 426C75655F53313330
Connect to Device: Blue_S130
Discovering services.
Connected
 
Upvote 0

Szantoi Gyorgy

Member
Licensed User
Longtime User
Hi,

this part of the log is belonging to the code you sent me :

Key: 1, Value:
Key: -1, Value: Y��e��
Key: 9, Value: Blue_S130
 
Upvote 0

Szantoi Gyorgy

Member
Licensed User
Longtime User
Hi Erel,

my code is the following and you can see the generated log too.

B4X:
    For Each k As Int In AdvertisingData.Keys
       If k <> 0 Then
          Dim b() As Byte = AdvertisingData.Get(k)
          Log("Key: " & k & ", Value ASCII: " & BytesToString(b, 0, b.Length, "utf8") & ", Value hex: " &  bc.HexFromBytes(b)  )
       End If
   Next


Log:

Key: 1, Value ASCII: , Value hex: 05
Key: -1, Value ASCII: Y��e��, Value hex: 59006500
Key: 9, Value ASCII: Blue_S130, Value hex: 426C75655F53313330
 
Upvote 0

Szantoi Gyorgy

Member
Licensed User
Longtime User
Hi Erel,
the GetRecordsFromAdvertisingData() function doesn't know ManufData, but I can get it with AdvertisingData.Get(x).
This other way is good too, so I thank you for your help.
 
Upvote 0
Top