Files
2026-04-08 16:59:20 +09:00

70 lines
2.1 KiB
C

/*******************************************************************************
* @file ble_security.h
* @brief BLE Security - Peer Manager, LESC, Bonding
* @author Charles KWON <charleskwon@medithings.co.kr>
* @date 2025-01-30
* @copyright (c) 2025 Medithings Inc. All rights reserved.
*
* @details Peer Manager initialization and security event handling.
******************************************************************************/
#ifndef BLE_SECURITY_H
#define BLE_SECURITY_H
#include <stdint.h>
#include <stdbool.h>
#if FEATURE_SECURE_CONNECTION
#include "ble_gap.h"
/*==============================================================================
* CONSTANTS
*============================================================================*/
#define LESC_DEBUG_MODE 0
#define SEC_PARAM_BOND 1
#define SEC_PARAM_MITM 1
#if FEATURE_STATIC_PASSKEY
#define SEC_PARAM_LESC 0
#else
#define SEC_PARAM_LESC 1
#endif
#define SEC_PARAM_KEYPRESS 0
#define SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_DISPLAY_ONLY
#define SEC_PARAM_OOB 0
#define SEC_PARAM_MIN_KEY_SIZE 7
#define SEC_PARAM_MAX_KEY_SIZE 16
#define PASSKEY_TXT_LENGTH 8
#define PASSKEY_LENGTH 6
#define BLE_DEV_MODE 1 /* 1=Dev mode, 0=Production */
#endif
/*==============================================================================
* FUNCTION PROTOTYPES
*============================================================================*/
#if FEATURE_SECURE_CONNECTION
/*==============================================================================
* EXTERNAL VARIABLES (SECURE CONNECTION ONLY)
*============================================================================*/
extern bool erase_bonds;
/**
* @brief Initialize Peer Manager with security configuration
*/
void peer_manager_init(void);
/**
* @brief Delete all bond information from flash
*/
void delete_bonds(void);
/**
* @brief Handle idle state for LESC
*/
void security_idle_state_handle(void);
#endif
#endif /* BLE_SECURITY_H */