PipeWire 1.4.1
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
dbus.h
Go to the documentation of this file.
1/* Simple Plugin API */
2/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3/* SPDX-License-Identifier: MIT */
4
5#ifndef SPA_DBUS_H
6#define SPA_DBUS_H
7
8#ifdef __cplusplus
9extern "C" {
10#endif
11
12#include <spa/support/loop.h>
13
14#ifndef SPA_API_DBUS
15 #ifdef SPA_API_IMPL
16 #define SPA_API_DBUS SPA_API_IMPL
17 #else
18 #define SPA_API_DBUS static inline
19 #endif
20#endif
21
31#define SPA_TYPE_INTERFACE_DBus SPA_TYPE_INFO_INTERFACE_BASE "DBus"
32
33#define SPA_VERSION_DBUS 0
34struct spa_dbus { struct spa_interface iface; };
35
36enum spa_dbus_type {
40};
41
42#define SPA_DBUS_CONNECTION_EVENT_DESTROY 0
43#define SPA_DBUS_CONNECTION_EVENT_DISCONNECTED 1
44#define SPA_DBUS_CONNECTION_EVENT_NUM 2
47#define SPA_VERSION_DBUS_CONNECTION_EVENTS 0
48 uint32_t version;
50 /* a connection is destroyed */
51 void (*destroy) (void *data);
53 /* a connection disconnected */
54 void (*disconnected) (void *data);
55};
58#define SPA_VERSION_DBUS_CONNECTION 1
59 uint32_t version;
71 void *(*get) (struct spa_dbus_connection *conn);
77 void (*destroy) (struct spa_dbus_connection *conn);
78
84 void (*add_listener) (struct spa_dbus_connection *conn,
85 struct spa_hook *listener,
86 const struct spa_dbus_connection_events *events,
87 void *data);
88};
89
93{
94 return spa_api_func_r(void *, NULL, conn, get, 0);
95}
99{
100 spa_api_func_v(conn, destroy, 0);
101}
105 struct spa_hook *listener,
106 const struct spa_dbus_connection_events *events,
107 void *data)
108{
109 spa_api_func_v(conn, add_listener, 1, listener, events, data);
110}
111
113#define SPA_VERSION_DBUS_METHODS 0
114 uint32_t version;
115
128 struct spa_dbus_connection * (*get_connection) (void *object,
129 enum spa_dbus_type type);
130};
131
136spa_dbus_get_connection(struct spa_dbus *dbus, enum spa_dbus_type type)
137{
138 return spa_api_method_r(struct spa_dbus_connection *, NULL,
139 spa_dbus, &dbus->iface, get_connection, 0, type);
140}
141
146#ifdef __cplusplus
147} /* extern "C" */
148#endif
149
150#endif /* SPA_DBUS_H */
#define SPA_API_DBUS
Definition dbus.h:25
spa_dbus_type
Definition dbus.h:45
SPA_API_DBUS void spa_dbus_connection_destroy(struct spa_dbus_connection *conn)
Destroy a dbus connection wrapper.
Definition dbus.h:112
SPA_API_DBUS void * spa_dbus_connection_get(struct spa_dbus_connection *conn)
Get the DBusConnection from a wrapper.
Definition dbus.h:106
SPA_API_DBUS struct spa_dbus_connection * spa_dbus_get_connection(struct spa_dbus *dbus, enum spa_dbus_type type)
Get a new connection wrapper for the given bus type.
Definition dbus.h:151
SPA_API_DBUS void spa_dbus_connection_add_listener(struct spa_dbus_connection *conn, struct spa_hook *listener, const struct spa_dbus_connection_events *events, void *data)
Add a listener for events.
Definition dbus.h:118
@ SPA_DBUS_TYPE_SESSION
The login session bus.
Definition dbus.h:46
@ SPA_DBUS_TYPE_STARTER
The bus that started us, if any.
Definition dbus.h:48
@ SPA_DBUS_TYPE_SYSTEM
The systemwide bus.
Definition dbus.h:47
#define spa_api_func_v(o, method, version,...)
Definition hook.h:268
#define spa_api_method_r(rtype, def, type, o, method, version,...)
Definition hook.h:291
#define spa_api_func_r(rtype, def, o, method, version,...)
Definition hook.h:273
spa/support/loop.h
Definition dbus.h:58
void(* destroy)(void *data)
Definition dbus.h:64
uint32_t version
Definition dbus.h:61
void(* disconnected)(void *data)
Definition dbus.h:67
Definition dbus.h:70
void(* destroy)(struct spa_dbus_connection *conn)
Destroy a dbus connection wrapper.
Definition dbus.h:91
void(* add_listener)(struct spa_dbus_connection *conn, struct spa_hook *listener, const struct spa_dbus_connection_events *events, void *data)
Add a listener for events.
Definition dbus.h:98
uint32_t version
Definition dbus.h:73
Definition dbus.h:126
uint32_t version
Definition dbus.h:129
Definition dbus.h:43
struct spa_interface iface
Definition dbus.h:43
A hook, contains the structure with functions and the data passed to the functions.
Definition hook.h:427
Definition hook.h:148