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.
27 #define MAX_LOCAL_BUFSZ 128
29 void request_cb(DBusPendingCall *pc, void *user_data)
35 reply = dbus_pending_call_steal_reply(pc);
36 dbus_pending_call_unref(pc);
38 dbus_error_init(&error);
40 if (!dbus_message_get_args(reply, &error,
41 DBUS_TYPE_STRING, &str, DBUS_TYPE_INVALID))
42 _E("Failed to complete call");
44 printf("filename = %s\n", str);
46 dbus_message_unref(reply);
51 int main(int argc, char **argv)
59 char tmp[MAX_LOCAL_BUFSZ];
63 loop = g_main_loop_new(NULL, FALSE);
65 dbus_error_init(&error);
67 bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
69 _E("Failed to open bus to bus")
71 dbus_connection_setup_with_g_main(bus, NULL);
73 message = dbus_message_new_method_call (
74 SERVICE_NAME,PATH_NAME,INTERFACE_NAME,
77 gettimeofday(&tv, NULL);
78 snprintf(tmp, MAX_LOCAL_BUFSZ, "%ld/%ld", tv.tv_sec, tv.tv_usec);
81 dbus_message_append_args(message,
82 DBUS_TYPE_STRING, &s, DBUS_TYPE_INVALID);
84 dbus_connection_send_with_reply(bus, message, &pc, INT_MAX);
85 if (!dbus_pending_call_set_notify(pc, request_cb, NULL, NULL))
86 _E("pending call set fail");
88 dbus_message_unref(message);
90 printf("wait result\n");
92 g_main_loop_run(loop);