edrosten / libblepp

Modern clean C++ Bluetooth Low Energy on Linux without the Bluez DBUS API
Other
241 stars 63 forks source link

BLE advertising #32

Open mrquincle opened 6 years ago

mrquincle commented 6 years ago

This is a very sweet, tiny library. I've already used it to read out the bits in the overflow area in iOS advertisements.

Do you perhaps mind to also add an example on how to advertise with this utility? I've now to use hcitool cmd and hciconfig hci0 leadv 0 (or 3), etc. It would be swell to be quickly configure my laptop as an iBeacon.

edrosten commented 6 years ago

I haven't touched on that side of things yet, I'm afraid!

Currently the library serves two purposes. The first (main) is to act as a BLE client. The second is to poke the HCI device into scanning for servers.

Since it sounds like you're messing with the HCI directly, it sounds like the lescan.cc might have some useful things since it pokes at the HCI device, albeit via the thin C wrapper of libbluetooth.

Can you post the commands you're constructing and sending to the device?

mrquincle commented 6 years ago

Something like:

sudo hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0 00 00 00 00 c5 00 00 00 00 00 00 00 00 00 00 00 00 00
sudo hciconfig hci0 leadv 0

For example, nice question at SO: https://stackoverflow.com/questions/23483086/using-hcitool-to-set-ad-packets

edrosten commented 6 years ago

Oh I see. Yes I think this would be a new module for my library. I've not had a chance to look at it yet.