24#ifndef DBUS_HANDLER_H_
25#define DBUS_HANDLER_H_
37static const char*
const kDbusName =
"org.opencpn.OpenCPN";
40static const char*
const kDbusObject =
"/org/opencpn/OpenCPN";
43static const char*
const kDbusInterface =
"opencpn.desktop";
46static const gchar introspection_xml[] = R
"""(
48 <interface name='opencpn.desktop'>
49 <annotation name='org.gtk.GDBus.Annotation' value='OnInterface'/>
50 <annotation name='org.gtk.GDBus.Annotation' value='AlsoOnInterface'/>
52 <annotation name='org.gtk.GDBus.Annotation' value='OnMethod'/>
53 <arg type='u' name='level' direction='out'/>
54 <arg type='b' name='stat' direction='out'/>
57 <annotation name='org.gtk.GDBus.Annotation' value='OnMethod'/>
58 <!-- In the GUI case, raise application to top. -->
61 <annotation name='org.gtk.GDBus.Annotation' value='OnMethod'/>
62 <arg type='s' name='level' direction='in'/>
63 <arg type='b' name='stat' direction='out'/>
65 <method name='GetRestEndpoint'>
66 <annotation name='org.gtk.GDBus.Annotation' value='OnMethod'/>
67 <arg type='s' name='endpoint' direction='out'/>
70 <annotation name='org.gtk.GDBus.Annotation' value='OnMethod'/>
77static void HandleMethodCall(GDBusConnection* connection,
const gchar* sender,
78 const gchar* object_path,
79 const gchar* interface_name,
80 const gchar* method_name, GVariant* parameters,
81 GDBusMethodInvocation* invocation,
127 void SetMainInstance(
bool value) { m_is_main_instance = value; }
136 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.
Instance check interface.
The local API has a server side handling commands and a client part issuing commands.
A common variable shared between producer and consumer which supports Listen() and Notify().