4G_module/include/cmiot/cm_wifiscan.h

154 lines
4.3 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @file cm_wifiscan.h
* @brief wifiscan 接口
* @copyright Copyright © 2021 China Mobile IOT. All rights reserved.
* @author By ShiMingRui
* @date 2021/4/12
*
* @defgroup wifiscan
* @ingroup wifiscan
* @{
*/
#ifndef __CM_WIFISCAN_H__
#define __CM_WIFISCAN_H__
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define MAX_BSSID_NUM_TOTAL 30 /*!< 扫描信息单元最大数量,请勿修改 */
#define SIZE_MAC_ADDRESS 6 /*!< MAC地址缓存区长度请勿修改 */
/****************************************************************************
* Public Types
****************************************************************************/
/** 优先级 */
typedef enum
{
CM_WIFI_SCAN_LTE_HIGH =0, /*!< 优先级设置LTE优先 */
CM_WIFI_SCAN_WIFI_HIGH, /*!< 优先级设置WIFI优先 */
}cm_wifi_scan_priority_e;
/** 扫描到的单元数据 */
typedef struct
{
uint8_t bssid[SIZE_MAC_ADDRESS]; /*!< Basic Service SetIDentifier一般是AP MAC地址 */
uint8_t padding[2]; /*!< 预留,未使用 */
int32_t rssi; /*!< 开发中,暂不支持 */
uint32_t channel_number; /*!< 通道号 */
}cm_wifi_scan_cell_info_t;
/** 扫描到的全部数据 */
typedef struct
{
uint8_t bssid_number; /*!< 扫描到的单元数量 */
cm_wifi_scan_cell_info_t channel_cell_list[MAX_BSSID_NUM_TOTAL]; /*!< 单元数据 */
}cm_wifi_scan_info_t;
/** 参数配置类型 */
typedef enum
{
CM_WIFI_SCAN_CFG_ROUND, /*!< 扫描轮次范围1~3默认值3 (该配置项暂不生效)*/
CM_WIFI_SCAN_CFG_MAX_COUNT, /*!< 最大扫描数量范围4~10默认值5该配置项暂不生效 */
CM_WIFI_SCAN_CFG_TIMEOUT, /*!< 扫描超时时间单位s范围10~60默认值25 (该配置项暂不生效)*/
CM_WIFI_SCAN_CFG_PRIORITY, /*!< LTE、WIFI优先级支持范围参见cm_wifi_scan_priority_e枚举量默认值CM_WIFI_SCAN_LTE_HIGH (该配置项暂不生效)*/
} cm_wifi_scan_cfg_type_e;
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/**
* @brief 扫描回调函数
*
* @param [in] param 扫描结果
* @param [in] user_param 用户参数
*
* @details 调用cm_wifiscan_start时传入
*/
typedef void (*cm_wifiscan_callback_t)(cm_wifi_scan_info_t *param, void *user_param);
/**
* @brief 设置扫描参数
*
* @param [in] type 设置参数类型
* @param [in] value 设置参数数值
*
* @return
* = 0 - 成功 \n
* = -1 - 失败
*
* @details
*/
int32_t cm_wifiscan_cfg(cm_wifi_scan_cfg_type_e type, void *value);
/**
* @brief 开始扫描
*
* @param [in] cb 回调函数
* @param [in] user_param 用户参数
*
* @return
* = 0 - 成功 \n
* = -1 - 失败
*
* @details 开启wifiscan功能开启后结果将通过回调函数异步上报。\n
* 切换CFUN过程中禁止扫描WiFi。
*/
int32_t cm_wifiscan_start(cm_wifiscan_callback_t cb, void *user_param);
/**
* @brief 停止扫描
*
* @return
* = 0 - 成功 \n
* = -1 - 失败
*
* @details 用于超时时间未到或结果未完全返回时可中断wifiscan功能。(该接口未生效)
*/
int32_t cm_wifiscan_stop(void);
/**
* @brief 查询最近一次扫描结果
*
* @param [out] param 扫描结果
*
* @return
* = 0 - 成功 \n
* = -1 - 失败
*
* @details
*/
int32_t cm_wifiscan_query(cm_wifi_scan_info_t **param);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif
/** @}*/