-
-
Notifications
You must be signed in to change notification settings - Fork 140
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 returns empty string #559
Comments
The device may not be advertising it's name so there is no data. |
I based the server code off the new user guide and included that code in my
request for help. The documentation indicates the value specified in the
init() command is used as the device name. Is there a different
place/method I should use to supply an "advertised" name? Thanks for the
quick reply.
…On Wed, Jun 28, 2023 at 9:44 PM h2zero ***@***.***> wrote:
The device may not be advertising it's name so there is no data.
—
Reply to this email directly, view it on GitHub
<#559 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOOIJVJMLZHMOQY5FRRE7W3XNT227ANCNFSM6AAAAAAZXRU4HQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Yes you need to set the name in the advertisement, the device name in init only sets the name value for the characteristic. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What am I missing or doing wrong?
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
Found 8 devices
Connected to
Length of getName() : 0
Found our UUID : 4fafc201-1fb5-459e-8fcc-c5c9c331914b
BLE server code=========
#include <Arduino.h>
#include "NimBLEDevice.h"
NimBLEServer *pServer;
// void setup()
void setup(void)
{
Serial.begin(115200);
Serial.println("Starting NimBLE Server");
}
void loop()
{
delay(2000);
Serial.print(".");
}
BLE Client code=================
#include "NimBLEDevice.h"
#include <Arduino.h>
void setup() {
char foo[48];
Serial.begin(115200);
Serial.println("Starting NimBLE Client");
NimBLEDevice::init("");
NimBLEScan *pScan = NimBLEDevice::getScan();
NimBLEScanResults results = pScan->start(10);
NimBLEUUID serviceUuid("4fafc201-1fb5-459e-8fcc-c5c9c331914b");
Serial.printf("Found %i devices\n",results.getCount());
for(int i = 0; i < results.getCount(); i++) {
NimBLEAdvertisedDevice device = results.getDevice(i);
}
}
void loop() {
// put your main code here, to run repeatedly:
}
The text was updated successfully, but these errors were encountered: