-
-
Notifications
You must be signed in to change notification settings - Fork 510
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
backend: improve backend api and initialization #357
Conversation
23ed98a
to
6dda28e
Compare
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.
Only one comment
backend/src/backend_api.h
Outdated
@@ -2,7 +2,7 @@ | |||
extern "C" { | |||
#endif | |||
|
|||
__attribute__((visibility("default"))) int runBackend(int mavlink_listen_port); | |||
__attribute__((visibility("default"))) void runBackend(int mavlink_listen_port, void (*onServerStarted)(void*), void *context); |
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.
Missing #pragma once
in this file.
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.
Good catch! Thanks!
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.
That's fixed.
6dda28e
to
2e0ba43
Compare
2e0ba43
to
5f00f15
Compare
dronecore::backend::ConnectionInitiator<dronecore::DroneCore> _connection_initiator; | ||
std::unique_ptr<grpc::Server> _server; | ||
private: | ||
DroneCore _dc; |
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.
Not reference ? I don't know, I'm just asking.
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.
No, because backend.cpp
is actually the one owning the object. It has to be created somewhere, right? :-)
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.
Yes :)
This PR adds a callback notifying when the gRPC server is started to the backend C api. This is necessary when the frontend starts the backend on the phone, because it needs to wait for the gRPC server to be started before it can initiate a connection.