3 * oFono - Open Source Telephony
5 * Copyright (C) 2008-2012 Intel Corporation. All rights reserved.
6 * Copyright (C) 2012 BMW Car IT GmbH. All rights reserved.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #define OFONO_API_SUBJECT_TO_CHANGE
27 #include <ofono/types.h>
29 #define DUN_VERSION_1_2 0x0102
31 void __dundee_exit(void);
33 enum dundee_error_type {
34 DUNDEE_ERROR_TYPE_NO_ERROR = 0,
35 DUNDEE_ERROR_TYPE_FAILURE,
39 enum dundee_error_type type;
49 static inline struct cb_data *cb_data_new(void *cb, void *data)
53 ret = g_new0(struct cb_data, 1);
60 #define CALLBACK_WITH_FAILURE(cb, args...) \
62 struct dundee_error cb_e; \
63 cb_e.type = DUNDEE_ERROR_TYPE_FAILURE; \
69 #define CALLBACK_WITH_SUCCESS(f, args...) \
71 struct dundee_error e; \
72 e.type = DUNDEE_ERROR_TYPE_NO_ERROR; \
77 #include <ofono/log.h>
79 int __ofono_log_init(const char *program, const char *debug,
81 void __ofono_log_cleanup(void);
82 void __ofono_log_enable(struct ofono_debug_desc *start,
83 struct ofono_debug_desc *stop);
85 #include <ofono/dbus.h>
87 #define DUNDEE_SERVICE "org.ofono.dundee"
88 #define DUNDEE_MANAGER_INTERFACE "org.ofono.dundee.Manager"
89 #define DUNDEE_DEVICE_INTERFACE "org.ofono.dundee.Device"
90 #define DUNDEE_MANAGER_PATH "/"
92 int __ofono_dbus_init(DBusConnection *conn);
93 void __ofono_dbus_cleanup(void);
95 void __ofono_dbus_pending_reply(DBusMessage **msg, DBusMessage *reply);
97 DBusMessage *__dundee_error_invalid_args(DBusMessage *msg);
98 DBusMessage *__dundee_error_failed(DBusMessage *msg);
99 DBusMessage *__dundee_error_in_progress(DBusMessage *msg);
100 DBusMessage *__dundee_error_timed_out(DBusMessage *msg);
103 int __dundee_manager_init(void);
104 void __dundee_manager_cleanup(void);
107 struct dundee_device;
109 int __dundee_device_init(void);
110 void __dundee_device_cleanup(void);
111 void __dundee_device_shutdown(void);
113 typedef void (*dundee_device_connect_cb_t)(const struct dundee_error *error,
115 typedef void (*dundee_device_disconnect_cb_t)(const struct dundee_error *error,
118 struct dundee_device_driver {
121 /* Connect and dial */
122 void (*connect)(struct dundee_device *device,
123 dundee_device_connect_cb_t cb, void *data);
125 /* Hangup and disconnect */
126 void (*disconnect)(struct dundee_device *device,
127 dundee_device_disconnect_cb_t cb, void *data);
130 struct dundee_device *dundee_device_create(struct dundee_device_driver *d);
131 int dundee_device_register(struct dundee_device *device);
132 void dundee_device_unregister(struct dundee_device *device);
134 void dundee_device_disconnect(const struct dundee_error *error,
135 struct dundee_device *device);
137 void dundee_device_set_data(struct dundee_device *device, void *data);
138 void *dundee_device_get_data(struct dundee_device *device);
140 int dundee_device_set_name(struct dundee_device *device, const char *name);
142 typedef void (*dundee_device_foreach_func)(struct dundee_device *device,
144 void __dundee_device_foreach(dundee_device_foreach_func cb, void *userdata);
146 const char *__dundee_device_get_path(struct dundee_device *device);
147 void __dundee_device_append_properties(struct dundee_device *device,
148 DBusMessageIter *dict);
150 int __dundee_bluetooth_init(void);
151 void __dundee_bluetooth_cleanup(void);