2017-04-13 10:14:28 -04:00
|
|
|
// Copyright (C) 2014 The Android Open Source Project
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2017-08-09 04:46:49 -04:00
|
|
|
#ifndef __BTC_BLE_STORAGE_H__
|
|
|
|
#define __BTC_BLE_STORAGE_H__
|
2017-04-13 10:14:28 -04:00
|
|
|
#include "bt_types.h"
|
|
|
|
#include "bt_target.h"
|
2017-08-09 04:46:49 -04:00
|
|
|
#include "esp_gap_ble_api.h"
|
2017-04-13 10:14:28 -04:00
|
|
|
|
2017-04-17 22:53:43 -04:00
|
|
|
#if (SMP_INCLUDED == TRUE)
|
2017-04-13 10:14:28 -04:00
|
|
|
#define BTC_LE_LOCAL_KEY_IR (1<<0)
|
|
|
|
#define BTC_LE_LOCAL_KEY_IRK (1<<1)
|
|
|
|
#define BTC_LE_LOCAL_KEY_DHK (1<<2)
|
|
|
|
#define BTC_LE_LOCAL_KEY_ER (1<<3)
|
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
#define BTC_BLE_STORAGE_DEV_TYPE_STR "DevType"
|
|
|
|
#define BTC_BLE_STORAGE_ADDR_TYPE_STR "AddrType"
|
|
|
|
#define BTC_BLE_STORAGE_LINK_KEY_STR "LinkKey"
|
|
|
|
#define BTC_BLE_STORAGE_LE_KEY_PENC_STR "LE_KEY_PENC"
|
|
|
|
#define BTC_BLE_STORAGE_LE_KEY_PID_STR "LE_KEY_PID"
|
|
|
|
#define BTC_BLE_STORAGE_LE_KEY_PCSRK_STR "LE_KEY_PCSRK"
|
|
|
|
#define BTC_BLE_STORAGE_LE_KEY_LENC_STR "LE_KEY_LENC"
|
|
|
|
#define BTC_BLE_STORAGE_LE_KEY_LID_STR "LE_KEY_LID"
|
|
|
|
#define BTC_BLE_STORAGE_LE_KEY_LCSRK_STR "LE_KEY_LCSRK"
|
|
|
|
|
|
|
|
#define BTC_BLE_STORAGE_LOCAL_ADAPTER_STR "Adapter"
|
|
|
|
#define BTC_BLE_STORAGE_LE_LOCAL_KEY_IR_STR "LE_LOCAL_KEY_IR"
|
|
|
|
#define BTC_BLE_STORAGE_LE_LOCAL_KEY_IRK_STR "LE_LOCAL_KEY_IRK"
|
|
|
|
#define BTC_BLE_STORAGE_LE_LOCAL_KEY_DHK_STR "LE_LOCAL_KEY_DHK"
|
|
|
|
#define BTC_BLE_STORAGE_LE_LOCAL_KEY_ER_STR "LE_LOCAL_KEY_ER"
|
|
|
|
|
2017-04-13 10:14:28 -04:00
|
|
|
/************************************************************************************
|
|
|
|
** Local type definitions
|
|
|
|
************************************************************************************/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
BT_OCTET16 sp_c;
|
|
|
|
BT_OCTET16 sp_r;
|
|
|
|
BD_ADDR oob_bdaddr; /* peer bdaddr*/
|
|
|
|
} btc_dm_oob_cb_t;
|
|
|
|
|
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
void btc_storage_save(void);
|
2017-04-13 10:14:28 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bt_status_t btc_storage_add_ble_bonding_key( bt_bdaddr_t *remote_bd_addr, char *key, uint8_t key_type, uint8_t key_length);
|
2017-08-09 04:46:49 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bt_status_t btc_storage_get_ble_bonding_key(bt_bdaddr_t *remote_bd_addr, uint8_t key_type, char *key_value, int key_length);
|
2017-04-13 10:14:28 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bt_status_t btc_storage_remove_ble_bonding_keys(bt_bdaddr_t *remote_bd_addr);
|
2017-04-13 10:14:28 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bool btc_storage_compare_address_key_value(bt_bdaddr_t *remote_bd_addr, uint8_t key_type, void *key_value, int key_length);
|
2017-04-13 10:14:28 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bt_status_t btc_storage_add_ble_local_key(char *key, uint8_t key_type, uint8_t key_length);
|
2017-06-26 05:02:57 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bt_status_t btc_storage_remove_ble_local_keys(void);
|
2017-04-13 10:14:28 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bt_status_t btc_storage_get_ble_local_key(uint8_t key_type, char *key_value, int key_len);
|
2017-04-13 10:14:28 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bt_status_t btc_storage_get_remote_addr_type(bt_bdaddr_t *remote_bd_addr, int *addr_type);
|
2017-04-13 10:14:28 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bt_status_t btc_storage_set_remote_addr_type(bt_bdaddr_t *remote_bd_addr, uint8_t addr_type, bool flush);
|
2017-04-13 10:14:28 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bt_status_t btc_storage_remove_remote_addr_type(bt_bdaddr_t *remote_bd_addr, bool flush);
|
2017-04-13 10:14:28 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bt_status_t btc_storage_set_ble_dev_type(bt_bdaddr_t *bd_addr, bool flush);
|
2017-08-09 04:46:49 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bt_status_t btc_storage_remove_ble_dev_type(bt_bdaddr_t *remote_bd_addr, bool flush);
|
2017-04-13 10:14:28 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bt_status_t btc_storage_load_bonded_ble_devices(void);
|
2017-04-13 10:14:28 -04:00
|
|
|
|
2017-08-28 05:14:49 -04:00
|
|
|
bt_status_t btc_storage_get_bonded_ble_devices_list(esp_ble_bond_dev_t *bond_dev, int dev_num);
|
2017-04-13 10:14:28 -04:00
|
|
|
|
2017-08-09 04:46:49 -04:00
|
|
|
int btc_storage_get_num_ble_bond_devices(void);
|
|
|
|
|
|
|
|
#endif ///SMP_INCLUDED == TRUE
|
2017-08-28 05:14:49 -04:00
|
|
|
#endif ///__BTC_BLE_STORAGE_H__
|