Loading system/stack/gatt/gatt_api.cc +62 −66 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ #include "bt_target.h" #include <base/strings/string_number_conversions.h> #include <base/strings/stringprintf.h> #include <stdio.h> #include <string.h> #include "bt_common.h" Loading @@ -34,7 +33,6 @@ #include "gatt_int.h" #include "l2c_api.h" using base::StringPrintf; using bluetooth::Uuid; /** Loading Loading @@ -184,9 +182,8 @@ uint16_t GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service, /* check for space */ if (num_handles > (0xFFFF - s_hdl + 1)) { LOG(ERROR) << StringPrintf( "GATTS_ReserveHandles: no handles, s_hdl: %u needed: %u", s_hdl, num_handles); LOG(ERROR) << __func__ << ": no handles, s_hdl=" << +s_hdl << " needed=" << num_handles; return GATT_INTERNAL_ERROR; } Loading @@ -204,10 +201,11 @@ uint16_t GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service, gatts_init_service_db(list.svc_db, svc_uuid, is_pri, s_hdl, num_handles); VLOG(1) << StringPrintf( "%s: handles needed:%u s_hdl=%u e_hdl=%u %s is_primary=%d", __func__, num_handles, list.asgn_range.s_handle, list.asgn_range.e_handle, list.asgn_range.svc_uuid.ToString().c_str(), list.asgn_range.is_primary); VLOG(1) << __func__ << ": handles needed=" << num_handles << ", s_hdl=" << loghex(list.asgn_range.s_handle) << ", e_hdl=" << loghex(list.asgn_range.e_handle) << ", uuid=" << list.asgn_range.svc_uuid << ", is_primary=" << +list.asgn_range.is_primary; service->attribute_handle = s_hdl; Loading @@ -221,17 +219,16 @@ uint16_t GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service, !(el->permissions & GATT_WRITE_SIGNED_PERM)) || ((el->permissions & GATT_WRITE_SIGNED_PERM) && !(el->properties & GATT_CHAR_PROP_BIT_AUTH))) { VLOG(1) << StringPrintf( "Invalid configuration property=0x%02x perm=0x%04x ", el->properties, el->permissions); VLOG(1) << "Invalid configuration property=" << loghex(el->properties) << ", perm=" << loghex(el->permissions); return GATT_INTERNAL_ERROR; } if (is_gatt_attr_type(uuid)) { LOG(ERROR) << StringPrintf( "%s: attept to add characteristic with UUID equal to GATT " "Attribute Type %s ", __func__, uuid.ToString().c_str()); LOG(ERROR) << __func__ << ": attept to add characteristic with UUID equal to GATT " "Attribute Type " << uuid; return GATT_INTERNAL_ERROR; } Loading @@ -239,10 +236,10 @@ uint16_t GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service, list.svc_db, el->permissions, el->properties, uuid); } else if (el->type == BTGATT_DB_DESCRIPTOR) { if (is_gatt_attr_type(uuid)) { LOG(ERROR) << StringPrintf( "%s: attept to add descriptor with UUID equal to GATT " "Attribute Type %s", __func__, uuid.ToString().c_str()); LOG(ERROR) << __func__ << ": attept to add descriptor with UUID equal to GATT " "Attribute Type " << uuid; return GATT_INTERNAL_ERROR; } Loading Loading @@ -294,9 +291,9 @@ uint16_t GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service, gatt_update_last_srv_info(); VLOG(1) << StringPrintf( "%s: allocated el: s_hdl=%d e_hdl=%d type=0x%x sdp_hdl=0x%x", __func__, elem.s_hdl, elem.e_hdl, elem.type, elem.sdp_handle); VLOG(1) << __func__ << ": allocated el s_hdl=" << loghex(elem.s_hdl) << ", e_hdl=" << loghex(elem.e_hdl) << ", type=" << loghex(elem.type) << ", sdp_hdl=" << loghex(elem.sdp_handle); gatt_proc_srv_chg(); Loading Loading @@ -354,8 +351,8 @@ bool GATTS_DeleteService(tGATT_IF gatt_if, Uuid* p_svc_uuid, GATTS_StopService(it->asgn_range.s_handle); } VLOG(1) << StringPrintf("released handles s_hdl=%u e_hdl=%u", it->asgn_range.s_handle, it->asgn_range.e_handle); VLOG(1) << "released handles s_hdl=" << loghex(it->asgn_range.s_handle) << ", e_hdl=" << loghex(it->asgn_range.e_handle); if ((it->asgn_range.s_handle >= gatt_cb.hdl_cfg.app_start_hdl) && gatt_cb.cb_info.p_nv_save_callback) Loading @@ -377,12 +374,12 @@ bool GATTS_DeleteService(tGATT_IF gatt_if, Uuid* p_svc_uuid, * ******************************************************************************/ void GATTS_StopService(uint16_t service_handle) { LOG(INFO) << __func__ << ": 0x" << std::hex << +service_handle; LOG(INFO) << __func__ << ": " << loghex(service_handle); auto it = gatt_sr_find_i_rcb_by_handle(service_handle); if (it == gatt_cb.srv_list_info->end()) { LOG(ERROR) << StringPrintf("%s: service_handle: %u is not in use", __func__, service_handle); LOG(ERROR) << __func__ << ": service_handle=" << loghex(service_handle) << " is not in use"; } if (it->sdp_handle) { Loading Loading @@ -422,7 +419,7 @@ tGATT_STATUS GATTS_HandleValueIndication(uint16_t conn_id, uint16_t attr_handle, VLOG(1) << __func__; if ((p_reg == NULL) || (p_tcb == NULL)) { LOG(ERROR) << __func__ << ": Unknown conn_id: " << +conn_id; LOG(ERROR) << __func__ << ": Unknown conn_id=" << loghex(conn_id); return (tGATT_STATUS)GATT_INVALID_CONN_ID; } Loading Loading @@ -532,19 +529,17 @@ tGATT_STATUS GATTS_SendRsp(uint16_t conn_id, uint32_t trans_id, tGATT_REG* p_reg = gatt_get_regcb(gatt_if); tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx); VLOG(1) << __func__ << StringPrintf(": conn_id: %u trans_id: %u Status: 0x%04x", conn_id, trans_id, status); VLOG(1) << __func__ << ": conn_id=" << loghex(conn_id) << ", trans_id=" << loghex(trans_id) << ", status=" << loghex(status); if ((p_reg == NULL) || (p_tcb == NULL)) { LOG(ERROR) << StringPrintf("Unknown conn_id: %u ", conn_id); LOG(ERROR) << "Unknown conn_id=" << loghex(conn_id); return (tGATT_STATUS)GATT_INVALID_CONN_ID; } if (p_tcb->sr_cmd.trans_id != trans_id) { LOG(ERROR) << StringPrintf("conn_id: %u waiting for op_code = %02x", conn_id, p_tcb->sr_cmd.op_code); LOG(ERROR) << "conn_id=" << loghex(conn_id) << " waiting for op_code=" << loghex(p_tcb->sr_cmd.op_code); return (GATT_WRONG_STATE); } /* Process App response */ Loading Loading @@ -582,7 +577,7 @@ tGATT_STATUS GATTC_ConfigureMTU(uint16_t conn_id, uint16_t mtu) { tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx); tGATT_REG* p_reg = gatt_get_regcb(gatt_if); VLOG(1) << __func__ << StringPrintf("conn_id=%d mtu=%d", conn_id, mtu); VLOG(1) << __func__ << ": conn_id=" << loghex(conn_id) << ", mtu=" << +mtu; if ((p_tcb == NULL) || (p_reg == NULL) || (mtu < GATT_DEF_BLE_MTU_SIZE) || (mtu > GATT_MAX_MTU_SIZE)) { Loading Loading @@ -630,13 +625,15 @@ tGATT_STATUS GATTC_Discover(uint16_t conn_id, tGATT_DISC_TYPE disc_type, tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx); tGATT_REG* p_reg = gatt_get_regcb(gatt_if); LOG(INFO) << __func__ << StringPrintf(" conn_id=%d disc_type=%d", conn_id, disc_type); LOG(INFO) << __func__ << " conn_id=" << loghex(conn_id) << ", disc_type=" << +disc_type << ", s_handle=" << loghex(p_param->s_handle) << ", e_handle=" << loghex(p_param->e_handle); if ((p_tcb == NULL) || (p_reg == NULL) || (p_param == NULL) || (disc_type >= GATT_DISC_MAX)) { LOG(ERROR) << StringPrintf("Illegal param: disc_type %d conn_id = %d", disc_type, conn_id); LOG(ERROR) << "Illegal param: disc_type=" << +disc_type << " conn_id=" << loghex(conn_id); return GATT_ILLEGAL_PARAMETER; } Loading Loading @@ -686,17 +683,18 @@ tGATT_STATUS GATTC_Read(uint16_t conn_id, tGATT_READ_TYPE type, tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx); tGATT_REG* p_reg = gatt_get_regcb(gatt_if); VLOG(1) << __func__ << StringPrintf(" conn_id=%d type=%d", conn_id, type); VLOG(1) << __func__ << ": conn_id=" << loghex(conn_id) << ", type=" << loghex(type); if ((p_tcb == NULL) || (p_reg == NULL) || (p_read == NULL) || ((type >= GATT_READ_MAX) || (type == 0))) { LOG(ERROR) << StringPrintf(" Illegal param: conn_id %d, type 0%d,", conn_id, type); LOG(ERROR) << ": illegal param: conn_id=" << loghex(conn_id) << "type=" << loghex(type); return GATT_ILLEGAL_PARAMETER; } if (gatt_is_clcb_allocated(conn_id)) { LOG(ERROR) << StringPrintf(" GATT_BUSY conn_id = %d", conn_id); LOG(ERROR) << "GATT_BUSY conn_id=" << loghex(conn_id); return GATT_BUSY; } Loading Loading @@ -767,14 +765,13 @@ tGATT_STATUS GATTC_Write(uint16_t conn_id, tGATT_WRITE_TYPE type, if ((p_tcb == NULL) || (p_reg == NULL) || (p_write == NULL) || ((type != GATT_WRITE) && (type != GATT_WRITE_PREPARE) && (type != GATT_WRITE_NO_RSP))) { LOG(ERROR) << __func__ << StringPrintf(" Illegal param: conn_id %d, type 0%d,", conn_id, type); LOG(ERROR) << __func__ << " Illegal param: conn_id=" << loghex(conn_id) << ", type=" << loghex(type); return GATT_ILLEGAL_PARAMETER; } if (gatt_is_clcb_allocated(conn_id)) { LOG(ERROR) << StringPrintf("GATT_BUSY conn_id = %d", conn_id); LOG(ERROR) << "GATT_BUSY conn_id=" << loghex(conn_id); return GATT_BUSY; } Loading Loading @@ -818,16 +815,16 @@ tGATT_STATUS GATTC_ExecuteWrite(uint16_t conn_id, bool is_execute) { tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx); tGATT_REG* p_reg = gatt_get_regcb(gatt_if); VLOG(1) << __func__ << StringPrintf(": conn_id=%d is_execute=%d", conn_id, is_execute); VLOG(1) << __func__ << ": conn_id=" << loghex(conn_id) << ", is_execute=" << +is_execute; if ((p_tcb == NULL) || (p_reg == NULL)) { LOG(ERROR) << StringPrintf(" Illegal param: conn_id %d", conn_id); LOG(ERROR) << " Illegal param: conn_id=" << loghex(conn_id); return GATT_ILLEGAL_PARAMETER; } if (gatt_is_clcb_allocated(conn_id)) { LOG(ERROR) << StringPrintf(" GATT_BUSY conn_id = %d", conn_id); LOG(ERROR) << " GATT_BUSY conn_id=" << loghex(conn_id); return GATT_BUSY; } Loading Loading @@ -855,17 +852,17 @@ tGATT_STATUS GATTC_ExecuteWrite(uint16_t conn_id, bool is_execute) { * ******************************************************************************/ tGATT_STATUS GATTC_SendHandleValueConfirm(uint16_t conn_id, uint16_t handle) { VLOG(1) << __func__ << StringPrintf(" conn_id=%d handle=0x%x", conn_id, handle); VLOG(1) << __func__ << " conn_id=" << loghex(conn_id) << ", handle=" << loghex(handle); tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(GATT_GET_TCB_IDX(conn_id)); if (!p_tcb) { LOG(ERROR) << StringPrintf(" Unknown conn_id: %u", conn_id); LOG(ERROR) << "Unknown conn_id=" << loghex(conn_id); return GATT_ILLEGAL_PARAMETER; } if (p_tcb->ind_count == 0) { VLOG(1) << " conn_id: " << +conn_id VLOG(1) << " conn_id: " << loghex(conn_id) << " ignored not waiting for indicaiton ack"; return GATT_SUCCESS; } Loading Loading @@ -921,9 +918,8 @@ void GATT_SetIdleTimeout(const RawAddress& bd_addr, uint16_t idle_tout, } } VLOG(1) << __func__ << StringPrintf(" idle_tout=%d status=%d(1-OK 0-not performed)", idle_tout, status); VLOG(1) << __func__ << " idle_tout=" << idle_tout << ", status=" << +status << " (1-OK 0-not performed)"; } /******************************************************************************* Loading Loading @@ -992,7 +988,7 @@ void GATT_Deregister(tGATT_IF gatt_if) { tGATT_REG* p_reg = gatt_get_regcb(gatt_if); /* Index 0 is GAP and is never deregistered */ if ((gatt_if == 0) || (p_reg == NULL)) { LOG(ERROR) << "invalid gatt_if: " << +gatt_if; LOG(ERROR) << "invalid gatt_if=" << +gatt_if; return; } Loading Loading @@ -1061,7 +1057,7 @@ void GATT_StartIf(tGATT_IF gatt_if) { uint16_t conn_id; tGATT_TRANSPORT transport; VLOG(1) << __func__ << " gatt_if=" << gatt_if; VLOG(1) << __func__ << " gatt_if=" << +gatt_if; p_reg = gatt_get_regcb(gatt_if); if (p_reg != NULL) { start_idx = 0; Loading Loading @@ -1111,7 +1107,7 @@ bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr, bool is_direct, /* Make sure app is registered */ p_reg = gatt_get_regcb(gatt_if); if (p_reg == NULL) { LOG(ERROR) << "gatt_if = " << gatt_if << " is not registered"; LOG(ERROR) << "gatt_if = " << +gatt_if << " is not registered"; return (false); } Loading Loading @@ -1209,7 +1205,7 @@ tGATT_STATUS GATT_Disconnect(uint16_t conn_id) { tGATT_IF gatt_if = GATT_GET_GATT_IF(conn_id); uint8_t tcb_idx = GATT_GET_TCB_IDX(conn_id); LOG(INFO) << __func__ << " conn_id=" << +conn_id; LOG(INFO) << __func__ << " conn_id=" << loghex(conn_id); p_tcb = gatt_get_tcb_by_idx(tcb_idx); Loading Loading @@ -1242,7 +1238,7 @@ bool GATT_GetConnectionInfor(uint16_t conn_id, tGATT_IF* p_gatt_if, tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx); bool status = false; VLOG(1) << __func__ << " conn_id=" << +conn_id; VLOG(1) << __func__ << " conn_id=" << loghex(conn_id); if (p_tcb && p_reg) { bd_addr = p_tcb->peer_bda; Loading Loading
system/stack/gatt/gatt_api.cc +62 −66 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ #include "bt_target.h" #include <base/strings/string_number_conversions.h> #include <base/strings/stringprintf.h> #include <stdio.h> #include <string.h> #include "bt_common.h" Loading @@ -34,7 +33,6 @@ #include "gatt_int.h" #include "l2c_api.h" using base::StringPrintf; using bluetooth::Uuid; /** Loading Loading @@ -184,9 +182,8 @@ uint16_t GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service, /* check for space */ if (num_handles > (0xFFFF - s_hdl + 1)) { LOG(ERROR) << StringPrintf( "GATTS_ReserveHandles: no handles, s_hdl: %u needed: %u", s_hdl, num_handles); LOG(ERROR) << __func__ << ": no handles, s_hdl=" << +s_hdl << " needed=" << num_handles; return GATT_INTERNAL_ERROR; } Loading @@ -204,10 +201,11 @@ uint16_t GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service, gatts_init_service_db(list.svc_db, svc_uuid, is_pri, s_hdl, num_handles); VLOG(1) << StringPrintf( "%s: handles needed:%u s_hdl=%u e_hdl=%u %s is_primary=%d", __func__, num_handles, list.asgn_range.s_handle, list.asgn_range.e_handle, list.asgn_range.svc_uuid.ToString().c_str(), list.asgn_range.is_primary); VLOG(1) << __func__ << ": handles needed=" << num_handles << ", s_hdl=" << loghex(list.asgn_range.s_handle) << ", e_hdl=" << loghex(list.asgn_range.e_handle) << ", uuid=" << list.asgn_range.svc_uuid << ", is_primary=" << +list.asgn_range.is_primary; service->attribute_handle = s_hdl; Loading @@ -221,17 +219,16 @@ uint16_t GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service, !(el->permissions & GATT_WRITE_SIGNED_PERM)) || ((el->permissions & GATT_WRITE_SIGNED_PERM) && !(el->properties & GATT_CHAR_PROP_BIT_AUTH))) { VLOG(1) << StringPrintf( "Invalid configuration property=0x%02x perm=0x%04x ", el->properties, el->permissions); VLOG(1) << "Invalid configuration property=" << loghex(el->properties) << ", perm=" << loghex(el->permissions); return GATT_INTERNAL_ERROR; } if (is_gatt_attr_type(uuid)) { LOG(ERROR) << StringPrintf( "%s: attept to add characteristic with UUID equal to GATT " "Attribute Type %s ", __func__, uuid.ToString().c_str()); LOG(ERROR) << __func__ << ": attept to add characteristic with UUID equal to GATT " "Attribute Type " << uuid; return GATT_INTERNAL_ERROR; } Loading @@ -239,10 +236,10 @@ uint16_t GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service, list.svc_db, el->permissions, el->properties, uuid); } else if (el->type == BTGATT_DB_DESCRIPTOR) { if (is_gatt_attr_type(uuid)) { LOG(ERROR) << StringPrintf( "%s: attept to add descriptor with UUID equal to GATT " "Attribute Type %s", __func__, uuid.ToString().c_str()); LOG(ERROR) << __func__ << ": attept to add descriptor with UUID equal to GATT " "Attribute Type " << uuid; return GATT_INTERNAL_ERROR; } Loading Loading @@ -294,9 +291,9 @@ uint16_t GATTS_AddService(tGATT_IF gatt_if, btgatt_db_element_t* service, gatt_update_last_srv_info(); VLOG(1) << StringPrintf( "%s: allocated el: s_hdl=%d e_hdl=%d type=0x%x sdp_hdl=0x%x", __func__, elem.s_hdl, elem.e_hdl, elem.type, elem.sdp_handle); VLOG(1) << __func__ << ": allocated el s_hdl=" << loghex(elem.s_hdl) << ", e_hdl=" << loghex(elem.e_hdl) << ", type=" << loghex(elem.type) << ", sdp_hdl=" << loghex(elem.sdp_handle); gatt_proc_srv_chg(); Loading Loading @@ -354,8 +351,8 @@ bool GATTS_DeleteService(tGATT_IF gatt_if, Uuid* p_svc_uuid, GATTS_StopService(it->asgn_range.s_handle); } VLOG(1) << StringPrintf("released handles s_hdl=%u e_hdl=%u", it->asgn_range.s_handle, it->asgn_range.e_handle); VLOG(1) << "released handles s_hdl=" << loghex(it->asgn_range.s_handle) << ", e_hdl=" << loghex(it->asgn_range.e_handle); if ((it->asgn_range.s_handle >= gatt_cb.hdl_cfg.app_start_hdl) && gatt_cb.cb_info.p_nv_save_callback) Loading @@ -377,12 +374,12 @@ bool GATTS_DeleteService(tGATT_IF gatt_if, Uuid* p_svc_uuid, * ******************************************************************************/ void GATTS_StopService(uint16_t service_handle) { LOG(INFO) << __func__ << ": 0x" << std::hex << +service_handle; LOG(INFO) << __func__ << ": " << loghex(service_handle); auto it = gatt_sr_find_i_rcb_by_handle(service_handle); if (it == gatt_cb.srv_list_info->end()) { LOG(ERROR) << StringPrintf("%s: service_handle: %u is not in use", __func__, service_handle); LOG(ERROR) << __func__ << ": service_handle=" << loghex(service_handle) << " is not in use"; } if (it->sdp_handle) { Loading Loading @@ -422,7 +419,7 @@ tGATT_STATUS GATTS_HandleValueIndication(uint16_t conn_id, uint16_t attr_handle, VLOG(1) << __func__; if ((p_reg == NULL) || (p_tcb == NULL)) { LOG(ERROR) << __func__ << ": Unknown conn_id: " << +conn_id; LOG(ERROR) << __func__ << ": Unknown conn_id=" << loghex(conn_id); return (tGATT_STATUS)GATT_INVALID_CONN_ID; } Loading Loading @@ -532,19 +529,17 @@ tGATT_STATUS GATTS_SendRsp(uint16_t conn_id, uint32_t trans_id, tGATT_REG* p_reg = gatt_get_regcb(gatt_if); tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx); VLOG(1) << __func__ << StringPrintf(": conn_id: %u trans_id: %u Status: 0x%04x", conn_id, trans_id, status); VLOG(1) << __func__ << ": conn_id=" << loghex(conn_id) << ", trans_id=" << loghex(trans_id) << ", status=" << loghex(status); if ((p_reg == NULL) || (p_tcb == NULL)) { LOG(ERROR) << StringPrintf("Unknown conn_id: %u ", conn_id); LOG(ERROR) << "Unknown conn_id=" << loghex(conn_id); return (tGATT_STATUS)GATT_INVALID_CONN_ID; } if (p_tcb->sr_cmd.trans_id != trans_id) { LOG(ERROR) << StringPrintf("conn_id: %u waiting for op_code = %02x", conn_id, p_tcb->sr_cmd.op_code); LOG(ERROR) << "conn_id=" << loghex(conn_id) << " waiting for op_code=" << loghex(p_tcb->sr_cmd.op_code); return (GATT_WRONG_STATE); } /* Process App response */ Loading Loading @@ -582,7 +577,7 @@ tGATT_STATUS GATTC_ConfigureMTU(uint16_t conn_id, uint16_t mtu) { tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx); tGATT_REG* p_reg = gatt_get_regcb(gatt_if); VLOG(1) << __func__ << StringPrintf("conn_id=%d mtu=%d", conn_id, mtu); VLOG(1) << __func__ << ": conn_id=" << loghex(conn_id) << ", mtu=" << +mtu; if ((p_tcb == NULL) || (p_reg == NULL) || (mtu < GATT_DEF_BLE_MTU_SIZE) || (mtu > GATT_MAX_MTU_SIZE)) { Loading Loading @@ -630,13 +625,15 @@ tGATT_STATUS GATTC_Discover(uint16_t conn_id, tGATT_DISC_TYPE disc_type, tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx); tGATT_REG* p_reg = gatt_get_regcb(gatt_if); LOG(INFO) << __func__ << StringPrintf(" conn_id=%d disc_type=%d", conn_id, disc_type); LOG(INFO) << __func__ << " conn_id=" << loghex(conn_id) << ", disc_type=" << +disc_type << ", s_handle=" << loghex(p_param->s_handle) << ", e_handle=" << loghex(p_param->e_handle); if ((p_tcb == NULL) || (p_reg == NULL) || (p_param == NULL) || (disc_type >= GATT_DISC_MAX)) { LOG(ERROR) << StringPrintf("Illegal param: disc_type %d conn_id = %d", disc_type, conn_id); LOG(ERROR) << "Illegal param: disc_type=" << +disc_type << " conn_id=" << loghex(conn_id); return GATT_ILLEGAL_PARAMETER; } Loading Loading @@ -686,17 +683,18 @@ tGATT_STATUS GATTC_Read(uint16_t conn_id, tGATT_READ_TYPE type, tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx); tGATT_REG* p_reg = gatt_get_regcb(gatt_if); VLOG(1) << __func__ << StringPrintf(" conn_id=%d type=%d", conn_id, type); VLOG(1) << __func__ << ": conn_id=" << loghex(conn_id) << ", type=" << loghex(type); if ((p_tcb == NULL) || (p_reg == NULL) || (p_read == NULL) || ((type >= GATT_READ_MAX) || (type == 0))) { LOG(ERROR) << StringPrintf(" Illegal param: conn_id %d, type 0%d,", conn_id, type); LOG(ERROR) << ": illegal param: conn_id=" << loghex(conn_id) << "type=" << loghex(type); return GATT_ILLEGAL_PARAMETER; } if (gatt_is_clcb_allocated(conn_id)) { LOG(ERROR) << StringPrintf(" GATT_BUSY conn_id = %d", conn_id); LOG(ERROR) << "GATT_BUSY conn_id=" << loghex(conn_id); return GATT_BUSY; } Loading Loading @@ -767,14 +765,13 @@ tGATT_STATUS GATTC_Write(uint16_t conn_id, tGATT_WRITE_TYPE type, if ((p_tcb == NULL) || (p_reg == NULL) || (p_write == NULL) || ((type != GATT_WRITE) && (type != GATT_WRITE_PREPARE) && (type != GATT_WRITE_NO_RSP))) { LOG(ERROR) << __func__ << StringPrintf(" Illegal param: conn_id %d, type 0%d,", conn_id, type); LOG(ERROR) << __func__ << " Illegal param: conn_id=" << loghex(conn_id) << ", type=" << loghex(type); return GATT_ILLEGAL_PARAMETER; } if (gatt_is_clcb_allocated(conn_id)) { LOG(ERROR) << StringPrintf("GATT_BUSY conn_id = %d", conn_id); LOG(ERROR) << "GATT_BUSY conn_id=" << loghex(conn_id); return GATT_BUSY; } Loading Loading @@ -818,16 +815,16 @@ tGATT_STATUS GATTC_ExecuteWrite(uint16_t conn_id, bool is_execute) { tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx); tGATT_REG* p_reg = gatt_get_regcb(gatt_if); VLOG(1) << __func__ << StringPrintf(": conn_id=%d is_execute=%d", conn_id, is_execute); VLOG(1) << __func__ << ": conn_id=" << loghex(conn_id) << ", is_execute=" << +is_execute; if ((p_tcb == NULL) || (p_reg == NULL)) { LOG(ERROR) << StringPrintf(" Illegal param: conn_id %d", conn_id); LOG(ERROR) << " Illegal param: conn_id=" << loghex(conn_id); return GATT_ILLEGAL_PARAMETER; } if (gatt_is_clcb_allocated(conn_id)) { LOG(ERROR) << StringPrintf(" GATT_BUSY conn_id = %d", conn_id); LOG(ERROR) << " GATT_BUSY conn_id=" << loghex(conn_id); return GATT_BUSY; } Loading Loading @@ -855,17 +852,17 @@ tGATT_STATUS GATTC_ExecuteWrite(uint16_t conn_id, bool is_execute) { * ******************************************************************************/ tGATT_STATUS GATTC_SendHandleValueConfirm(uint16_t conn_id, uint16_t handle) { VLOG(1) << __func__ << StringPrintf(" conn_id=%d handle=0x%x", conn_id, handle); VLOG(1) << __func__ << " conn_id=" << loghex(conn_id) << ", handle=" << loghex(handle); tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(GATT_GET_TCB_IDX(conn_id)); if (!p_tcb) { LOG(ERROR) << StringPrintf(" Unknown conn_id: %u", conn_id); LOG(ERROR) << "Unknown conn_id=" << loghex(conn_id); return GATT_ILLEGAL_PARAMETER; } if (p_tcb->ind_count == 0) { VLOG(1) << " conn_id: " << +conn_id VLOG(1) << " conn_id: " << loghex(conn_id) << " ignored not waiting for indicaiton ack"; return GATT_SUCCESS; } Loading Loading @@ -921,9 +918,8 @@ void GATT_SetIdleTimeout(const RawAddress& bd_addr, uint16_t idle_tout, } } VLOG(1) << __func__ << StringPrintf(" idle_tout=%d status=%d(1-OK 0-not performed)", idle_tout, status); VLOG(1) << __func__ << " idle_tout=" << idle_tout << ", status=" << +status << " (1-OK 0-not performed)"; } /******************************************************************************* Loading Loading @@ -992,7 +988,7 @@ void GATT_Deregister(tGATT_IF gatt_if) { tGATT_REG* p_reg = gatt_get_regcb(gatt_if); /* Index 0 is GAP and is never deregistered */ if ((gatt_if == 0) || (p_reg == NULL)) { LOG(ERROR) << "invalid gatt_if: " << +gatt_if; LOG(ERROR) << "invalid gatt_if=" << +gatt_if; return; } Loading Loading @@ -1061,7 +1057,7 @@ void GATT_StartIf(tGATT_IF gatt_if) { uint16_t conn_id; tGATT_TRANSPORT transport; VLOG(1) << __func__ << " gatt_if=" << gatt_if; VLOG(1) << __func__ << " gatt_if=" << +gatt_if; p_reg = gatt_get_regcb(gatt_if); if (p_reg != NULL) { start_idx = 0; Loading Loading @@ -1111,7 +1107,7 @@ bool GATT_Connect(tGATT_IF gatt_if, const RawAddress& bd_addr, bool is_direct, /* Make sure app is registered */ p_reg = gatt_get_regcb(gatt_if); if (p_reg == NULL) { LOG(ERROR) << "gatt_if = " << gatt_if << " is not registered"; LOG(ERROR) << "gatt_if = " << +gatt_if << " is not registered"; return (false); } Loading Loading @@ -1209,7 +1205,7 @@ tGATT_STATUS GATT_Disconnect(uint16_t conn_id) { tGATT_IF gatt_if = GATT_GET_GATT_IF(conn_id); uint8_t tcb_idx = GATT_GET_TCB_IDX(conn_id); LOG(INFO) << __func__ << " conn_id=" << +conn_id; LOG(INFO) << __func__ << " conn_id=" << loghex(conn_id); p_tcb = gatt_get_tcb_by_idx(tcb_idx); Loading Loading @@ -1242,7 +1238,7 @@ bool GATT_GetConnectionInfor(uint16_t conn_id, tGATT_IF* p_gatt_if, tGATT_TCB* p_tcb = gatt_get_tcb_by_idx(tcb_idx); bool status = false; VLOG(1) << __func__ << " conn_id=" << +conn_id; VLOG(1) << __func__ << " conn_id=" << loghex(conn_id); if (p_tcb && p_reg) { bd_addr = p_tcb->peer_bda; Loading