int wifi_mesh_stop(wifi_mesh_h handle);
/**
+ * @brief Get the Wi-Fi mesh enable state.
+ * @details Check if mesh is enabled in current device.
+ *
+ * @since_tizen 4.0
+ *
+ * @param[in] handle The Wi-Fi mesh handle
+ * @param[out] is_started The state of mesh.
+ *
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #WIFI_MESH_ERROR_NONE Successful
+ * @retval #WIFI_MESH_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_MESH_ERROR_IO_ERROR Unexpected d-bus error
+ *
+ * @see wifi_mesh_start()
+ * @see wifi_mesh_stop()
+ *
+ */
+int wifi_mesh_is_started(wifi_mesh_h handle, bool *is_started);
+
+/**
* @brief Get the Wi-Fi mesh connection state.
* @details Check if current device is joined Wi-Fi mesh network.
*
wifi_mesh_connected_peer_cb cb, void *user_data);
int _wifi_mesh_enable_mesh(wifi_mesh_h handle);
int _wifi_mesh_disable_mesh(wifi_mesh_h handle);
+int _wifi_mesh_is_started(wifi_mesh_h handle, bool* is_started);
int _wifi_mesh_is_joined(wifi_mesh_h handle, bool* is_joined);
int _mesh_get_joined_mesh_network(wifi_mesh_h handle, wifi_mesh_network_h* _network);
int _wifi_mesh_set_gate(wifi_mesh_h handle, bool gate_announce, int hwmp_root_mode, bool stp);
return result;
}
+int _wifi_mesh_is_started(wifi_mesh_h handle, bool* is_started)
+{
+ GVariant *variant = NULL;
+ GError *error = NULL;
+ gboolean state;
+ struct mesh_handle *h = handle;
+
+ if (NULL == h) {
+ /* LCOV_EXCL_START */
+ LOGE("Invaild parameter");
+ return WIFI_MESH_ERROR_INVALID_PARAMETER;
+ /* LCOV_EXCL_STOP */
+ }
+
+ if (NULL == h->dbus_connection || NULL == _gproxy_mesh_service) {
+ /* LCOV_EXCL_START */
+ LOGE("I/O error");
+ return WIFI_MESH_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
+ }
+
+ variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "is_mesh_enabled",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, &error);
+ if (variant) {
+ g_variant_get(variant, "(b)", &state);
+ *is_started = ((state) ? true : false);
+ } else if (error) {
+ /* LCOV_EXCL_START */
+ LOGE("Failed DBus call [%s]", error->message);
+ g_error_free(error);
+ return WIFI_MESH_ERROR_IO_ERROR;
+ /* LCOV_EXCL_STOP */
+ }
+
+ return WIFI_MESH_ERROR_NONE;
+}
+
/* TODO: Parameter verification required */
int _wifi_mesh_is_joined(wifi_mesh_h handle, bool* is_joined)
{
return rv;
}
+EXPORT_API int wifi_mesh_is_started(wifi_mesh_h handle, bool *is_started)
+{
+ int rv = 0;
+ CHECK_FEATURE_SUPPORTED(MESH_FEATURE);
+
+ if (NULL == handle || is_started == NULL) {
+ /* LCOV_EXCL_START */
+ LOGE("Invalid parameter");
+ return WIFI_MESH_ERROR_INVALID_PARAMETER;
+ /* LCOV_EXCL_STOP */
+ }
+
+ rv = _wifi_mesh_is_started(handle, is_started);
+ return rv;
+}
+
EXPORT_API int wifi_mesh_is_joined(wifi_mesh_h handle, bool* is_joined)
{
int rv = 0;
static int run_wifi_mesh_enable(MManager *mm, struct menu_data *menu)
{
int ret;
+ bool is_started;
+
+ ret = wifi_mesh_is_started(mesh, &is_started);
+ if (WIFI_MESH_ERROR_NONE != ret) {
+ msgr("Failed to check mesh started: [%s(0x%X)]",
+ wifi_mesh_error_to_string(ret), ret);
+ return RET_FAILURE;
+ }
+
+ if (is_started == true) {
+ msg("Mesh is already enabled");
+ return RET_SUCCESS;
+ }
+
msg("Enable Mesh");
ret = wifi_mesh_start(mesh);