Appearance
Network Provisioning API
API Overview
Function | Description |
---|---|
Qth_wifiOpenNetcfg() | Enables network provisioning. |
Qth_wifiCloseNetcfg() | Disables network provisioning. |
Qth_wifiGetCfgStatus() | Gets Wi-Fi network provisioning status. |
Note: See Product Configuration API for the details about Wi-Fi information configuration.
API Description
Qth_wifiOpenNetcfg
This function enables network provisioning.
Prototype
c
oprt_ret Qth_wifiOpenNetcfg(Qth_wifiConfigMode_e mode);
Parameter
Input Parameter
- Qth_wifiConfigMode
mode
: Network provisioning mode.Value Description QTH_WIFI_CFGMODE_SLIENT Idle mode (The device enters idle mode after network provisioning fails.) QTH_WIFI_CFGMODE_BACKROUTE Reconnect mode (The device attempts to reconnect to the previous router after network provisioning fails; if unsuccessful, enter idle mode.)
- Qth_wifiConfigMode
Output Parameter
None
Return Value
OPRT_OK
: Successful execution- Other values: Failed execution. See Error Code List for details.
Example
c
oprt_ret ret = OPRT_OK;
ret = Qth_wifiOpenNetcfg(QTH_WIFI_CFGMODE_SLIENT);
if (OPRT_OK != ret)
{
Quos_logPrintf(APPS_OPEN, LL_ERR, "open wifi netcfg error");
}
Qth_wifiCloseNetcfg
This function disables network provisioning.
Prototype
c
oprt_ret Qth_wifiCloseNetcfg(void);
Parameter
Input Parameter
- None
Output Parameter
- None
Return Value
OPRT_OK
: Successful execution- Other values: Failed execution. See Error Code List for details.
Example
c
oprt_ret ret = OPRT_OK;
Qth_wifiOpenNetcfg();
Qhal_system_sleepMs(10000);
ret = Qth_wifiCloseNetcfg();
if (OPRT_OK != ret)
{
Quos_logPrintf(APPS_OPEN, LL_ERR, "close wifi netcfg error");
}
Qth_wifiGetCfgStatus
This function gets Wi-Fi network provisioning status.
Prototype
c
Qth_wifiConfigStatus_e Qth_wifiGetCfgStatus(void);
Parameter
Input Parameter
None
Output Parameter
None
Return Value
Value Description QTH_WIFI_CFGSTA_NOT_CONFIG Wi-Fi network unprovisioned QTH_WIFI_CFGSTA_CONFIGING Wi-Fi network provisioning QTH_WIFI_CFGSTA_ALREADY_CONFIG Wi-Fi network provisioned
Example
c
Qth_wifiConfigStatus_e status;
status = Qth_wifiGetCfgStatus();
Quos_logPrintf(APPS_OPEN, LL_DBG, "status:%d", status);
Error Code List
Enumeration Value | Hexadecimal | Decimal | Description |
---|---|---|---|
OPRT_OK | -0x0000 | -0 | Successful execution. |
OPRT_COM_ERROR | -0x0001 | -1 | General error. |
OPRT_INVALID_PARM | -0x0002 | -2 | Invalid parameter. |
OPRT_MALLOC_FAILED | -0x0003 | -3 | Memory allocation failed. |
OPRT_NOT_SUPPORTED | -0x0004 | -4 | Not supported. |
OPRT_NOT_FOUND | -0x0005 | -5 | Object not found. |
OPRT_INDEX_OUT_OF_BOUND | -0x0006 | -6 | Index out of bounds. |
OPRT_EXCEED_UPPER_LIMIT | -0x0007 | -7 | Exceed upper limit. |
OPRT_NOT_EXIST | -0x0008 | -8 | Not exist. |
OPRT_QTH_WIFI_OPEN_NETCFG_FAILED | -0x1c00 | -7168 | Failed to enable Wi-Fi network provisioning. |
OPRT_QTH_WIFI_CONN_ROUTER_FAILED | -0x1c01 | -7169 | Failed to connect to the router. |
OPRT_QTH_WIFI_ROUTER_DISCONNECTED | -0x1c02 | -7170 | Router disconnected. |