diff options
author | fredc <fredc@broadcom.com> | 2012-04-25 17:33:07 -0700 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2012-07-14 11:19:18 -0700 |
commit | 7105408a110e1fa7bfa7b82637cd704a2c428f68 (patch) | |
tree | b1db2af12aea7988c099350a3fec856ecc2aa246 /btif | |
parent | bc5b4b2e7c7d923a861039d3ca5d9a7492a5f328 (diff) | |
download | external_bluetooth_bluedroid-7105408a110e1fa7bfa7b82637cd704a2c428f68.zip external_bluetooth_bluedroid-7105408a110e1fa7bfa7b82637cd704a2c428f68.tar.gz external_bluetooth_bluedroid-7105408a110e1fa7bfa7b82637cd704a2c428f68.tar.bz2 |
Reverted PAN on/off handling code.
Change-Id: I5a0924e972665584e091a87c2a7e5c3c479e8e64
Diffstat (limited to 'btif')
-rw-r--r-- | btif/include/btif_pan.h | 2 | ||||
-rw-r--r-- | btif/src/btif_core.c | 7 | ||||
-rw-r--r-- | btif/src/btif_pan.c | 50 | ||||
-rw-r--r-- | btif/src/btif_sock.c | 15 |
4 files changed, 48 insertions, 26 deletions
diff --git a/btif/include/btif_pan.h b/btif/include/btif_pan.h index 065b9da..47635d7 100644 --- a/btif/include/btif_pan.h +++ b/btif/include/btif_pan.h @@ -59,4 +59,6 @@ #define btif_pan_h_ #include <hardware/bt_pan.h> btpan_interface_t *btif_pan_interface(); +void btif_pan_init(); +void btif_pan_cleanup(); #endif diff --git a/btif/src/btif_core.c b/btif/src/btif_core.c index 3c0142d..ff8512e 100644 --- a/btif/src/btif_core.c +++ b/btif/src/btif_core.c @@ -512,6 +512,8 @@ void btif_enable_bluetooth_evt(tBTA_STATUS status, BD_ADDR local_bd) /* init rfcomm & l2cap api */ btif_sock_init(); + /* init pan */ + btif_pan_init(); /* load did configuration */ bte_load_did_conf(BTE_DID_CONF_FILE); @@ -523,6 +525,8 @@ void btif_enable_bluetooth_evt(tBTA_STATUS status, BD_ADDR local_bd) /* cleanup rfcomm & l2cap api */ btif_sock_cleanup(); + btif_pan_cleanup(); + btif_enabled = 0; HAL_CBACK(bt_hal_cbacks, adapter_state_changed_cb, BT_STATE_OFF); @@ -556,7 +560,8 @@ bt_status_t btif_disable_bluetooth(void) /* cleanup rfcomm & l2cap api */ btif_sock_cleanup(); - //btif_pan_cleanup(); + btif_pan_cleanup(); + status = BTA_DisableBluetooth(); diff --git a/btif/src/btif_pan.c b/btif/src/btif_pan.c index 7edd88a..c489149 100644 --- a/btif/src/btif_pan.c +++ b/btif/src/btif_pan.c @@ -89,11 +89,11 @@ #include <cutils/log.h> -#define info(fmt, ...) LOGI ("%s(L%d): " fmt,__FUNCTION__, __LINE__, ## __VA_ARGS__) -#define debug(fmt, ...) LOGD ("%s(L%d): " fmt,__FUNCTION__, __LINE__, ## __VA_ARGS__) -#define warn(fmt, ...) LOGW ("## WARNING : %s(L%d): " fmt "##",__FUNCTION__, __LINE__, ## __VA_ARGS__) -#define error(fmt, ...) LOGE ("## ERROR : %s(L%d): " fmt "##",__FUNCTION__, __LINE__, ## __VA_ARGS__) -#define asrt(s) if(!(s)) LOGE ("## %s assert %s failed at line:%d ##",__FUNCTION__, #s, __LINE__) +#define info(fmt, ...) LOGI ("btif_pan: %s(L%d): " fmt,__FUNCTION__, __LINE__, ## __VA_ARGS__) +#define debug(fmt, ...) LOGD ("btif_pan: %s(L%d): " fmt,__FUNCTION__, __LINE__, ## __VA_ARGS__) +#define warn(fmt, ...) LOGW ("btif_pan: ## WARNING : %s(L%d): " fmt "##",__FUNCTION__, __LINE__, ## __VA_ARGS__) +#define error(fmt, ...) LOGE ("btif_pan: ## ERROR : %s(L%d): " fmt "##",__FUNCTION__, __LINE__, ## __VA_ARGS__) +#define asrt(s) if(!(s)) LOGE ("btif_pan: ## %s assert %s failed at line:%d ##",__FUNCTION__, #s, __LINE__) @@ -133,13 +133,11 @@ btpan_interface_t *btif_pan_get_interface() { return &pan_if; } - -static btpan_callbacks_t callback; -static bt_status_t btpan_init(const btpan_callbacks_t* callbacks) +void btif_pan_init() { - //static volatile int binit; - - debug("in, btpan_cb.enabled:%d", btpan_cb.enabled); + debug("btpan_cb.enabled:%d", btpan_cb.enabled); + //btif_enable_service(BTA_PANU_SERVICE_ID); + //btif_enable_service(BTA_NAP_SERVICE_ID); if (!btpan_cb.enabled) { //btui_cfg.pan_security = PAN_SECURITY; @@ -158,23 +156,36 @@ static bt_status_t btpan_init(const btpan_callbacks_t* callbacks) btpan_enable(BTPAN_ROLE_PANU); //debug("set to BTPAN_ROLE_PANNAP for testing"); //btpan_enable(BTPAN_ROLE_PANNAP); - callback = *callbacks; - return BT_STATUS_SUCCESS; } - return BT_STATUS_FAIL; -} + debug("leaving"); -static void btpan_cleanup() +} +void btif_pan_cleanup() { - debug("in, btpan_cb.enabled:%d", btpan_cb.enabled); - debug("in, bt is shuting down..."); + debug(""); //bt is shuting down, invalid all bta pan handles int i; for(i = 0; i < MAX_PAN_CONNS; i++) { btpan_cleanup_conn(&btpan_cb.conns[i]); } + debug("calling btpan_cleanup"); + btpan_cleanup(); + debug("done calling btpan_cleanup"); +} +static btpan_callbacks_t callback; +static bt_status_t btpan_init(const btpan_callbacks_t* callbacks) +{ + debug(" btpan_cb.enabled:%d", btpan_cb.enabled); + static volatile int binit; + callback = *callbacks; + debug(" leaving"); + return BT_STATUS_SUCCESS; +} +static void btpan_cleanup() +{ + debug("btpan_cb.enabled:%d", btpan_cb.enabled); if (btpan_cb.enabled) { btpan_cb.enabled = 0; @@ -186,9 +197,8 @@ static void btpan_cleanup() btpan_cb.tap_fd = -1; } } - debug("out, %s", __FUNCTION__); + debug("leaving"); } - static inline int bta_role_to_btpan(int bta_pan_role) { int btpan_role = 0; diff --git a/btif/src/btif_sock.c b/btif/src/btif_sock.c index 9e57c4b..816d4e3 100644 --- a/btif/src/btif_sock.c +++ b/btif/src/btif_sock.c @@ -68,10 +68,10 @@ #include "btif_sock_thread.h" #include "btif_sock_rfc.h" #include <cutils/log.h> -#define info(fmt, ...) LOGI ("%s: " fmt,__FUNCTION__, ## __VA_ARGS__) -#define debug(fmt, ...) LOGD ("%s: " fmt,__FUNCTION__, ## __VA_ARGS__) -#define error(fmt, ...) LOGE ("## ERROR : %s: " fmt "##",__FUNCTION__, ## __VA_ARGS__) -#define asrt(s) if(!(s)) LOGE ("## %s assert %s failed at line:%d ##",__FUNCTION__, #s, __LINE__) +#define info(fmt, ...) LOGI ("btif_sock: %s: " fmt,__FUNCTION__, ## __VA_ARGS__) +#define debug(fmt, ...) LOGD ("btif_sock: %s: " fmt,__FUNCTION__, ## __VA_ARGS__) +#define error(fmt, ...) LOGE ("btif_sock: ## ERROR : %s: " fmt "##",__FUNCTION__, ## __VA_ARGS__) +#define asrt(s) if(!(s)) LOGE ("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); @@ -100,6 +100,9 @@ btsock_interface_t *btif_sock_get_interface() } bt_status_t btif_sock_init() { + debug(""); + + static volatile int binit; if(!binit) { @@ -119,9 +122,11 @@ bt_status_t btif_sock_init() } void btif_sock_cleanup() { - debug("btif_sock_cleanup()"); + debug(""); btsock_rfc_cleanup(); + debug("leaving"); } + static bt_status_t btsock_listen(btsock_type_t type, const char* service_name, const uint8_t* service_uuid, int channel, int* sock_fd, int flags) { |