This project has moved. For the latest updates, please go here.

When is BluetoothDeviceInfo.DeviceName updated?

Topics: Bluetooth - Microsoft
Feb 4, 2013 at 10:26 PM
I'm having an issue with finding when the user friendly name is updated. According to the documentation, I need to call .Refresh() and then wait for some time. However, it is still reporting very stale information. Is there another way to force this refresh? Is there a good way to know whether this is the device's fault?

Also, is there a good way to know that I've been passed a MAC address for a name? I've written my own check, but if there is something more reliable I'd rather use that.

This is happening on Win7.

Thanks!
Developer
Feb 5, 2013 at 7:42 AM
Windows itself caches the DeviceName and we have never found a way to flush that cache. See e.g. http://inthehand.com/forums/p/4007/11718.aspx So if the name was found previously then it won't change. I'll update the docs with that information. So Refresh is more useful when the name wasn't ready previously -- i.e. pre-v2.1 discovery where the name wasn't included in the inquiry process.

I'll look at adding a HasName property.
Feb 5, 2013 at 4:22 PM
Thanks Alan

On a lark, I tried setting the .DeviceName to "", and calling .Refresh() and .Update() - It appears to be working-ish.

I'm trying to find the right sequence for these steps - as I have them now, I only get the updated name on the second search back through the list.
Developer
Feb 6, 2013 at 9:07 PM
Good. :-,) Let me know what you find in the end and I'll add it to the docs, or to the code etc.
Feb 8, 2013 at 3:39 PM
I haven't made a whole lot of progress past my Tuesday post, but I've found a suboptimal solution that is good enough for what we need to do.
infos[] = BluetoothClient.DiscoverDevices
foreach info in infos
    if this info is relevant to my interests:
       .refresh()
       Optional: use the name if it isn't a mac address
       .DeviceName = "";
       .Update();

Wait a few seconds...

goodinfos = BluetoothClient.DiscoverDevices
All the names are accurate in this new list.

I haven't found a way to get it in only one DiscoverDevices call.