Android Question BLE Peripheral - advertising data

jvetterli

Member
Licensed User
Longtime User
Playing around with the BLE peripheral library, I'm wondering if it's possible to change the advertising data. When doing a BLE scan with a RedBear Duo, it shows me:

reportCallback:
The advEventType: 0
The peerAddrType: 1
The peerAddr: 64 D6 55 74 E2 D9
The rssi: -55
The advertising data: 2 1 1A E 9 42 34 41 50 65 72 69 70 68 65 72 61 6C 2 A F9 3 3 1 0
The length of Complete Local Name : D
The Complete Local Name is : B4APeripheral

Local name can be changed, but the advertising data stays the same with different phones.
 

jvetterli

Member
Licensed User
Longtime User
Hi Erel, I'm sorry for the late reply, thanks for the new version, didn't have a chance to try until today.
Unfortunately it doesn't work, if I set the manufacturer data, BLEperipheral2 doesn't seem to work anymore (without showing any errors in the log view), as the two phones I'm testing with, aren't showing up anymore.
 
Upvote 0

jvetterli

Member
Licensed User
Longtime User
I don't see any abnormalities in the log, I've attached them, BLEnew.txt for the version including the manufacturer-date.

I'm using your BlePeripheral sample and only changed Manager_StateChanged with two variations:

B4X:
Private Sub Manager_StateChanged (State As Int)
    If State <> manager.STATE_POWERED_ON Then
        ToastMessageShow("Please enable Bluetooth", True)
        NotAvailable = True
    Else
        peripheral.Initialize("peripheral", manager)
        
        'peripheral.ManufacturerData = CreateMap(123: "this is my data".GetBytes("utf8"))
        peripheral.ManufacturerData = CreateMap(123: "this is my data".GetBytes("utf8"), 124: Array As Byte(1, 2, 3, 4))
        
        If peripheral.IsPeripheralSupported = False Then
            ToastMessageShow("Peripheral mode not supported.", True)
            NotAvailable = True
        Else
            peripheral.Start("B4APeripheral")
            Wait For Peripheral_Start (Success As Boolean)
            Log("Peripheral started successfully? " & Success)
        End If
    End If
    SetState(False)
End Sub
 

Attachments

  • BLE.txt
    4.7 KB · Views: 385
  • BLEnew.txt
    1.8 KB · Views: 375
Upvote 0

jvetterli

Member
Licensed User
Longtime User
Don't know what I do wrong, but it still doesn't show up, I've attached the unfiltered log, maybe it will help.
 

Attachments

  • BLE log.txt
    6.4 KB · Views: 398
Upvote 0

jvetterli

Member
Licensed User
Longtime User
Pretty strange, I've tested with a Samsung Note4 and Blackview A7 without success. As soon as I comment the ManufacturerData out, the phone will show up on BLEscanner
 
Upvote 0
Top