* @since_tizen 3.0
*/
typedef enum {
- WIFI_MANAGER_RSSI_LEVEL_0 = 0, /**< level 0 */
- WIFI_MANAGER_RSSI_LEVEL_1 = 1, /**< level 1 */
- WIFI_MANAGER_RSSI_LEVEL_2 = 2, /**< level 2 */
- WIFI_MANAGER_RSSI_LEVEL_3 = 3, /**< level 3 */
- WIFI_MANAGER_RSSI_LEVEL_4 = 4, /**< level 4 */
+ WIFI_MANAGER_RSSI_LEVEL_0 = 0, /**< No signal */
+ WIFI_MANAGER_RSSI_LEVEL_1 = 1, /**< Very weak signal ~ -83dBm */
+ WIFI_MANAGER_RSSI_LEVEL_2 = 2, /**< Weak signal -82 ~ -75dBm */
+ WIFI_MANAGER_RSSI_LEVEL_3 = 3, /**< Strong signal -74 ~ -64dBm */
+ WIFI_MANAGER_RSSI_LEVEL_4 = 4, /**< Very strong signal -63dBm ~ */
} wifi_manager_rssi_level_e;
/**
* @brief Gets the RSSI.
* @since_tizen 3.0
* @param[in] ap The access point handle
- * @param[out] rssi The RSSI
+ * @param[out] rssi The RSSI value (in dBm)
* @return 0 on success, otherwise negative error value
* @retval #WIFI_MANAGER_ERROR_NONE Successful
* @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
int wifi_manager_ap_get_rssi(wifi_manager_ap_h ap, int *rssi);
/**
+ * @brief Gets the RSSI level.
+ * @since_tizen 4.0
+ * @param[in] ap The access point handle
+ * @param[out] rssi_level The RSSI level
+ * @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_NOT_SUPPORTED Not supported
+ */
+int wifi_manager_ap_get_rssi_level(wifi_manager_ap_h ap, wifi_manager_rssi_level_e *rssi_level);
+
+/**
* @brief Gets the frequency band (MHz).
* @since_tizen 3.0
* @param[in] ap The access point handle
return WIFI_MANAGER_ERROR_NONE;
}
+EXPORT_API int wifi_manager_ap_get_rssi_level(wifi_manager_ap_h ap, wifi_manager_rssi_level_e *rssi_level)
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ int rssi_dbm = 0;
+
+ if (_wifi_check_ap_validity(ap) == false || rssi_level == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ net_profile_info_s *profile_info = ap;
+ rssi_dbm = (int)(profile_info->Strength - 120);
+
+ /* Wi-Fi Signal Strength Display
+ *
+ * No signal : 0
+ * Excellent : -63 ~
+ * Good : -74 ~ -64
+ * Weak : -82 ~ -75
+ * Very weak : -83 ~
+ */
+
+ if (rssi_dbm == 0)
+ *rssi_level = WIFI_MANAGER_RSSI_LEVEL_0;
+ else if (rssi_dbm >= -63)
+ *rssi_level = WIFI_MANAGER_RSSI_LEVEL_4;
+ else if (rssi_dbm >= -74)
+ *rssi_level = WIFI_MANAGER_RSSI_LEVEL_3;
+ else if (rssi_dbm >= -82)
+ *rssi_level = WIFI_MANAGER_RSSI_LEVEL_2;
+ else
+ *rssi_level = WIFI_MANAGER_RSSI_LEVEL_1;
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
EXPORT_API int wifi_manager_ap_get_frequency(wifi_manager_ap_h ap, int *frequency)
{
CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
bool bool_value;
char *ap_name_part = (char*)user_data;
wifi_manager_disconnect_reason_e disconnect_reason;
+ wifi_manager_rssi_level_e rssi_level;
rv = wifi_manager_ap_get_essid(ap, &ap_name);
if (rv != WIFI_MANAGER_ERROR_NONE) {
else
printf("Fail to get RSSI\n");
+ if (wifi_manager_ap_get_rssi_level(ap, &rssi_level) == WIFI_MANAGER_ERROR_NONE)
+ printf("RSSI level : %d\n", rssi_level);
+ else
+ printf("Fail to get RSSI level\n");
+
if (wifi_manager_ap_get_frequency(ap, &int_value) == WIFI_MANAGER_ERROR_NONE)
printf("Frequency : %d\n", int_value);
else