Re: Get Name in Scan Response?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Travis,

On Fri, Nov 3, 2017 at 12:35 AM, Travis Griggs <travisgriggs@xxxxxxxxx> wrote:
> We’ve been developing products using BlueNRG chips, that act as BLE peripherals and are connected via Android/iOS devices acting as centrals to control/configure them. It is desirable to be able to discover nearby devices and then connect to them. Because of heinous caching strategies in both Android and iOS just using a previously connected devices name (derived from the name characteristic). The most reliable thing to do at the iOS/Droid level is capture the name from the advertising data and associate that with the device. This is the only reliable way to have a device determine its name programmatically and advertise that reliably.
>
> I’m trying to do a product with a Pi like SBC that runs BlueZ with a BLE dongle. I set the device’s alias with:
>
>     adapterProperties.Set('org.bluez.Adapter1', 'Alias', bleName())
>
> Where bleName() returns the string I want to use for the device. If I connect a time or two and reboot a time or two, this will eventually show up as the name property in Android/iOS. But if I try to get it from the advertising data, there doesn’t seem to be a name in there. Is this name not set as part of either the advertisement or scan response packet? I know that when doing a custom service UUID, there is not enough room in the advertisement packet to have both service UUID and name, so it has to go in the scan response packet. Can any bluez developers confirm what I should be expecting to happen with setting the Alias property?
>
> Is there a way to achieve what I want to do? I have an Advertisement interface that I worked up from the examples that I use to do the solicitID in. Do I need to shove the name in there somehow additionally?
>

You actually need to set the include option in the advertisement,
otherwise the kernel won't include the name on the scan response:

https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n147
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n64

You can check how it works with:
bluetoothctl> set-advertise-name on

Alternatively, you can set a local name for the advertisement:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n72
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux