const char* bridge_interface, const char* softap_interface);
int wmesh_request_disable_softap(
const char* bridge_interface, const char* softap_interface);
+bool wmesh_request_check_softap_status();
/* Mesh Station & path */
int wmesh_request_get_station_info(const char* mesh_interface, GList **station_list);
int *max_sta, int *security, char **passphrase);
int wmesh_softap_enable_softap();
int wmesh_softap_disable_softap();
+bool wmesh_softap_check_softap_status();
#ifdef __cplusplus
}
<method name="disable_softap">\r
<arg type="i" name="result" direction="out"/>\r
</method>\r
+ <method name="is_softap_enabled">\r
+ <arg type="b" name="status" direction="out"/>\r
+ </method>\r
<method name="create_mesh_network">\r
<arg type="s" name="mesh_id" direction="in"/>\r
<arg type="i" name="channel" direction="in"/>\r
return ret;
}
+bool wmesh_request_check_softap_status()
+{
+ WMESH_LOGD("Check softAp status");
+
+ return wmesh_softap_check_softap_status();
+}
+
int wmesh_request_get_station_info(const char* mesh_interface, GList **station_list)
{
int ret = WMESHD_ERROR_NONE;
return TRUE;
}
+static gboolean _wmeshd_dbus_handle_is_softap_enabled(NetWmesh *object,
+ GDBusMethodInvocation *invocation, gpointer user_data)
+{
+ bool status;
+ (void) user_data;
+
+ /* Check SoftAP status */
+ status = wmesh_request_check_softap_status();
+ WMESH_LOGD("SoftAP is %s", status ? "enabled" : "disabled");
+
+ net_wmesh_complete_is_softap_enabled(object, invocation, status);
+
+ return TRUE;
+}
+
static gboolean _wmeshd_dbus_handle_create_mesh_network(NetWmesh *object,
GDBusMethodInvocation *invocation,
gchar *mesh_id, gint channel, gint security,
G_CALLBACK(_wmeshd_dbus_handle_enable_softap), service);
g_signal_connect(meshd_dbus_object, "handle-disable-softap",
G_CALLBACK(_wmeshd_dbus_handle_disable_softap), service);
+ g_signal_connect(meshd_dbus_object, "handle-is-softap-enabled",
+ G_CALLBACK(_wmeshd_dbus_handle_is_softap_enabled), NULL);
g_signal_connect(meshd_dbus_object, "handle-create-mesh-network",
G_CALLBACK(_wmeshd_dbus_handle_create_mesh_network), service);
g_signal_connect(meshd_dbus_object, "handle-connect-mesh-network",
return ret;
}
+
+bool wmesh_softap_check_softap_status()
+{
+ int ret = WMESHD_ERROR_NONE;
+ pid_t hostapd_pid = 0;
+
+ ret = __get_pid_of_hostapd(&hostapd_pid);
+ if (ret != WMESHD_ERROR_NONE) {
+ WMESH_LOGE("hostapd is not running");
+ return false;
+ }
+
+ if (hostapd_pid == 0) {
+ WMESH_LOGD("hostapd is not running");
+ return false;
+ }
+
+ return true;
+}