XFusion API v1.3.0
载入中...
搜索中...
未找到
xf_main.c 文件参考
#include "xf_utils.h"
#include "xf_wifi.h"
#include "xf_task.h"
xf_main.c 的引用(Include)关系图:

浏览源代码.

结构体

struct  example_scan_context_s
 扫描任务无栈协程上下文。 更多...
 
struct  example_authenticate_mode_message_s
 认证模式与字符串消息。 更多...
 

宏定义

#define EXAMPLE_SCAN_CHANNEL_START   1
 
#define EXAMPLE_SCAN_CHANNEL_END   13
 
#define EXAMPLE_SCAN_RESULT_SIZE   20
 
#define EXAMPLE_SCAN_BLOCK_IS_ENABLE   1
 
#define EXAMPLE_SCAN_BLOCK   true
 
#define EXAMPLE_WIFI_NTASK_PRIORITY   15
 
#define EXAMPLE_WIFI_NTASK_PERIOD_MS   10
 
#define TBL_IT(v)   {v, XSTR(v)}
 
#define ERROR_CHECK(expression)
 

类型定义

typedef struct example_scan_context_s ex_scan_ctx_t
 
typedef struct example_authenticate_mode_message_s ex_auth_mode_msg_t
 

函数

static void _error_check_failed (void)
 
static void _wifi_sta_event_handler (xf_wifi_event_id_t event_id, void *event_data, void *user_args)
 
static const char * ex_auth_mode_to_name (xf_wifi_auth_mode_t code)
 
static void _wifi_ntask (xf_task_t task)
 
void xf_main (void)
 全局函数定义: [Global Functions].
 

变量

static const char * TAG = "scan"
 
static ex_scan_ctx_t ctx = {0}
 
static ex_scan_ctx_tsp_ctx = &ctx
 

详细描述

作者
catcatBlue (catca.nosp@m.tblu.nosp@m.e@qq..nosp@m.com)
版本
1.0
日期
2024-09-14

Copyright (c) 2024, CorAL. All rights reserved.

在文件 xf_main.c 中定义.

宏定义说明

◆ EXAMPLE_SCAN_CHANNEL_START

#define EXAMPLE_SCAN_CHANNEL_START   1

◆ EXAMPLE_SCAN_CHANNEL_END

#define EXAMPLE_SCAN_CHANNEL_END   13

◆ EXAMPLE_SCAN_RESULT_SIZE

#define EXAMPLE_SCAN_RESULT_SIZE   20

在文件 xf_main.c27 行定义.

◆ EXAMPLE_SCAN_BLOCK_IS_ENABLE

#define EXAMPLE_SCAN_BLOCK_IS_ENABLE   1

在文件 xf_main.c28 行定义.

◆ EXAMPLE_SCAN_BLOCK

#define EXAMPLE_SCAN_BLOCK   true

◆ EXAMPLE_WIFI_NTASK_PRIORITY

#define EXAMPLE_WIFI_NTASK_PRIORITY   15

在文件 xf_main.c36 行定义.

◆ EXAMPLE_WIFI_NTASK_PERIOD_MS

#define EXAMPLE_WIFI_NTASK_PERIOD_MS   10

在文件 xf_main.c37 行定义.

◆ TBL_IT

#define TBL_IT (   v)    {v, XSTR(v)}

◆ ERROR_CHECK

#define ERROR_CHECK (   expression)
值:
do { \
if (unlikely((expression) != XF_OK)) { \
XF_LOGE(TAG, "An error occurred: %s", XSTR(expression != XF_OK)); \
_error_check_failed(); \
} \
} while (0)
#define unlikely(x)
分支预测,优化条件为 假 的可能性更大的情况。
Definition xf_attr.h:113
@ XF_OK
Definition xf_err.h:43
#define XSTR(x)
参数字符串化。 见:https://gcc.gnu.org/onlinedocs/gcc-3.4.3/cpp/Stringification.html
Definition xf_predef.h:110
#define TAG
Definition xf_main.c:24

在文件 xf_main.c74 行定义.

类型定义说明

◆ ex_scan_ctx_t

◆ ex_auth_mode_msg_t

函数说明

◆ _error_check_failed()

static void _error_check_failed ( void  )
static

在文件 xf_main.c201 行定义.

◆ _wifi_sta_event_handler()

static void _wifi_sta_event_handler ( xf_wifi_event_id_t  event_id,
void *  event_data,
void *  user_args 
)
static

在文件 xf_main.c161 行定义.

◆ ex_auth_mode_to_name()

static const char * ex_auth_mode_to_name ( xf_wifi_auth_mode_t  code)
static

◆ _wifi_ntask()

static void _wifi_ntask ( xf_task_t  task)
static

在文件 xf_main.c103 行定义.

◆ xf_main()

void xf_main ( void  )

全局函数定义: [Global Functions].

  1. 全局函数原型在**头文件**中声明并编写注释,此处可以不加 brief。

主函数。 正常情况下此行空白:函数之间需要有一个空行作为分隔

< 用于接收 _xf_template_func 的传出

< 防止警告

分支语句哪怕只有一句也必须加花括号。

判断语句中,如果一行不足以放下判断语句, 分行时需要将逻辑符号放在新行的开头。 此时最好还是用变量表达判断语句。

常量在前可以避免不必要的逻辑错误。 如 if (XF_TEMPL_FAIL = ret) 时编译会报错。

对于返回值为 void 的函数, return;可有可无,文件风格统一即可。

注意! xf_init() 会在 xf_main() 前运行,此处不需要重复调用 xf_init()

此示例仅用于演示自动初始化的使用方法。

< 所有等级打印都带有全部信息

< 过滤文件名为 "file1.c" 的打印

< 打开过滤器

< 设置过滤器为黑名单

< 不用彩色打印

< 启用彩色打印

在文件 xf_main.c84 行定义.

变量说明

◆ TAG

const char* TAG = "scan"
static

在文件 xf_main.c67 行定义.

◆ ctx

◆ sp_ctx