?? wps_dish.c
字號:
#include "../wps/wps_userapi.h"
#include "../wps/wps_common.h"
#include "../common/metatype.h"
#include "../common/strlib.h"
#include "../common/memlib.h"
#include "../common/malloc.h"
#include "../dish/dish.h"
static void callback_fn(USER_CALLBACK_EVENT event)
{
USER_WLAN_PARAM param;
switch (event) {
case USER_CALLBACK_EVENT_ERROR:
d_printf("###USER_CALLBACK_EVENT: Error");
break;
case USER_CALLBACK_EVENT_OVERLAP:
d_printf("###USER_CALLBACK_EVENT: Overlap");
break;
case USER_CALLBACK_EVENT_SUCCESS:
d_printf("###USER_CALLBACK_EVENT: Success");
if (wps_enrol_get_wlan_param(¶m) != WPS_ERROR_SUCCESS) {
d_printf("Get WLAN parameters failed.");
}
else {
d_printf("Get WLAN parameters successfully.");
}
break;
case USER_CALLBACK_EVENT_STOPPED:
d_printf("###USER_CALLBACK_EVENT: Stopped");
break;
default:
d_printf("###USER_CALLBACK_EVENT: ???");
break;
}
}
static int wps_dish_start_pin(char *cmdp)
{
wps_enrol_set_mode(USER_WPS_PIN_MODE);
wps_enrol_set_pin("37030742");
wps_enrol_set_callback(callback_fn);
if (wps_enrol_start() != WPS_ERROR_SUCCESS) {
d_printf("Start failed.");
}
return 0;
}
static int wps_dish_start_pbc(char *cmdp)
{
wps_enrol_set_mode(USER_WPS_PBC_MODE);
wps_enrol_set_callback(callback_fn);
if (wps_enrol_start() != WPS_ERROR_SUCCESS) {
d_printf("Start failed.");
}
return 0;
}
static int wps_dish_stop(char *cmdp)
{
if (wps_enrol_stop() != WPS_ERROR_SUCCESS) {
d_printf("Stop failed.");
}
return 0;
}
static dish_cmdlink wps_dish_cmdlink;
static dish_hlplink wps_dish_hlplink;
static const char wps_dish_module_name[] = "WPS";
const dish_cmdtbl wps_dish_cmdtbl[] = {
{"s_pin", wps_dish_start_pin},
{"s_pbc", wps_dish_start_pbc},
{"stop", wps_dish_stop},
{NULL, NULL}
};
const dish_hlptbl wps_dish_hlptbl[] = {
{"s_pin", "Start WPS process with PIN mode"},
{"s_pbc", "Start WPS process with PBC mode"},
{"stop", "Stop the WPS process"},
{NULL, NULL}
};
void wps_dish_init(void)
{
dish_addcmd(wps_dish_cmdtbl, &wps_dish_cmdlink);
dish_addhlp(wps_dish_hlptbl, &wps_dish_hlplink);
dish_set_module_name(&wps_dish_cmdlink, &wps_dish_hlplink, wps_dish_module_name);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -