int _net_dbus_add_vsie(unsigned int frame_id, const char *vsie_str);
int _net_dbus_get_vsie(unsigned int frame_id, char **vsie_str);
int _net_dbus_remove_vsie(unsigned int frame_id, const char *vsie_str);
-int _net_dbus_get_vsie_list(GSList **vsie_list);
int _net_dbus_flush_bss(void);
int _net_dbus_get_auto_connect_mode(int *connect_mode);
int _net_dbus_set_auto_connect_mode(int connect_mode);
net_wifi_eap_auth_type_e eap_auth_type;
} net_eap_config_s;
-typedef struct {
- char *elem; //vendor element
- int length; //size of vendor element
-} net_vsie_data_s;
-
typedef void (*net_event_cb)(const net_event_info_s* net_event, void* user_data);
int net_register_client_ext(net_event_cb event_cb, void *user_data);
int net_wifi_add_vsie(unsigned int frame_id, const char *vsie_str);
int net_wifi_get_vsie(unsigned int frame_id, char **vsie_str);
int net_wifi_remove_vsie(unsigned int frame_id, const char *vsie_str);
-int net_wifi_get_vsie_list(GSList **vsie_list);
int net_wifi_flush_bss(void);
int net_wifi_get_auto_connect_mode(int *connect_mode);
int net_wifi_set_auto_connect_mode(int connect_mode);
wifi_manager_vsie_frames_e frame_id, char **vsie_str);
int _wifi_remove_vsie(wifi_manager_h wifi,
wifi_manager_vsie_frames_e frame_id, const char *vsie_str);
-int _wifi_get_vsie_list(wifi_manager_vsie_list_cb callback, void *user_data);
int _wifi_flush_bss(void);
int _wifi_get_auto_connect(int *connect_mode);
*/
/**
- * @brief Called when you get the vsie repeatedly.
- * @since_tizen 4.0
- *
- * @param[in] vsie The vsie data
- * @param[in] length The length of vsie data
- * @param[in] user_data The user data passed from the request function
- *
- * @return @c true to continue with the next iteration of the loop, \n
- * otherwise @c false to break out of the loop
- * @see wifi_manager_get_vsie_list()
- */
-typedef bool(*wifi_manager_vsie_list_cb)(char* vsie, int length, void* user_data);
-
-/**
* @brief Enables or disables auto-scanning
* @details If auto-scanning is disabled, then background scan and wps scan don't work.
* By default, the auto-scanning is enabled automatically until disabling auto-scanning.
wifi_manager_vsie_frames_e frame_id, const char *vsie_str);
/**
- * @brief Gets the vsie result of the scan.
- * @since_tizen 4.0
- *
- * @param[in] wifi The Wi-Fi handle
- * @param[in] callback The callback to be called
- * @param[in] user_data The user data passed to the callback function
- *
- * @return 0 on success, otherwise negative error value
- * @retval #WIFI_MANAGER_ERROR_NONE Successful
- * @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #WIFI_MANAGER_ERROR_OPERATION_FAILED Operation failed
- * @retval #WIFI_MANAGER_ERROR_PERMISSION_DENIED Permission Denied
- * @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED Not supported
- * @post This function invokes wifi_manager_vsie_list_cb().
- */
-int wifi_manager_get_vsie_list(wifi_manager_h wifi,
- wifi_manager_vsie_list_cb callback, void *user_data);
-
-/**
* @brief Gets the vsie result of the AP.
* @since_tizen 5.0
* @remarks @a vsie must be released with free().
return Error;
}
-static int _net_get_vsies(GVariant *msg, GSList **vsie_list)
-{
- WIFI_LOG(WIFI_INFO, "Extract vsie data");
-
- GVariant *var;
- GVariantIter *iter, *next;
- char *obj;
- gchar *key;
-
- g_variant_get(msg, "(a(oa{sv}))", &iter);
- while (g_variant_iter_loop(iter, "(oa{sv})", &obj, &next)) {
- if (obj == NULL || g_str_has_prefix(obj, CONNMAN_WIFI_SERVICE_PROFILE_PREFIX) == false)
- continue;
-
- while (g_variant_iter_loop(next, "{sv}", &key, &var)) {
- if (g_strcmp0(key, "Vsie") == 0) {
- const char *vsie = NULL;
- net_vsie_data_s *vendor_data;
- gsize vsie_len;
- int i;
-
- vsie = g_variant_get_fixed_array(var, &vsie_len, sizeof(guchar));
-
- if (vsie) {
- vendor_data = (net_vsie_data_s*)g_try_malloc0(sizeof(net_vsie_data_s));
- if (vendor_data) {
- vendor_data->length = vsie_len;
- vendor_data->elem = (char *)g_try_malloc0(vsie_len);
- if (vendor_data->elem)
- memcpy(vendor_data->elem, vsie, vsie_len);
- else {
- WIFI_LOG(WIFI_ERROR, "Failed to allocate memory");
- g_free(vendor_data);
- g_free(obj);
- g_free(key);
- g_free(var);
- g_variant_iter_free(next);
- g_variant_iter_free(iter);
- return -1;
- }
-
- WIFI_LOG(WIFI_INFO, "VSIE Len: %d", vendor_data->length);
- for (i = 0; i < vsie_len; i++)
- WIFI_LOG(WIFI_INFO, "vendor elem: %02x", vendor_data->elem[i]);
-
- *vsie_list = g_slist_append(*vsie_list, (void *)vendor_data);
- }
- }
- }
- }
- }
- g_variant_iter_free(iter);
-
- return NET_ERR_NONE;
-}
-
-int _net_dbus_get_vsie_list(GSList **vsie_list)
-{
- __NETWORK_FUNC_ENTER__;
-
- net_err_e Error = NET_ERR_NONE;
- GVariant *message = NULL;
-
- message = _net_invoke_dbus_method(
- CONNMAN_SERVICE,
- CONNMAN_MANAGER_PATH,
- CONNMAN_MANAGER_INTERFACE,
- "GetVsies",
- NULL,
- &Error);
-
- if (message == NULL) {
- WIFI_LOG(WIFI_ERROR, "Failed to get vsie info");
- __NETWORK_FUNC_EXIT__;
- return Error;
- }
-
- Error = _net_get_vsies(message, vsie_list);
-
- g_variant_unref(message);
-
- __NETWORK_FUNC_EXIT__;
- return Error;
-}
-
int _net_dbus_flush_bss(void)
{
__NETWORK_FUNC_ENTER__;
return Error;
}
-int net_wifi_get_vsie_list(GSList **vsie_list)
-{
- __NETWORK_FUNC_ENTER__;
-
- net_err_e Error = NET_ERR_NONE;
-
- if (NetworkInfo.ref_count < 1) {
- WIFI_LOG(WIFI_ERROR, "Application is not registered");
- __NETWORK_FUNC_EXIT__;
- return NET_ERR_APP_NOT_REGISTERED;
- }
-
- if (NetworkInfo.wifi_state == WIFI_OFF) {
- if ((NetworkInfo.wifi_state = _net_get_wifi_state(&Error)) == WIFI_OFF) {
- WIFI_LOG(WIFI_ERROR, "Wi-Fi is powered off!");
- __NETWORK_FUNC_EXIT__;
- return NET_ERR_INVALID_OPERATION;
- }
- }
-
- if (_net_dbus_is_pending_call_used() == TRUE) {
- WIFI_LOG(WIFI_ERROR, "pending call in progress");
- __NETWORK_FUNC_EXIT__;
- return NET_ERR_INVALID_OPERATION;
- }
-
- Error = _net_dbus_get_vsie_list(vsie_list);
- if (Error != NET_ERR_NONE) {
- WIFI_LOG(WIFI_ERROR,
- "_net_dbus_get_vsie_list failed. Error [%s]",
- _net_print_error(Error));
- }
-
- __NETWORK_FUNC_EXIT__;
- return Error;
-}
-
EXPORT_API int net_wifi_flush_bss(void)
{
__NETWORK_CAPI_FUNC_ENTER__;
return WIFI_MANAGER_ERROR_OPERATION_FAILED;
}
-int _wifi_get_vsie_list(wifi_manager_vsie_list_cb callback, void *user_data)
-{
- int rv;
- GSList *vsie_list = NULL;
-
- rv = net_wifi_get_vsie_list(&vsie_list);
-
- if (rv == NET_ERR_ACCESS_DENIED) {
- WIFI_LOG(WIFI_ERROR, "Access denied");
- return WIFI_MANAGER_ERROR_PERMISSION_DENIED;
- } else if (rv == NET_ERR_INVALID_OPERATION) {
- WIFI_LOG(WIFI_ERROR, "Invalid Operation");
- return WIFI_MANAGER_ERROR_INVALID_OPERATION;
- } else if (rv == NET_ERR_NONE) {
- WIFI_LOG(WIFI_ERROR, "Error None");
- GSList *list;
- int ret;
- for (list = vsie_list; list; list = list->next) {
- ret = callback((char *)((net_vsie_data_s *)list->data)->elem,
- ((net_vsie_data_s *)list->data)->length, user_data);
- if (ret == false)
- break;
- }
-
- g_slist_free_full(vsie_list, g_free);
- vsie_list = NULL;
-
- return WIFI_MANAGER_ERROR_NONE;
- }
-
- WIFI_LOG(WIFI_ERROR, "Operation Failed");
- return WIFI_MANAGER_ERROR_OPERATION_FAILED;
-}
-
int _wifi_flush_bss(void)
{
int rv;
return _wifi_remove_vsie(wifi, frame_id, vsie_str);
}
-EXPORT_API int wifi_manager_get_vsie_list(wifi_manager_h wifi,
- wifi_manager_vsie_list_cb callback, void *user_data)
-{
- __NETWORK_CAPI_FUNC_ENTER__;
-
- CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
-
- WIFI_LOG(WIFI_INFO, "WiFi get vsies\n");
- if (callback == NULL || !(__wifi_check_handle_validity(wifi))) {
- WIFI_LOG(WIFI_ERROR, "Invalid parameter");
- __NETWORK_CAPI_FUNC_EXIT__;
- return WIFI_MANAGER_ERROR_INVALID_PARAMETER;
- }
-
- __NETWORK_CAPI_FUNC_EXIT__;
- return _wifi_get_vsie_list(callback, user_data);
-}
-
EXPORT_API int wifi_manager_flush_bss(wifi_manager_h wifi)
{
__NETWORK_CAPI_FUNC_ENTER__;