Loading system/stack/sdp/sdp_utils.cc +15 −15 Original line number Diff line number Diff line Loading @@ -386,7 +386,7 @@ tCONN_CB* sdpu_allocate_ccb(void) { * Returns void * ******************************************************************************/ void sdpu_callback(tCONN_CB& ccb, tSDP_REASON reason) { void sdpu_callback(const tCONN_CB& ccb, tSDP_REASON reason) { if (ccb.p_cb) { (ccb.p_cb)(ccb.device_address, reason); } else if (ccb.complete_callback) { Loading Loading @@ -415,7 +415,7 @@ void sdpu_release_ccb(tCONN_CB& ccb) { if (ccb.rsp_list) { log::verbose("releasing SDP rsp_list"); } osi_free_and_reset((void**)&ccb.rsp_list); osi_free_and_reset(reinterpret_cast<void**>(&ccb.rsp_list)); } /******************************************************************************* Loading Loading @@ -480,7 +480,7 @@ uint16_t sdpu_get_active_ccb_cid(const RawAddress& bd_addr) { * Returns returns true if any pending ccb, else false. * ******************************************************************************/ bool sdpu_process_pend_ccb_same_cid(tCONN_CB& ccb) { bool sdpu_process_pend_ccb_same_cid(const tCONN_CB& ccb) { uint16_t xx; tCONN_CB* p_ccb{}; Loading Loading @@ -509,7 +509,7 @@ bool sdpu_process_pend_ccb_same_cid(tCONN_CB& ccb) { * Returns returns true if any pending ccb, else false. * ******************************************************************************/ bool sdpu_process_pend_ccb_new_cid(tCONN_CB& ccb) { bool sdpu_process_pend_ccb_new_cid(const tCONN_CB& ccb) { uint16_t xx; tCONN_CB* p_ccb{}; uint16_t new_cid = 0; Loading Loading @@ -549,7 +549,7 @@ bool sdpu_process_pend_ccb_new_cid(tCONN_CB& ccb) { * Returns returns none. * ******************************************************************************/ void sdpu_clear_pend_ccb(tCONN_CB& ccb) { void sdpu_clear_pend_ccb(const tCONN_CB& ccb) { uint16_t xx; tCONN_CB* p_ccb{}; Loading Loading @@ -700,14 +700,14 @@ void sdpu_build_n_send_error(tCONN_CB* p_ccb, uint16_t trans_num, tSDP_STATUS er char* p_error_text) { uint8_t *p_rsp, *p_rsp_start, *p_rsp_param_len; uint16_t rsp_param_len; BT_HDR* p_buf = (BT_HDR*)osi_malloc(SDP_DATA_BUF_SIZE); BT_HDR* p_buf = reinterpret_cast<BT_HDR*>(osi_malloc(SDP_DATA_BUF_SIZE)); log::warn("SDP - sdpu_build_n_send_error code: 0x{:x} CID: 0x{:x}", error_code, p_ccb->connection_id); /* Send the packet to L2CAP */ p_buf->offset = L2CAP_MIN_OFFSET; p_rsp = p_rsp_start = (uint8_t*)(p_buf + 1) + L2CAP_MIN_OFFSET; p_rsp = p_rsp_start = reinterpret_cast<uint8_t*>(p_buf + 1) + L2CAP_MIN_OFFSET; UINT8_TO_BE_STREAM(p_rsp, SDP_PDU_ERROR_RESPONSE); UINT16_TO_BE_STREAM(p_rsp, trans_num); Loading Loading @@ -1128,7 +1128,7 @@ bool sdpu_compare_uuid_arrays(const uint8_t* p_uuid1, uint32_t len1, const uint8 return (p_uuid1[0] == p_uuid2[0]) && (p_uuid1[1] == p_uuid2[1]) && (p_uuid1[2] == p_uuid2[2]) && (p_uuid1[3] == p_uuid2[3]); } else { return memcmp(p_uuid1, p_uuid2, (size_t)len1) == 0; return memcmp(p_uuid1, p_uuid2, static_cast<size_t>(len1)) == 0; } } else if (len1 > len2) { /* If the len1 was 4-byte, (so len2 is 2-byte), compare on the fly */ Loading Loading @@ -1160,9 +1160,9 @@ bool sdpu_compare_uuid_arrays(const uint8_t* p_uuid1, uint32_t len1, const uint8 memcpy(nu1, sdp_base_uuid, Uuid::kNumBytes128); if (len1 == 4) { memcpy(nu1, p_uuid1, (size_t)len1); memcpy(nu1, p_uuid1, static_cast<size_t>(len1)); } else if (len1 == 2) { memcpy(nu1 + 2, p_uuid1, (size_t)len1); memcpy(nu1 + 2, p_uuid1, static_cast<size_t>(len1)); } return memcmp(nu1, nu2, Uuid::kNumBytes128) == 0; Loading Loading @@ -1210,8 +1210,8 @@ bool sdpu_compare_uuid_with_attr(const Uuid& uuid, tSDP_DISC_ATTR* p_attr) { return false; } if (memcmp(uuid.To128BitBE().data(), (void*)p_attr->attr_value.v.array, Uuid::kNumBytes128) == 0) { if (memcmp(uuid.To128BitBE().data(), static_cast<void*>(p_attr->attr_value.v.array), Uuid::kNumBytes128) == 0) { return true; } Loading Loading @@ -1399,7 +1399,7 @@ uint16_t sdpu_get_attrib_entry_len(const tSDP_ATTRIBUTE* p_attr) { ******************************************************************************/ uint8_t* sdpu_build_partial_attrib_entry(uint8_t* p_out, const tSDP_ATTRIBUTE* p_attr, uint16_t len, uint16_t* offset) { uint8_t* p_attr_buff = (uint8_t*)osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN); uint8_t* p_attr_buff = reinterpret_cast<uint8_t*>(osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN)); sdpu_build_attrib_entry(p_attr_buff, p_attr); uint16_t attr_len = sdpu_get_attrib_entry_len(p_attr); Loading Loading @@ -1561,7 +1561,7 @@ void sdpu_set_avrc_target_version(const tSDP_ATTRIBUTE* p_attr, const RawAddress } if (!btif_config_get_bin(bdaddr->ToString(), BTIF_STORAGE_KEY_AVRCP_CONTROLLER_VERSION, (uint8_t*)&cached_version, &version_value_size)) { reinterpret_cast<uint8_t*>(&cached_version), &version_value_size)) { log::info( "no cached AVRC Controller version for {}. Reply default AVRC Target " "version {:x}.DUT AVRC Target version {:x}.", Loading Loading @@ -1630,7 +1630,7 @@ void sdpu_set_avrc_target_features(const tSDP_ATTRIBUTE* p_attr, const RawAddres } if (!btif_config_get_bin(bdaddr->ToString(), BTIF_STORAGE_KEY_AV_REM_CTRL_FEATURES, (uint8_t*)&avrcp_peer_features, &version_value_size)) { reinterpret_cast<uint8_t*>(&avrcp_peer_features), &version_value_size)) { log::error("Unable to fetch cached AVRC features"); return; } Loading system/stack/sdp/sdpint.h +25 −26 Original line number Diff line number Diff line Loading @@ -22,16 +22,16 @@ * ******************************************************************************/ #ifndef SDP_INT_H #define SDP_INT_H #pragma once #include <base/functional/callback.h> #include <base/strings/stringprintf.h> #include <cstdint> #include <string> #include "include/macros.h" #include "internal_include/bt_target.h" #include "macros.h" #include "osi/include/alarm.h" #include "stack/include/bt_hdr.h" #include "stack/include/l2c_api.h" Loading Loading @@ -116,15 +116,15 @@ struct tSDP_DB { /* Continuation information for the SDP server response */ struct tSDP_CONT_INFO { uint16_t next_attr_index; /* attr index for next continuation response */ uint16_t next_attr_start_id; /* attr id to start with for the attr index in next cont. response */ const tSDP_RECORD* prev_sdp_rec; /* last sdp record that was completely sent in the response */ bool last_attr_seq_desc_sent; /* whether attr seq length has been sent previously */ uint16_t attr_offset; /* offset within the attr to keep trak of partial attributes in the responses */ uint16_t next_attr_index; // attr index for next continuation response uint16_t next_attr_start_id; // attr id to start with for the attr index in // next cont. response const tSDP_RECORD* prev_sdp_rec; // last sdp record that was completely sent // in the response bool last_attr_seq_desc_sent; // whether attr seq length has been sent // previously uint16_t attr_offset; // offset within the attr to keep trak of partial // attributes in the responses }; enum class tSDP_STATE : uint8_t { Loading @@ -147,6 +147,7 @@ inline std::string sdp_state_text(const tSDP_STATE& state) { } enum : uint8_t { SDP_FLAGS_NONE = 0x00, SDP_FLAGS_IS_ORIG = 0x01, SDP_FLAGS_HIS_CFG_DONE = 0x02, SDP_FLAGS_MY_CFG_DONE = 0x04, Loading Loading @@ -175,16 +176,16 @@ typedef uint8_t tSDP_DISC_WAIT; /* Define the SDP Connection Control Block */ struct tCONN_CB { tSDP_STATE con_state; uint8_t con_flags; tSDP_STATE con_state{tSDP_STATE::IDLE}; tSDP_FLAGS con_flags{SDP_FLAGS_NONE}; RawAddress device_address; alarm_t* sdp_conn_timer; uint16_t rem_mtu_size; uint16_t connection_id; uint16_t list_len; /* length of the response in the GKI buffer */ uint16_t pse_dynamic_attributes_len; /* length of the attributes need to be added in final sdp response len */ uint16_t pse_dynamic_attributes_len; // length of the attributes need to be // added in final sdp response len uint8_t* rsp_list; /* pointer to GKI buffer holding response */ tSDP_DISCOVERY_DB* p_db; /* Database to save info into */ Loading @@ -199,12 +200,12 @@ struct tCONN_CB { uint16_t transaction_id; tSDP_REASON disconnect_reason; /* Disconnect reason */ uint8_t disc_state; bool is_attr_search; tSDP_DISC_WAIT disc_state{SDP_DISC_WAIT_CONN}; bool is_attr_search{false}; uint16_t cont_offset; /* Continuation state data in the server response */ tSDP_CONT_INFO cont_info; /* structure to hold continuation information for the server response */ tSDP_CONT_INFO cont_info; // structure to hold continuation information for // the server response tCONN_CB() = default; private: Loading Loading @@ -286,10 +287,10 @@ void sdpu_set_avrc_target_version(const tSDP_ATTRIBUTE* p_attr, const RawAddress void sdpu_set_avrc_target_features(const tSDP_ATTRIBUTE* p_attr, const RawAddress* bdaddr, uint16_t profile_version); uint16_t sdpu_get_active_ccb_cid(const RawAddress& bd_addr); bool sdpu_process_pend_ccb_same_cid(tCONN_CB& ccb); bool sdpu_process_pend_ccb_new_cid(tCONN_CB& ccb); void sdpu_clear_pend_ccb(tCONN_CB& ccb); void sdpu_callback(tCONN_CB& ccb, tSDP_REASON reason); bool sdpu_process_pend_ccb_same_cid(const tCONN_CB& ccb); bool sdpu_process_pend_ccb_new_cid(const tCONN_CB& ccb); void sdpu_clear_pend_ccb(const tCONN_CB& ccb); void sdpu_callback(const tCONN_CB& ccb, tSDP_REASON reason); /* Functions provided by sdp_db.cc */ Loading @@ -315,5 +316,3 @@ void sdp_save_local_pse_record_attributes(int32_t rfcomm_channel_number, int32_t size_t sdp_get_num_records(const tSDP_DISCOVERY_DB& db); size_t sdp_get_num_attributes(const tSDP_DISC_REC& sdp_disc_rec); #endif Loading
system/stack/sdp/sdp_utils.cc +15 −15 Original line number Diff line number Diff line Loading @@ -386,7 +386,7 @@ tCONN_CB* sdpu_allocate_ccb(void) { * Returns void * ******************************************************************************/ void sdpu_callback(tCONN_CB& ccb, tSDP_REASON reason) { void sdpu_callback(const tCONN_CB& ccb, tSDP_REASON reason) { if (ccb.p_cb) { (ccb.p_cb)(ccb.device_address, reason); } else if (ccb.complete_callback) { Loading Loading @@ -415,7 +415,7 @@ void sdpu_release_ccb(tCONN_CB& ccb) { if (ccb.rsp_list) { log::verbose("releasing SDP rsp_list"); } osi_free_and_reset((void**)&ccb.rsp_list); osi_free_and_reset(reinterpret_cast<void**>(&ccb.rsp_list)); } /******************************************************************************* Loading Loading @@ -480,7 +480,7 @@ uint16_t sdpu_get_active_ccb_cid(const RawAddress& bd_addr) { * Returns returns true if any pending ccb, else false. * ******************************************************************************/ bool sdpu_process_pend_ccb_same_cid(tCONN_CB& ccb) { bool sdpu_process_pend_ccb_same_cid(const tCONN_CB& ccb) { uint16_t xx; tCONN_CB* p_ccb{}; Loading Loading @@ -509,7 +509,7 @@ bool sdpu_process_pend_ccb_same_cid(tCONN_CB& ccb) { * Returns returns true if any pending ccb, else false. * ******************************************************************************/ bool sdpu_process_pend_ccb_new_cid(tCONN_CB& ccb) { bool sdpu_process_pend_ccb_new_cid(const tCONN_CB& ccb) { uint16_t xx; tCONN_CB* p_ccb{}; uint16_t new_cid = 0; Loading Loading @@ -549,7 +549,7 @@ bool sdpu_process_pend_ccb_new_cid(tCONN_CB& ccb) { * Returns returns none. * ******************************************************************************/ void sdpu_clear_pend_ccb(tCONN_CB& ccb) { void sdpu_clear_pend_ccb(const tCONN_CB& ccb) { uint16_t xx; tCONN_CB* p_ccb{}; Loading Loading @@ -700,14 +700,14 @@ void sdpu_build_n_send_error(tCONN_CB* p_ccb, uint16_t trans_num, tSDP_STATUS er char* p_error_text) { uint8_t *p_rsp, *p_rsp_start, *p_rsp_param_len; uint16_t rsp_param_len; BT_HDR* p_buf = (BT_HDR*)osi_malloc(SDP_DATA_BUF_SIZE); BT_HDR* p_buf = reinterpret_cast<BT_HDR*>(osi_malloc(SDP_DATA_BUF_SIZE)); log::warn("SDP - sdpu_build_n_send_error code: 0x{:x} CID: 0x{:x}", error_code, p_ccb->connection_id); /* Send the packet to L2CAP */ p_buf->offset = L2CAP_MIN_OFFSET; p_rsp = p_rsp_start = (uint8_t*)(p_buf + 1) + L2CAP_MIN_OFFSET; p_rsp = p_rsp_start = reinterpret_cast<uint8_t*>(p_buf + 1) + L2CAP_MIN_OFFSET; UINT8_TO_BE_STREAM(p_rsp, SDP_PDU_ERROR_RESPONSE); UINT16_TO_BE_STREAM(p_rsp, trans_num); Loading Loading @@ -1128,7 +1128,7 @@ bool sdpu_compare_uuid_arrays(const uint8_t* p_uuid1, uint32_t len1, const uint8 return (p_uuid1[0] == p_uuid2[0]) && (p_uuid1[1] == p_uuid2[1]) && (p_uuid1[2] == p_uuid2[2]) && (p_uuid1[3] == p_uuid2[3]); } else { return memcmp(p_uuid1, p_uuid2, (size_t)len1) == 0; return memcmp(p_uuid1, p_uuid2, static_cast<size_t>(len1)) == 0; } } else if (len1 > len2) { /* If the len1 was 4-byte, (so len2 is 2-byte), compare on the fly */ Loading Loading @@ -1160,9 +1160,9 @@ bool sdpu_compare_uuid_arrays(const uint8_t* p_uuid1, uint32_t len1, const uint8 memcpy(nu1, sdp_base_uuid, Uuid::kNumBytes128); if (len1 == 4) { memcpy(nu1, p_uuid1, (size_t)len1); memcpy(nu1, p_uuid1, static_cast<size_t>(len1)); } else if (len1 == 2) { memcpy(nu1 + 2, p_uuid1, (size_t)len1); memcpy(nu1 + 2, p_uuid1, static_cast<size_t>(len1)); } return memcmp(nu1, nu2, Uuid::kNumBytes128) == 0; Loading Loading @@ -1210,8 +1210,8 @@ bool sdpu_compare_uuid_with_attr(const Uuid& uuid, tSDP_DISC_ATTR* p_attr) { return false; } if (memcmp(uuid.To128BitBE().data(), (void*)p_attr->attr_value.v.array, Uuid::kNumBytes128) == 0) { if (memcmp(uuid.To128BitBE().data(), static_cast<void*>(p_attr->attr_value.v.array), Uuid::kNumBytes128) == 0) { return true; } Loading Loading @@ -1399,7 +1399,7 @@ uint16_t sdpu_get_attrib_entry_len(const tSDP_ATTRIBUTE* p_attr) { ******************************************************************************/ uint8_t* sdpu_build_partial_attrib_entry(uint8_t* p_out, const tSDP_ATTRIBUTE* p_attr, uint16_t len, uint16_t* offset) { uint8_t* p_attr_buff = (uint8_t*)osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN); uint8_t* p_attr_buff = reinterpret_cast<uint8_t*>(osi_malloc(sizeof(uint8_t) * SDP_MAX_ATTR_LEN)); sdpu_build_attrib_entry(p_attr_buff, p_attr); uint16_t attr_len = sdpu_get_attrib_entry_len(p_attr); Loading Loading @@ -1561,7 +1561,7 @@ void sdpu_set_avrc_target_version(const tSDP_ATTRIBUTE* p_attr, const RawAddress } if (!btif_config_get_bin(bdaddr->ToString(), BTIF_STORAGE_KEY_AVRCP_CONTROLLER_VERSION, (uint8_t*)&cached_version, &version_value_size)) { reinterpret_cast<uint8_t*>(&cached_version), &version_value_size)) { log::info( "no cached AVRC Controller version for {}. Reply default AVRC Target " "version {:x}.DUT AVRC Target version {:x}.", Loading Loading @@ -1630,7 +1630,7 @@ void sdpu_set_avrc_target_features(const tSDP_ATTRIBUTE* p_attr, const RawAddres } if (!btif_config_get_bin(bdaddr->ToString(), BTIF_STORAGE_KEY_AV_REM_CTRL_FEATURES, (uint8_t*)&avrcp_peer_features, &version_value_size)) { reinterpret_cast<uint8_t*>(&avrcp_peer_features), &version_value_size)) { log::error("Unable to fetch cached AVRC features"); return; } Loading
system/stack/sdp/sdpint.h +25 −26 Original line number Diff line number Diff line Loading @@ -22,16 +22,16 @@ * ******************************************************************************/ #ifndef SDP_INT_H #define SDP_INT_H #pragma once #include <base/functional/callback.h> #include <base/strings/stringprintf.h> #include <cstdint> #include <string> #include "include/macros.h" #include "internal_include/bt_target.h" #include "macros.h" #include "osi/include/alarm.h" #include "stack/include/bt_hdr.h" #include "stack/include/l2c_api.h" Loading Loading @@ -116,15 +116,15 @@ struct tSDP_DB { /* Continuation information for the SDP server response */ struct tSDP_CONT_INFO { uint16_t next_attr_index; /* attr index for next continuation response */ uint16_t next_attr_start_id; /* attr id to start with for the attr index in next cont. response */ const tSDP_RECORD* prev_sdp_rec; /* last sdp record that was completely sent in the response */ bool last_attr_seq_desc_sent; /* whether attr seq length has been sent previously */ uint16_t attr_offset; /* offset within the attr to keep trak of partial attributes in the responses */ uint16_t next_attr_index; // attr index for next continuation response uint16_t next_attr_start_id; // attr id to start with for the attr index in // next cont. response const tSDP_RECORD* prev_sdp_rec; // last sdp record that was completely sent // in the response bool last_attr_seq_desc_sent; // whether attr seq length has been sent // previously uint16_t attr_offset; // offset within the attr to keep trak of partial // attributes in the responses }; enum class tSDP_STATE : uint8_t { Loading @@ -147,6 +147,7 @@ inline std::string sdp_state_text(const tSDP_STATE& state) { } enum : uint8_t { SDP_FLAGS_NONE = 0x00, SDP_FLAGS_IS_ORIG = 0x01, SDP_FLAGS_HIS_CFG_DONE = 0x02, SDP_FLAGS_MY_CFG_DONE = 0x04, Loading Loading @@ -175,16 +176,16 @@ typedef uint8_t tSDP_DISC_WAIT; /* Define the SDP Connection Control Block */ struct tCONN_CB { tSDP_STATE con_state; uint8_t con_flags; tSDP_STATE con_state{tSDP_STATE::IDLE}; tSDP_FLAGS con_flags{SDP_FLAGS_NONE}; RawAddress device_address; alarm_t* sdp_conn_timer; uint16_t rem_mtu_size; uint16_t connection_id; uint16_t list_len; /* length of the response in the GKI buffer */ uint16_t pse_dynamic_attributes_len; /* length of the attributes need to be added in final sdp response len */ uint16_t pse_dynamic_attributes_len; // length of the attributes need to be // added in final sdp response len uint8_t* rsp_list; /* pointer to GKI buffer holding response */ tSDP_DISCOVERY_DB* p_db; /* Database to save info into */ Loading @@ -199,12 +200,12 @@ struct tCONN_CB { uint16_t transaction_id; tSDP_REASON disconnect_reason; /* Disconnect reason */ uint8_t disc_state; bool is_attr_search; tSDP_DISC_WAIT disc_state{SDP_DISC_WAIT_CONN}; bool is_attr_search{false}; uint16_t cont_offset; /* Continuation state data in the server response */ tSDP_CONT_INFO cont_info; /* structure to hold continuation information for the server response */ tSDP_CONT_INFO cont_info; // structure to hold continuation information for // the server response tCONN_CB() = default; private: Loading Loading @@ -286,10 +287,10 @@ void sdpu_set_avrc_target_version(const tSDP_ATTRIBUTE* p_attr, const RawAddress void sdpu_set_avrc_target_features(const tSDP_ATTRIBUTE* p_attr, const RawAddress* bdaddr, uint16_t profile_version); uint16_t sdpu_get_active_ccb_cid(const RawAddress& bd_addr); bool sdpu_process_pend_ccb_same_cid(tCONN_CB& ccb); bool sdpu_process_pend_ccb_new_cid(tCONN_CB& ccb); void sdpu_clear_pend_ccb(tCONN_CB& ccb); void sdpu_callback(tCONN_CB& ccb, tSDP_REASON reason); bool sdpu_process_pend_ccb_same_cid(const tCONN_CB& ccb); bool sdpu_process_pend_ccb_new_cid(const tCONN_CB& ccb); void sdpu_clear_pend_ccb(const tCONN_CB& ccb); void sdpu_callback(const tCONN_CB& ccb, tSDP_REASON reason); /* Functions provided by sdp_db.cc */ Loading @@ -315,5 +316,3 @@ void sdp_save_local_pse_record_attributes(int32_t rfcomm_channel_number, int32_t size_t sdp_get_num_records(const tSDP_DISCOVERY_DB& db); size_t sdp_get_num_attributes(const tSDP_DISC_REC& sdp_disc_rec); #endif