Added Haltest for wifi-mesh-manager
[platform/core/connectivity/wifi-mesh-manager.git] / haltest / gdbus.h
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef __WIFI_MESH_MGR_GDBUS_H__
17 #define __WIFI_MESH_MGR_GDBUS_H__
18
19 #include <glib.h>
20 #include <gio/gio.h>
21
22 #include "wmeshmgr.h"
23
24 #define GMAINTIMEOUT 10000
25 #define DBUS_REPLY_TIMEOUT (120 * 1000)
26
27 #define WIFI_MESH_MGR_SERVICE "net.wmesh"
28 #define WIFI_MESH_MGR_INTERFACE WIFI_MESH_MGR_SERVICE
29
30 #define WIFI_MESH_MGR_MANAGER_INTERFACE WIFI_MESH_MGR_SERVICE ".manager"
31
32 #define WIFI_MESH_MGR_MANAGER_PATH "/net/wmesh/manager"
33 #define WIFI_MESH_MGR_PATH "/net/wmesh"
34
35 #define WIFI_MESH_MGR_METHOD_MANAGER_START "enable"
36 #define WIFI_MESH_MGR_METHOD_MANAGER_STOP "disable"
37 #define WIFI_MESH_MGR_METHOD_SCAN "scan"
38 #define WIFI_MESH_MGR_METHOD_SPECIFIC_SCAN "specific_scan"
39 #define WIFI_MESH_MGR_METHOD_CANCEL_SCAN "cancel_scan"
40 #define WIFI_MESH_MGR_METHOD_GET_FOUND_MESH_NETWORKS "get_found_mesh_networks"
41 #define WIFI_MESH_MGR_METHOD_GET_CONNECTED_PEERS "get_connected_peers"
42 #define WIFI_MESH_MGR_METHOD_ENABLE_MESH "enable_mesh"
43 #define WIFI_MESH_MGR_METHOD_DISABLE_MESH "disable_mesh"
44 #define WIFI_MESH_MGR_METHOD_IS_MESH_ENABLED "is_mesh_enabled"
45 #define WIFI_MESH_MGR_METHOD_IS_JOINED "is_joined"
46 #define WIFI_MESH_MGR_METHOD_GET_JOINED_MESH_NETWORK "get_joined_mesh_network"
47 #define WIFI_MESH_MGR_METHOD_SET_GATE "set_gate"
48 #define WIFI_MESH_MGR_METHOD_UNSET_GATE "unset_gate"
49 #define WIFI_MESH_MGR_METHOD_SET_SOFTAP "set_softap"
50 #define WIFI_MESH_MGR_METHOD_GET_SOFTAP "get_softap"
51 #define WIFI_MESH_MGR_METHOD_ENABLE_SOFTAP "enable_softap"
52 #define WIFI_MESH_MGR_METHOD_DISABLE_SOFTAP "disable_softap"
53 #define WIFI_MESH_MGR_METHOD_IS_SOFTAP_ENABLED "is_softap_enabled"
54 #define WIFI_MESH_MGR_METHOD_CREATE_MESH_NETWORK "create_mesh_network"
55 #define WIFI_MESH_MGR_METHOD_CONNECT_MESH_NETWORK "connect_mesh_network"
56 #define WIFI_MESH_MGR_METHOD_DISCONNECT_MESH_NETWORK "disconnect_mesh_network"
57 #define WIFI_MESH_MGR_METHOD_FORGET_MESH_NETWORK "forget_mesh_network"
58 #define WIFI_MESH_MGR_METHOD_SET_INTERFACES "set_interfaces"
59 #define WIFI_MESH_MGR_METHOD_GET_STATION_INFO "get_station_info"
60 #define WIFI_MESH_MGR_METHOD_GET_MPATH_INFO "get_mpath_info"
61 #define WIFI_MESH_MGR_METHOD_GET_MESHCONF_INFO "get_meshconf_info"
62
63
64 class GDbus {
65 private:
66         GDBusConnection *m_pConnection;
67         GCancellable *m_pCancellable;
68 public:
69         GDbus();
70         ~GDbus();
71         error_e Create(void);
72         error_e Destroy(void);
73         GDBusConnection *GetConnection(void);
74         GCancellable *GetCancellable(void);
75         error_e ConvertErrorStringToEnum(const char *error);
76         GVariant *InvokeMethod(const char *dest, const char *path,
77                 const char *iface_name, const char *method, GVariant *params, error_e *dbus_error);
78         error_e InvokeMethodNonblock(const char *dest, const char *path,
79                 const char *iface_name, const char *method, GVariant *params, int timeout,
80                 GAsyncReadyCallback notify_func, void *user_data);
81 };
82
83 #endif /* __WIFI_MESH_MGR_GDBUS_H__ */