@ -13,7 +13,7 @@
# include "nrf_bootloader_info.h"
# include "nrf_bootloader_info.h"
# endif
# endif
/*******************************************************************************
/*******************************************************************************
* 广 播 包 配 ? ? *
* 骞 挎 挱 鍖 呴 厤 ? ? *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# define MIN_CONN_INTERVAL MSEC_TO_UNITS(20, UNIT_1_25_MS) /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
# define MIN_CONN_INTERVAL MSEC_TO_UNITS(20, UNIT_1_25_MS) /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
# define MAX_CONN_INTERVAL MSEC_TO_UNITS(75, UNIT_1_25_MS) /**< Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */
# define MAX_CONN_INTERVAL MSEC_TO_UNITS(75, UNIT_1_25_MS) /**< Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */
@ -24,12 +24,12 @@
BLE_ADVERTISING_DEF ( m_advertising ) ; /**< Advertising module instance. */
BLE_ADVERTISING_DEF ( m_advertising ) ; /**< Advertising module instance. */
/*******************************************************************************
/*******************************************************************************
* GATT配置 *
* GATT閰嶇疆 *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
NRF_BLE_GATT_DEF ( m_gatt ) ; /**< GATT module instance. */
NRF_BLE_GATT_DEF ( m_gatt ) ; /**< GATT module instance. */
/*******************************************************************************
/*******************************************************************************
* 连 接 参 数 配 置 *
* 杩 炴 帴 鍙 傛 暟 閰 嶇 疆 *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# define FIRST_CONN_PARAMS_UPDATE_DELAY \
# define FIRST_CONN_PARAMS_UPDATE_DELAY \
APP_TIMER_TICKS ( 5000 ) /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (5 seconds). \
APP_TIMER_TICKS ( 5000 ) /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (5 seconds). \
@ -41,7 +41,7 @@ NRF_BLE_GATT_DEF(m_gatt); /**< GATT module instance. */
* CODE *
* CODE *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID ; /**< 当前连接句柄 */
static uint16_t m_conn_handle = BLE_CONN_HANDLE_INVALID ; /**< 褰撳墠杩炴帴鍙ユ焺 */
static uint16_t m_mtu_size = BLE_GATT_ATT_MTU_DEFAULT - 3 ;
static uint16_t m_mtu_size = BLE_GATT_ATT_MTU_DEFAULT - 3 ;
static zble_event_listener_t m_event_listener ;
static zble_event_listener_t m_event_listener ;
static uint32_t m_last_disconnected_tp ;
static uint32_t m_last_disconnected_tp ;
@ -104,7 +104,7 @@ static void ble_evt_handler(ble_evt_t const *p_ble_evt, void *p_context) {
}
}
static void gatt_evt_handler ( nrf_ble_gatt_t * p_gatt , nrf_ble_gatt_evt_t const * p_evt ) {
static void gatt_evt_handler ( nrf_ble_gatt_t * p_gatt , nrf_ble_gatt_evt_t const * p_evt ) {
/*******************************************************************************
/*******************************************************************************
* MTU SIZE 更 新 *
* MTU SIZE 鏇 存 柊 *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
if ( ( m_conn_handle = = p_evt - > conn_handle ) & & ( p_evt - > evt_id = = NRF_BLE_GATT_EVT_ATT_MTU_UPDATED ) ) {
if ( ( m_conn_handle = = p_evt - > conn_handle ) & & ( p_evt - > evt_id = = NRF_BLE_GATT_EVT_ATT_MTU_UPDATED ) ) {
m_mtu_size = p_evt - > params . att_mtu_effective - OPCODE_LENGTH - HANDLE_LENGTH ;
m_mtu_size = p_evt - > params . att_mtu_effective - OPCODE_LENGTH - HANDLE_LENGTH ;
@ -306,11 +306,11 @@ static uint8_t p_company_identifier_data[COMPANY_IDENTIFIER_DATA_LEGTH] = {
void zble_module_init ( zble_module_cfg_t * cfg ) {
void zble_module_init ( zble_module_cfg_t * cfg ) {
/**
/**
* @ brief
* @ brief
* 初 始 化 蓝 牙 协 议 栈 , 并 注 册 蓝 牙 事 件 处 理 函 数 , 固 定 代 码 , 勿 修 ? ?
* 鍒 濆 � 鍖 栬 摑 鐗 欏 崗 璁 � 爤 锛 屽 苟 娉 ㄥ 唽 钃 濈 墮 浜 嬩 欢 澶 勭 悊 鍑 芥 暟 锛 屽 浐 瀹 氫 唬 鐮 侊 紝 鍕 夸 慨 ? ?
*/
*/
{ NRF_SDH_BLE_OBSERVER ( m_ble_observer , 3 , ble_evt_handler , NULL ) ; }
{ NRF_SDH_BLE_OBSERVER ( m_ble_observer , 3 , ble_evt_handler , NULL ) ; }
/*******************************************************************************
/*******************************************************************************
* GAP初始 ? ? *
* GAP鍒濆 � ? ? *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
{
{
uint32_t err_code ;
uint32_t err_code ;
@ -334,7 +334,7 @@ void zble_module_init(zble_module_cfg_t *cfg) {
}
}
/*******************************************************************************
/*******************************************************************************
* GATT 初 始 ? ? *
* GATT 鍒 濆 � ? ? *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
{
{
ret_code_t err_code ;
ret_code_t err_code ;
@ -347,7 +347,7 @@ void zble_module_init(zble_module_cfg_t *cfg) {
}
}
/*******************************************************************************
/*******************************************************************************
* 广 播 初 始 ? ? *
* 骞 挎 挱 鍒 濆 � ? ? *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
{
{
uint32_t err_code ;
uint32_t err_code ;
@ -391,7 +391,7 @@ void zble_module_init(zble_module_cfg_t *cfg) {
}
}
/*******************************************************************************
/*******************************************************************************
* 蓝 牙 服 务 初 始 ? ? *
* 钃 濈 墮 鏈 嶅 姟 鍒 濆 � ? ? *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# if BLE_DFU_ENABLED
# if BLE_DFU_ENABLED
{
{
@ -404,7 +404,7 @@ void zble_module_init(zble_module_cfg_t *cfg) {
# endif
# endif
/*******************************************************************************
/*******************************************************************************
* 连 接 参 数 初 始 ? ? *
* 杩 炴 帴 鍙 傛 暟 鍒 濆 � ? ? *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
{
{
uint32_t err_code ;
uint32_t err_code ;