Modification for Tizen Coding Rule
[platform/core/multimedia/libmm-sound.git] / include / mm_sound_dbus.h
1 /*
2  * libmm-sound
3  *
4  * Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Seungbae Shin <seungbae.shin@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 /**
23  * @file                mm_sound_dbus.h
24  * @brief               Internal dbus utility library for audio module.
25  * @date
26  * @version             Release
27  *
28  * Internal dbus utility library for audio module.
29  * Audio modules can use dbus simply without using dbus library directly.
30  */
31
32 #ifndef __MM_SOUND_DBUS_H__
33 #define __MM_SOUND_DBUS_H__
34
35 #include <gio/gio.h>
36 #include "include/mm_sound_intf.h"
37
38 typedef void (*mm_sound_dbus_callback)(audio_event_t event, GVariant *param, void *userdata);
39 typedef void (*mm_sound_dbus_userdata_free) (void *data);
40
41 int mm_sound_dbus_method_call_to(audio_provider_t provider, audio_method_t method_type, GVariant *args, GVariant **result);
42 int mm_sound_dbus_signal_subscribe_to(audio_provider_t provider, audio_event_t event, mm_sound_dbus_callback callback, void *userdata, mm_sound_dbus_userdata_free freefunc, unsigned *subs_id);
43 int mm_sound_dbus_signal_unsubscribe(unsigned subs_id);
44 int mm_sound_dbus_emit_signal(audio_provider_t provider, audio_event_t event, GVariant *param);
45
46 int mm_sound_dbus_get_event_name(audio_event_t event, const char **event_name);
47 int mm_sound_dbus_get_method_name(audio_method_t method, const char **method_name);
48
49 typedef void (*dbus_method_handler)(GDBusMethodInvocation *invocation);
50 typedef int (*dbus_signal_sender)(GDBusConnection *conn, GVariant *parameter);
51
52 typedef struct mm_sound_dbus_method_info {
53         const char* name;
54         /*
55         const char* argument;
56         const char* reply;
57         */
58 } mm_sound_dbus_method_info_t;
59
60 typedef struct mm_sound_dbus_signal_info {
61         const char* name;
62         const char* argument;
63 } mm_sound_dbus_signal_info_t;
64
65 typedef struct mm_sound_dbus_method_intf {
66         struct mm_sound_dbus_method_info info;
67         dbus_method_handler handler;
68 } mm_sound_dbus_method_intf_t;
69
70 typedef struct mm_sound_dbus_signal_intf {
71         struct mm_sound_dbus_signal_info info;
72         dbus_signal_sender sender;
73 } mm_sound_dbus_signal_intf_t;
74
75 #endif /* __MM_SOUND_DBUS_H__  */