88 lines
2.6 KiB
C
88 lines
2.6 KiB
C
#ifndef USER_MAIN_H
|
||
#define USER_MAIN_H
|
||
|
||
#include "protocol.h"
|
||
|
||
|
||
#define MAX_MSG_CACHE (5)
|
||
#define NE_DEBUG_VERSION (0)
|
||
|
||
#define DEVICE_YANXUAN_SWEEPER 0
|
||
|
||
|
||
typedef enum
|
||
{
|
||
APP_WIFI_CFG_SYS_ERR = 100, // 配网进程运行错误
|
||
APP_WIFI_CFG_FMT_INVALID, // 配网参数的WiFi ssid为空
|
||
APP_WIFI_CFG_JSON_INVALID, // 配网参数json解析错误
|
||
APP_WIFI_CFG_PARAMS_ERR, // 配网参数错误/解析错误
|
||
APP_WIFI_CFG_SSID_NO_EXIT, // 扫描不到配网的ssid
|
||
APP_WIFI_CFG_PWD_INVALID, // 配网密码错误
|
||
APP_WIFI_CFG_BUSY, // 处于配网过程中,用于内部状态机控制
|
||
APP_WIFI_CFG_TIMEOUT, // 网络配置超时
|
||
APP_WIFI_CFG_WIFI_MD_ERR, // --
|
||
APP_WIFI_CFG_CODEC_ERR, // 配网的WiFi加密类型不支持
|
||
APP_WIFI_CFG_OTHER, // 未知错误
|
||
APP_WIFI_CFG_SYS_CFG_BUSY, // 上一次APP请求的配网过程还未结束
|
||
APP_WIFI_CFG_SERVER_ERR, // --
|
||
APP_WIFI_CFG_PROTO_ERR, // 底层无线协议交互出错
|
||
APP_WIFI_CFG_CMPT_ERR, // 底层无线协议兼容性问题
|
||
|
||
APP_WIFI_CFG_AP_FULL_ERR, // 达到AP的客户端最大容量,无法再关联设备
|
||
APP_WIFI_CFG_STATE_INVALID
|
||
|
||
} WIFI_ERROR_CODE;
|
||
|
||
typedef enum
|
||
{
|
||
ERR_OK = 0,
|
||
ERR_FAIL,
|
||
ERR_NOT_SUPPORT,
|
||
ERR_INPUT_PARAMS = 1001,
|
||
ERR_NO_ITEMS = 1002,
|
||
ERR_MALLOC_MEMORY = 1003,
|
||
ERR_ITEM_UNINIT,
|
||
|
||
ERR_JSON_STR_FORMAT = 1100,
|
||
|
||
ERR_UNKNOWN_CMD_ID = 1200,
|
||
|
||
ERR_PRO_DECODE = 1300,
|
||
|
||
ERR_SEND_MESSAGE = 1400,
|
||
ERR_MSG_FULL,
|
||
|
||
ERR_ERASE_FLASH = 1500,
|
||
ERR_WRITE_FLASH,
|
||
ERR_READ_FLASH,
|
||
|
||
ERR_GPIO_NOT_SUPPORT = 1600,
|
||
ERR_GPIO_NOT_CONFIG,
|
||
ERR_GPIO_MUX_UNSUPPORT,
|
||
ERR_GPIO_MODE_UNSUPPORT,
|
||
ERR_GPIO_INTR_UNSUPPORT,
|
||
ERR_GPIO_UNKNOWN_CMD,
|
||
|
||
ERR_UNSUPPORT,
|
||
} PLATFORM_ERROR;
|
||
|
||
char* SysBin2HexStr(char *p, const unsigned char *cp, int count);
|
||
const char* SysGetErrName(int err);
|
||
const char* SysGetHALWIFIError(int wifiErr);
|
||
const char* SysGetWIFIError(int wifiErr);
|
||
int HalWifiCodeToUser(int wifiErr);
|
||
const char* ProName2Str(int cmdId);
|
||
const char* ProCryptoName2Str(int cryptoType);
|
||
|
||
|
||
void wifi_connect_ap(const char* pSSID, int lenSSID, const char* pPasswd, int lenPasswd);
|
||
const char* GetPlatformDevId(void);
|
||
const char* GetSTAMacAddr(void);
|
||
int SoftAPSendRspMsg(char* pMsg);
|
||
int SoftAPDecodeCfgApMsg(PCFG_AP_INFO pApInfo);
|
||
void SoftAPTestConnect(const char* pSSID, const char* pPasswd, const char* pBssid);
|
||
void SoftAPEnterCfgMode(void);
|
||
void SoftAPExitCfgMode(int delaySecs);
|
||
int IsSoftAPMode(void);
|
||
#endif
|