4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>, Jaeho Lee <jaeho81.lee@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
28 #define MAX_LOCAL_BUFSZ 128
30 void request_cb(DBusPendingCall *pc, void *user_data)
36 reply = dbus_pending_call_steal_reply(pc);
37 dbus_pending_call_unref(pc);
39 dbus_error_init(&error);
41 if (!dbus_message_get_args(reply, &error,
42 DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID))
43 _E("Failed to complete call");
45 printf("filename = %s\n", str);
47 dbus_message_unref(reply);
52 int main(int argc, char **argv)
61 char tmp[MAX_LOCAL_BUFSZ];
65 loop = g_main_loop_new(NULL, FALSE);
67 dbus_error_init(&error);
69 bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
71 _E("Failed to open bus to bus")
73 dbus_connection_setup_with_g_main(bus, NULL);
75 message = dbus_message_new_method_call (
76 SERVICE_NAME,PATH_NAME,INTERFACE_NAME,
79 gettimeofday(&tv, NULL);
80 snprintf(tmp, MAX_LOCAL_BUFSZ, "%ld/%ld", tv.tv_sec, tv.tv_usec);
83 dbus_message_append_args(message,
84 DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID);
86 ret = dbus_connection_send_with_reply(bus, message, &pc, INT_MAX);
88 _E("dbus_connection_send_with_reply() failed.");
89 dbus_message_unref(message);
92 if (!dbus_pending_call_set_notify(pc, request_cb, NULL, NULL))
93 _E("pending call set fail");
95 dbus_message_unref(message);
97 printf("wait result\n");
99 g_main_loop_run(loop);