diff options
-rw-r--r-- | audio/headset.c | 32 | ||||
-rw-r--r-- | audio/headset.h | 14 | ||||
-rw-r--r-- | audio/manager.c | 20 | ||||
-rw-r--r-- | audio/manager.h | 2 |
4 files changed, 34 insertions, 34 deletions
diff --git a/audio/headset.c b/audio/headset.c index 85c233d5..e1122bd6 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -240,7 +240,7 @@ static void close_sco(struct headset *hs) hs->audio_output = NULL; } if (hs->audio_input) - audio_headset_close_input(hs); + headset_close_input(hs); assert(hs->rfcomm); hs->state = HEADSET_STATE_CONNECTED; hs_signal(hs, "Stopped"); @@ -436,7 +436,7 @@ gboolean headset_server_io_cb(GIOChannel *chan, GIOCondition cond, hs = manager_find_headset_by_bda(manager, &addr.rc_bdaddr); if (!hs) { - hs = audio_headset_new(manager_get_dbus_conn(manager), + hs = headset_new(manager_get_dbus_conn(manager), &addr.rc_bdaddr); if (!hs) { error("Unable to create a new headset object"); @@ -526,7 +526,7 @@ static gboolean audio_input_to_sco_cb(GIOChannel *chan, GIOCondition cond, gpoin return TRUE; failed: - audio_headset_close_input(hs); + headset_close_input(hs); return FALSE; } @@ -545,7 +545,7 @@ static gboolean sco_input_to_audio_output_cb(GIOChannel *chan, GIOCondition cond goto disconn; if (!hs->audio_output && hs->output) - audio_headset_open_output(hs, hs->output); + headset_open_output(hs, hs->output); err = g_io_channel_read(chan, buf, sizeof(buf), &bytes_read); @@ -1291,7 +1291,7 @@ static DBusHandlerResult hs_connect(struct headset *hs, DBusMessage *msg) return DBUS_HANDLER_RESULT_HANDLED;; } -static GIOError audio_headset_send_ring(struct headset *hs) +static GIOError headset_send_ring(struct headset *hs) { const char *ring_str = "\r\nRING\r\n"; GIOError err; @@ -1323,7 +1323,7 @@ static gboolean ring_timer_cb(gpointer data) assert(hs != NULL); - if (audio_headset_send_ring(hs) != G_IO_ERROR_NONE) + if (headset_send_ring(hs) != G_IO_ERROR_NONE) error("Sending RING failed"); return TRUE; @@ -1349,7 +1349,7 @@ static DBusHandlerResult hs_ring(struct headset *hs, DBusMessage *msg) goto done; } - if (audio_headset_send_ring(hs) != G_IO_ERROR_NONE) { + if (headset_send_ring(hs) != G_IO_ERROR_NONE) { dbus_message_unref(reply); return err_failed(hs->conn, msg); } @@ -1527,7 +1527,7 @@ static const DBusObjectPathVTable hs_table = { ** Create a unique dbus object path for the headset and allocates a new ** headset or return NULL if fail */ -struct headset *audio_headset_new(DBusConnection *conn, const bdaddr_t *bda) +struct headset *headset_new(DBusConnection *conn, const bdaddr_t *bda) { static int headset_uid = 0; struct headset *hs; @@ -1539,7 +1539,7 @@ struct headset *audio_headset_new(DBusConnection *conn, const bdaddr_t *bda) } snprintf(hs->object_path, sizeof(hs->object_path), - AUDIO_HEADSET_PATH_BASE "%d", headset_uid++); + HEADSET_PATH_BASE "%d", headset_uid++); if (!dbus_connection_register_object_path(conn, hs->object_path, &hs_table, hs)) { @@ -1555,7 +1555,7 @@ struct headset *audio_headset_new(DBusConnection *conn, const bdaddr_t *bda) return hs; } -void audio_headset_unref(struct headset *hs) +void headset_unref(struct headset *hs) { assert(hs != NULL); @@ -1564,7 +1564,7 @@ void audio_headset_unref(struct headset *hs) g_free(hs); } -gboolean audio_headset_close_output(struct headset *hs) +gboolean headset_close_output(struct headset *hs) { assert(hs != NULL); @@ -1579,13 +1579,13 @@ gboolean audio_headset_close_output(struct headset *hs) } /* FIXME: in the furture, that would be great to provide user space alsa driver (not plugin) */ -gboolean audio_headset_open_output(struct headset *hs, const char *output) +gboolean headset_open_output(struct headset *hs, const char *output) { int out; assert(hs != NULL && output != NULL); - audio_headset_close_output(hs); + headset_close_output(hs); if (output && hs->output) { g_free(hs->output); hs->output = g_strdup(output); @@ -1611,7 +1611,7 @@ gboolean audio_headset_open_output(struct headset *hs, const char *output) return TRUE; } -gboolean audio_headset_close_input(struct headset *hs) +gboolean headset_close_input(struct headset *hs) { assert(hs != NULL); @@ -1625,7 +1625,7 @@ gboolean audio_headset_close_input(struct headset *hs) return TRUE; } -gboolean audio_headset_open_input(struct headset *hs, const char *input) +gboolean headset_open_input(struct headset *hs, const char *input) { int in; @@ -1655,7 +1655,7 @@ gboolean audio_headset_open_input(struct headset *hs, const char *input) return TRUE; } -const char *audio_headset_get_path(struct headset *hs) +const char *headset_get_path(struct headset *hs) { return hs->object_path; } diff --git a/audio/headset.h b/audio/headset.h index 3027a9c1..9f1c1232 100644 --- a/audio/headset.h +++ b/audio/headset.h @@ -33,9 +33,9 @@ struct headset; #define BUF_SIZE 1024 -struct headset *audio_headset_new(DBusConnection *conn, const bdaddr_t *bda); +struct headset *headset_new(DBusConnection *conn, const bdaddr_t *bda); -void audio_headset_unref(struct headset *hs); +void headset_unref(struct headset *hs); uint32_t headset_add_ag_record(DBusConnection *conn, uint8_t channel); @@ -46,14 +46,14 @@ gboolean headset_server_io_cb(GIOChannel *chan, GIOCondition cond, gint headset_bda_cmp(gconstpointer headset, gconstpointer bda); -const char *audio_headset_get_path(struct headset *hs); +const char *headset_get_path(struct headset *hs); -gboolean audio_headset_close_output(struct headset *hs); +gboolean headset_close_output(struct headset *hs); -gboolean audio_headset_open_output(struct headset *hs, const char *output); +gboolean headset_open_output(struct headset *hs, const char *output); -gboolean audio_headset_close_input(struct headset *hs); +gboolean headset_close_input(struct headset *hs); -gboolean audio_headset_open_input(struct headset *hs, const char *input); +gboolean headset_open_input(struct headset *hs, const char *input); #endif /* __AUDIO_HEADSET_H_ */ diff --git a/audio/manager.c b/audio/manager.c index 743e50d5..28ae615e 100644 --- a/audio/manager.c +++ b/audio/manager.c @@ -169,7 +169,7 @@ static GIOChannel *server_socket(uint8_t *channel) return io; } -static gboolean audio_manager_create_headset_server(struct manager *manager, uint8_t chan) +static gboolean manager_create_headset_server(struct manager *manager, uint8_t chan) { assert(manager != NULL); @@ -249,7 +249,7 @@ static DBusHandlerResult am_create_headset(struct manager *manager, str2ba(address, &bda); hs = manager_find_headset_by_bda(manager, &bda); if (!hs) { - hs = audio_headset_new(manager->conn, &bda); + hs = headset_new(manager->conn, &bda); if (!hs) return error_reply(manager->conn, msg, "org.bluez.Error.Failed", @@ -257,7 +257,7 @@ static DBusHandlerResult am_create_headset(struct manager *manager, manager_add_headset(manager, hs); } - object_path = audio_headset_get_path(hs); + object_path = headset_get_path(hs); dbus_message_append_args(reply, DBUS_TYPE_STRING, &object_path, DBUS_TYPE_INVALID); @@ -287,7 +287,7 @@ static DBusHandlerResult am_get_default_headset(struct manager *manager, if (!reply) return DBUS_HANDLER_RESULT_NEED_MEMORY; - snprintf(object_path, sizeof(object_path), AUDIO_HEADSET_PATH_BASE "%d", + snprintf(object_path, sizeof(object_path), HEADSET_PATH_BASE "%d", manager->default_hs); dbus_message_append_args(reply, DBUS_TYPE_STRING, &opath, DBUS_TYPE_INVALID); @@ -339,7 +339,7 @@ static const DBusObjectPathVTable am_table = { .message_function = am_message, }; -static struct manager *audio_manager_new(DBusConnection *conn) +static struct manager *manager_new(DBusConnection *conn) { struct manager *manager; @@ -357,7 +357,7 @@ static struct manager *audio_manager_new(DBusConnection *conn) return manager; } -static void audio_manager_free(struct manager *manager) +static void manager_free(struct manager *manager) { assert(manager != NULL); @@ -372,7 +372,7 @@ static void audio_manager_free(struct manager *manager) } if (manager->headset_list) { - g_slist_foreach(manager->headset_list, (GFunc) audio_headset_unref, + g_slist_foreach(manager->headset_list, (GFunc) headset_unref, manager); g_slist_free(manager->headset_list); manager->headset_list = NULL; @@ -421,13 +421,13 @@ int audio_init(DBusConnection *conn) g_io_channel_unref(io); - manager = audio_manager_new(conn); + manager = manager_new(conn); if (!manager) { error("Failed to create an audio manager"); return -1; } - audio_manager_create_headset_server(manager, 12); + manager_create_headset_server(manager, 12); return 0; } @@ -438,7 +438,7 @@ void audio_exit(void) unix_sock = -1; - audio_manager_free(manager); + manager_free(manager); manager = NULL; } diff --git a/audio/manager.h b/audio/manager.h index 8335c79a..ca4df09d 100644 --- a/audio/manager.h +++ b/audio/manager.h @@ -33,7 +33,7 @@ struct manager; #define AUDIO_MANAGER_PATH "/org/bluez/audio" -#define AUDIO_HEADSET_PATH_BASE "/org/bluez/audio/headset" +#define HEADSET_PATH_BASE AUDIO_MANAGER_PATH "/headset" void manager_add_headset(struct manager *manager, struct headset *hs); |