Loading system/gd/hci/controller.cc +11 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,10 @@ struct Controller::impl { le_set_event_mask(kDefaultLeEventMask); set_event_mask(kDefaultEventMask); write_le_host_support(Enable::ENABLED); // SSP is managed by security layer once enabled if (!common::init_flags::gd_security_is_enabled()) { write_simple_pairing_mode(Enable::ENABLED); } hci_->EnqueueCommand(ReadLocalNameBuilder::Create(), handler->BindOnceOn(this, &Controller::impl::read_local_name_complete_handler)); hci_->EnqueueCommand(ReadLocalVersionInformationBuilder::Create(), Loading Loading @@ -448,6 +452,13 @@ struct Controller::impl { module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_status<WriteLeHostSupportCompleteView>)); } void write_simple_pairing_mode(Enable enable) { std::unique_ptr<WriteSimplePairingModeBuilder> packet = WriteSimplePairingModeBuilder::Create(enable); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_status<WriteSimplePairingModeCompleteView>)); } void reset() { std::unique_ptr<ResetBuilder> packet = ResetBuilder::Create(); hci_->EnqueueCommand(std::move(packet), Loading system/stack/acl/btm_acl.cc +1 −1 Original line number Diff line number Diff line Loading @@ -1591,7 +1591,7 @@ uint16_t BTM_GetMaxPacketSize(const RawAddress& addr) { ******************************************************************************/ bool BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version, uint16_t* manufacturer, uint16_t* lmp_sub_version) { if (!bluetooth::shim::is_gd_l2cap_enabled()) { if (bluetooth::shim::is_gd_l2cap_enabled()) { return bluetooth::shim::L2CA_ReadRemoteVersion( addr, lmp_version, manufacturer, lmp_sub_version); } Loading system/stack/gatt/att_protocol.cc +7 −6 Original line number Diff line number Diff line Loading @@ -189,8 +189,8 @@ BT_HDR* attp_build_read_by_type_value_cmd(uint16_t payload_size, * Returns None. * ******************************************************************************/ BT_HDR* attp_build_read_multi_cmd(uint16_t payload_size, uint16_t num_handle, uint16_t* p_handle) { BT_HDR* attp_build_read_multi_cmd(uint8_t op_code, uint16_t payload_size, uint16_t num_handle, uint16_t* p_handle) { uint8_t *p, i = 0; BT_HDR* p_buf = (BT_HDR*)osi_malloc(sizeof(BT_HDR) + num_handle * 2 + 1 + L2CAP_MIN_OFFSET); Loading @@ -199,7 +199,7 @@ BT_HDR* attp_build_read_multi_cmd(uint16_t payload_size, uint16_t num_handle, p_buf->offset = L2CAP_MIN_OFFSET; p_buf->len = 1; UINT8_TO_STREAM(p, GATT_REQ_READ_MULTI); UINT8_TO_STREAM(p, op_code); for (i = 0; i < num_handle && p_buf->len + 2 <= payload_size; i++) { UINT16_TO_STREAM(p, *(p_handle + i)); Loading Loading @@ -570,8 +570,9 @@ tGATT_STATUS attp_send_cl_msg(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, break; case GATT_REQ_READ_MULTI: p_cmd = attp_build_read_multi_cmd(payload_size, p_msg->read_multi.num_handles, case GATT_REQ_READ_MULTI_VAR: p_cmd = attp_build_read_multi_cmd(op_code, payload_size, p_msg->read_multi.num_handles, p_msg->read_multi.handles); break; Loading system/stack/gatt/gatt_attr.cc +5 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,10 @@ using bluetooth::Uuid; #define BLE_GATT_CL_SUP_FEAT_CACHING_BITMASK 0x01 #define BLE_GATT_CL_SUP_FEAT_EATT_BITMASK 0x02 #define BLE_GATT_CL_SUP_FEAT_MULTI_NOTIF_BITMASK 0x04 #define BLE_GATT_CL_ANDROID_SUP_FEAT \ (BLE_GATT_CL_SUP_FEAT_EATT_BITMASK | BLE_GATT_CL_SUP_FEAT_MULTI_NOTIF_BITMASK) using gatt_eatt_support_cb = base::OnceCallback<void(const RawAddress&, bool)>; Loading Loading @@ -408,7 +412,7 @@ void gatt_profile_db_init(void) { gatt_cb.handle_cl_supported_feat = service[3].attribute_handle; gatt_cb.gatt_svr_supported_feat_mask |= BLE_GATT_SVR_SUP_FEAT_EATT_BITMASK; gatt_cb.gatt_cl_supported_feat_mask |= BLE_GATT_CL_SUP_FEAT_EATT_BITMASK; gatt_cb.gatt_cl_supported_feat_mask |= BLE_GATT_CL_ANDROID_SUP_FEAT; VLOG(1) << __func__ << ": gatt_if=" << gatt_cb.gatt_if << " EATT supported"; } Loading system/stack/gatt/gatt_cl.cc +37 −14 Original line number Diff line number Diff line Loading @@ -625,9 +625,9 @@ void gatt_process_notification(tGATT_TCB& tcb, uint16_t cid, uint8_t op_code, tGATT_STATUS encrypt_status; uint8_t* p = p_data; uint8_t i; uint8_t event = (op_code == GATT_HANDLE_VALUE_NOTIF) ? GATTC_OPTYPE_NOTIFICATION : GATTC_OPTYPE_INDICATION; uint8_t event = (op_code == GATT_HANDLE_VALUE_IND) ? GATTC_OPTYPE_INDICATION : GATTC_OPTYPE_NOTIFICATION; VLOG(1) << __func__; Loading @@ -638,12 +638,19 @@ void gatt_process_notification(tGATT_TCB& tcb, uint16_t cid, uint8_t op_code, memset(&value, 0, sizeof(value)); STREAM_TO_UINT16(value.handle, p); if (op_code == GATT_HANDLE_MULTI_VALUE_NOTIF) { STREAM_TO_UINT16(value.len, p); } else { value.len = len - 2; } if (value.len > GATT_MAX_ATTR_LEN) { LOG(ERROR) << "value.len larger than GATT_MAX_ATTR_LEN, discard"; return; } memcpy(value.value, p, value.len); STREAM_TO_ARRAY(value.value, p, value.len); if (!GATT_HANDLE_IS_VALID(value.handle)) { /* illegal handle, send ack now */ Loading Loading @@ -686,6 +693,9 @@ void gatt_process_notification(tGATT_TCB& tcb, uint16_t cid, uint8_t op_code, } encrypt_status = gatt_get_link_encrypt_status(tcb); uint16_t rem_len = len; while (rem_len) { tGATT_CL_COMPLETE gatt_cl_complete; gatt_cl_complete.att_value = value; gatt_cl_complete.cid = cid; Loading @@ -697,6 +707,17 @@ void gatt_process_notification(tGATT_TCB& tcb, uint16_t cid, uint8_t op_code, &gatt_cl_complete); } } if (op_code != GATT_HANDLE_MULTI_VALUE_NOTIF) return; /* 4 stands for 2 octects for handle and 2 octecs for len */ rem_len -= (4 + value.len); if (rem_len) { STREAM_TO_UINT16(value.handle, p); STREAM_TO_UINT16(value.len, p); STREAM_TO_ARRAY(value.value, p, value.len); } } } /******************************************************************************* Loading Loading @@ -1112,7 +1133,8 @@ void gatt_client_handle_server_rsp(tGATT_TCB& tcb, uint16_t cid, uint16_t payload_size = gatt_tcb_get_payload_size_rx(tcb, cid); if (op_code == GATT_HANDLE_VALUE_IND || op_code == GATT_HANDLE_VALUE_NOTIF) { if (op_code == GATT_HANDLE_VALUE_IND || op_code == GATT_HANDLE_VALUE_NOTIF || op_code == GATT_HANDLE_MULTI_VALUE_NOTIF) { if (len >= payload_size) { LOG(ERROR) << StringPrintf( "%s: invalid indicate pkt size: %d, PDU size: %d", __func__, len + 1, Loading Loading @@ -1173,6 +1195,7 @@ void gatt_client_handle_server_rsp(tGATT_TCB& tcb, uint16_t cid, case GATT_RSP_READ: case GATT_RSP_READ_BLOB: case GATT_RSP_READ_MULTI: case GATT_RSP_READ_MULTI_VAR: gatt_process_read_rsp(tcb, p_clcb, op_code, len, p_data); break; Loading Loading
system/gd/hci/controller.cc +11 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,10 @@ struct Controller::impl { le_set_event_mask(kDefaultLeEventMask); set_event_mask(kDefaultEventMask); write_le_host_support(Enable::ENABLED); // SSP is managed by security layer once enabled if (!common::init_flags::gd_security_is_enabled()) { write_simple_pairing_mode(Enable::ENABLED); } hci_->EnqueueCommand(ReadLocalNameBuilder::Create(), handler->BindOnceOn(this, &Controller::impl::read_local_name_complete_handler)); hci_->EnqueueCommand(ReadLocalVersionInformationBuilder::Create(), Loading Loading @@ -448,6 +452,13 @@ struct Controller::impl { module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_status<WriteLeHostSupportCompleteView>)); } void write_simple_pairing_mode(Enable enable) { std::unique_ptr<WriteSimplePairingModeBuilder> packet = WriteSimplePairingModeBuilder::Create(enable); hci_->EnqueueCommand( std::move(packet), module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_status<WriteSimplePairingModeCompleteView>)); } void reset() { std::unique_ptr<ResetBuilder> packet = ResetBuilder::Create(); hci_->EnqueueCommand(std::move(packet), Loading
system/stack/acl/btm_acl.cc +1 −1 Original line number Diff line number Diff line Loading @@ -1591,7 +1591,7 @@ uint16_t BTM_GetMaxPacketSize(const RawAddress& addr) { ******************************************************************************/ bool BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version, uint16_t* manufacturer, uint16_t* lmp_sub_version) { if (!bluetooth::shim::is_gd_l2cap_enabled()) { if (bluetooth::shim::is_gd_l2cap_enabled()) { return bluetooth::shim::L2CA_ReadRemoteVersion( addr, lmp_version, manufacturer, lmp_sub_version); } Loading
system/stack/gatt/att_protocol.cc +7 −6 Original line number Diff line number Diff line Loading @@ -189,8 +189,8 @@ BT_HDR* attp_build_read_by_type_value_cmd(uint16_t payload_size, * Returns None. * ******************************************************************************/ BT_HDR* attp_build_read_multi_cmd(uint16_t payload_size, uint16_t num_handle, uint16_t* p_handle) { BT_HDR* attp_build_read_multi_cmd(uint8_t op_code, uint16_t payload_size, uint16_t num_handle, uint16_t* p_handle) { uint8_t *p, i = 0; BT_HDR* p_buf = (BT_HDR*)osi_malloc(sizeof(BT_HDR) + num_handle * 2 + 1 + L2CAP_MIN_OFFSET); Loading @@ -199,7 +199,7 @@ BT_HDR* attp_build_read_multi_cmd(uint16_t payload_size, uint16_t num_handle, p_buf->offset = L2CAP_MIN_OFFSET; p_buf->len = 1; UINT8_TO_STREAM(p, GATT_REQ_READ_MULTI); UINT8_TO_STREAM(p, op_code); for (i = 0; i < num_handle && p_buf->len + 2 <= payload_size; i++) { UINT16_TO_STREAM(p, *(p_handle + i)); Loading Loading @@ -570,8 +570,9 @@ tGATT_STATUS attp_send_cl_msg(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, break; case GATT_REQ_READ_MULTI: p_cmd = attp_build_read_multi_cmd(payload_size, p_msg->read_multi.num_handles, case GATT_REQ_READ_MULTI_VAR: p_cmd = attp_build_read_multi_cmd(op_code, payload_size, p_msg->read_multi.num_handles, p_msg->read_multi.handles); break; Loading
system/stack/gatt/gatt_attr.cc +5 −1 Original line number Diff line number Diff line Loading @@ -42,6 +42,10 @@ using bluetooth::Uuid; #define BLE_GATT_CL_SUP_FEAT_CACHING_BITMASK 0x01 #define BLE_GATT_CL_SUP_FEAT_EATT_BITMASK 0x02 #define BLE_GATT_CL_SUP_FEAT_MULTI_NOTIF_BITMASK 0x04 #define BLE_GATT_CL_ANDROID_SUP_FEAT \ (BLE_GATT_CL_SUP_FEAT_EATT_BITMASK | BLE_GATT_CL_SUP_FEAT_MULTI_NOTIF_BITMASK) using gatt_eatt_support_cb = base::OnceCallback<void(const RawAddress&, bool)>; Loading Loading @@ -408,7 +412,7 @@ void gatt_profile_db_init(void) { gatt_cb.handle_cl_supported_feat = service[3].attribute_handle; gatt_cb.gatt_svr_supported_feat_mask |= BLE_GATT_SVR_SUP_FEAT_EATT_BITMASK; gatt_cb.gatt_cl_supported_feat_mask |= BLE_GATT_CL_SUP_FEAT_EATT_BITMASK; gatt_cb.gatt_cl_supported_feat_mask |= BLE_GATT_CL_ANDROID_SUP_FEAT; VLOG(1) << __func__ << ": gatt_if=" << gatt_cb.gatt_if << " EATT supported"; } Loading
system/stack/gatt/gatt_cl.cc +37 −14 Original line number Diff line number Diff line Loading @@ -625,9 +625,9 @@ void gatt_process_notification(tGATT_TCB& tcb, uint16_t cid, uint8_t op_code, tGATT_STATUS encrypt_status; uint8_t* p = p_data; uint8_t i; uint8_t event = (op_code == GATT_HANDLE_VALUE_NOTIF) ? GATTC_OPTYPE_NOTIFICATION : GATTC_OPTYPE_INDICATION; uint8_t event = (op_code == GATT_HANDLE_VALUE_IND) ? GATTC_OPTYPE_INDICATION : GATTC_OPTYPE_NOTIFICATION; VLOG(1) << __func__; Loading @@ -638,12 +638,19 @@ void gatt_process_notification(tGATT_TCB& tcb, uint16_t cid, uint8_t op_code, memset(&value, 0, sizeof(value)); STREAM_TO_UINT16(value.handle, p); if (op_code == GATT_HANDLE_MULTI_VALUE_NOTIF) { STREAM_TO_UINT16(value.len, p); } else { value.len = len - 2; } if (value.len > GATT_MAX_ATTR_LEN) { LOG(ERROR) << "value.len larger than GATT_MAX_ATTR_LEN, discard"; return; } memcpy(value.value, p, value.len); STREAM_TO_ARRAY(value.value, p, value.len); if (!GATT_HANDLE_IS_VALID(value.handle)) { /* illegal handle, send ack now */ Loading Loading @@ -686,6 +693,9 @@ void gatt_process_notification(tGATT_TCB& tcb, uint16_t cid, uint8_t op_code, } encrypt_status = gatt_get_link_encrypt_status(tcb); uint16_t rem_len = len; while (rem_len) { tGATT_CL_COMPLETE gatt_cl_complete; gatt_cl_complete.att_value = value; gatt_cl_complete.cid = cid; Loading @@ -697,6 +707,17 @@ void gatt_process_notification(tGATT_TCB& tcb, uint16_t cid, uint8_t op_code, &gatt_cl_complete); } } if (op_code != GATT_HANDLE_MULTI_VALUE_NOTIF) return; /* 4 stands for 2 octects for handle and 2 octecs for len */ rem_len -= (4 + value.len); if (rem_len) { STREAM_TO_UINT16(value.handle, p); STREAM_TO_UINT16(value.len, p); STREAM_TO_ARRAY(value.value, p, value.len); } } } /******************************************************************************* Loading Loading @@ -1112,7 +1133,8 @@ void gatt_client_handle_server_rsp(tGATT_TCB& tcb, uint16_t cid, uint16_t payload_size = gatt_tcb_get_payload_size_rx(tcb, cid); if (op_code == GATT_HANDLE_VALUE_IND || op_code == GATT_HANDLE_VALUE_NOTIF) { if (op_code == GATT_HANDLE_VALUE_IND || op_code == GATT_HANDLE_VALUE_NOTIF || op_code == GATT_HANDLE_MULTI_VALUE_NOTIF) { if (len >= payload_size) { LOG(ERROR) << StringPrintf( "%s: invalid indicate pkt size: %d, PDU size: %d", __func__, len + 1, Loading Loading @@ -1173,6 +1195,7 @@ void gatt_client_handle_server_rsp(tGATT_TCB& tcb, uint16_t cid, case GATT_RSP_READ: case GATT_RSP_READ_BLOB: case GATT_RSP_READ_MULTI: case GATT_RSP_READ_MULTI_VAR: gatt_process_read_rsp(tcb, p_clcb, op_code, len, p_data); break; Loading