WIFI_MANAGER_TDLS_DISCOVERY_STATE_FINISHED = 1, /**< Discovery is finished */
} wifi_manager_tdls_discovery_state_e;
+/**
+ * @brief Enumeration for the Wi-Fi Module state.
+ * @since_tizen 4.0
+ */
+typedef enum {
+ WIFI_MANAGER_MODULE_STATE_DETACHED = 0, /**< Wi-Fi Module is detached */
+ WIFI_MANAGER_MODULE_STATE_ATTACHED = 1, /**< Wi-Fi Module is attached */
+} wifi_manager_module_state_e;
+
/**
* @}
*/
*/
int wifi_manager_unset_rssi_level_changed_cb(wifi_manager_h wifi);
+/**
+ * @brief Gets the Wi-Fi Module state.
+ * @since_tizen 4.0
+ * @param[in] wifi The Wi-Fi handle
+ * @param[out] state The Wi-Fi Module state
+ * @return @c 0 on success, otherwise negative error value
+ * @retval #WIFI_MANAGER_ERROR_NONE Successful
+ * @retval #WIFI_MANAGER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_MANAGER_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED Not supported
+ */
+int wifi_manager_get_module_state(wifi_manager_h wifi, wifi_manager_module_state_e *state);
/**
* @}
*/
int wifi_manager_ap_refresh(wifi_manager_ap_h ap);
+
/**
* @}
*/
WIFI_SUPPORTED_FEATURE_MAX,
} wifi_supported_feature_e;
+/* It is specific to TV Profile that WiFi Module can be insert or remove in platform */
+#define VCONFKEY_WIFI_DEVICE_STATUS_UEVENT "memory/wifi/device/status_uevent"
#define CHECK_FEATURE_SUPPORTED(...) \
do { \
int _wifi_set_background_scan_mode(wifi_manager_autoscan_mode_e mode);
int _wifi_get_autoscan(bool *autoscan);
int _wifi_get_autoscanmode(wifi_manager_autoscan_mode_e *autoscanmode);
+int _wifi_get_module_state(wifi_manager_module_state_e *state);
gchar *id = config_ids->data;
h = g_new0(wifi_config_s, 1);
- if (h == NULL) {
+ if (h == NULL)
break;
- }
if (g_str_has_suffix(id, "ieee8021x") == TRUE) {
h->eap_config = g_new0(wifi_eap_config_s, 1);
return WIFI_MANAGER_ERROR_NONE;
}
+
+int _wifi_get_module_state(wifi_manager_module_state_e *state)
+{
+ int rv = 0;
+ int wifi_device_status = 0;
+
+ rv = vconf_get_int(VCONFKEY_WIFI_DEVICE_STATUS_UEVENT, &wifi_device_status);
+
+ if (rv < 0) {
+ WIFI_LOG(WIFI_ERROR, "Failed to get vconf value [%s]\n",
+ VCONFKEY_WIFI_DEVICE_STATUS_UEVENT);
+ return WIFI_MANAGER_ERROR_OPERATION_FAILED;
+ }
+
+ if (wifi_device_status == 0) {
+ WIFI_LOG(WIFI_INFO, "Wi-Fi Module is detached");
+ *state = WIFI_MANAGER_MODULE_STATE_DETACHED;
+ } else {
+ WIFI_LOG(WIFI_INFO, "Wi-Fi Module is attached");
+ *state = WIFI_MANAGER_MODULE_STATE_ATTACHED;
+ }
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
//LCOV_EXCL_STOP
}
//LCOV_EXCL_STOP
+EXPORT_API int wifi_manager_get_module_state(wifi_manager_h wifi,
+ wifi_manager_module_state_e *state)
+
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ if (state == NULL || !(__wifi_check_handle_validity(wifi))) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ return _wifi_get_module_state(state);
+
+}
+
}
return 1;
}
+int test_wifi_manager_get_module_state(void)
+{
+ int rv = 0;
+ wifi_manager_module_state_e module_state;
+
+ rv = wifi_manager_get_module_state(wifi, &module_state);
+
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to get wifi module state [%s]\n", __test_convert_error_to_string(rv));
+ return -1;
+ }
+
+ printf("Success to get WiFI Module state : ");
+ switch (module_state) {
+ case WIFI_MANAGER_MODULE_STATE_ATTACHED:
+ printf("Wi-Fi Module Attached \n");
+ break;
+ case WIFI_MANAGER_MODULE_STATE_DETACHED:
+ printf("Wi-Fi Module Detached\n");
+ break;
+ default:
+ printf("Unknown\n");
+ }
+
+ return 1;
+}
+
int test_wifi_manager_connect_hidden_ap(void)
{
printf("A - Get Auto Scan Mode\n");
printf("B - Enable TDLS Channel Switch Request\n");
printf("C - Disable TDLS Channel Switch Request\n");
+ printf("D - Get Wi-Fi Module State\\n");
printf(LOG_RED "0 - Exit \n" LOG_END);
printf("ENTER - Show options menu.......\n");
case 'C':
rv = test_wifi_manager_tdls_disable_channel_switch();
break;
+ case 'D':
+ rv = test_wifi_manager_get_module_state();
+ break;
default:
break;
}