From 5b9b4989612f0bee7d7b5574e78e760090bd2b7d Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 23 Apr 2008 20:19:04 +0000 Subject: Make bt_rfcomm_connect to take a channel instead of record and export bt_sco_connect. --- common/glib-helper.c | 21 +++------------------ common/glib-helper.h | 5 +++-- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/common/glib-helper.c b/common/glib-helper.c index 23271fa2..6eafa4f7 100644 --- a/common/glib-helper.c +++ b/common/glib-helper.c @@ -470,7 +470,7 @@ static int l2cap_connect(struct io_context *io_ctxt, const bdaddr_t *src, } static int rfcomm_connect(struct io_context *io_ctxt, const bdaddr_t *src, - const bdaddr_t *dst, int channel) + const bdaddr_t *dst, uint8_t channel) { struct sockaddr_rc addr; int sk, err; @@ -525,25 +525,10 @@ static void io_context_cleanup(struct io_context *io_ctxt) } int bt_rfcomm_connect(const bdaddr_t *src, const bdaddr_t *dst, - sdp_record_t *record, bt_io_callback_t cb, - void *user_data) + uint8_t channel, bt_io_callback_t cb, void *user_data) { struct io_context *io_ctxt; - sdp_list_t *protos; - int err, channel = -1; - - if (!record) - return -EINVAL; - - if (!sdp_get_access_protos(record, &protos)) { - channel = sdp_get_proto_port(protos, RFCOMM_UUID); - sdp_list_foreach(protos, (sdp_list_func_t) sdp_list_free, - NULL); - sdp_list_free(protos, NULL); - } - - if (channel < 0) - return -EINVAL; + int err; err = create_io_context(&io_ctxt, cb, user_data); if (err < 0) diff --git a/common/glib-helper.h b/common/glib-helper.h index d356290f..b51122ad 100644 --- a/common/glib-helper.h +++ b/common/glib-helper.h @@ -37,7 +37,8 @@ gchar *bt_list2string(GSList *list); GSList *bt_string2list(const gchar *str); int bt_rfcomm_connect(const bdaddr_t *src, const bdaddr_t *dst, - sdp_record_t *record, bt_io_callback_t cb, - void *user_data); + uint8_t channel, bt_io_callback_t cb, void *user_data); int bt_l2cap_connect(const bdaddr_t *src, const bdaddr_t *dst, uint16_t psm, bt_io_callback_t cb, void *user_data); +int bt_sco_connect(const bdaddr_t *src, const bdaddr_t *dst, + bt_io_callback_t cb, void *user_data); -- cgit