Loading system/main/bte_conf.c +23 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,28 @@ void bte_load_conf(const char *path) { config_free(config); } extern int btm_ble_tx_power[BTM_BLE_ADV_TX_POWER_MAX + 1]; void bte_load_ble_conf(const char* path) { assert(path != NULL); ALOGI("%s attempt to load ble stack conf from %s", __func__, path); config_t *config = config_new(path); if (!config) { ALOGI("%s file >%s< not found", __func__, path); return; } const char* ble_adv_tx_power = config_get_string(config, CONFIG_DEFAULT_SECTION, "BLE_ADV_TX_POWER", ""); if(*ble_adv_tx_power) { sscanf(ble_adv_tx_power, "%d,%d,%d,%d,%d", btm_ble_tx_power, btm_ble_tx_power + 1, btm_ble_tx_power + 2, btm_ble_tx_power + 3, btm_ble_tx_power + 4); ALOGI("loaded btm_ble_tx_power: %d, %d, %d, %d, %d", (char)btm_ble_tx_power[0], (char)btm_ble_tx_power[1], btm_ble_tx_power[2], btm_ble_tx_power[3], btm_ble_tx_power[4]); } config_free(config); } // Parses the specified Device ID configuration file and registers the // Device ID records with SDP. void bte_load_did_conf(const char *p_path) { Loading Loading @@ -107,3 +129,4 @@ void bte_load_did_conf(const char *p_path) { config_free(config); } system/main/bte_main.c +6 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,10 @@ #ifndef BTE_STACK_CONF_FILE #define BTE_STACK_CONF_FILE "/etc/bluetooth/bt_stack.conf" #endif /* Run-time configuration file for BLE*/ #ifndef BTE_BLE_STACK_CONF_FILE #define BTE_BLE_STACK_CONF_FILE "/etc/bluetooth/ble_stack.conf" #endif /* if not specified in .txt file then use this as default */ #ifndef HCI_LOGGING_FILENAME Loading Loading @@ -107,6 +111,7 @@ BT_API extern void BTE_LoadStack(void); BT_API void BTE_UnloadStack(void); extern void scru_flip_bda (BD_ADDR dst, const BD_ADDR src); extern void bte_load_conf(const char *p_path); extern void bte_load_ble_conf(const char *p_path); extern bt_bdaddr_t btif_local_bd_addr; Loading Loading @@ -158,6 +163,7 @@ void bte_main_boot_entry(void) bte_main_in_hw_init(); bte_load_conf(BTE_STACK_CONF_FILE); bte_load_ble_conf(BTE_BLE_STACK_CONF_FILE); #if (BTTRC_INCLUDED == TRUE) /* Initialize trace feature */ Loading system/stack/btm/btm_ble_multi_adv.c +19 −2 Original line number Diff line number Diff line Loading @@ -222,7 +222,24 @@ tBTM_STATUS btm_ble_enable_multi_adv (BOOLEAN enable, UINT8 inst_id, UINT8 cb_ev } return rt; } /******************************************************************************* ** ** Function btm_ble_map_adv_tx_power ** ** Description return the actual power in dBm based on the mapping in config file ** ** Parameters advertise parameters used for this instance. ** ** Returns tx power in dBm ** *******************************************************************************/ int btm_ble_tx_power[BTM_BLE_ADV_TX_POWER_MAX + 1] = BTM_BLE_ADV_TX_POWER; static char btm_ble_map_adv_tx_power(int tx_power_index) { if(0 <= tx_power_index && tx_power_index < BTM_BLE_ADV_TX_POWER_MAX) return (char)btm_ble_tx_power[tx_power_index]; return 0; } /******************************************************************************* ** ** Function btm_ble_multi_adv_set_params Loading Loading @@ -282,7 +299,7 @@ tBTM_STATUS btm_ble_multi_adv_set_params (tBTM_BLE_MULTI_ADV_INST *p_inst, if (p_params->tx_power > BTM_BLE_ADV_TX_POWER_MAX) p_params->tx_power = BTM_BLE_ADV_TX_POWER_MAX; UINT8_TO_STREAM (pp, p_params->tx_power); UINT8_TO_STREAM (pp, btm_ble_map_adv_tx_power(p_params->tx_power)); BTM_TRACE_EVENT("set_params:Chnl Map %d,adv_fltr policy %d,ID:%d, TX Power%d", p_params->channel_map,p_params->adv_filter_policy,p_inst->inst_id,p_params->tx_power); Loading system/stack/include/btm_ble_api.h +2 −0 Original line number Diff line number Diff line Loading @@ -323,6 +323,8 @@ typedef UINT8 tBTM_BLE_AD_TYPE; #define BTM_BLE_ADV_TX_POWER_MAX 4 /* maximum tx power */ typedef UINT8 tBTM_BLE_ADV_TX_POWER; /* adv tx power in dBm */ #define BTM_BLE_ADV_TX_POWER {-21, -15, -7, 1, 9} typedef struct { Loading Loading
system/main/bte_conf.c +23 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,28 @@ void bte_load_conf(const char *path) { config_free(config); } extern int btm_ble_tx_power[BTM_BLE_ADV_TX_POWER_MAX + 1]; void bte_load_ble_conf(const char* path) { assert(path != NULL); ALOGI("%s attempt to load ble stack conf from %s", __func__, path); config_t *config = config_new(path); if (!config) { ALOGI("%s file >%s< not found", __func__, path); return; } const char* ble_adv_tx_power = config_get_string(config, CONFIG_DEFAULT_SECTION, "BLE_ADV_TX_POWER", ""); if(*ble_adv_tx_power) { sscanf(ble_adv_tx_power, "%d,%d,%d,%d,%d", btm_ble_tx_power, btm_ble_tx_power + 1, btm_ble_tx_power + 2, btm_ble_tx_power + 3, btm_ble_tx_power + 4); ALOGI("loaded btm_ble_tx_power: %d, %d, %d, %d, %d", (char)btm_ble_tx_power[0], (char)btm_ble_tx_power[1], btm_ble_tx_power[2], btm_ble_tx_power[3], btm_ble_tx_power[4]); } config_free(config); } // Parses the specified Device ID configuration file and registers the // Device ID records with SDP. void bte_load_did_conf(const char *p_path) { Loading Loading @@ -107,3 +129,4 @@ void bte_load_did_conf(const char *p_path) { config_free(config); }
system/main/bte_main.c +6 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,10 @@ #ifndef BTE_STACK_CONF_FILE #define BTE_STACK_CONF_FILE "/etc/bluetooth/bt_stack.conf" #endif /* Run-time configuration file for BLE*/ #ifndef BTE_BLE_STACK_CONF_FILE #define BTE_BLE_STACK_CONF_FILE "/etc/bluetooth/ble_stack.conf" #endif /* if not specified in .txt file then use this as default */ #ifndef HCI_LOGGING_FILENAME Loading Loading @@ -107,6 +111,7 @@ BT_API extern void BTE_LoadStack(void); BT_API void BTE_UnloadStack(void); extern void scru_flip_bda (BD_ADDR dst, const BD_ADDR src); extern void bte_load_conf(const char *p_path); extern void bte_load_ble_conf(const char *p_path); extern bt_bdaddr_t btif_local_bd_addr; Loading Loading @@ -158,6 +163,7 @@ void bte_main_boot_entry(void) bte_main_in_hw_init(); bte_load_conf(BTE_STACK_CONF_FILE); bte_load_ble_conf(BTE_BLE_STACK_CONF_FILE); #if (BTTRC_INCLUDED == TRUE) /* Initialize trace feature */ Loading
system/stack/btm/btm_ble_multi_adv.c +19 −2 Original line number Diff line number Diff line Loading @@ -222,7 +222,24 @@ tBTM_STATUS btm_ble_enable_multi_adv (BOOLEAN enable, UINT8 inst_id, UINT8 cb_ev } return rt; } /******************************************************************************* ** ** Function btm_ble_map_adv_tx_power ** ** Description return the actual power in dBm based on the mapping in config file ** ** Parameters advertise parameters used for this instance. ** ** Returns tx power in dBm ** *******************************************************************************/ int btm_ble_tx_power[BTM_BLE_ADV_TX_POWER_MAX + 1] = BTM_BLE_ADV_TX_POWER; static char btm_ble_map_adv_tx_power(int tx_power_index) { if(0 <= tx_power_index && tx_power_index < BTM_BLE_ADV_TX_POWER_MAX) return (char)btm_ble_tx_power[tx_power_index]; return 0; } /******************************************************************************* ** ** Function btm_ble_multi_adv_set_params Loading Loading @@ -282,7 +299,7 @@ tBTM_STATUS btm_ble_multi_adv_set_params (tBTM_BLE_MULTI_ADV_INST *p_inst, if (p_params->tx_power > BTM_BLE_ADV_TX_POWER_MAX) p_params->tx_power = BTM_BLE_ADV_TX_POWER_MAX; UINT8_TO_STREAM (pp, p_params->tx_power); UINT8_TO_STREAM (pp, btm_ble_map_adv_tx_power(p_params->tx_power)); BTM_TRACE_EVENT("set_params:Chnl Map %d,adv_fltr policy %d,ID:%d, TX Power%d", p_params->channel_map,p_params->adv_filter_policy,p_inst->inst_id,p_params->tx_power); Loading
system/stack/include/btm_ble_api.h +2 −0 Original line number Diff line number Diff line Loading @@ -323,6 +323,8 @@ typedef UINT8 tBTM_BLE_AD_TYPE; #define BTM_BLE_ADV_TX_POWER_MAX 4 /* maximum tx power */ typedef UINT8 tBTM_BLE_ADV_TX_POWER; /* adv tx power in dBm */ #define BTM_BLE_ADV_TX_POWER {-21, -15, -7, 1, 9} typedef struct { Loading