48e059367f3be286316ca024ab0062d1dcd9bd6c
[platform/core/connectivity/wifi-direct-manager.git] / include / wifi-direct-dbus.h
1 /*
2  * Network Configuration Module
3  *
4  * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 /**
21  * This file declares wifi direct dbus utility functions.
22  *
23  * @file        wifi-direct-dbus.h
24  * @author      Nishant Chaprana (n.chaprana@samsung.com)
25  * @version     0.1
26  */
27
28 #ifndef __WIFI_DIRECT_DBUS_H__
29 #define __WIFI_DIRECT_DBUS_H__
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #include <gio/gio.h>
36
37 #define WFD_MANAGER_SERVICE                     "net.wifidirect"
38 #define WFD_MANAGER_PATH                        "/net/wifidirect"
39 #define WFD_MANAGER_MANAGE_INTERFACE            WFD_MANAGER_SERVICE
40 #define WFD_MANAGER_GROUP_INTERFACE             WFD_MANAGER_SERVICE ".group"
41 #define WFD_MANAGER_CONFIG_INTERFACE            WFD_MANAGER_SERVICE ".config"
42 #define WFD_MANAGER_SERVICE_INTERFACE           WFD_MANAGER_SERVICE ".service"
43 #define WFD_MANAGER_DISPLAY_INTERFACE           WFD_MANAGER_SERVICE ".display"
44 #ifdef TIZEN_FEATURE_WIFI_DIRECT_ON_DEMAND
45 #define DBUS_SERVICE                            "org.freedesktop.DBus"
46 #define DBUS_INTERFACE                          "org.freedesktop.DBus"
47 #define DBUS_PATH                               "/org/freedesktop/DBus"
48 #endif /* TIZEN_FEATURE_WIFI_DIRECT_ON_DEMAND */
49 #if defined(TIZEN_FEATURE_ASP)
50 #define WFD_MANAGER_ASP_INTERFACE               WFD_MANAGER_SERVICE ".asp"
51 #endif
52
53 #define WFD_MANAGER_DBUS_REPLY_TIMEOUT          10 * 1000
54 #define WFD_MANAGER_DBUS_REPLY_TIMEOUT_SYNC     10 * 1000
55 #define DBUS_OBJECT_PATH_MAX                    150
56
57 #define DBUS_DEBUG_VARIANT(parameters) \
58         do {\
59                 gchar *parameters_debug_str = NULL;\
60                 if (parameters)\
61                         parameters_debug_str = g_variant_print(parameters, TRUE);\
62                 WDS_LOGD("signal params [%s]", parameters_debug_str ? parameters_debug_str : "NULL");\
63                 g_free(parameters_debug_str);\
64         } while (0)
65
66 gboolean wfd_manager_dbus_init(void);
67
68 void wfd_manager_dbus_deinit(void);
69
70 guint wfd_manager_dbus_iface_register(const gchar* iface_name,
71                                       const gchar* iface_path,
72                                       GDBusNodeInfo *node_info,
73                                       const GDBusInterfaceVTable *interface_vtable);
74
75 gboolean wfd_manager_dbus_iface_unregister(guint reg_id);
76
77 gboolean wfd_manager_dbus_emit_signal(const gchar *interface_name,
78                                       const gchar *signal_name,
79                                       GVariant *parameters);
80
81 GVariant* wfd_manager_dbus_pack_ay(const unsigned char *src, int size);
82 #ifdef TIZEN_FEATURE_WIFI_DIRECT_ON_DEMAND
83 void wfd_manager_dbus_unregister_nameowner_signal(void);
84 #endif /* TIZEN_FEATURE_WIFI_DIRECT_ON_DEMAND */
85 #ifdef __cplusplus
86 }
87 #endif
88
89 #endif /* __WIFI_DIRECT_DBUS_H__ */