Closed hanhdt closed 6 years ago
Typically the advertisement packets that are periodically broadcast for passive discovery do not include the name and some other details. But when you use noble-uwp
to start scanning, it does an active scan, and it waits for a response to the active scan request (and that response typically does include the device name) before emitting a 'discover' event.
Are you seeing this behavior for all kinds of devices, or just a particular one?
Hi, Thanks for answering my question.
Yes, I understand. In fact, I tested with my specific hardware only. It's fine when I use with noble and ble adapter, I can see this. But not for noble-uwp.
Thanks.
Hi, I have encountered the same issue using noble-uwp in an electron app. As @hanhdt mentioned above, localName is null on peripheral discovery:
{
"localName":null,
"txPowerLevel":4,
"manufacturerData":{
"type":"Buffer",
"data":[ 107, 0, 47, 12, 64, 60 ]
},
"serviceUuids":[ "180d", "feee", "fea5" ],
"serviceData":[ { } ]
}
but if I write the advertisement object to the console:
console.dir(peripheral.advertisement);
the localName appears:
Object {
"localName": "Polar H10 34BE152A",
"txPowerLevel":4,
"manufacturerData":{
"type":"Buffer",
"data":[ 107, 0, 47, 12, 64, 60 ]
},
"serviceUuids":[ "180d", "feee", "fea5" ],
"serviceData":[ { } ]
}
i found a workaround from this post:
setTimeout(function()
{
var foo = peripheral;
}, 100);
Yes, it works for me. I can get localName after deplayed periods.
Thank you @jartholomew and @jasongin .
When I'm scanning devices, but get advertisement data without localName like this:
Do I have any workaround for this?
Thanks.