-
-
Notifications
You must be signed in to change notification settings - Fork 83
Add support for creating a NimBLEClient from a NimBLEServer peer. #251
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
Conversation
|
@finger563 You may be interested in reviewing this, your feedback would be greatly appreciated. |
@h2zero It looks like a net improvement to the API for sure, and I like not having to manage the client pointer myself just to talk to the connected client. One question I do have though is that In my code previously I would unset the client connection (calling |
|
That shouldn't be necessary now because the client is created and managed by the server and |
e4234d2 to
5910c10
Compare
|
@finger563 Did you perhaps test this at all? |
|
@h2zero Unfortunately, I've not had time to yet. If you need, I'll be able to test late today or tomorrow. |
|
@h2zero one change in behavior I'm seeing when using the new client instead of the one I was using before is that the initial connection (before auth is complete) now returns failure to get generic access service from the client: Disconnect and reconnect and it works fine. So that's something that ideally could be fixed? Code I'm using: // since this connection is handled by the server, we won't manually
// connect, and instead inform the client that we are already connected
// using this conn handle
auto client = server_->getClient(conn_info);
// refresh the services
client->getServices(true);
// now get Generic Access Service
auto gas = client->getService(NimBLEUUID("1800"));
if (!gas) {
logger_.error("Failed to get Generic Access Service");
return {};
} |
|
Thanks, not sure why that errored, would need to see logging with info messages on. |
|
Thanks, found the issue. @finger563 Just pushed the fix if you could please confirm when you have time? |
|
@h2zero Thanks, confirmed it's fixed :) |
This allows the NimBLEServer instance to create a NimBLEClient instance to read/write form/to a connected peer. Only one instance is supported subsequent calls will overwrite the previous client connection information and data.
09f4c15 to
081fdc6
Compare
finger563
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well in my testing :)
|
Great, thanks! I'm considering removing the server name read to go along with this as it seems redundant and bloats the code. |
With the implementation of the NimBLEServer::getClient function this is now redundant.



This allows the NimBLEServer instance to create a NimBLEClient instance to read/write form/to a connected peer. Only one instance is supported subsequent calls will overwrite the previous client connection information and data.