CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(mobileap-agent C)
-SET(SRCS src/mobileap_softap.c
+## Default
+SET(BASE_SRCS src/mobileap_softap.c
src/mobileap_main.c
src/mobileap_wifi.c
+ src/mobileap_common.c
+ src/mobileap_network.c
+ src/mobileap_iptables.c
+ src/gdbus/mobileap_dbus.c
+)
+
+SET(BASE_PKGS alarm-service
+ appcore-common
+ appsvc
+ capi-network-bluetooth
+ capi-network-connection
+ capi-network-wifi-manager
+ capi-system-info
+ dbus-1
+ deviced
+ dlog
+ dpm
+ gio-2.0
+ gio-unix-2.0
+ libcrypto
+ libtzplatform-config
+ notification
+ syspopup-caller
+ key-manager
+ vconf)
+
+
+MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
+
+## Redefine for COMMON
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "COMMON")
+SET(SRCS ${BASE_SRCS}
+ src/mobileap_usb.c
+ src/mobileap_bluetooth.c
+ src/mobileap_handler.c
+ src/mobileap_notification.c)
+SET(PKGS "${BASE_PKGS}")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "COMMON")
+
+## Redefine for TM1
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "TM1")
+SET(SRCS ${BASE_SRCS}
src/mobileap_usb.c
src/mobileap_bluetooth.c
src/mobileap_handler.c
- src/mobileap_common.c
src/mobileap_notification.c
- src/mobileap_network.c
- src/mobileap_iptables.c
src/mobileap_p2p.c
src/mobileap_wfd.c
- src/gdbus/mobileap_dbus.c
)
+SET(PKGS "${BASE_PKGS} capi-network-wifi-direct")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "TM1")
+
+## Redefine for RPI
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "RPI")
+SET(SRCS ${BASE_SRCS})
+SET(PKGS "${BASE_PKGS}")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "RPI")
+
SET(CMAKE_INSTALL_PREFIX /usr)
SET(APP_DIR ${CMAKE_INSTALL_PREFIX}/bin)
SET(INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
-IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
- SET(CMAKE_BUILD_TYPE "Release")
-ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
-
-MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
INCLUDE_DIRECTORIES(${INCLUDE_DIR} ${CMAKE_SOURCE_DIR})
INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED gio-2.0 gio-unix-2.0 dbus-1 dlog deviced vconf notification capi-network-connection capi-network-bluetooth syspopup-caller
- appcore-common capi-network-wifi-manager capi-network-wifi-direct alarm-service appsvc libcrypto key-manager libtzplatform-config dpm
- capi-system-info)
+pkg_check_modules(pkgs REQUIRED ${PKGS})
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ADD_DEFINITIONS(-DTIZEN_FEATURE_ENABLE_IPV6)
ENDIF(TIZEN_FEATURE_ENABLE_IPV6)
-IF(TIZEN_FEATURE_RPI)
- ADD_DEFINITIONS(-DTIZEN_FEATURE_RPI)
-ENDIF(TIZEN_FEATURE_RPI)
+IF(TIZEN_FEATURE_HEADLESS)
+ ADD_DEFINITIONS(-DTIZEN_FEATURE_HEADLESS)
+ENDIF(TIZEN_FEATURE_HEADLESS)
+
+IF(TIZEN_FEATURE_ENABLE_WIFI_DIRECT)
+ ADD_DEFINITIONS(-DTIZEN_FEATURE_ENABLE_WIFI_DIRECT)
+ENDIF(TIZEN_FEATURE_ENABLE_WIFI_DIRECT)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -pie")
#ifndef __MOBILEAP_BLUETOOTH_H__
#define __MOBILEAP_BLUETOOTH_H__
-#ifndef TIZEN_FEATURE_RPI
#include "mobileap_softap.h"
#define PS_RECHECK_INTERVAL 500
GDBusMethodInvocation *context, mobile_ap_address_type_e address_type);
gboolean tethering_disable_bt_tethering(Tethering *obj,
GDBusMethodInvocation *context, mobile_ap_address_type_e address_type);
-#endif
#endif /* __MOBILEAP_BLUETOOTH_H__ */
#ifndef __MOBILEAP_HANDLER_H__
#define __MOBILEAP_HANDLER_H__
-#ifndef TIZEN_FEATURE_RPI
#include <time.h>
#include <alarm.h>
void _stop_timeout_cb(mobile_ap_type_e type);
void _deinit_timeout_cb(mobile_ap_type_e type);
#endif
-#endif
#ifndef __MOBILEAP_NOTIFICATION_H__
#define __MOBILEAP_NOTIFICATION_H__
-#ifndef TIZEN_FEATURE_RPI
#include <appcore-common.h>
#include <notification.h>
#include <tzplatform_config.h>
void _create_bt_tethering_active_noti(void);
void _create_security_restriction_noti(mobile_ap_type_e type);
#endif
-#endif
#ifndef __MOBILEAP_USB_H__
#define __MOBILEAP_USB_H__
-#ifndef TIZEN_FEATURE_RPI
#include "mobileap_softap.h"
void __handle_usb_disconnect_cb(keynode_t *key, void *data);
GDBusMethodInvocation *context);
gboolean tethering_disable_usb_tethering(Tethering *obj,
GDBusMethodInvocation *context);
-#endif
#endif /* __MOBILEAP_USB_H__ */
Name: mobileap-agent
Summary: Mobile AP daemon for setting tethering environments
-Version: 1.0.98
+Version: 1.0.99
Release: 1
Group: System/Network
License: Apache-2.0
BuildRequires: pkgconfig(syspopup-caller)
BuildRequires: pkgconfig(bundle)
BuildRequires: pkgconfig(appcore-common)
-BuildRequires: pkgconfig(capi-network-wifi-direct)
BuildRequires: pkgconfig(capi-network-wifi-manager)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(alarm-service)
%ifarch %{arm}
%package extension-TM1
Summary: Extension for mobile TM1
+BuildRequires: pkgconfig(capi-network-wifi-direct)
Requires: %{name} = %{version}-%{release}
%description extension-TM1
Mobile AP daemon for setting tethering environments for mobile TM1
%ifarch %{arm}
# Build for TM1
-%cmake -DCMAKE_BUILD_TYPE="" \
- -DTIZEN_FEATURE_MULTICAST=1 \
- -DTIZEN_FEATURE_WLAN_BOARD_SPRD=1 \
- -DTIZEN_FEATURE_ENABLE_IPV6=1 \
- .
+%cmake -DCMAKE_BUILD_TYPE="TM1" \
+ -DTIZEN_FEATURE_ENABLE_IPV6=1 \
+ -DTIZEN_FEATURE_ENABLE_WIFI_DIRECT=1 \
+ -DTIZEN_FEATURE_HEADLESS=0 \
+ -DTIZEN_FEATURE_MULTICAST=1 \
+ -DTIZEN_FEATURE_WLAN_BOARD_SPRD=1 \
+.
%make_install
mv %{buildroot}%{_bindir}/mobileap-agent %{_builddir}/%{name}-%{version}/mobileap-agent.tm1
make %{?jobs:-j%jobs}
# Build for RPi
-%cmake -DCMAKE_BUILD_TYPE="" \
+%cmake -DCMAKE_BUILD_TYPE="RPI" \
+ -DTIZEN_FEATURE_ENABLE_IPV6=0 \
+ -DTIZEN_FEATURE_ENABLE_WIFI_DIRECT=0 \
+ -DTIZEN_FEATURE_HEADLESS=1 \
-DTIZEN_FEATURE_MULTICAST=1 \
- -DTIZEN_FEATURE_RPI=1 \
+ -DTIZEN_FEATURE_WLAN_BOARD_SPRD=0 \
.
%make_install
%endif
# Build for Common
-%cmake -DCMAKE_BUILD_TYPE="" \
- -DTIZEN_FEATURE_MULTICAST=1 \
+%cmake -DCMAKE_BUILD_TYPE="COMMON" \
-DTIZEN_FEATURE_ENABLE_IPV6=1 \
+ -DTIZEN_FEATURE_ENABLE_WIFI_DIRECT=0 \
+ -DTIZEN_FEATURE_HEADLESS=0 \
+ -DTIZEN_FEATURE_MULTICAST=1 \
+ -DTIZEN_FEATURE_WLAN_BOARD_SPRD=0 \
.
make %{?jobs:-j%jobs}
%post
/bin/chmod +x /opt/etc/dump.d/module.d/tethering_dump.sh
-#/usr/sbin/setcap cap_dac_override,cap_fowner,cap_net_bind_service,cap_net_admin,cap_net_raw+eip /usr/bin/mobileap-agent
%ifarch %{arm}
%post extension-TM1
pushd %{_bindir}
mv mobileap-agent.tm1 mobileap-agent
popd
-#/usr/sbin/setcap cap_dac_override,cap_fowner,cap_net_bind_service,cap_net_admin,cap_net_raw+eip /usr/bin/mobileap-agent
%preun extension-TM1
rm %{_bindir}/mobileap-agent
* limitations under the License.
*/
-#ifndef TIZEN_FEATURE_RPI
#include <stdio.h>
#include <glib.h>
#include <dbus/dbus.h>
return;
}
#endif /* TIZEN_FEATURE_ENABLE_IPV6 */
-#endif /* TIZEN_FEATURE_RPI */
#include <netinet/in.h>
#include <arpa/inet.h>
#include <dbus/dbus.h>
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
#include <dpm/device-policy-manager.h>
#include <dpm/restriction.h>
#endif
static GSList *station_list = NULL;
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
/* DPM */
device_policy_manager_h dpm = NULL;
int wifi_tethering_id = 0;
void _update_station_count(int count)
{
static int prev_cnt = 0;
+#ifndef TIZEN_FEATURE_HEADLESS
int wifi_count = 0;
int bt_count = 0;
int usb_count = 0;
mobile_ap_type_e type;
+#endif
if (_mobileap_is_enabled(MOBILE_AP_STATE_WIFI_AP))
return;
return;
}
+#ifndef TIZEN_FEATURE_HEADLESS
if (count == 0) {
prev_cnt = 0;
-#ifndef TIZEN_FEATURE_RPI
_delete_connected_noti();
-#endif
return;
}
else
type = MOBILE_AP_TYPE_MAX;
-#ifndef TIZEN_FEATURE_RPI
if (prev_cnt == 0)
_create_connected_noti(type, count);
else
_update_connected_noti(type, count);
-#endif
prev_cnt = count;
+#endif
return;
}
return MOBILE_AP_ERROR_INVALID_PARAM;
}
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
static void __policy_chnaged_cb(const char *name, const char *value, void *data)
{
Tethering *obj = _get_tethering_obj();
* limitations under the License.
*/
-#ifndef TIZEN_FEATURE_RPI
#include <glib.h>
#include <dbus/dbus.h>
#include <stdlib.h>
DBG("-\n");
return;
}
-#endif
#include <string.h>
#include <stdlib.h>
#include <time.h>
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
#include <dd-display.h>
#endif
#include <vconf.h>
#include <net_connection.h>
#include <appcore-common.h>
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
#include <alarm.h>
#endif
return FALSE;
}
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
if (_is_trying_bt_operation()) {
DBG("BT operation is going on\n");
return FALSE;
}
#endif
+#ifdef TIZZEN_FEATURE_WIFI_DIRECT
if (_is_trying_p2p_operation()) {
DBG("P2P operation is going on\n");
return FALSE;
}
+#endif
DBG("All tethering / AP's are turned off\n");
g_main_loop_quit(mainloop);
void _block_device_sleep(void)
{
-#ifdef TIZEN_FEATURE_RPI
+#ifdef TIZEN_FEATURE_HEADLESS
return;
#else
int ret = 0;
void _unblock_device_sleep(void)
{
-#ifdef TIZEN_FEATURE_RPI
+#ifdef TIZEN_FEATURE_HEADLESS
return;
#else
int ret = 0;
else
_disable_wifi_tethering(obj, MOBILE_AP_ADDRESS_TYPE_IPV4);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
if (_mobileap_get_ipv6_state(MOBILE_AP_STATE_BT))
_disable_bt_tethering(obj, MOBILE_AP_ADDRESS_TYPE_IPV6);
else
char *ip_addr = NULL;
char *mac = NULL;
char *name = NULL;
+#ifndef TIZEN_FEATURE_HEADLESS
char *bt_remote_device_name = NULL;
+#endif
mobile_ap_type_e type = MOBILE_AP_TYPE_MAX;
mobile_ap_station_info_t *info = NULL;
int n_station = 0;
else
info->hostname = g_strdup(name);
}
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
else if (type == MOBILE_AP_TYPE_BT) {
_bt_get_remote_device_name(mac, &bt_remote_device_name);
if (bt_remote_device_name == NULL)
_get_station_count((gconstpointer)type,
_slist_find_station_by_interface, &n_station);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
if (n_station == 1)
_stop_timeout_cb(type);
#endif
} else {
DBG("Export sucessss");
}
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
g_signal_connect(tethering_obj, "handle-enable-wifi-tethering",
G_CALLBACK(tethering_enable_wifi_tethering), NULL);
g_signal_connect(tethering_obj, "handle-enable-bt-tethering",
G_CALLBACK(tethering_push_wps_button), NULL);
/* For P2P Tethering */
+#ifdef TIZEN_FEATURE_ENABLE_WIFI_DIRECT
g_signal_connect(tethering_obj, "handle-enable-p2p-tethering",
G_CALLBACK(tethering_p2p_enable), NULL);
g_signal_connect(tethering_obj, "handle-disable-p2p-tethering",
G_CALLBACK(tethering_p2p_disable), NULL);
-
+#endif
#endif
g_signal_connect(softap_obj, "handle-enable",
G_CALLBACK(softap_push_wps_button), NULL);
_init_network((void *)tethering_obj);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
_register_vconf_cb((void *)tethering_obj);
#endif
}
/* Platform modules */
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
if (appcore_set_i18n(MOBILEAP_LOCALE_COMMON_PKG, MOBILEAP_LOCALE_COMMON_RES) < 0)
ERR("appcore_set_i18n is failed\n");
#endif
_register_wifi_station_handler();
_init_wifi_manager();
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
ret = alarmmgr_init(APPNAME);
if (ret != ALARMMGR_RESULT_SUCCESS) {
ERR("alarmmgr_init(%s) is failed : %d\n", APPNAME, ret);
#endif
g_main_loop_run(mainloop);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
_deinit_dpm();
alarmmgr_fini();
#endif
_deinit_wifi_manager();
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
_unregister_vconf_cb();
#endif
_unregister_wifi_station_handler();
_disable_wifi_tethering(obj, MOBILE_AP_ADDRESS_TYPE_IPV4);
DBG("_disable_wifi_tethering returns %d\n", ret);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
if (_mobileap_get_ipv6_state(MOBILE_AP_STATE_BT))
ret = _disable_bt_tethering(obj, MOBILE_AP_ADDRESS_TYPE_IPV6);
else
* limitations under the License.
*/
-#ifndef TIZEN_FEATURE_RPI
#include <glib.h>
#include <dbus/dbus.h>
#include <stdio.h>
return;
}
-#endif
static char dns_addr[INET_ADDRSTRLEN] = "0.0.0.0";
GSList *sta_timer_list = NULL;
-#if TIZEN_FEATURE_WLAN_BOARD_SPRD
-static char *saved_wifi_if_addr = NULL;
-#endif
-
#ifdef TIZEN_FEATURE_ENABLE_IPV6
static pid_t nat64_pid = 0;
static pid_t dns64_pid = 0;
else
hw_mode = g_strdup(mode);
-#ifdef TIZEN_FEATURE_RPI
+#ifdef TIZEN_FEATURE_HEADLESS
snprintf(buf, sizeof(buf), HOSTAPD_RPI_CONF,
WIFI_IF,
HOSTAPD_CTRL_INTF_DIR,
_get_station_count((gconstpointer)type,
_slist_find_station_by_interface, &n_station);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
if (n_station == 0) {
if (type == MOBILE_AP_TYPE_WIFI)
_start_timeout_cb(type, time(NULL) + TETHERING_CONN_TIMEOUT);
_get_station_count((gconstpointer)type,
_slist_find_station_by_interface, &n_station);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
if (n_station == 0) {
if (type == MOBILE_AP_TYPE_WIFI)
_start_timeout_cb(type, time(NULL) + TETHERING_CONN_TIMEOUT);
_get_station_count((gconstpointer)type,
_slist_find_station_by_interface, &n_station);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
if (n_station == 1)
_stop_timeout_cb(type);
#endif
* limitations under the License.
*/
-#ifndef TIZEN_FEATURE_RPI
#include <glib.h>
#include <dbus/dbus.h>
#include <stdio.h>
{
return (g_context ? TRUE : FALSE || in_progress);
}
-#endif
#include <string.h>
#include <stdlib.h>
#include <wifi-manager.h>
+#ifdef TIZEN_FEATURE_ENABLE_WIFI_DIRECT
#include <wifi-direct.h>
+#endif
#include <ckmc/ckmc-manager.h>
#include "mobileap.h"
return &obj_softap_settings;
}
+#ifdef TIZEN_FEATURE_ENABLE_WIFI_DIRECT
static void _wifi_direct_state_cb(int error_code, wifi_direct_device_state_e state, void *user_data)
{
bool wifi_state = false;
ERR("_enable_wifi_tethering is failed\n");
} else {
tethering_emit_wifi_on((Tethering *)obj);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
_create_tethering_active_noti();
#endif
}
DBG("-\n");
return;
}
+#endif
static void __wifi_manager_activated_cb(wifi_manager_error_e result, void *user_data)
{
} else {
prev_wifi_on = TRUE;
tethering_emit_wifi_on(obj);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
_create_tethering_active_noti();
#endif
}
return MOBILE_AP_ERROR_NONE;
}
+#ifdef TIZEN_FEATURE_ENABLE_WIFI_DIRECT
static gboolean __is_wifi_direct_on(void)
{
int wifi_direct_state = 0;
return MOBILE_AP_ERROR_NONE;
}
+#endif
static mobile_ap_error_code_e __update_softap_settings(softap_settings_t *st,
gchar *ssid, gchar *passphrase, gchar* mode, gint channel, int hide_mode,
return ret;
}
tethering_emit_wifi_on(obj);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
_create_tethering_active_noti();
#endif
_mobileap_clear_state(MOBILE_AP_STATE_WIFI);
goto DONE;
}
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
_delete_timeout_noti();
_init_timeout_cb(MOBILE_AP_TYPE_WIFI, (void *)obj);
_start_timeout_cb(MOBILE_AP_TYPE_WIFI, time(NULL) + TETHERING_CONN_TIMEOUT);
}
_flush_ip_address(WIFI_IF);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
_deinit_timeout_cb(type);
#endif
goto DONE;
}
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
_delete_timeout_noti();
_init_timeout_cb(MOBILE_AP_TYPE_WIFI_AP, (void *)obj);
_start_timeout_cb(MOBILE_AP_TYPE_WIFI_AP, time(NULL) + WIFI_AP_CONN_TIMEOUT);
_del_routing_rule(WIFI_IF);
_del_interface_routing(WIFI_IF, IP_ADDRESS_SOFTAP);
_flush_ip_address(WIFI_IF);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
_deinit_timeout_cb(type);
#endif
if (_remove_station_info_all(type) != MOBILE_AP_ERROR_NONE)
}
g_context = context;
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
if (!_is_allowed(MOBILE_AP_TYPE_WIFI)) {
DBG("DPM policy restricts Wi-Fi tethering\n");
ret = MOBILE_AP_ERROR_NOT_PERMITTED;
prev_wifi_on = TRUE;
}
+#ifdef TIZEN_FEATURE_ENABLE_WIFI_DIRECT
if (__is_wifi_direct_on() == TRUE) {
DBG("Wi-Fi and Wi-Fi direct are turned on\n");
if (__turn_off_wifi_direct(obj) != MOBILE_AP_ERROR_NONE) {
return TRUE;
}
+#endif
wifi_manager_is_activated(wifi_manager, &wifi_state);
if (wifi_state == true) {
ERR("_enable_wifi_tethering is failed\n");
} else {
tethering_emit_wifi_on(obj);
-#ifndef TIZEN_FEATURE_RPI
+#ifndef TIZEN_FEATURE_HEADLESS
_create_tethering_active_noti();
#endif
ret_val = TRUE;
wifi_recovery_timeout_id = 0;
}
+#ifdef TIZEN_FEATURE_ENABLE_WIFI_DIRECT
if (__is_wifi_direct_on() == TRUE) {
DBG("Wi-Fi and Wi-Fi direct are turned on\n");
if (__turn_off_wifi_direct(obj) != MOBILE_AP_ERROR_NONE) {
return TRUE;
}
+#endif
wifi_manager_is_activated(wifi_manager, &wifi_state);
if (wifi_state == true) {