Loading wifi/1.0/default/failure_reason_util.cpp +17 −15 Original line number Diff line number Diff line Loading @@ -16,11 +16,11 @@ #include "failure_reason_util.h" using ::android::hardware::wifi::V1_0::CommandFailureReason; namespace android { namespace hardware { namespace wifi { namespace V1_0 { namespace implementation { std::string LegacyErrorToString(wifi_error error) { switch (error) { Loading Loading @@ -48,16 +48,16 @@ std::string LegacyErrorToString(wifi_error error) { } } V1_0::FailureReason CreateFailureReason( CommandFailureReason reason, const std::string& description) { V1_0::FailureReason result; FailureReason CreateFailureReason(CommandFailureReason reason, const std::string& description) { FailureReason result; result.reason = reason; result.description = description.data(); return result; } V1_0::FailureReason CreateFailureReasonLegacyError( wifi_error error, const std::string& desc) { FailureReason CreateFailureReasonLegacyError(wifi_error error, const std::string& desc) { switch (error) { case WIFI_ERROR_UNINITIALIZED: case WIFI_ERROR_NOT_AVAILABLE: Loading @@ -71,16 +71,16 @@ V1_0::FailureReason CreateFailureReasonLegacyError( return CreateFailureReason(CommandFailureReason::INVALID_ARGS, desc); case WIFI_ERROR_TIMED_OUT: return CreateFailureReason( CommandFailureReason::UNKNOWN, desc + ", timed out"); return CreateFailureReason(CommandFailureReason::UNKNOWN, desc + ", timed out"); case WIFI_ERROR_TOO_MANY_REQUESTS: return CreateFailureReason( CommandFailureReason::UNKNOWN, desc + ", too many requests"); return CreateFailureReason(CommandFailureReason::UNKNOWN, desc + ", too many requests"); case WIFI_ERROR_OUT_OF_MEMORY: return CreateFailureReason( CommandFailureReason::UNKNOWN, desc + ", out of memory"); return CreateFailureReason(CommandFailureReason::UNKNOWN, desc + ", out of memory"); case WIFI_ERROR_NONE: case WIFI_ERROR_UNKNOWN: Loading @@ -89,6 +89,8 @@ V1_0::FailureReason CreateFailureReasonLegacyError( } } } // namespace implementation } // namespace V1_0 } // namespace wifi } // namespace hardware } // namespace android wifi/1.0/default/failure_reason_util.h +8 −4 Original line number Diff line number Diff line Loading @@ -23,14 +23,18 @@ namespace android { namespace hardware { namespace wifi { namespace V1_0 { namespace implementation { std::string LegacyErrorToString(wifi_error error); V1_0::FailureReason CreateFailureReason( V1_0::CommandFailureReason reason, const std::string& description); V1_0::FailureReason CreateFailureReasonLegacyError( wifi_error error, const std::string& description); FailureReason CreateFailureReason(CommandFailureReason reason, const std::string& description); FailureReason CreateFailureReasonLegacyError(wifi_error error, const std::string& description); } // namespace implementation } // namespace V1_0 } // namespace wifi } // namespace hardware } // namespace android Loading wifi/1.0/default/service.cpp +10 −9 Original line number Diff line number Diff line Loading @@ -36,15 +36,15 @@ int OnBinderReadReady(int /*fd*/, int /*events*/, void* /*data*/) { } int main(int /*argc*/, char** argv) { android::base::InitLogging( argv, android::base::LogdLogger(android::base::SYSTEM)); android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM)); LOG(INFO) << "wifi_hal_legacy is starting up..."; // Setup binder int binder_fd = -1; ProcessState::self()->setThreadPoolMaxThreadCount(0); CHECK_EQ(IPCThreadState::self()->setupPolling(&binder_fd), android::NO_ERROR) << "Failed to initialize binder polling"; CHECK_EQ(IPCThreadState::self()->setupPolling(&binder_fd), android::NO_ERROR) << "Failed to initialize binder polling"; CHECK_GE(binder_fd, 0) << "Invalid binder FD: " << binder_fd; // Setup looper Loading @@ -54,13 +54,14 @@ int main(int /*argc*/, char** argv) { << "Failed to watch binder FD"; // Setup hwbinder service android::sp<android::hardware::wifi::Wifi> service = new android::hardware::wifi::Wifi(looper); CHECK_EQ(service->registerAsService("wifi"), android::NO_ERROR) << "Failed to register wifi HAL"; android::sp<android::hardware::wifi::V1_0::IWifi> service = new android::hardware::wifi::V1_0::implementation::Wifi(looper); CHECK_EQ(service->registerAsService("wifi"), android::NO_ERROR) << "Failed to register wifi HAL"; // Loop while (looper->pollAll(-1) != Looper::POLL_ERROR); while (looper->pollAll(-1) != Looper::POLL_ERROR) ; LOG(INFO) << "wifi_hal_legacy is terminating..."; return 0; Loading wifi/1.0/default/wifi.cpp +14 −13 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ #include "failure_reason_util.h" #include "wifi_chip.h" using ::android::hardware::wifi::V1_0::CommandFailureReason; using RunState = ::android::hardware::wifi::WifiHalState::RunState; namespace { Loading @@ -36,6 +35,8 @@ std::string GetWlanInterfaceName() { namespace android { namespace hardware { namespace wifi { namespace V1_0 { namespace implementation { Wifi::Wifi(sp<Looper>& looper) : state_(looper) { CHECK_EQ(init_wifi_vendor_hal_func_table(&state_.func_table_), WIFI_SUCCESS) Loading @@ -43,7 +44,7 @@ Wifi::Wifi(sp<Looper>& looper) : state_(looper) { } Return<void> Wifi::registerEventCallback( const sp<V1_0::IWifiEventCallback>& callback) { const sp<IWifiEventCallback>& callback) { // TODO(b/31632518): remove the callback when the client is destroyed callbacks_.insert(callback); return Void(); Loading Loading @@ -72,8 +73,8 @@ Return<void> Wifi::start() { if (status != WIFI_SUCCESS) { LOG(ERROR) << "Failed to initialize Wifi HAL"; for (auto& callback : callbacks_) { callback->onStartFailure(CreateFailureReasonLegacyError( status, "Failed to initialize HAL")); callback->onStartFailure( CreateFailureReasonLegacyError(status, "Failed to initialize HAL")); } return Void(); } Loading @@ -95,8 +96,7 @@ Return<void> Wifi::start() { return Void(); } wifi_interface_handle Wifi::FindInterfaceHandle( const std::string& ifname) { wifi_interface_handle Wifi::FindInterfaceHandle(const std::string& ifname) { int num_iface_handles = 0; wifi_interface_handle* iface_handles = nullptr; wifi_error ret = state_.func_table_.wifi_get_ifaces( Loading Loading @@ -124,7 +124,6 @@ wifi_interface_handle Wifi::FindInterfaceHandle( return kInterfaceNotFoundHandle; } void NoopHalCleanupHandler(wifi_handle) {} Return<void> Wifi::stop() { Loading @@ -142,7 +141,8 @@ Return<void> Wifi::stop() { awaiting_hal_event_loop_termination_ = true; state_.run_state_ = RunState::STOPPING; if (chip_.get()) chip_->Invalidate(); if (chip_.get()) chip_->Invalidate(); chip_.clear(); state_.func_table_.wifi_cleanup(state_.hal_handle_, NoopHalCleanupHandler); Loading Loading @@ -176,12 +176,13 @@ void Wifi::FinishHalCleanup() { } } Return<void> Wifi::getChip(getChip_cb cb) { cb(chip_); return Void(); } } // namespace implementation } // namespace V1_0 } // namespace wifi } // namespace hardware } // namespace android wifi/1.0/default/wifi.h +9 −6 Original line number Diff line number Diff line Loading @@ -21,25 +21,26 @@ #include <set> #include <thread> #include <android/hardware/wifi/1.0/IWifi.h> #include <android-base/macros.h> #include <android/hardware/wifi/1.0/IWifi.h> #include <hardware_legacy/wifi_hal.h> #include <utils/Looper.h> #include "wifi_hal_state.h" #include "wifi_chip.h" namespace android { namespace hardware { namespace wifi { namespace V1_0 { namespace implementation { class WifiChip; class Wifi : public V1_0::IWifi { class Wifi : public IWifi { public: Wifi(sp<Looper>& looper); Return<void> registerEventCallback( const sp<V1_0::IWifiEventCallback>& callback) override; const sp<IWifiEventCallback>& callback) override; Return<bool> isStarted() override; Return<void> start() override; Loading @@ -63,7 +64,7 @@ class Wifi : public V1_0::IWifi { */ void DoHalEventLoop(); std::set<sp<V1_0::IWifiEventCallback>> callbacks_; std::set<sp<IWifiEventCallback>> callbacks_; sp<WifiChip> chip_; WifiHalState state_; Loading @@ -76,6 +77,8 @@ class Wifi : public V1_0::IWifi { DISALLOW_COPY_AND_ASSIGN(Wifi); }; } // namespace implementation } // namespace V1_0 } // namespace wifi } // namespace hardware } // namespace android Loading Loading
wifi/1.0/default/failure_reason_util.cpp +17 −15 Original line number Diff line number Diff line Loading @@ -16,11 +16,11 @@ #include "failure_reason_util.h" using ::android::hardware::wifi::V1_0::CommandFailureReason; namespace android { namespace hardware { namespace wifi { namespace V1_0 { namespace implementation { std::string LegacyErrorToString(wifi_error error) { switch (error) { Loading Loading @@ -48,16 +48,16 @@ std::string LegacyErrorToString(wifi_error error) { } } V1_0::FailureReason CreateFailureReason( CommandFailureReason reason, const std::string& description) { V1_0::FailureReason result; FailureReason CreateFailureReason(CommandFailureReason reason, const std::string& description) { FailureReason result; result.reason = reason; result.description = description.data(); return result; } V1_0::FailureReason CreateFailureReasonLegacyError( wifi_error error, const std::string& desc) { FailureReason CreateFailureReasonLegacyError(wifi_error error, const std::string& desc) { switch (error) { case WIFI_ERROR_UNINITIALIZED: case WIFI_ERROR_NOT_AVAILABLE: Loading @@ -71,16 +71,16 @@ V1_0::FailureReason CreateFailureReasonLegacyError( return CreateFailureReason(CommandFailureReason::INVALID_ARGS, desc); case WIFI_ERROR_TIMED_OUT: return CreateFailureReason( CommandFailureReason::UNKNOWN, desc + ", timed out"); return CreateFailureReason(CommandFailureReason::UNKNOWN, desc + ", timed out"); case WIFI_ERROR_TOO_MANY_REQUESTS: return CreateFailureReason( CommandFailureReason::UNKNOWN, desc + ", too many requests"); return CreateFailureReason(CommandFailureReason::UNKNOWN, desc + ", too many requests"); case WIFI_ERROR_OUT_OF_MEMORY: return CreateFailureReason( CommandFailureReason::UNKNOWN, desc + ", out of memory"); return CreateFailureReason(CommandFailureReason::UNKNOWN, desc + ", out of memory"); case WIFI_ERROR_NONE: case WIFI_ERROR_UNKNOWN: Loading @@ -89,6 +89,8 @@ V1_0::FailureReason CreateFailureReasonLegacyError( } } } // namespace implementation } // namespace V1_0 } // namespace wifi } // namespace hardware } // namespace android
wifi/1.0/default/failure_reason_util.h +8 −4 Original line number Diff line number Diff line Loading @@ -23,14 +23,18 @@ namespace android { namespace hardware { namespace wifi { namespace V1_0 { namespace implementation { std::string LegacyErrorToString(wifi_error error); V1_0::FailureReason CreateFailureReason( V1_0::CommandFailureReason reason, const std::string& description); V1_0::FailureReason CreateFailureReasonLegacyError( wifi_error error, const std::string& description); FailureReason CreateFailureReason(CommandFailureReason reason, const std::string& description); FailureReason CreateFailureReasonLegacyError(wifi_error error, const std::string& description); } // namespace implementation } // namespace V1_0 } // namespace wifi } // namespace hardware } // namespace android Loading
wifi/1.0/default/service.cpp +10 −9 Original line number Diff line number Diff line Loading @@ -36,15 +36,15 @@ int OnBinderReadReady(int /*fd*/, int /*events*/, void* /*data*/) { } int main(int /*argc*/, char** argv) { android::base::InitLogging( argv, android::base::LogdLogger(android::base::SYSTEM)); android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM)); LOG(INFO) << "wifi_hal_legacy is starting up..."; // Setup binder int binder_fd = -1; ProcessState::self()->setThreadPoolMaxThreadCount(0); CHECK_EQ(IPCThreadState::self()->setupPolling(&binder_fd), android::NO_ERROR) << "Failed to initialize binder polling"; CHECK_EQ(IPCThreadState::self()->setupPolling(&binder_fd), android::NO_ERROR) << "Failed to initialize binder polling"; CHECK_GE(binder_fd, 0) << "Invalid binder FD: " << binder_fd; // Setup looper Loading @@ -54,13 +54,14 @@ int main(int /*argc*/, char** argv) { << "Failed to watch binder FD"; // Setup hwbinder service android::sp<android::hardware::wifi::Wifi> service = new android::hardware::wifi::Wifi(looper); CHECK_EQ(service->registerAsService("wifi"), android::NO_ERROR) << "Failed to register wifi HAL"; android::sp<android::hardware::wifi::V1_0::IWifi> service = new android::hardware::wifi::V1_0::implementation::Wifi(looper); CHECK_EQ(service->registerAsService("wifi"), android::NO_ERROR) << "Failed to register wifi HAL"; // Loop while (looper->pollAll(-1) != Looper::POLL_ERROR); while (looper->pollAll(-1) != Looper::POLL_ERROR) ; LOG(INFO) << "wifi_hal_legacy is terminating..."; return 0; Loading
wifi/1.0/default/wifi.cpp +14 −13 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ #include "failure_reason_util.h" #include "wifi_chip.h" using ::android::hardware::wifi::V1_0::CommandFailureReason; using RunState = ::android::hardware::wifi::WifiHalState::RunState; namespace { Loading @@ -36,6 +35,8 @@ std::string GetWlanInterfaceName() { namespace android { namespace hardware { namespace wifi { namespace V1_0 { namespace implementation { Wifi::Wifi(sp<Looper>& looper) : state_(looper) { CHECK_EQ(init_wifi_vendor_hal_func_table(&state_.func_table_), WIFI_SUCCESS) Loading @@ -43,7 +44,7 @@ Wifi::Wifi(sp<Looper>& looper) : state_(looper) { } Return<void> Wifi::registerEventCallback( const sp<V1_0::IWifiEventCallback>& callback) { const sp<IWifiEventCallback>& callback) { // TODO(b/31632518): remove the callback when the client is destroyed callbacks_.insert(callback); return Void(); Loading Loading @@ -72,8 +73,8 @@ Return<void> Wifi::start() { if (status != WIFI_SUCCESS) { LOG(ERROR) << "Failed to initialize Wifi HAL"; for (auto& callback : callbacks_) { callback->onStartFailure(CreateFailureReasonLegacyError( status, "Failed to initialize HAL")); callback->onStartFailure( CreateFailureReasonLegacyError(status, "Failed to initialize HAL")); } return Void(); } Loading @@ -95,8 +96,7 @@ Return<void> Wifi::start() { return Void(); } wifi_interface_handle Wifi::FindInterfaceHandle( const std::string& ifname) { wifi_interface_handle Wifi::FindInterfaceHandle(const std::string& ifname) { int num_iface_handles = 0; wifi_interface_handle* iface_handles = nullptr; wifi_error ret = state_.func_table_.wifi_get_ifaces( Loading Loading @@ -124,7 +124,6 @@ wifi_interface_handle Wifi::FindInterfaceHandle( return kInterfaceNotFoundHandle; } void NoopHalCleanupHandler(wifi_handle) {} Return<void> Wifi::stop() { Loading @@ -142,7 +141,8 @@ Return<void> Wifi::stop() { awaiting_hal_event_loop_termination_ = true; state_.run_state_ = RunState::STOPPING; if (chip_.get()) chip_->Invalidate(); if (chip_.get()) chip_->Invalidate(); chip_.clear(); state_.func_table_.wifi_cleanup(state_.hal_handle_, NoopHalCleanupHandler); Loading Loading @@ -176,12 +176,13 @@ void Wifi::FinishHalCleanup() { } } Return<void> Wifi::getChip(getChip_cb cb) { cb(chip_); return Void(); } } // namespace implementation } // namespace V1_0 } // namespace wifi } // namespace hardware } // namespace android
wifi/1.0/default/wifi.h +9 −6 Original line number Diff line number Diff line Loading @@ -21,25 +21,26 @@ #include <set> #include <thread> #include <android/hardware/wifi/1.0/IWifi.h> #include <android-base/macros.h> #include <android/hardware/wifi/1.0/IWifi.h> #include <hardware_legacy/wifi_hal.h> #include <utils/Looper.h> #include "wifi_hal_state.h" #include "wifi_chip.h" namespace android { namespace hardware { namespace wifi { namespace V1_0 { namespace implementation { class WifiChip; class Wifi : public V1_0::IWifi { class Wifi : public IWifi { public: Wifi(sp<Looper>& looper); Return<void> registerEventCallback( const sp<V1_0::IWifiEventCallback>& callback) override; const sp<IWifiEventCallback>& callback) override; Return<bool> isStarted() override; Return<void> start() override; Loading @@ -63,7 +64,7 @@ class Wifi : public V1_0::IWifi { */ void DoHalEventLoop(); std::set<sp<V1_0::IWifiEventCallback>> callbacks_; std::set<sp<IWifiEventCallback>> callbacks_; sp<WifiChip> chip_; WifiHalState state_; Loading @@ -76,6 +77,8 @@ class Wifi : public V1_0::IWifi { DISALLOW_COPY_AND_ASSIGN(Wifi); }; } // namespace implementation } // namespace V1_0 } // namespace wifi } // namespace hardware } // namespace android Loading