Loading system/bta/dm/bta_dm_act.cc +4 −41 Original line number Diff line number Diff line Loading @@ -1068,13 +1068,11 @@ static size_t find_utf8_char_boundary(const char* utf8str, size_t offset) { static void bta_dm_set_eir(char* local_name) { uint8_t* p; uint8_t* p_length; #if (BTA_EIR_CANNED_UUID_LIST != TRUE) uint8_t* p_type; uint8_t max_num_uuid; #if (BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) uint8_t custom_uuid_idx; #endif // BTA_EIR_SERVER_NUM_CUSTOM_UUID #endif // BTA_EIR_CANNED_UUID_LIST uint8_t free_eir_length = HCI_DM5_PACKET_SIZE; uint8_t num_uuid; uint8_t data_type; Loading @@ -1083,14 +1081,12 @@ static void bta_dm_set_eir(char* local_name) { /* wait until complete to disable */ if (alarm_is_scheduled(bta_dm_cb.disable_timer)) return; #if (BTA_EIR_CANNED_UUID_LIST != TRUE) /* if local name is not provided, get it from controller */ if (local_name == NULL) { if (BTM_ReadLocalDeviceName((const char**)&local_name) != BTM_SUCCESS) { log::error("Fail to read local device name for EIR"); } } #endif // BTA_EIR_CANNED_UUID_LIST /* Allocate a buffer to hold HCI command */ BT_HDR* p_buf = (BT_HDR*)osi_malloc(BTM_CMD_BUF_SIZE); Loading @@ -1111,14 +1107,10 @@ static void bta_dm_set_eir(char* local_name) { /* check whether it needs to be shortened or not */ if (local_name_len > p_bta_dm_eir_cfg->bta_dm_eir_min_name_len) { /* get number of UUID 16-bit list */ #if (BTA_EIR_CANNED_UUID_LIST == TRUE) num_uuid = p_bta_dm_eir_cfg->bta_dm_eir_uuid16_len / Uuid::kNumBytes16; #else // BTA_EIR_CANNED_UUID_LIST max_num_uuid = (free_eir_length - 2) / Uuid::kNumBytes16; data_type = get_btm_client_interface().eir.BTM_GetEirSupportedServices( bta_dm_cb.eir_uuid, &p, max_num_uuid, &num_uuid); p = (uint8_t*)p_buf + BTM_HCI_EIR_OFFSET; /* reset p */ #endif // BTA_EIR_CANNED_UUID_LIST /* if UUID doesn't fit remaing space, shorten local name */ if (local_name_len > (free_eir_length - 4 - num_uuid * Uuid::kNumBytes16)) { Loading @@ -1140,31 +1132,6 @@ static void bta_dm_set_eir(char* local_name) { } free_eir_length -= local_name_len + 2; #if (BTA_EIR_CANNED_UUID_LIST == TRUE) /* if UUID list is provided as static data in configuration */ if ((p_bta_dm_eir_cfg->bta_dm_eir_uuid16_len > 0) && (p_bta_dm_eir_cfg->bta_dm_eir_uuid16)) { if (free_eir_length > Uuid::kNumBytes16 + 2) { free_eir_length -= 2; if (free_eir_length >= p_bta_dm_eir_cfg->bta_dm_eir_uuid16_len) { num_uuid = p_bta_dm_eir_cfg->bta_dm_eir_uuid16_len / Uuid::kNumBytes16; data_type = HCI_EIR_COMPLETE_16BITS_UUID_TYPE; } else /* not enough room for all UUIDs */ { log::warn("BTA EIR: UUID 16-bit list is truncated"); num_uuid = free_eir_length / Uuid::kNumBytes16; data_type = HCI_EIR_MORE_16BITS_UUID_TYPE; } UINT8_TO_STREAM(p, num_uuid * Uuid::kNumBytes16 + 1); UINT8_TO_STREAM(p, data_type); memcpy(p, p_bta_dm_eir_cfg->bta_dm_eir_uuid16, num_uuid * Uuid::kNumBytes16); p += num_uuid * Uuid::kNumBytes16; free_eir_length -= num_uuid * Uuid::kNumBytes16; } } #else /* (BTA_EIR_CANNED_UUID_LIST == TRUE) */ /* if UUID list is dynamic */ if (free_eir_length >= 2) { p_length = p++; Loading Loading @@ -1202,9 +1169,8 @@ static void bta_dm_set_eir(char* local_name) { UINT8_TO_STREAM(p_type, data_type); free_eir_length -= num_uuid * Uuid::kNumBytes16 + 2; } #endif /* (BTA_EIR_CANNED_UUID_LIST == TRUE) */ #if (BTA_EIR_CANNED_UUID_LIST != TRUE && BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) #if (BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) /* Adding 32-bit UUID list */ if (free_eir_length >= 2) { p_length = p++; Loading Loading @@ -1262,8 +1228,7 @@ static void bta_dm_set_eir(char* local_name) { UINT8_TO_STREAM(p_type, data_type); free_eir_length -= num_uuid * Uuid::kNumBytes128 + 2; } #endif /* ( BTA_EIR_CANNED_UUID_LIST != TRUE \ )&&(BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) */ #endif /* BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0 */ /* if Flags are provided in configuration */ if ((p_bta_dm_eir_cfg->bta_dm_eir_flag_len > 0) && Loading Loading @@ -1308,7 +1273,6 @@ static void bta_dm_set_eir(char* local_name) { get_btm_client_interface().eir.BTM_WriteEIR(p_buf); } #if (BTA_EIR_CANNED_UUID_LIST != TRUE) /******************************************************************************* * * Function bta_dm_get_cust_uuid_index Loading Loading @@ -1414,7 +1378,6 @@ void bta_dm_eir_update_uuid(uint16_t uuid16, bool adding) { bta_dm_set_eir(NULL); } #endif // BTA_EIR_CANNED_UUID_LIST tBTA_DM_PEER_DEVICE* find_connected_device( const RawAddress& bd_addr, UNUSED_ATTR tBT_TRANSPORT transport) { Loading system/bta/dm/bta_dm_cfg.cc +1 −15 Original line number Diff line number Diff line Loading @@ -623,24 +623,11 @@ const tBTM_PM_PWR_MD* p_bta_dm_pm_md = &bta_dm_pm_md[0]; * (same reason of DM5) */ #if (BTA_EIR_CANNED_UUID_LIST == TRUE) /* for example */ const uint8_t bta_dm_eir_uuid16_list[] = { 0x08, 0x11, /* Headset */ 0x1E, 0x11, /* Handsfree */ 0x0E, 0x11, /* AV Remote Control */ 0x0B, 0x11, /* Audio Sink */ }; #endif // BTA_EIR_CANNED_UUID_LIST /* Extended Inquiry Response */ const tBTA_DM_EIR_CONF bta_dm_eir_cfg = { 50, /* minimum length of local name when it is shortened */ /* if length of local name is longer than this and EIR has not enough */ /* room for all UUID list then local name is shortened to this length */ #if (BTA_EIR_CANNED_UUID_LIST == TRUE) 8, (uint8_t*)bta_dm_eir_uuid16_list, #else // BTA_EIR_CANNED_UUID_LIST { /* mask of UUID list in EIR */ 0xFFFFFFFF, /* LSB is the first UUID of the first 32 UUIDs in Loading @@ -649,7 +636,6 @@ const tBTA_DM_EIR_CONF bta_dm_eir_cfg = { BTM_EIR_UUID_LKUP_TBL */ /* BTM_EIR_UUID_LKUP_TBL can be overrided */ }, #endif // BTA_EIR_CANNED_UUID_LIST NULL, /* Inquiry TX power */ 0, /* length of flags in bytes */ NULL, /* flags for EIR */ Loading system/bta/dm/bta_dm_int.h +0 −4 Original line number Diff line number Diff line Loading @@ -214,15 +214,11 @@ typedef struct { tBTA_PM_TIMER pm_timer[BTA_DM_NUM_PM_TIMER]; uint8_t cur_av_count; /* current AV connecions */ #if (BTA_EIR_CANNED_UUID_LIST != TRUE) /* store UUID list for EIR */ uint32_t eir_uuid[BTM_EIR_SERVICE_ARRAY_SIZE]; #if (BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) tBTA_CUSTOM_UUID bta_custom_uuid[BTA_EIR_SERVER_NUM_CUSTOM_UUID]; #endif #endif alarm_t* switch_delay_timer; } tBTA_DM_CB; Loading system/bta/include/bta_api.h +0 −5 Original line number Diff line number Diff line Loading @@ -156,12 +156,7 @@ enum { typedef struct { uint8_t bta_dm_eir_min_name_len; /* minimum length of local name when it is shortened */ #if (BTA_EIR_CANNED_UUID_LIST == TRUE) uint8_t bta_dm_eir_uuid16_len; /* length of 16-bit UUIDs */ uint8_t* bta_dm_eir_uuid16; /* 16-bit UUIDs */ #else uint32_t uuid_mask[BTM_EIR_SERVICE_ARRAY_SIZE]; /* mask of UUID list in EIR */ #endif int8_t* bta_dm_eir_inq_tx_power; /* Inquiry TX power */ uint8_t bta_dm_eir_flag_len; /* length of flags in bytes */ uint8_t* bta_dm_eir_flags; /* flags for EIR */ Loading system/bta/pan/bta_pan_act.cc +0 −2 Original line number Diff line number Diff line Loading @@ -380,11 +380,9 @@ void bta_pan_disable(void) { /* close all connections */ PAN_SetRole(0, std::string(), std::string()); #if (BTA_EIR_CANNED_UUID_LIST != TRUE) bta_sys_remove_uuid(UUID_SERVCLASS_NAP); bta_sys_remove_uuid(UUID_SERVCLASS_GN); bta_sys_remove_uuid(UUID_SERVCLASS_PANU); #endif // BTA_EIR_CANNED_UUID_LIST /* free all queued up data buffers */ for (i = 0; i < BTA_PAN_NUM_CONN; i++, p_scb++) { if (p_scb->in_use) { Loading Loading
system/bta/dm/bta_dm_act.cc +4 −41 Original line number Diff line number Diff line Loading @@ -1068,13 +1068,11 @@ static size_t find_utf8_char_boundary(const char* utf8str, size_t offset) { static void bta_dm_set_eir(char* local_name) { uint8_t* p; uint8_t* p_length; #if (BTA_EIR_CANNED_UUID_LIST != TRUE) uint8_t* p_type; uint8_t max_num_uuid; #if (BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) uint8_t custom_uuid_idx; #endif // BTA_EIR_SERVER_NUM_CUSTOM_UUID #endif // BTA_EIR_CANNED_UUID_LIST uint8_t free_eir_length = HCI_DM5_PACKET_SIZE; uint8_t num_uuid; uint8_t data_type; Loading @@ -1083,14 +1081,12 @@ static void bta_dm_set_eir(char* local_name) { /* wait until complete to disable */ if (alarm_is_scheduled(bta_dm_cb.disable_timer)) return; #if (BTA_EIR_CANNED_UUID_LIST != TRUE) /* if local name is not provided, get it from controller */ if (local_name == NULL) { if (BTM_ReadLocalDeviceName((const char**)&local_name) != BTM_SUCCESS) { log::error("Fail to read local device name for EIR"); } } #endif // BTA_EIR_CANNED_UUID_LIST /* Allocate a buffer to hold HCI command */ BT_HDR* p_buf = (BT_HDR*)osi_malloc(BTM_CMD_BUF_SIZE); Loading @@ -1111,14 +1107,10 @@ static void bta_dm_set_eir(char* local_name) { /* check whether it needs to be shortened or not */ if (local_name_len > p_bta_dm_eir_cfg->bta_dm_eir_min_name_len) { /* get number of UUID 16-bit list */ #if (BTA_EIR_CANNED_UUID_LIST == TRUE) num_uuid = p_bta_dm_eir_cfg->bta_dm_eir_uuid16_len / Uuid::kNumBytes16; #else // BTA_EIR_CANNED_UUID_LIST max_num_uuid = (free_eir_length - 2) / Uuid::kNumBytes16; data_type = get_btm_client_interface().eir.BTM_GetEirSupportedServices( bta_dm_cb.eir_uuid, &p, max_num_uuid, &num_uuid); p = (uint8_t*)p_buf + BTM_HCI_EIR_OFFSET; /* reset p */ #endif // BTA_EIR_CANNED_UUID_LIST /* if UUID doesn't fit remaing space, shorten local name */ if (local_name_len > (free_eir_length - 4 - num_uuid * Uuid::kNumBytes16)) { Loading @@ -1140,31 +1132,6 @@ static void bta_dm_set_eir(char* local_name) { } free_eir_length -= local_name_len + 2; #if (BTA_EIR_CANNED_UUID_LIST == TRUE) /* if UUID list is provided as static data in configuration */ if ((p_bta_dm_eir_cfg->bta_dm_eir_uuid16_len > 0) && (p_bta_dm_eir_cfg->bta_dm_eir_uuid16)) { if (free_eir_length > Uuid::kNumBytes16 + 2) { free_eir_length -= 2; if (free_eir_length >= p_bta_dm_eir_cfg->bta_dm_eir_uuid16_len) { num_uuid = p_bta_dm_eir_cfg->bta_dm_eir_uuid16_len / Uuid::kNumBytes16; data_type = HCI_EIR_COMPLETE_16BITS_UUID_TYPE; } else /* not enough room for all UUIDs */ { log::warn("BTA EIR: UUID 16-bit list is truncated"); num_uuid = free_eir_length / Uuid::kNumBytes16; data_type = HCI_EIR_MORE_16BITS_UUID_TYPE; } UINT8_TO_STREAM(p, num_uuid * Uuid::kNumBytes16 + 1); UINT8_TO_STREAM(p, data_type); memcpy(p, p_bta_dm_eir_cfg->bta_dm_eir_uuid16, num_uuid * Uuid::kNumBytes16); p += num_uuid * Uuid::kNumBytes16; free_eir_length -= num_uuid * Uuid::kNumBytes16; } } #else /* (BTA_EIR_CANNED_UUID_LIST == TRUE) */ /* if UUID list is dynamic */ if (free_eir_length >= 2) { p_length = p++; Loading Loading @@ -1202,9 +1169,8 @@ static void bta_dm_set_eir(char* local_name) { UINT8_TO_STREAM(p_type, data_type); free_eir_length -= num_uuid * Uuid::kNumBytes16 + 2; } #endif /* (BTA_EIR_CANNED_UUID_LIST == TRUE) */ #if (BTA_EIR_CANNED_UUID_LIST != TRUE && BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) #if (BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) /* Adding 32-bit UUID list */ if (free_eir_length >= 2) { p_length = p++; Loading Loading @@ -1262,8 +1228,7 @@ static void bta_dm_set_eir(char* local_name) { UINT8_TO_STREAM(p_type, data_type); free_eir_length -= num_uuid * Uuid::kNumBytes128 + 2; } #endif /* ( BTA_EIR_CANNED_UUID_LIST != TRUE \ )&&(BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) */ #endif /* BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0 */ /* if Flags are provided in configuration */ if ((p_bta_dm_eir_cfg->bta_dm_eir_flag_len > 0) && Loading Loading @@ -1308,7 +1273,6 @@ static void bta_dm_set_eir(char* local_name) { get_btm_client_interface().eir.BTM_WriteEIR(p_buf); } #if (BTA_EIR_CANNED_UUID_LIST != TRUE) /******************************************************************************* * * Function bta_dm_get_cust_uuid_index Loading Loading @@ -1414,7 +1378,6 @@ void bta_dm_eir_update_uuid(uint16_t uuid16, bool adding) { bta_dm_set_eir(NULL); } #endif // BTA_EIR_CANNED_UUID_LIST tBTA_DM_PEER_DEVICE* find_connected_device( const RawAddress& bd_addr, UNUSED_ATTR tBT_TRANSPORT transport) { Loading
system/bta/dm/bta_dm_cfg.cc +1 −15 Original line number Diff line number Diff line Loading @@ -623,24 +623,11 @@ const tBTM_PM_PWR_MD* p_bta_dm_pm_md = &bta_dm_pm_md[0]; * (same reason of DM5) */ #if (BTA_EIR_CANNED_UUID_LIST == TRUE) /* for example */ const uint8_t bta_dm_eir_uuid16_list[] = { 0x08, 0x11, /* Headset */ 0x1E, 0x11, /* Handsfree */ 0x0E, 0x11, /* AV Remote Control */ 0x0B, 0x11, /* Audio Sink */ }; #endif // BTA_EIR_CANNED_UUID_LIST /* Extended Inquiry Response */ const tBTA_DM_EIR_CONF bta_dm_eir_cfg = { 50, /* minimum length of local name when it is shortened */ /* if length of local name is longer than this and EIR has not enough */ /* room for all UUID list then local name is shortened to this length */ #if (BTA_EIR_CANNED_UUID_LIST == TRUE) 8, (uint8_t*)bta_dm_eir_uuid16_list, #else // BTA_EIR_CANNED_UUID_LIST { /* mask of UUID list in EIR */ 0xFFFFFFFF, /* LSB is the first UUID of the first 32 UUIDs in Loading @@ -649,7 +636,6 @@ const tBTA_DM_EIR_CONF bta_dm_eir_cfg = { BTM_EIR_UUID_LKUP_TBL */ /* BTM_EIR_UUID_LKUP_TBL can be overrided */ }, #endif // BTA_EIR_CANNED_UUID_LIST NULL, /* Inquiry TX power */ 0, /* length of flags in bytes */ NULL, /* flags for EIR */ Loading
system/bta/dm/bta_dm_int.h +0 −4 Original line number Diff line number Diff line Loading @@ -214,15 +214,11 @@ typedef struct { tBTA_PM_TIMER pm_timer[BTA_DM_NUM_PM_TIMER]; uint8_t cur_av_count; /* current AV connecions */ #if (BTA_EIR_CANNED_UUID_LIST != TRUE) /* store UUID list for EIR */ uint32_t eir_uuid[BTM_EIR_SERVICE_ARRAY_SIZE]; #if (BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0) tBTA_CUSTOM_UUID bta_custom_uuid[BTA_EIR_SERVER_NUM_CUSTOM_UUID]; #endif #endif alarm_t* switch_delay_timer; } tBTA_DM_CB; Loading
system/bta/include/bta_api.h +0 −5 Original line number Diff line number Diff line Loading @@ -156,12 +156,7 @@ enum { typedef struct { uint8_t bta_dm_eir_min_name_len; /* minimum length of local name when it is shortened */ #if (BTA_EIR_CANNED_UUID_LIST == TRUE) uint8_t bta_dm_eir_uuid16_len; /* length of 16-bit UUIDs */ uint8_t* bta_dm_eir_uuid16; /* 16-bit UUIDs */ #else uint32_t uuid_mask[BTM_EIR_SERVICE_ARRAY_SIZE]; /* mask of UUID list in EIR */ #endif int8_t* bta_dm_eir_inq_tx_power; /* Inquiry TX power */ uint8_t bta_dm_eir_flag_len; /* length of flags in bytes */ uint8_t* bta_dm_eir_flags; /* flags for EIR */ Loading
system/bta/pan/bta_pan_act.cc +0 −2 Original line number Diff line number Diff line Loading @@ -380,11 +380,9 @@ void bta_pan_disable(void) { /* close all connections */ PAN_SetRole(0, std::string(), std::string()); #if (BTA_EIR_CANNED_UUID_LIST != TRUE) bta_sys_remove_uuid(UUID_SERVCLASS_NAP); bta_sys_remove_uuid(UUID_SERVCLASS_GN); bta_sys_remove_uuid(UUID_SERVCLASS_PANU); #endif // BTA_EIR_CANNED_UUID_LIST /* free all queued up data buffers */ for (i = 0; i < BTA_PAN_NUM_CONN; i++, p_scb++) { if (p_scb->in_use) { Loading