Merge "wifi: Don't include legacy hal header in wifi_status_util"

This commit is contained in:
Roshan Pius 2016-12-02 20:29:01 +00:00 committed by Gerrit Code Review
commit 786c00d72e
4 changed files with 40 additions and 38 deletions

View file

@ -98,8 +98,8 @@ WifiStatus Wifi::startInternal() {
}
LOG(INFO) << "Starting HAL";
wifi_error legacy_status = legacy_hal_->start();
if (legacy_status != WIFI_SUCCESS) {
legacy_hal::wifi_error legacy_status = legacy_hal_->start();
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
LOG(ERROR) << "Failed to start Wifi HAL: "
<< legacyErrorToString(legacy_status);
return createWifiStatusFromLegacyError(legacy_status,
@ -139,8 +139,9 @@ WifiStatus Wifi::stopInternal() {
};
}
};
wifi_error legacy_status = legacy_hal_->stop(on_complete_callback_);
if (legacy_status != WIFI_SUCCESS) {
legacy_hal::wifi_error legacy_status =
legacy_hal_->stop(on_complete_callback_);
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
LOG(ERROR) << "Failed to stop Wifi HAL: "
<< legacyErrorToString(legacy_status);
WifiStatus wifi_status =

View file

@ -319,10 +319,10 @@ std::pair<WifiStatus, uint32_t> WifiChip::getModeInternal() {
std::pair<WifiStatus, IWifiChip::ChipDebugInfo>
WifiChip::requestChipDebugInfoInternal() {
IWifiChip::ChipDebugInfo result;
wifi_error legacy_status;
legacy_hal::wifi_error legacy_status;
std::string driver_desc;
std::tie(legacy_status, driver_desc) = legacy_hal_.lock()->getDriverVersion();
if (legacy_status != WIFI_SUCCESS) {
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get driver version: "
<< legacyErrorToString(legacy_status);
WifiStatus status = createWifiStatusFromLegacyError(
@ -334,7 +334,7 @@ WifiChip::requestChipDebugInfoInternal() {
std::string firmware_desc;
std::tie(legacy_status, firmware_desc) =
legacy_hal_.lock()->getFirmwareVersion();
if (legacy_status != WIFI_SUCCESS) {
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get firmware version: "
<< legacyErrorToString(legacy_status);
WifiStatus status = createWifiStatusFromLegacyError(
@ -348,11 +348,11 @@ WifiChip::requestChipDebugInfoInternal() {
std::pair<WifiStatus, std::vector<uint8_t>>
WifiChip::requestDriverDebugDumpInternal() {
wifi_error legacy_status;
legacy_hal::wifi_error legacy_status;
std::vector<uint8_t> driver_dump;
std::tie(legacy_status, driver_dump) =
legacy_hal_.lock()->requestDriverMemoryDump();
if (legacy_status != WIFI_SUCCESS) {
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get driver debug dump: "
<< legacyErrorToString(legacy_status);
return {createWifiStatusFromLegacyError(legacy_status),
@ -363,11 +363,11 @@ WifiChip::requestDriverDebugDumpInternal() {
std::pair<WifiStatus, std::vector<uint8_t>>
WifiChip::requestFirmwareDebugDumpInternal() {
wifi_error legacy_status;
legacy_hal::wifi_error legacy_status;
std::vector<uint8_t> firmware_dump;
std::tie(legacy_status, firmware_dump) =
legacy_hal_.lock()->requestFirmwareMemoryDump();
if (legacy_status != WIFI_SUCCESS) {
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
LOG(ERROR) << "Failed to get firmware debug dump: "
<< legacyErrorToString(legacy_status);
return {createWifiStatusFromLegacyError(legacy_status), {}};

View file

@ -22,27 +22,27 @@ namespace wifi {
namespace V1_0 {
namespace implementation {
std::string legacyErrorToString(wifi_error error) {
std::string legacyErrorToString(legacy_hal::wifi_error error) {
switch (error) {
case WIFI_SUCCESS:
case legacy_hal::WIFI_SUCCESS:
return "SUCCESS";
case WIFI_ERROR_UNINITIALIZED:
case legacy_hal::WIFI_ERROR_UNINITIALIZED:
return "UNINITIALIZED";
case WIFI_ERROR_NOT_AVAILABLE:
case legacy_hal::WIFI_ERROR_NOT_AVAILABLE:
return "NOT_AVAILABLE";
case WIFI_ERROR_NOT_SUPPORTED:
case legacy_hal::WIFI_ERROR_NOT_SUPPORTED:
return "NOT_SUPPORTED";
case WIFI_ERROR_INVALID_ARGS:
case legacy_hal::WIFI_ERROR_INVALID_ARGS:
return "INVALID_ARGS";
case WIFI_ERROR_INVALID_REQUEST_ID:
case legacy_hal::WIFI_ERROR_INVALID_REQUEST_ID:
return "INVALID_REQUEST_ID";
case WIFI_ERROR_TIMED_OUT:
case legacy_hal::WIFI_ERROR_TIMED_OUT:
return "TIMED_OUT";
case WIFI_ERROR_TOO_MANY_REQUESTS:
case legacy_hal::WIFI_ERROR_TOO_MANY_REQUESTS:
return "TOO_MANY_REQUESTS";
case WIFI_ERROR_OUT_OF_MEMORY:
case legacy_hal::WIFI_ERROR_OUT_OF_MEMORY:
return "OUT_OF_MEMORY";
case WIFI_ERROR_UNKNOWN:
case legacy_hal::WIFI_ERROR_UNKNOWN:
default:
return "UNKNOWN";
}
@ -57,42 +57,42 @@ WifiStatus createWifiStatus(WifiStatusCode code) {
return createWifiStatus(code, "");
}
WifiStatus createWifiStatusFromLegacyError(wifi_error error,
WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error,
const std::string& desc) {
switch (error) {
case WIFI_ERROR_UNINITIALIZED:
case WIFI_ERROR_NOT_AVAILABLE:
case legacy_hal::WIFI_ERROR_UNINITIALIZED:
case legacy_hal::WIFI_ERROR_NOT_AVAILABLE:
return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, desc);
case WIFI_ERROR_NOT_SUPPORTED:
case legacy_hal::WIFI_ERROR_NOT_SUPPORTED:
return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED, desc);
case WIFI_ERROR_INVALID_ARGS:
case WIFI_ERROR_INVALID_REQUEST_ID:
case legacy_hal::WIFI_ERROR_INVALID_ARGS:
case legacy_hal::WIFI_ERROR_INVALID_REQUEST_ID:
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS, desc);
case WIFI_ERROR_TIMED_OUT:
case legacy_hal::WIFI_ERROR_TIMED_OUT:
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
desc + ", timed out");
case WIFI_ERROR_TOO_MANY_REQUESTS:
case legacy_hal::WIFI_ERROR_TOO_MANY_REQUESTS:
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
desc + ", too many requests");
case WIFI_ERROR_OUT_OF_MEMORY:
case legacy_hal::WIFI_ERROR_OUT_OF_MEMORY:
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
desc + ", out of memory");
case WIFI_ERROR_NONE:
case legacy_hal::WIFI_ERROR_NONE:
return createWifiStatus(WifiStatusCode::SUCCESS, desc);
case WIFI_ERROR_UNKNOWN:
case legacy_hal::WIFI_ERROR_UNKNOWN:
default:
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, "unknown");
}
}
WifiStatus createWifiStatusFromLegacyError(wifi_error error) {
WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error) {
return createWifiStatusFromLegacyError(error, "");
}

View file

@ -18,7 +18,8 @@
#define WIFI_STATUS_UTIL_H_
#include <android/hardware/wifi/1.0/IWifi.h>
#include <hardware_legacy/wifi_hal.h>
#include "wifi_legacy_hal.h"
namespace android {
namespace hardware {
@ -26,13 +27,13 @@ namespace wifi {
namespace V1_0 {
namespace implementation {
std::string legacyErrorToString(wifi_error error);
std::string legacyErrorToString(legacy_hal::wifi_error error);
WifiStatus createWifiStatus(WifiStatusCode code,
const std::string& description);
WifiStatus createWifiStatus(WifiStatusCode code);
WifiStatus createWifiStatusFromLegacyError(wifi_error error,
WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error,
const std::string& description);
WifiStatus createWifiStatusFromLegacyError(wifi_error error);
WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error);
} // namespace implementation
} // namespace V1_0