-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetName() #9
Comments
Hi, I started looking into this right now, but most of the devices within reach to not seem to provide a name:
Apart from that, you already have the implementation in your request. Regards, |
Added in #10 |
It is possible that only few people use it but all bluetooth devices supports advertising this information. For the LYWSD03 you can even edit the name in the Telink Flasher: To my regret the implementation I came up with is not working. I believe it has something to do with the data structure of NimBLE, unfortunately I am not code wizard enough to figure out how to pull this string from within the framework of this repository I will take a look at #10 |
Ah, o.k. I just added it and created a new release v0.4.1 which should be available in the Arduino library manager within an hour. Hope it works - please let me know. |
Thanks, I just pulled it from here and tested the example code from the from page but unfortunately the name is not passed. My output looks like this:
I was expecting:
|
I thought I'd done something wrong so I just went and pulled 0.4.1 directly from the releases page, but it's the same result, no name |
As far as I figured out, if I replace
|
I found that it works if you change to active scan mode in
I don't know if this is expected behaviour or a bug - if the other data is valid, I would expect the name to be available, too. You can set the Debug Level to "Debug" in the Arduino IDE and recompile to get more info from NimBLE and this library. |
See #11 and Release v0.4.2 |
With 0.4.2 I can confirm that it works as you described, also accasionally missing a name now and then, however changing scan time from 5 to 10 does not seem to affect this. Thank you so much for your effort, I am all fine with closing this issue here, unless you want to finetune the |
I'll leave it is at is for now. I used 15 seconds when I got the name reliably. Maybe it is related to some multiple of the advertising cycle time. |
Here is the answer: https://development.libelium.com/ble-networking-guide/scanning-ble-devices On the other hand, in active scanning the module will request more information once an advertisement is received, and the advertiser will answer with information like friendly name and supported profiles. I think the reason for missing names during active scanning is that I stop scanning when I receive an advertisement with the wanted address. At that time, the response to the advertising request may not have been received yet. |
Is your feature request related to a problem? Please describe.
When fetchins sensor data for several devices I would also like to include the bluetooth name of the sensor in my readout. Currently all we got is the MAC and I don't want to maintain a list copy of the BTnames in code.
Describe the solution you'd like
Update the struct
MiThData_S
and supporting code to hold the string value of the bluetooth name:In such a way that we will be able to get the BT name just like any other sensor detail, for instance:
std::string myName = miThDat.name;
and
int16_t myRssi = miThDat.rssi
Describe alternatives you've considered
I have already tried modifying the supporting code myself, but I got to admit that I am in way over my head
I got as far as to insert these two lines at line 168 of ATC_MiThermometer.cpp, right next to the
data[n].rssi
code:but this is not enough to get it working
Additional context
For someone who is not a complete noob, this is probably an easy fix :-)
The text was updated successfully, but these errors were encountered: