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,
33 NFC_INFO(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
35 /* check privilege and update client context */
36 ret = net_nfc_server_gdbus_check_privilege(invocation, smack_privilege,
40 NFC_ERR("permission denied, and finished request");
45 net_nfc_server_gdbus_set_launch_state(g_dbus_method_invocation_get_sender(invocation),
48 net_nfc_gdbus_popup_complete_set(popup_manager, invocation, NET_NFC_OK);
53 static gboolean popup_handle_get(NetNfcGDbusPopup *popup_manager,
54 GDBusMethodInvocation *invocation, GVariant *smack_privilege, gpointer user_data)
59 NFC_INFO(">>> REQUEST from [%s]", g_dbus_method_invocation_get_sender(invocation));
61 /* check privilege and update client context */
62 ret = net_nfc_server_gdbus_check_privilege(invocation, smack_privilege,
66 NFC_ERR("permission denied, and finished request");
71 state = net_nfc_server_gdbus_get_launch_state(
72 g_dbus_method_invocation_get_sender(invocation));
74 net_nfc_gdbus_popup_complete_get(popup_manager, invocation, NET_NFC_OK, state);
79 gboolean net_nfc_server_system_handler_init(GDBusConnection *connection)
85 g_object_unref(popup_skeleton);
87 popup_skeleton = net_nfc_gdbus_popup_skeleton_new();
88 if (NULL == popup_skeleton)
90 NFC_ERR("Failed to allocate popup skeleton");
95 g_signal_connect(popup_skeleton, "handle-set", G_CALLBACK(popup_handle_set), NULL);
97 g_signal_connect(popup_skeleton, "handle-get", G_CALLBACK(popup_handle_get), NULL);
99 result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(popup_skeleton),
100 connection, "/org/tizen/NetNfcService/Popup", &error);
103 NFC_ERR("Can not skeleton_export %s", error->message);
107 net_nfc_server_system_handler_deinit();
113 void net_nfc_server_system_handler_deinit(void)
117 g_object_unref(popup_skeleton);
118 popup_skeleton = NULL;