12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- #ifndef BLE_PERIPHERAL_H__
- #define BLE_PERIPHERAL_H__
- #include <stdint.h>
- #include "_string.h"
- #include "nordic_common.h"
- #include "nrf.h"
- #include "ble_advdata.h"
- #include "ble_advertising.h"
- #include "ble_conn_params.h"
- #include "nrf_sdh.h"
- #include "nrf_sdh_soc.h"
- #include "nrf_sdh_ble.h"
- #include "nrf_ble_gatt.h"
- #include "nrf_ble_qwr.h"
- #include "app_timer.h"
- #include "app_error.h"
- #include "ble.h"
- #include "ble_err.h"
- #include "ble_hci.h"
- #include "ble_srv_common.h"
- #include "define.h"
- #include "app_button.h"
- #include "nrf_pwr_mgmt.h"
- #include "nrf_log.h"
- #include "nrf_log_ctrl.h"
- #include "nrf_log_default_backends.h"
- #include "ble_config.h"
- #if WECHAT_SERVER_ENABLED==1
- #include "ble_wechat.h"
- #include "mpbledev.h"
- #endif
- #if OWNED_SERVER_ENABLED==1
- #include "ble_owned.h"
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef void (*set_dfu_func)(bool stat);
- typedef struct
- {
- set_dfu_func dfu_func;
- bool dfu_stat;
- }ble_peripheral_s;
- typedef struct
- {
- uint8_t product_type;
- uint8_t dev_version;
- uint8_t dev_reg_stat;
- uint8_t bat_percent;
- uint8_t m_addr[BLE_GAP_ADDR_LEN]; //设备mac地址
- }ble_adv_manuf_data;
-
- #ifndef BLE_DEVICE_NAME
- #define BLE_DEVICE_NAME NRF_BLE_ADV_NAME // 设备名称字符串
- #endif
- #ifndef APP_BLE_OBSERVER_PRIO
- #define APP_BLE_OBSERVER_PRIO 3 //应用程序BLE事件监视者优先级,应用程序不能修改该数值
- #endif
- #ifndef APP_BLE_CONN_CFG_TAG
- #define APP_BLE_CONN_CFG_TAG 1 //SoftDevice BLE配置标志
- #endif
- uint32_t advertising_init(void);
- void Ble_Peripheral_Init(set_dfu_func func,uint16_t **conn_handle);
- void Peripheral_Start(void);
- void Peripheral_Stop(void);
- void ble_peripheral_on_ble_evt(ble_evt_t const * p_ble_evt, void * p_context);
- void user_ble_advertising_modes_config_set(ble_adv_modes_config_t const * const p_adv_modes_config);
- #if NRF_MODULE_ENABLED(BLE_DFU)
- void dfu_service_init(void);
- #endif
- void set_ble_tx_power_level(int8_t rssi);
- void set_ble_adv_interval(uint32_t time);
- extern bool m_ready_for_reset;//检查是否准备好关机
- extern uint8_t dev_reg_stat;
- extern uint32_t ble_adv_interval;
- extern uint32_t ble_adv_duration;
- extern bool ble_adv_stat;
- #ifdef __cplusplus
- }
- #endif
- #endif // BLE_PERIPHERAL_H__
- /** @} */
|