2019-08-03 10:39:03 +08:00
|
|
|
/*
|
2021-03-12 00:09:55 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2019-08-03 10:39:03 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2019-01-25 winner micro
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
#include "oneshot.h"
|
|
|
|
#include "wm_wifi_oneshot.h"
|
|
|
|
#include "wm_wifi.h"
|
|
|
|
|
|
|
|
/* start oneshot */
|
|
|
|
int wm_oneshot_start(WM_ONESHOT_MODE mode, wm_oneshot_callback callback)
|
|
|
|
{
|
2021-03-12 00:09:55 +08:00
|
|
|
tls_wifi_oneshot_callback_register(callback);
|
|
|
|
if(mode == WM_UDP)
|
|
|
|
{
|
|
|
|
tls_wifi_set_oneshot_config_mode(0);
|
|
|
|
}
|
2019-08-03 10:39:03 +08:00
|
|
|
else if (mode == WM_APSOCKET)
|
|
|
|
{
|
|
|
|
tls_wifi_set_oneshot_config_mode(1);
|
2021-03-12 00:09:55 +08:00
|
|
|
}
|
|
|
|
else if(mode == WM_APWEB)
|
|
|
|
{
|
|
|
|
tls_wifi_set_oneshot_config_mode(2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
tls_wifi_set_oneshot_flag(1);
|
|
|
|
return 0;
|
2019-08-03 10:39:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* stop oneshot */
|
|
|
|
int wm_oneshot_stop(void)
|
|
|
|
{
|
2021-03-12 00:09:55 +08:00
|
|
|
tls_wifi_oneshot_callback_delete();
|
|
|
|
tls_wifi_set_oneshot_flag(0);
|
|
|
|
return 0;
|
2019-08-03 10:39:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* get status */
|
|
|
|
int wm_oneshot_get(void)
|
|
|
|
{
|
2021-03-12 00:09:55 +08:00
|
|
|
return tls_wifi_get_oneshot_flag();
|
2019-08-03 10:39:03 +08:00
|
|
|
}
|