compoment/bt:Change the tabs to space in btc_ble_storage.c & btc_gap_ble.c file

This commit is contained in:
Yulong 2017-04-13 23:50:14 -04:00
parent aff8758fe4
commit f6f094213e
2 changed files with 59 additions and 61 deletions

View File

@ -152,9 +152,9 @@ static void btc_read_le_key(const uint8_t key_type, const size_t key_len, bt_bda
bt_status_t btc_storage_add_ble_bonding_key(bt_bdaddr_t *remote_bd_addr, bt_status_t btc_storage_add_ble_bonding_key(bt_bdaddr_t *remote_bd_addr,
char *key, char *key,
uint8_t key_type, uint8_t key_type,
uint8_t key_length) uint8_t key_length)
{ {
char bdstr[6] = {0}; char bdstr[6] = {0};
bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr)); bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
@ -199,9 +199,9 @@ bt_status_t btc_storage_add_ble_bonding_key(bt_bdaddr_t *remote_bd_addr,
** **
*******************************************************************************/ *******************************************************************************/
bt_status_t btc_storage_get_ble_bonding_key(bt_bdaddr_t *remote_bd_addr, bt_status_t btc_storage_get_ble_bonding_key(bt_bdaddr_t *remote_bd_addr,
uint8_t key_type, uint8_t key_type,
char *key_value, char *key_value,
int key_length) int key_length)
{ {
char bdstr[6] = {0}; char bdstr[6] = {0};
bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr)); bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
@ -279,8 +279,8 @@ bt_status_t btc_storage_remove_ble_bonding_keys(bt_bdaddr_t *remote_bd_addr)
** **
*******************************************************************************/ *******************************************************************************/
bt_status_t btc_storage_add_ble_local_key(char *key, bt_status_t btc_storage_add_ble_local_key(char *key,
uint8_t key_type, uint8_t key_type,
uint8_t key_length) uint8_t key_length)
{ {
const char* name; const char* name;
switch (key_type) { switch (key_type) {
@ -315,8 +315,8 @@ bt_status_t btc_storage_add_ble_local_key(char *key,
** **
*******************************************************************************/ *******************************************************************************/
bt_status_t btc_storage_get_ble_local_key(uint8_t key_type, bt_status_t btc_storage_get_ble_local_key(uint8_t key_type,
char *key_value, char *key_value,
int key_length) int key_length)
{ {
const char* name; const char* name;
switch (key_type) { switch (key_type) {
@ -371,7 +371,7 @@ bt_status_t btc_storage_remove_ble_local_keys(void)
bt_status_t btc_in_fetch_bonded_ble_device(const char *remote_bd_addr, int add, bt_status_t btc_in_fetch_bonded_ble_device(const char *remote_bd_addr, int add,
btc_bonded_devices_t *p_bonded_devices) btc_bonded_devices_t *p_bonded_devices)
{ {
int device_type; int device_type;
int addr_type; int addr_type;
@ -385,35 +385,36 @@ bt_status_t btc_in_fetch_bonded_ble_device(const char *remote_bd_addr, int add,
return BT_STATUS_FAIL; return BT_STATUS_FAIL;
} }
string_to_bdaddr(remote_bd_addr, &bd_addr); string_to_bdaddr(remote_bd_addr, &bd_addr);
bdcpy(bta_bd_addr, bd_addr.address); bdcpy(bta_bd_addr, bd_addr.address);
if (btc_storage_get_remote_addr_type(&bd_addr, &addr_type) != BT_STATUS_SUCCESS) { if (btc_storage_get_remote_addr_type(&bd_addr, &addr_type) != BT_STATUS_SUCCESS) {
addr_type = BLE_ADDR_PUBLIC; addr_type = BLE_ADDR_PUBLIC;
btc_storage_set_remote_addr_type(&bd_addr, BLE_ADDR_PUBLIC); btc_storage_set_remote_addr_type(&bd_addr, BLE_ADDR_PUBLIC);
}
btc_read_le_key(BTM_LE_KEY_PENC, sizeof(tBTM_LE_PENC_KEYS),
bd_addr, addr_type, add, &device_added, &key_found);
btc_read_le_key(BTM_LE_KEY_PID, sizeof(tBTM_LE_PID_KEYS),
bd_addr, addr_type, add, &device_added, &key_found);
btc_read_le_key(BTM_LE_KEY_LID, sizeof(tBTM_LE_PID_KEYS),
bd_addr, addr_type, add, &device_added, &key_found);
btc_read_le_key(BTM_LE_KEY_PCSRK, sizeof(tBTM_LE_PCSRK_KEYS),
bd_addr, addr_type, add, &device_added, &key_found);
btc_read_le_key(BTM_LE_KEY_LENC, sizeof(tBTM_LE_LENC_KEYS),
bd_addr, addr_type, add, &device_added, &key_found);
btc_read_le_key(BTM_LE_KEY_LCSRK, sizeof(tBTM_LE_LCSRK_KEYS),
bd_addr, addr_type, add, &device_added, &key_found);
if (key_found) {
return BT_STATUS_SUCCESS;
} }
btc_read_le_key(BTM_LE_KEY_PENC, sizeof(tBTM_LE_PENC_KEYS),
bd_addr, addr_type, add, &device_added, &key_found);
btc_read_le_key(BTM_LE_KEY_PID, sizeof(tBTM_LE_PID_KEYS),
bd_addr, addr_type, add, &device_added, &key_found);
btc_read_le_key(BTM_LE_KEY_LID, sizeof(tBTM_LE_PID_KEYS),
bd_addr, addr_type, add, &device_added, &key_found);
btc_read_le_key(BTM_LE_KEY_PCSRK, sizeof(tBTM_LE_PCSRK_KEYS),
bd_addr, addr_type, add, &device_added, &key_found);
btc_read_le_key(BTM_LE_KEY_LENC, sizeof(tBTM_LE_LENC_KEYS),
bd_addr, addr_type, add, &device_added, &key_found);
btc_read_le_key(BTM_LE_KEY_LCSRK, sizeof(tBTM_LE_LCSRK_KEYS),
bd_addr, addr_type, add, &device_added, &key_found);
if (key_found) {
return BT_STATUS_SUCCESS;
}
return BT_STATUS_FAIL; return BT_STATUS_FAIL;
} }
@ -438,7 +439,7 @@ bt_status_t btc_storage_set_remote_addr_type(bt_bdaddr_t *remote_bd_addr,
** **
*******************************************************************************/ *******************************************************************************/
bt_status_t btc_storage_get_remote_addr_type(bt_bdaddr_t *remote_bd_addr, bt_status_t btc_storage_get_remote_addr_type(bt_bdaddr_t *remote_bd_addr,
int*addr_type) int*addr_type)
{ {
char bdstr[6] = {0}; char bdstr[6] = {0};
bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr)); bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
@ -469,7 +470,7 @@ void btc_dm_load_ble_local_keys(void)
} }
void btc_dm_get_ble_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OCTET16 er, void btc_dm_get_ble_local_keys(tBTA_DM_BLE_LOCAL_KEY_MASK *p_key_mask, BT_OCTET16 er,
tBTA_BLE_LOCAL_ID_KEYS *p_id_keys) tBTA_BLE_LOCAL_ID_KEYS *p_id_keys)
{ {
if (ble_local_key_cb.is_er_rcvd ) { if (ble_local_key_cb.is_er_rcvd ) {
memcpy(&er[0], &ble_local_key_cb.er[0], sizeof(BT_OCTET16)); memcpy(&er[0], &ble_local_key_cb.er[0], sizeof(BT_OCTET16));

View File

@ -761,7 +761,7 @@ void btc_gap_ble_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
} }
break; break;
} }
case BTC_GAP_BLE_SET_SECURITY_PARAM_EVT: { case BTC_GAP_BLE_SET_SECURITY_PARAM_EVT: {
btc_ble_gap_args_t *src = (btc_ble_gap_args_t *)p_src; btc_ble_gap_args_t *src = (btc_ble_gap_args_t *)p_src;
btc_ble_gap_args_t *dst = (btc_ble_gap_args_t *) p_dest; btc_ble_gap_args_t *dst = (btc_ble_gap_args_t *) p_dest;
uint8_t length = 0; uint8_t length = 0;
@ -887,21 +887,20 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
case BTC_GAP_BLE_SET_SECURITY_PARAM_EVT: { case BTC_GAP_BLE_SET_SECURITY_PARAM_EVT: {
switch(arg->set_security_param.param_type) { switch(arg->set_security_param.param_type) {
case ESP_BLE_SM_PASSKEY: case ESP_BLE_SM_PASSKEY:
break;
break;
case ESP_BLE_SM_AUTHEN_REQ_MODE: { case ESP_BLE_SM_AUTHEN_REQ_MODE: {
uint8_t authen_req = 0; uint8_t authen_req = 0;
STREAM_TO_UINT8(authen_req, arg->set_security_param.value); STREAM_TO_UINT8(authen_req, arg->set_security_param.value);
bta_dm_co_ble_set_auth_req(authen_req); bta_dm_co_ble_set_auth_req(authen_req);
break; break;
} }
case ESP_BLE_SM_IOCAP_MODE: { case ESP_BLE_SM_IOCAP_MODE: {
uint8_t iocap = 0; uint8_t iocap = 0;
STREAM_TO_UINT8(iocap, arg->set_security_param.value); STREAM_TO_UINT8(iocap, arg->set_security_param.value);
bta_dm_co_ble_set_io_cap(iocap); bta_dm_co_ble_set_io_cap(iocap);
break; break;
} }
case ESP_BLE_SM_SET_INIT_KEY: { case ESP_BLE_SM_SET_INIT_KEY: {
uint8_t init_key = 0; uint8_t init_key = 0;
STREAM_TO_UINT8(init_key, arg->set_security_param.value); STREAM_TO_UINT8(init_key, arg->set_security_param.value);
@ -919,20 +918,18 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
STREAM_TO_UINT8(key_size, arg->set_security_param.value); STREAM_TO_UINT8(key_size, arg->set_security_param.value);
bta_dm_co_ble_set_max_key_size(key_size); bta_dm_co_ble_set_max_key_size(key_size);
break; break;
} }
default:
default: break;
break; }
}
break; break;
} }
case BTC_GAP_BLE_SECURITY_RSP_EVT: { case BTC_GAP_BLE_SECURITY_RSP_EVT: {
BD_ADDR bd_addr; BD_ADDR bd_addr;
tBTA_DM_BLE_SEC_GRANT res = arg->sec_rsp.accept ? BTA_DM_SEC_GRANTED : BTA_DM_SEC_PAIR_NOT_SPT; tBTA_DM_BLE_SEC_GRANT res = arg->sec_rsp.accept ? BTA_DM_SEC_GRANTED : BTA_DM_SEC_PAIR_NOT_SPT;
memcpy(bd_addr, arg->sec_rsp.bd_addr, sizeof(BD_ADDR)); memcpy(bd_addr, arg->sec_rsp.bd_addr, sizeof(BD_ADDR));
BTA_DmBleSecurityGrant(bd_addr, res); BTA_DmBleSecurityGrant(bd_addr, res);
break; break;
} }
default: default:
break; break;