This repository has been archived on 2023-07-17. You can view files and clone it, but cannot push or open issues or pull requests.
bl_mcu_sdk/components/ble/ble_stack/host/settings.h

40 lines
1.2 KiB
C
Raw Normal View History

2021-06-04 17:46:09 +08:00
/*
* Copyright (c) 2018 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#if defined(BFLB_BLE)
#include "addr.h"
#endif
/* Max settings key length (with all components) */
#define BT_SETTINGS_KEY_MAX 36
/* Base64-encoded string buffer size of in_size bytes */
2021-06-20 12:25:46 +08:00
#define BT_SETTINGS_SIZE(in_size) ((((((in_size)-1) / 3) * 4) + 4) + 1)
2021-06-04 17:46:09 +08:00
/* Helpers for keys containing a bdaddr */
void bt_settings_encode_key(char *path, size_t path_size, const char *subsys,
2021-06-20 12:25:46 +08:00
bt_addr_le_t *addr, const char *key);
2021-06-04 17:46:09 +08:00
int bt_settings_decode_key(const char *key, bt_addr_le_t *addr);
void bt_settings_save_id(void);
int bt_settings_init(void);
#if defined(BFLB_BLE)
2021-06-20 12:25:46 +08:00
#define NV_LOCAL_NAME "LOCAL_NAME"
#define NV_LOCAL_ID_ADDR "LOCAL_ID_ADDR"
#define NV_LOCAL_IRK "LOCAL_IRK"
#define NV_KEY_POOL "KEY_POOL"
#define NV_IMG_info "IMG_INFO"
2021-06-04 17:46:09 +08:00
int bt_settings_get_bin(const char *key, u8_t *value, size_t exp_len, size_t *real_len);
int bt_settings_set_bin(const char *key, const u8_t *value, size_t length);
int settings_delete(const char *key);
int settings_save_one(const char *key, const u8_t *value, size_t length);
void bt_settings_save_name(void);
void bt_local_info_load(void);
#endif