OpenCPN Partial API docs
|
Basic interface to low-level DBus library. More...
#include <dbus_server.h>
Public Member Functions | |
DbusServer (DbusServer &)=delete | |
void | operator= (const DbusServer &)=delete |
void | WaitUntilValid () override |
Wait until ready. More... | |
bool | IsMainInstance () |
Check if this instance is the only one. More... | |
void | SetMainInstance (bool value) |
DbusServer * | UnitTestInstance () |
Public Member Functions inherited from LocalServerApi | |
virtual void | SetGetRestApiEndpointCb (std::function< std::string()> cb) |
Set callback returning the rest server root endpoint. | |
Public Member Functions inherited from InstanceCheck | |
virtual void | CleanUp () |
Remove all persistent instance state, including possible lock file and defunct opencpn processes. | |
virtual void | OnExit () |
Do whatever needed before wxWidget's checks triggers. | |
Static Public Member Functions | |
static DbusServer & | GetInstance () |
static void | Disconnect () |
Clear current singleton instance and disconnect from session bus. | |
Static Public Member Functions inherited from LocalServerApi | |
static LocalServerApi & | GetInstance () |
static void | ReleaseInstance () |
Release Instance. | |
Static Public Member Functions inherited from InstanceCheck | |
static InstanceCheck & | GetInstance () |
Public Attributes | |
GDBusNodeInfo * | introspection_data |
Callback context. | |
Public Attributes inherited from LocalServerApi | |
EventVar | on_raise |
Notified on the Raise command. | |
EventVar | on_quit |
Notified on the Quit command. | |
std::function< bool(const std::string &)> | open_file_cb |
Callback invoked on open command with a file path argument. | |
std::function< std::string()> | get_rest_api_endpoint_cb |
Basic interface to low-level DBus library.
The server is started by the first call to GetInstance(). The server bith acts as a regular LocalApiServer and as an InstanceCheckinstance check.
Definition at line 94 of file dbus_server.h.
|
inlinevirtual |
Check if this instance is the only one.
Implements InstanceCheck.
Definition at line 129 of file dbus_server.h.
|
overridevirtual |
Wait until ready.
There is no signal for "ready", so the strategy is to just wait for some time, allowing the underlying layers to perform the dbus handshake. If we have claimed the bus name after this time we are a server, else a client.
TODO: Some clever algorithm to define processor speed which could be used to determine the wait time. On my fast development machine 200 us is enough in native Linux, but Flatpak requires longer time.
TODO: Some kind of lazy evalution to avoid delays?
Reimplemented from InstanceCheck.
Definition at line 154 of file dbus_server.cpp.