21 #ifndef DBUS_HANDLER_H__
22 #define DBUS_HANDLER_H__
29 #include "model/instance_check.h"
31 #include "observable_evtvar.h"
40 static const char*
const kDbusName =
"org.opencpn.OpenCPN";
43 static const char*
const kDbusObject =
"/org/opencpn/OpenCPN";
46 static const char*
const kDbusInterface =
"opencpn.desktop";
49 static const gchar introspection_xml[] = R
"""(
51 <interface name='opencpn.desktop'>
52 <annotation name='org.gtk.GDBus.Annotation' value='OnInterface'/>
53 <annotation name='org.gtk.GDBus.Annotation' value='AlsoOnInterface'/>
55 <annotation name='org.gtk.GDBus.Annotation' value='OnMethod'/>
56 <arg type='u' name='level' direction='out'/>
57 <arg type='b' name='stat' direction='out'/>
60 <annotation name='org.gtk.GDBus.Annotation' value='OnMethod'/>
61 <!-- In the GUI case, raise application to top. -->
64 <annotation name='org.gtk.GDBus.Annotation' value='OnMethod'/>
65 <arg type='s' name='level' direction='in'/>
66 <arg type='b' name='stat' direction='out'/>
68 <method name='GetRestEndpoint'>
69 <annotation name='org.gtk.GDBus.Annotation' value='OnMethod'/>
70 <arg type='s' name='endpoint' direction='out'/>
73 <annotation name='org.gtk.GDBus.Annotation' value='OnMethod'/>
80 static void HandleMethodCall(GDBusConnection* connection,
const gchar* sender,
81 const gchar* object_path,
82 const gchar* interface_name,
83 const gchar* method_name, GVariant* parameters,
84 GDBusMethodInvocation* invocation,
131 void SetMainInstance(
bool value) { m_is_main_instance = value; }
140 bool m_is_main_instance;
Basic interface to low-level DBus library.
GDBusNodeInfo * introspection_data
Callback context.
static void Disconnect()
Clear current singleton instance and disconnect from session bus.
void WaitUntilValid() override
Wait until ready.
bool IsMainInstance()
Check if this instance is the only one.
Common interface for all instance checkers.
Base interface for local server command handling.
The local API has a server side handling commands and a client part issuing commands.