2 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (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
8 * http://floralicense.org/license/
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.
16 #include "net_nfc_debug_internal.h"
17 #include "net_nfc_gdbus.h"
18 #include "net_nfc_server_common.h"
19 #include "net_nfc_server_context.h"
20 #include "net_nfc_server_system_handler.h"
23 static NetNfcGDbusPopup *popup_skeleton = NULL;
25 static gboolean popup_handle_set(NetNfcGDbusPopup *popup_manager,
26 GDBusMethodInvocation *invocation,
29 GVariant *smack_privilege,
32 static gboolean popup_handle_get(NetNfcGDbusPopup *popup_manager,
33 GDBusMethodInvocation *invocation,
34 GVariant *smack_privilege,
37 static gboolean popup_handle_set(NetNfcGDbusPopup *popup_manager,
38 GDBusMethodInvocation *invocation,
41 GVariant *smack_privilege,
44 INFO_MSG(">>> REQUEST from [%s]",
45 g_dbus_method_invocation_get_sender(invocation));
47 /* check privilege and update client context */
48 if (net_nfc_server_gdbus_check_privilege(invocation,
52 DEBUG_ERR_MSG("permission denied, and finished request");
57 net_nfc_server_gdbus_set_launch_state(
58 g_dbus_method_invocation_get_sender(invocation),
61 net_nfc_gdbus_popup_complete_set(popup_manager, invocation, NET_NFC_OK);
66 static gboolean popup_handle_get(NetNfcGDbusPopup *popup_manager,
67 GDBusMethodInvocation *invocation,
68 GVariant *smack_privilege,
73 INFO_MSG(">>> REQUEST from [%s]",
74 g_dbus_method_invocation_get_sender(invocation));
76 /* check privilege and update client context */
77 if (net_nfc_server_gdbus_check_privilege(invocation,
81 DEBUG_ERR_MSG("permission denied, and finished request");
86 state = net_nfc_server_gdbus_get_launch_state(
87 g_dbus_method_invocation_get_sender(invocation));
89 net_nfc_gdbus_popup_complete_get(popup_manager, invocation,
95 gboolean net_nfc_server_system_handler_init(GDBusConnection *connection)
101 g_object_unref(popup_skeleton);
103 popup_skeleton = net_nfc_gdbus_popup_skeleton_new();
104 if (popup_skeleton == NULL)
106 DEBUG_ERR_MSG("Failed to allocate popup skeleton");
111 g_signal_connect(popup_skeleton,
113 G_CALLBACK(popup_handle_set),
116 g_signal_connect(popup_skeleton,
118 G_CALLBACK(popup_handle_get),
121 result = g_dbus_interface_skeleton_export(
122 G_DBUS_INTERFACE_SKELETON(popup_skeleton),
124 "/org/tizen/NetNfcService/Popup",
128 DEBUG_ERR_MSG("Can not skeleton_export %s", error->message);
132 net_nfc_server_system_handler_deinit();
138 void net_nfc_server_system_handler_deinit(void)
142 g_object_unref(popup_skeleton);
143 popup_skeleton = NULL;