GSList *vsie_list; /** List of Vendor Specific Information Element of AP*/
int assoc_status_code; /** Supplicant WiFi Association Status Code */
char country_code[NET_WLAN_COUNTRY_CODE_LEN]; /** Country code received from AP */
+ unsigned int connection_mode; /** Connection mode (IEEE 802.11b/g/n/a/ac) */
GSList *bssid_list; /** List if BSSID, strength and frequency of AP **/
} net_profile_info_s;
WIFI_MANAGER_AUTOSCAN_MODE_PERIODIC
} wifi_manager_autoscan_mode_e;
+/**
+ * @brief Enumeration for the Wi-Fi Connection Mode.
+ * @since_tizen 5.0
+ */
+typedef enum {
+ WIFI_MANAGER_CONNECTION_MODE_UNKNOWN, /**< Unknown */
+ WIFI_MANAGER_CONNECTION_MODE_80211_B, /**< IEEE 802.11b 2.4 Ghz */
+ WIFI_MANAGER_CONNECTION_MODE_80211_G, /**< IEEE 802.11g 2.4 Ghz */
+ WIFI_MANAGER_CONNECTION_MODE_80211_N, /**< IEEE 802.11n 2.4/5 Ghz */
+ WIFI_MANAGER_CONNECTION_MODE_80211_A, /**< IEEE 802.11a 5 Ghz */
+ WIFI_MANAGER_CONNECTION_MODE_80211_AC, /**< IEEE 802.11ac 5 Ghz */
+} wifi_manager_connection_mode_e;
+
/**
* @brief The Wi-Fi netlink scan handle.
* @since_tizen 5.0
*/
int wifi_manager_deinitialize_cs(int tid, wifi_manager_h wifi);
+/**
+ * @brief Gets IEEE 802.11 Connection mode of connected network.
+ * @since_tizen 5.0
+ * @param[in] wifi Wi-Fi handle
+ * @param[out] mode connection mode
+ * @return 0 on success, otherwise negative error value
+ * @retval #WIFI_MANAGER_ERROR_NONE Successful
+ * @retval #WIFI_MANAGER_ERROR_NO_CONNECTION Not Connected
+ * @retval #WIFI_MANAGER_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED Not supported
+ */
+int wifi_manager_get_connection_mode(wifi_manager_h wifi,
+ wifi_manager_connection_mode_e *mode);
+
/**
* @}
*/
int _wifi_get_ip_conflict_state(wifi_manager_ip_conflict_state_e *state);
int _wifi_get_ip_conflict_period(unsigned int* initial_time);
int _wifi_get_wps_generated_pin(char **wps_pin);
+int _wifi_get_connection_mode(wifi_manager_connection_mode_e *mode);
void __clear_profile_list(GSList **iterator);
} else if (g_strcmp0(key, "Frequency") == 0) {
ProfInfo->frequency = (unsigned int)g_variant_get_uint16(var);
+ } else if (g_strcmp0(key, "ConnMode") == 0) {
+ ProfInfo->connection_mode = (unsigned int)g_variant_get_uint16(var);
+
} else if (g_strcmp0(key, "Vsie") == 0) {
const unsigned char *vsie_bytes = NULL;
unsigned char *vsie = NULL;
return WIFI_MANAGER_ERROR_NONE;
}
-
return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
+
+int _wifi_get_connection_mode(wifi_manager_connection_mode_e *mode)
+{
+ int rv;
+ GSList *list;
+ net_profile_info_s *prof_info = NULL;
+
+ rv = __update_profile_iterator();
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ WIFI_LOG(WIFI_ERROR, "Access denied");
+ return WIFI_MANAGER_ERROR_PERMISSION_DENIED;
+ }
+
+ for (list = profile_iterator; list; list = list->next) {
+ prof_info = (net_profile_info_s *)list->data;
+ if (prof_info->ProfileState == NET_STATE_TYPE_ONLINE ||
+ prof_info->ProfileState == NET_STATE_TYPE_READY)
+ break;
+ }
+
+ if (prof_info == NULL) {
+ WIFI_LOG(WIFI_ERROR, "There is no connected AP");
+ return WIFI_MANAGER_ERROR_NO_CONNECTION;
+ }
+
+ *mode = (wifi_manager_connection_mode_e)prof_info->connection_mode;
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
__NETWORK_CAPI_FUNC_EXIT__;
return _wifi_start_multi_scan(wifi, specific_scan, callback, user_data);
}
+
+EXPORT_API int wifi_manager_get_connection_mode(wifi_manager_h wifi,
+ wifi_manager_connection_mode_e *mode)
+{
+ __NETWORK_CAPI_FUNC_ENTER__;
+
+ int rv;
+
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ RET_ERR_IF_HANDLE_IS_NOT_VALID_OR_NOT_INITIALIZED(wifi, __NETWORK_CAPI_FUNC_EXIT__);
+
+ if (mode == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter");
+ __NETWORK_CAPI_FUNC_EXIT__;
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER;
+ }
+
+ rv = _wifi_get_connection_mode(mode);
+ WIFI_LOG(WIFI_INFO, "Connection mode %d", *mode);
+
+ __NETWORK_CAPI_FUNC_EXIT__;
+ return rv;
+}
}
}
+static const char *__test_convert_connection_mode_to_string(wifi_manager_connection_mode_e mode)
+{
+ switch (mode) {
+ case WIFI_MANAGER_CONNECTION_MODE_80211_B:
+ return "802.11b";
+ case WIFI_MANAGER_CONNECTION_MODE_80211_G:
+ return "802.11g";
+ case WIFI_MANAGER_CONNECTION_MODE_80211_N:
+ return "802.11n";
+ case WIFI_MANAGER_CONNECTION_MODE_80211_A:
+ return "802.11a";
+ case WIFI_MANAGER_CONNECTION_MODE_80211_AC:
+ return "802.11ac";
+ case WIFI_MANAGER_CONNECTION_MODE_UNKNOWN:
+ return "Uknown";
+ default:
+ return "Uknown";
+ }
+}
+
static void __test_device_state_callback(wifi_manager_device_state_e state, void* user_data)
{
printf("[%s] Device state changed callback", (char *)user_data);
rv = scanf("%39s", ip_addr);
if (rv > 0) {
switch (ip_addr[0]) {
- case 'x':
- rv = WIFI_MANAGER_ERROR_NONE;
- break;
- case '0':
- rv = wifi_manager_config_set_subnet_mask(config, address_type,
- NULL);
- break;
- default:
- rv = wifi_manager_config_set_subnet_mask(config, address_type,
- ip_addr);
+ case 'x':
+ rv = WIFI_MANAGER_ERROR_NONE;
+ break;
+ case '0':
+ rv = wifi_manager_config_set_subnet_mask(config, address_type,
+ NULL);
+ break;
+ default:
+ rv = wifi_manager_config_set_subnet_mask(config, address_type,
+ ip_addr);
}
if (rv != WIFI_MANAGER_ERROR_NONE) {
return 1;
}
+int test_wifi_manager_get_connection_mode(void)
+{
+ int rv, int_value;
+ wifi_manager_connection_mode_e mode;
+ char *ap_name = NULL;
+ wifi_manager_ap_h ap_h;
+
+ rv = wifi_manager_get_connected_ap(wifi, &ap_h);
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to get connected AP [%s]\n", __test_convert_error_to_string(rv));
+ return -1;
+ }
+
+ rv = wifi_manager_ap_get_essid(ap_h, &ap_name);
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to get essid [%s]\n", __test_convert_error_to_string(rv));
+ wifi_manager_ap_destroy(ap_h);
+ return -1;
+ }
+
+ rv = wifi_manager_ap_get_max_speed(ap_h, &int_value);
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to get max speed[%s]\n", __test_convert_error_to_string(rv));
+ wifi_manager_ap_destroy(ap_h);
+ return -1;
+ }
+
+ rv = wifi_manager_get_connection_mode(wifi, &mode);
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to get connection mode[%s]\n", __test_convert_error_to_string(rv));
+ wifi_manager_ap_destroy(ap_h);
+ return -1;
+ }
+
+ printf("Connected AP : %s\n", ap_name);
+ printf("Connection mode : %s\n", __test_convert_connection_mode_to_string(mode));
+ printf("Link speed : %d\n", int_value);
+ g_free(ap_name);
+ wifi_manager_ap_destroy(ap_h);
+ return 1;
+}
+
int main(int argc, char **argv)
{
GMainLoop *mainloop;
printf("V - Netlink Scan Normal/Specific-AP\n");
printf("W - Get passpoint state\n");
printf("X - Set passpoint on/off\n");
+ printf("Y - Get Access Point Hardware Mode\n");
printf(LOG_RED "0 - Exit \n" LOG_END);
printf("ENTER - Show options menu.......\n");
case 'X':
rv = test_wifi_manager_set_passpoint_enable();
break;
+ case 'Y':
+ rv = test_wifi_manager_get_connection_mode();
+ break;
default:
break;
}