pinebuds/services/ble_app/app_sec/app_sec.h
2022-08-15 17:20:27 +08:00

111 lines
3.1 KiB
C

/***************************************************************************
*
* Copyright 2015-2019 BES.
* All rights reserved. All unpublished rights reserved.
*
* No part of this work may be used or reproduced in any form or by any
* means, or stored in a database or retrieval system, without prior written
* permission of BES.
*
* Use of this work is governed by a license granted by BES.
* This work contains confidential and proprietary information of
* BES. which is protected by copyright, trade secret,
* trademark and other intellectual property rights.
*
****************************************************************************/
/**
****************************************************************************************
* @addtogroup APP_SEC
* @{
****************************************************************************************
*/
#ifndef APP_SEC_H_
#define APP_SEC_H_
/*
* INCLUDE FILES
****************************************************************************************
*/
#include "rwip_config.h"
#if (BLE_APP_SEC)
#include <stdint.h> // Standard Integer Definition
/*
* DEFINES
****************************************************************************************
*/
/*
* STRUCTURES DEFINITIONS
****************************************************************************************
*/
struct app_sec_env_tag
{
// Bond status
bool bonded;
};
/*
* GLOBAL VARIABLE DECLARATIONS
****************************************************************************************
*/
/// Application Security Environment
extern struct app_sec_env_tag app_sec_env;
/// Table of message handlers
extern const struct ke_state_handler app_sec_table_handler;
/*
* GLOBAL FUNCTIONS DECLARATIONS
****************************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
****************************************************************************************
* @brief Initialize the Application Security Module
****************************************************************************************
*/
void app_sec_init(void);
#if (NVDS_SUPPORT)
/**
****************************************************************************************
* @brief Remove all bond data stored in NVDS
****************************************************************************************
*/
void app_sec_remove_bond(void);
#endif //(NVDS_SUPPORT)
/**
****************************************************************************************
* @brief Send a security request to the peer device. This function is used to require the
* central to start the encryption with a LTK that would have shared during a previous
* bond procedure.
*
* @param[in] - conidx: Connection Index
****************************************************************************************
*/
void app_sec_send_security_req(uint8_t conidx, enum gap_auth authority);
void app_sec_reset_env_on_connection(void);
#ifdef __cplusplus
}
#endif
#endif //(BLE_APP_SEC)
#endif // APP_SEC_H_
/// @} APP_SEC