diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2012-12-12 17:18:15 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2012-12-12 17:18:15 -0800 |
commit | 689d66b6559dcb3a0ad7f6cc33b6129e50910253 (patch) | |
tree | 0da4b1946b25b966e04569afd01aa992e19fb7bc /btif/src/btif_sock.c | |
parent | 3ad3c81926cce0ae789752fbef6aa79ba595ae83 (diff) | |
download | external_bluetooth_bluedroid-689d66b6559dcb3a0ad7f6cc33b6129e50910253.zip external_bluetooth_bluedroid-689d66b6559dcb3a0ad7f6cc33b6129e50910253.tar.gz external_bluetooth_bluedroid-689d66b6559dcb3a0ad7f6cc33b6129e50910253.tar.bz2 |
Snapshot 9fd57cbacd95e89602f430244c35bbc67f08b6d2
Change-Id: Ibc3a4bf4161d286c7cfab89a19c676eb5cc9224f
Diffstat (limited to 'btif/src/btif_sock.c')
-rw-r--r-- | btif/src/btif_sock.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/btif/src/btif_sock.c b/btif/src/btif_sock.c index a2c799a..621a91e 100644 --- a/btif/src/btif_sock.c +++ b/btif/src/btif_sock.c @@ -38,11 +38,6 @@ #include "bta_api.h" #include "btif_sock_thread.h" #include "btif_sock_rfc.h" -#include <cutils/log.h> -#define info(fmt, ...) ALOGI ("btif_sock: %s: " fmt,__FUNCTION__, ## __VA_ARGS__) -#define debug(fmt, ...) ALOGD ("btif_sock: %s: " fmt,__FUNCTION__, ## __VA_ARGS__) -#define error(fmt, ...) ALOGE ("btif_sock: ## ERROR : %s: " fmt "##",__FUNCTION__, ## __VA_ARGS__) -#define asrt(s) if(!(s)) ALOGE ("btif_sock: ## %s assert %s failed at line:%d ##",__FUNCTION__, #s, __LINE__) static bt_status_t btsock_listen(btsock_type_t type, const char* service_name, const uint8_t* uuid, int channel, int* sock_fd, int flags); @@ -71,31 +66,27 @@ btsock_interface_t *btif_sock_get_interface() } bt_status_t btif_sock_init() { - debug(""); - - static volatile int binit; if(!binit) { //fix me, the process doesn't exit right now. don't set the init flag for now //binit = 1; - debug("btsock initializing..."); + BTIF_TRACE_DEBUG0("btsock initializing..."); btsock_thread_init(); int handle = btsock_thread_create(btsock_signaled, NULL); if(handle >= 0 && btsock_rfc_init(handle) == BT_STATUS_SUCCESS) { - debug("btsock successfully initialized"); + BTIF_TRACE_DEBUG0("btsock successfully initialized"); return BT_STATUS_SUCCESS; } } - else error("btsock interface already initialized"); + else BTIF_TRACE_ERROR0("btsock interface already initialized"); return BT_STATUS_FAIL; } void btif_sock_cleanup() { - debug(""); btsock_rfc_cleanup(); - debug("leaving"); + BTIF_TRACE_DEBUG0("leaving"); } static bt_status_t btsock_listen(btsock_type_t type, const char* service_name, @@ -103,7 +94,7 @@ static bt_status_t btsock_listen(btsock_type_t type, const char* service_name, { if((service_uuid == NULL && channel <= 0) || sock_fd == NULL) { - error("invalid parameters, uuid:%p, channel:%d, sock_fd:%p", service_uuid, channel, sock_fd); + BTIF_TRACE_ERROR3("invalid parameters, uuid:%p, channel:%d, sock_fd:%p", service_uuid, channel, sock_fd); return BT_STATUS_PARM_INVALID; } *sock_fd = -1; @@ -114,15 +105,15 @@ static bt_status_t btsock_listen(btsock_type_t type, const char* service_name, status = btsock_rfc_listen(service_name, service_uuid, channel, sock_fd, flags); break; case BTSOCK_L2CAP: - error("bt l2cap socket type not supported, type:%d", type); + BTIF_TRACE_ERROR1("bt l2cap socket type not supported, type:%d", type); status = BT_STATUS_UNSUPPORTED; break; case BTSOCK_SCO: - error("bt sco socket not supported, type:%d", type); + BTIF_TRACE_ERROR1("bt sco socket not supported, type:%d", type); status = BT_STATUS_UNSUPPORTED; break; default: - error("unknown bt socket type:%d", type); + BTIF_TRACE_ERROR1("unknown bt socket type:%d", type); status = BT_STATUS_UNSUPPORTED; break; } @@ -133,7 +124,7 @@ static bt_status_t btsock_connect(const bt_bdaddr_t *bd_addr, btsock_type_t type { if((uuid == NULL && channel <= 0) || bd_addr == NULL || sock_fd == NULL) { - error("invalid parameters, bd_addr:%p, uuid:%p, channel:%d, sock_fd:%p", + BTIF_TRACE_ERROR4("invalid parameters, bd_addr:%p, uuid:%p, channel:%d, sock_fd:%p", bd_addr, uuid, channel, sock_fd); return BT_STATUS_PARM_INVALID; } @@ -145,15 +136,15 @@ static bt_status_t btsock_connect(const bt_bdaddr_t *bd_addr, btsock_type_t type status = btsock_rfc_connect(bd_addr, uuid, channel, sock_fd, flags); break; case BTSOCK_L2CAP: - error("bt l2cap socket type not supported, type:%d", type); + BTIF_TRACE_ERROR1("bt l2cap socket type not supported, type:%d", type); status = BT_STATUS_UNSUPPORTED; break; case BTSOCK_SCO: - error("bt sco socket not supported, type:%d", type); + BTIF_TRACE_ERROR1("bt sco socket not supported, type:%d", type); status = BT_STATUS_UNSUPPORTED; break; default: - error("unknown bt socket type:%d", type); + BTIF_TRACE_ERROR1("unknown bt socket type:%d", type); status = BT_STATUS_UNSUPPORTED; break; } @@ -167,13 +158,13 @@ static void btsock_signaled(int fd, int type, int flags, uint32_t user_id) btsock_rfc_signaled(fd, flags, user_id); break; case BTSOCK_L2CAP: - error("bt l2cap socket type not supported, fd:%d, flags:%d", fd, flags); + BTIF_TRACE_ERROR2("bt l2cap socket type not supported, fd:%d, flags:%d", fd, flags); break; case BTSOCK_SCO: - error("bt sco socket type not supported, fd:%d, flags:%d", fd, flags); + BTIF_TRACE_ERROR2("bt sco socket type not supported, fd:%d, flags:%d", fd, flags); break; default: - error("unknown socket type:%d, fd:%d, flags:%d", type, fd, flags); + BTIF_TRACE_ERROR3("unknown socket type:%d, fd:%d, flags:%d", type, fd, flags); break; } } |