XFusion API v1.3.0
|
#include "xf_hal.h"
#include "xf_ble_gap.h"
#include "xf_ble_gatt_client.h"
#include "string.h"
#include "xf_task.h"
宏定义 | |
#define | TAG "sample_gattc" |
#define | DEFAULT_BLE_GAP_SCAN_INTERVAL 0x48 |
#define | DEFAULT_BLE_GAP_SCAN_WINDOW 0x48 |
#define | TASK_PRIORITY 5 |
#define | TASK_DELAY_MS 500 |
#define | DEFAULT_SERVICE_INDEX (1) |
#define | DEFAULT_CHARA_READ_INDEX (0) |
#define | DEFAULT_CHARA_WRITE_INDEX (1) |
函数 | |
static xf_err_t | sample_ble_set_scan_param (void) |
static xf_err_t | sample_ble_gattc_event_cb (xf_ble_gattc_event_t event, xf_ble_gattc_evt_cb_param_t param) |
static xf_err_t | gattc_event_scan_result_cb (xf_ble_gattc_evt_cb_param_t *param) |
static void | discovery_task (xf_task_t task) |
static void | read_write_task (xf_task_t task) |
void | xf_main (void) |
全局函数定义: [Global Functions]. | |
变量 | |
static uint8_t | target_gatts_device_name [] = "XF_GATTS" |
static uint8_t | write_req_data [] = "I M GATTC" |
static xf_ble_uuid_info_t | app_uuid |
static uint8_t | s_app_id = 0 |
static uint8_t | s_conn_id = 0 |
static bool | is_need_discovery = false |
static bool | is_discovery_cmpl = false |
static bool | is_read_cmpl = false |
static xf_ble_gattc_service_found_set_t * | service_found_set = NULL |
static xf_ble_addr_t | peer_addr = {0} |
#define DEFAULT_BLE_GAP_SCAN_INTERVAL 0x48 |
#define DEFAULT_BLE_GAP_SCAN_WINDOW 0x48 |
#define DEFAULT_SERVICE_INDEX (1) |
#define DEFAULT_CHARA_READ_INDEX (0) |
#define DEFAULT_CHARA_WRITE_INDEX (1) |
|
static |
|
static |
|
static |
|
static |
|
static |
void xf_main | ( | void | ) |
全局函数定义: [Global Functions].
主函数。 正常情况下此行空白:函数之间需要有一个空行作为分隔
< 用于接收 _xf_template_func 的传出
< 防止警告
分支语句哪怕只有一句也必须加花括号。
判断语句中,如果一行不足以放下判断语句, 分行时需要将逻辑符号放在新行的开头。 此时最好还是用变量表达判断语句。
常量在前可以避免不必要的逻辑错误。 如 if (XF_TEMPL_FAIL = ret) 时编译会报错。
对于返回值为 void 的函数, return;
可有可无,文件风格统一即可。
注意! xf_init() 会在 xf_main() 前运行,此处不需要重复调用 xf_init()!
此示例仅用于演示自动初始化的使用方法。
< 所有等级打印都带有全部信息
< 过滤文件名为 "file1.c" 的打印
< 打开过滤器
< 设置过滤器为黑名单
< 不用彩色打印
< 启用彩色打印
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |