Author Topic: Custom Advertisement Packets  (Read 22621 times)

Offline briandunham

  • Newbie
  • *
  • Posts: 29
  • Karma: 0
Custom Advertisement Packets
« on: January 10, 2022, 10:40:34 PM »
I'm trying to create custom advertisement packets with multiple advertisement data types. For example, I need to have a single packet with both LE_GAP_AD_TYPE_FLAGS data and LE_GAP_AD_TYPE_MANUFACTURER data in the same packet. I'm referencing the Beacons demo project and I don't see a way do to this.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Custom Advertisement Packets
« Reply #1 on: January 10, 2022, 10:53:35 PM »
Hello,

You can not use LE_GAP_AD_TYPE_FLAGS on Windows platform. For LE_GAP_AD_TYPE_MANUFACTURER use wclBluetoothLeManufacturerAdvertisement class (refer to Beacons demo application to find more details).

Offline briandunham

  • Newbie
  • *
  • Posts: 29
  • Karma: 0
Re: Custom Advertisement Packets
« Reply #2 on: January 11, 2022, 06:29:39 PM »
Thanks for the quick response! But for future reference, is there a way to have multiple data types that are allowed?

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Custom Advertisement Packets
« Reply #3 on: January 11, 2022, 06:32:07 PM »
Thanks for the quick response! But for future reference, is there a way to have multiple data types that are allowed?

You can find all the data type restrictions by this link: https://www.btframework.com/blebeacon.htm

Offline briandunham

  • Newbie
  • *
  • Posts: 29
  • Karma: 0
Re: Custom Advertisement Packets
« Reply #4 on: January 17, 2022, 11:57:04 PM »
Is there not support for having multiple data type in the SAME advertisement packet? For example, we are scanning for specific advertisements and each advertisement has the flags, manufacturer data, and complete local name. All within the same packet! The issue here is when using the Beacons Demo, the OnAdvertisementFrameInformation() and OnManufacturerRawFrame() hooks are both called for a single advertisement. So associating the manufacturer data with the complete local name becomes unreliable because I have no way of knowing if they both came from the same advertisement or not.

I attached an image below showing how a Bluetooth advertisement can have multiple data types within the same payload. Is there a way to do this with this library?


Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Custom Advertisement Packets
« Reply #5 on: January 18, 2022, 05:15:57 AM »
Hello,

In fact I know how BLE advertisement looks. Not all advertismeents from any BLE device includes name and other data. It's just your device does so. Others may advertise name in separate advertisement. As you have MAC its not a problem to combine name and manufacturer data with using, let say, Dictionary class or something similar.

However we probably can add something like OnRawFrame but you have to parse all the data manually then.
« Last Edit: January 18, 2022, 05:35:16 AM by Mike Petrichenko »

Offline briandunham

  • Newbie
  • *
  • Posts: 29
  • Karma: 0
Re: Custom Advertisement Packets
« Reply #6 on: January 18, 2022, 06:50:29 PM »
I can't go into the specifics of how our hardware uses advertisements. But having all the data presented in a single OnRawFrame hook would be very beneficial for us. Parsing the data manually is no problem, but trying to piece together data from multiple hooks and storing it in a data structure isn't the ideal approach for us. In our specific case, this becomes an overly complicated solution that can be prone to issues.

This same issues arises when sending advertisements from Windows to our hardware. Putting all the data into a single advertisement would be very helpful even if we have to manually build the packet byte-by-byte.

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Custom Advertisement Packets
« Reply #7 on: January 18, 2022, 06:59:55 PM »
Ok, I see. We will try to add this feature. I'll let you about progress soon.

Offline briandunham

  • Newbie
  • *
  • Posts: 29
  • Karma: 0
Re: Custom Advertisement Packets
« Reply #8 on: January 18, 2022, 07:24:09 PM »
Thank you very much Mike. We really appreciate your support!

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Custom Advertisement Packets
« Reply #9 on: January 18, 2022, 10:00:36 PM »
Just sent changed version with new OnAdvertisementReceived() event to the registered e-mail address.

Offline briandunham

  • Newbie
  • *
  • Posts: 29
  • Karma: 0
Re: Custom Advertisement Packets
« Reply #10 on: January 27, 2022, 02:32:56 AM »
Just replying here to say that the new event works perfectly. We are now able to read the entire Bluetooth raw payload in a single event. Which allows us to have the freedom to build our own customized data parser to fit our needs! Great addition Mike

Offline Mike Petrichenko

  • Bluetooth Framework Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 1000
    • Wireless Communication Libraries
Re: Custom Advertisement Packets
« Reply #11 on: January 27, 2022, 06:13:33 AM »
You are very welcome. Have you received update with new raw advertisement so you can build your own advertisements? I sent it a couple of days ago.

Offline briandunham

  • Newbie
  • *
  • Posts: 29
  • Karma: 0
Re: Custom Advertisement Packets
« Reply #12 on: January 28, 2022, 12:27:37 AM »
Yes I received that update too. Thanks again!

 

Sitemap 1 2 3 4 5 6 7