I found the sequence to set as Ibeacon with BLE Peripheral library but I could not succeed to create the map
The comment code is from a site that explain the sequency
Thanks
B4X:
'protected void setAdvertiseData() {
'
' AdvertiseData.Builder mBuilder = new AdvertiseData.Builder()
'
' ByteBuffer mManufacturerData = ByteBuffer.allocate(23);
'
' byte[] uuid = getIdAsByte(UUID.fromString("0CF052C297CA407C84F8B62AAC4E9020"));
'
' mManufacturerData.put(0, (byte)0x02);
' mManufacturerData.put(1, (byte)0x15);
'
' For (int i=2; i<=17; i++) {
' mManufacturerData.put(i, uuid[i-2]); // adding the UUID
' }
'
' mManufacturerData.put(18, (byte)0x00); // first byte of Major
' mManufacturerData.put(19, (byte)0x09); // second byte of Major
' mManufacturerData.put(20, (byte)0x00); // first minor
' mManufacturerData.put(21, (byte)0x06); // second minor
' mManufacturerData.put(22, (byte)0xB5); // txPower
'
' mBuilder.addManufacturerData(76, mManufacturerData.array());
' mAdvertiseData = mBuilder.build();
'}
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))
'peripheral.ManufacturerData = CreateMap(0x0700: "abc".GetBytes("utf8"))
Dim xManuf () As Byte
xManuf = Array As Byte (2, 21,48,14,45,65,48,14,45,65,48,14,45,65,48,14,45,65 ,12,35,12,36,111)
peripheral.ManufacturerData = CreateMap(22: xManuf )
If peripheral.IsPeripheralSupported = False Then
ToastMessageShow("Peripheral mode not supported.", True)
NotAvailable = True
Else
peripheral.Start2("B4APeripheral", CreateAdvertiseSettings)
' peripheral.Start("B4APeripheral")
Wait For Peripheral_Start (Success As Boolean)
Log("Peripheral started successfully? " & Success)
End If
End If
SetState(False)
End Sub
The comment code is from a site that explain the sequency
Thanks