|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include<stdio.h> |
|
20 #include <dbus/dbus.h> |
|
21 #include <stdlib.h> |
|
22 #include <string.h> |
|
23 |
|
24 #define LOG_FILE "c:\\logs\\dbus_connection_data_slot0_log1.txt" |
|
25 #include "std_log_result.h" |
|
26 #define LOG_FILENAME_LINE __FILE__, __LINE__ |
|
27 |
|
28 void create_xml(int result) |
|
29 { |
|
30 if(result) |
|
31 assert_failed = 1; |
|
32 |
|
33 testResultXml("dbus_connection_data_slot0"); |
|
34 close_log_file(); |
|
35 } |
|
36 |
|
37 int CheckConnection(DBusConnection* conn, DBusError* error) |
|
38 { |
|
39 if(!conn) |
|
40 { |
|
41 std_log(LOG_FILENAME_LINE, "Failed to get connection with error :: %s\n%s", error->name, error->message); |
|
42 |
|
43 dbus_error_free(error); |
|
44 return FALSE; |
|
45 } |
|
46 |
|
47 return TRUE; |
|
48 } |
|
49 |
|
50 int main() |
|
51 { |
|
52 DBusError error; |
|
53 DBusConnection* connection; |
|
54 dbus_int32_t data_slot = -1; |
|
55 |
|
56 dbus_error_init(&error); |
|
57 |
|
58 connection = dbus_bus_get_private(DBUS_BUS_SESSION, &error); |
|
59 if(!CheckConnection(connection, &error)) |
|
60 { |
|
61 create_xml(1); |
|
62 return 1; |
|
63 } |
|
64 |
|
65 if(!dbus_connection_allocate_data_slot(&data_slot)) |
|
66 { |
|
67 std_log(LOG_FILENAME_LINE, "Out of Memory"); |
|
68 create_xml(1); |
|
69 return 1; |
|
70 } |
|
71 |
|
72 dbus_connection_free_data_slot(&data_slot); |
|
73 |
|
74 dbus_connection_close(connection); |
|
75 dbus_connection_unref(connection); |
|
76 dbus_shutdown(); |
|
77 |
|
78 std_log(LOG_FILENAME_LINE, "Test Successful"); |
|
79 create_xml(0); |
|
80 return 0; |
|
81 } |