Merge branch 'bugfix/btdm_btc_ble_set_rand_addr' into 'master'

component/bt: Fix bug of function btc_ble_set_rand_addr

See merge request !1297
This commit is contained in:
Jiang Jiang Jian 2017-09-30 15:49:53 +08:00
commit c2a4713958
2 changed files with 5 additions and 5 deletions

View file

@ -864,9 +864,9 @@ esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr);
/** /**
* @brief Set a GAP security parameter value. Overrides the default value. * @brief Set a GAP security parameter value. Overrides the default value.
* *
* @param[in] param_type :L the type of the param which to be set * @param[in] param_type : the type of the param which to be set
* @param[in] value : the param value * @param[in] value : the param value
* @param[out] len : the length of the param value * @param[in] len : the length of the param value
* *
* @return - ESP_OK : success * @return - ESP_OK : success
* - other : failed * - other : failed

View file

@ -805,14 +805,14 @@ static void btc_ble_set_rand_addr (BD_ADDR rand_addr)
BD_ADDR invalid_rand_addr_a, invalid_rand_addr_b; BD_ADDR invalid_rand_addr_a, invalid_rand_addr_b;
memset(invalid_rand_addr_a, 0xff, sizeof(BD_ADDR)); memset(invalid_rand_addr_a, 0xff, sizeof(BD_ADDR));
memset(invalid_rand_addr_b, 0x00, sizeof(BD_ADDR)); memset(invalid_rand_addr_b, 0x00, sizeof(BD_ADDR));
invalid_rand_addr_b[BD_ADDR_LEN - 1] = invalid_rand_addr_b[BD_ADDR_LEN - 1] | BT_STATIC_RAND_ADDR_MASK; invalid_rand_addr_b[0] = invalid_rand_addr_b[0] | BT_STATIC_RAND_ADDR_MASK;
if((rand_addr[BD_ADDR_LEN - 1] & BT_STATIC_RAND_ADDR_MASK) == BT_STATIC_RAND_ADDR_MASK if((rand_addr[0] & BT_STATIC_RAND_ADDR_MASK) == BT_STATIC_RAND_ADDR_MASK
&& memcmp(invalid_rand_addr_a, rand_addr, BD_ADDR_LEN) != 0 && memcmp(invalid_rand_addr_a, rand_addr, BD_ADDR_LEN) != 0
&& memcmp(invalid_rand_addr_b, rand_addr, BD_ADDR_LEN) != 0){ && memcmp(invalid_rand_addr_b, rand_addr, BD_ADDR_LEN) != 0){
BTA_DmSetRandAddress(rand_addr); BTA_DmSetRandAddress(rand_addr);
} else { } else {
param.set_rand_addr_cmpl.status = ESP_BT_STATUS_INVALID_STATIC_RAND_ADDR; param.set_rand_addr_cmpl.status = ESP_BT_STATUS_INVALID_STATIC_RAND_ADDR;
LOG_ERROR("Invalid random address, the high bit should be 0b11, the random part shall not be to 1 or 0"); LOG_ERROR("Invalid random address, the high bit should be 0b11, all bits of the random part shall not be to 1 or 0");
} }
} else { } else {
param.set_rand_addr_cmpl.status = ESP_BT_STATUS_INVALID_STATIC_RAND_ADDR; param.set_rand_addr_cmpl.status = ESP_BT_STATUS_INVALID_STATIC_RAND_ADDR;