mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 22:04:26 +00:00
wifi: Rename failure_reason_util to wifi_status_util am: 1922482a5c am: 5aaf00608a
am: e9d9899587
Change-Id: I80451107271a98a1e36280dee8fc452c32048ae1
This commit is contained in:
@@ -18,7 +18,6 @@ LOCAL_MODULE := android.hardware.wifi@1.0-impl
|
||||
LOCAL_MODULE_RELATIVE_PATH := hw
|
||||
LOCAL_CPPFLAGS := -std=c++11 -Wall -Wno-unused-parameter -Werror -Wextra
|
||||
LOCAL_SRC_FILES := \
|
||||
failure_reason_util.cpp \
|
||||
wifi.cpp \
|
||||
wifi_ap_iface.cpp \
|
||||
wifi_chip.cpp \
|
||||
@@ -26,7 +25,8 @@ LOCAL_SRC_FILES := \
|
||||
wifi_nan_iface.cpp \
|
||||
wifi_p2p_iface.cpp \
|
||||
wifi_rtt_controller.cpp \
|
||||
wifi_sta_iface.cpp
|
||||
wifi_sta_iface.cpp \
|
||||
wifi_status_util.cpp
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
android.hardware.wifi@1.0 \
|
||||
libbase \
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "failure_reason_util.h"
|
||||
#include "wifi_status_util.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
@@ -22,7 +22,7 @@ namespace wifi {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
std::string LegacyErrorToString(wifi_error error) {
|
||||
std::string legacyErrorToString(wifi_error error) {
|
||||
switch (error) {
|
||||
case WIFI_SUCCESS:
|
||||
return "SUCCESS";
|
||||
@@ -48,47 +48,57 @@ std::string LegacyErrorToString(wifi_error error) {
|
||||
}
|
||||
}
|
||||
|
||||
FailureReason CreateFailureReason(CommandFailureReason reason,
|
||||
const std::string& description) {
|
||||
FailureReason result;
|
||||
result.reason = reason;
|
||||
WifiStatus createWifiStatus(WifiStatusCode code,
|
||||
const std::string& description) {
|
||||
WifiStatus result;
|
||||
result.code = code;
|
||||
result.description = description.data();
|
||||
return result;
|
||||
}
|
||||
|
||||
FailureReason CreateFailureReasonLegacyError(wifi_error error,
|
||||
const std::string& desc) {
|
||||
WifiStatus createWifiStatus(WifiStatusCode code) {
|
||||
return createWifiStatus(code, "");
|
||||
}
|
||||
|
||||
WifiStatus createWifiStatusFromLegacyError(wifi_error error,
|
||||
const std::string& desc) {
|
||||
switch (error) {
|
||||
case WIFI_ERROR_UNINITIALIZED:
|
||||
case WIFI_ERROR_NOT_AVAILABLE:
|
||||
return CreateFailureReason(CommandFailureReason::NOT_AVAILABLE, desc);
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, desc);
|
||||
|
||||
case WIFI_ERROR_NOT_SUPPORTED:
|
||||
return CreateFailureReason(CommandFailureReason::NOT_SUPPORTED, desc);
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED, desc);
|
||||
|
||||
case WIFI_ERROR_INVALID_ARGS:
|
||||
case WIFI_ERROR_INVALID_REQUEST_ID:
|
||||
return CreateFailureReason(CommandFailureReason::INVALID_ARGS, desc);
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS, desc);
|
||||
|
||||
case WIFI_ERROR_TIMED_OUT:
|
||||
return CreateFailureReason(CommandFailureReason::UNKNOWN,
|
||||
desc + ", timed out");
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
|
||||
desc + ", timed out");
|
||||
|
||||
case WIFI_ERROR_TOO_MANY_REQUESTS:
|
||||
return CreateFailureReason(CommandFailureReason::UNKNOWN,
|
||||
desc + ", too many requests");
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
|
||||
desc + ", too many requests");
|
||||
|
||||
case WIFI_ERROR_OUT_OF_MEMORY:
|
||||
return CreateFailureReason(CommandFailureReason::UNKNOWN,
|
||||
desc + ", out of memory");
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
|
||||
desc + ", out of memory");
|
||||
|
||||
case WIFI_ERROR_NONE:
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS, desc);
|
||||
|
||||
case WIFI_ERROR_UNKNOWN:
|
||||
default:
|
||||
return CreateFailureReason(CommandFailureReason::UNKNOWN, "unknown");
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, "unknown");
|
||||
}
|
||||
}
|
||||
|
||||
WifiStatus createWifiStatusFromLegacyError(wifi_error error) {
|
||||
return createWifiStatusFromLegacyError(error, "");
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace wifi
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FAILURE_REASON_UTIL_H_
|
||||
#define FAILURE_REASON_UTIL_H_
|
||||
#ifndef WIFI_STATUS_UTIL_H_
|
||||
#define WIFI_STATUS_UTIL_H_
|
||||
|
||||
#include <android/hardware/wifi/1.0/IWifi.h>
|
||||
#include <hardware_legacy/wifi_hal.h>
|
||||
@@ -26,12 +26,14 @@ namespace wifi {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
std::string LegacyErrorToString(wifi_error error);
|
||||
std::string legacyErrorToString(wifi_error error);
|
||||
|
||||
FailureReason CreateFailureReason(CommandFailureReason reason,
|
||||
const std::string& description);
|
||||
FailureReason CreateFailureReasonLegacyError(wifi_error error,
|
||||
const std::string& description);
|
||||
WifiStatus createWifiStatus(WifiStatusCode code,
|
||||
const std::string& description);
|
||||
WifiStatus createWifiStatus(WifiStatusCode code);
|
||||
WifiStatus createWifiStatusFromLegacyError(wifi_error error,
|
||||
const std::string& description);
|
||||
WifiStatus createWifiStatusFromLegacyError(wifi_error error);
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
@@ -39,4 +41,4 @@ FailureReason CreateFailureReasonLegacyError(wifi_error error,
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // FAILURE_REASON_UTIL_H_
|
||||
#endif // WIFI_STATUS_UTIL_H_
|
||||
Reference in New Issue
Block a user