Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 911752af authored by Prerepa Viswanadham's avatar Prerepa Viswanadham
Browse files

Fix build: Revert the reversion done due to build failure.

original commit id: f18e904a
revert commit id: 51774111

Fix builds: Revert "Added code to publish ble adv tx power in dBm""

This reverts commit 51774111.

Change-Id: I2afeeaa4b52aa449e54115fd5f816a7a949d2ea8
parent 88efeecb
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -53,6 +53,31 @@ void bte_load_conf(const char *path) {
  config_free(config);
}

#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
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);
}
#endif

// Parses the specified Device ID configuration file and registers the
// Device ID records with SDP.
void bte_load_did_conf(const char *p_path) {
@@ -107,3 +132,4 @@ void bte_load_did_conf(const char *p_path) {

    config_free(config);
}
+8 −0
Original line number Diff line number Diff line
@@ -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
@@ -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;


@@ -158,6 +163,9 @@ void bte_main_boot_entry(void)
    bte_main_in_hw_init();

    bte_load_conf(BTE_STACK_CONF_FILE);
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
    bte_load_ble_conf(BTE_BLE_STACK_CONF_FILE);
#endif

#if (BTTRC_INCLUDED == TRUE)
    /* Initialize trace feature */
+19 −2
Original line number Diff line number Diff line
@@ -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
@@ -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);
+2 −0
Original line number Diff line number Diff line
@@ -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
{