1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #ifndef BLE_WECHAT_H
- #define BLE_WECHAT_H
- #include <stdint.h>
- #include <stdbool.h>
- #include <stdlib.h>
- #include "_string.h"
- #include "sdk_config.h"
- #include "ble_config.h"
- #include "ble.h"
- #include "ble_srv_common.h"
- #include "nrf_sdh_ble.h"
- #include "ble_link_ctx_manager.h"
- #include "ble_wechat_util.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- // 蓝牙微信服务实例宏定义
- // _name ->实例名称
- #define BLE_WECHAT_DEF(_name) \
- static ble_wechat_t _name; \
- NRF_SDH_BLE_OBSERVER(_name ## _obs, \
- BLE_WECHAT_BLE_OBSERVER_PRIO, \
- ble_evt_handler, &_name)
-
- // 蓝牙微信服务UUID定义
- #define BLE_UUID_WECHAT_SERVICE 0xFEE7
- #define BLE_UUID_WECHAT_WRITE_CHARACTERISTICS 0xFEC7
- #define BLE_UUID_WECHAT_INDICATE_CHARACTERISTICS 0xFEC8
- #define BLE_UUID_WECHAT_READ_CHARACTERISTICS 0xFEC9
- #define BLE_WECHAT_MAX_DATA_LEN 20
- #define BLE_OWNED_MAX_DATA_LEN 64
- extern uint8_t m_addl_adv_manuf_data[];
- typedef struct
- {
- uint16_t service_handle;
- ble_gatts_char_handles_t indicate_handles;
- ble_gatts_char_handles_t write_handles;
- ble_gatts_char_handles_t read_handles;
- ble_gatts_char_handles_t active_indicate_handles;
- ble_gatts_char_handles_t biz_indicate_handles;
- uint16_t conn_handle;
- bool active_server_on;
- bool biz_server_on;
- } ble_wechat_t;
- typedef struct
- {
- uint8_t *data;
- uint16_t len;
- uint16_t offset;
- } data_info;
- int ble_wechat_indicate_data(ble_wechat_t *p_wcs,data_handler *p_data_handler, uint8_t *data, int len);
- void ble_wechat_on_ble_evt(ble_wechat_t *p_wcs,ble_evt_t * p_ble_evt, data_handler *p_data_handler);
- uint32_t ble_wechat_add_service(ble_wechat_t *p_wechat);
- uint32_t ble_wechat_add_characteristics(ble_wechat_t *p_wechat);
- uint32_t ble_wechat_init(ble_wechat_t * p_wechat);
- #ifdef __cplusplus
- }
- #endif
- #endif // BLE_WECHAT_H
|