mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
wifi(implementation): Fix formatting
Use the top level clang-format setup by the HIDL team to format the entire implementation. clang-format -i --style file wifi/1.2/default/* Bug: 32287573 Test: Compiles Change-Id: I336c21fd9bfdc560117aa7212f92ab5f01df4b8e
This commit is contained in:
@@ -29,22 +29,23 @@ using on_death_cb_function = std::function<void(uint64_t)>;
|
||||
// callbacks stored in HidlCallbackHandler.
|
||||
template <typename CallbackType>
|
||||
class HidlDeathHandler : public android::hardware::hidl_death_recipient {
|
||||
public:
|
||||
HidlDeathHandler(const on_death_cb_function& user_cb_function)
|
||||
: cb_function_(user_cb_function) {}
|
||||
~HidlDeathHandler() = default;
|
||||
public:
|
||||
HidlDeathHandler(const on_death_cb_function& user_cb_function)
|
||||
: cb_function_(user_cb_function) {}
|
||||
~HidlDeathHandler() = default;
|
||||
|
||||
// Death notification for callbacks.
|
||||
void serviceDied(
|
||||
uint64_t cookie,
|
||||
const android::wp<android::hidl::base::V1_0::IBase>& /* who */) override {
|
||||
cb_function_(cookie);
|
||||
}
|
||||
// Death notification for callbacks.
|
||||
void serviceDied(
|
||||
uint64_t cookie,
|
||||
const android::wp<android::hidl::base::V1_0::IBase>& /* who */)
|
||||
override {
|
||||
cb_function_(cookie);
|
||||
}
|
||||
|
||||
private:
|
||||
on_death_cb_function cb_function_;
|
||||
private:
|
||||
on_death_cb_function cb_function_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(HidlDeathHandler);
|
||||
DISALLOW_COPY_AND_ASSIGN(HidlDeathHandler);
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -58,58 +59,60 @@ template <typename CallbackType>
|
||||
// Provides a class to manage callbacks for the various HIDL interfaces and
|
||||
// handle the death of the process hosting each callback.
|
||||
class HidlCallbackHandler {
|
||||
public:
|
||||
HidlCallbackHandler()
|
||||
: death_handler_(new HidlDeathHandler<CallbackType>(
|
||||
std::bind(&HidlCallbackHandler::onObjectDeath,
|
||||
this,
|
||||
std::placeholders::_1))) {}
|
||||
~HidlCallbackHandler() = default;
|
||||
public:
|
||||
HidlCallbackHandler()
|
||||
: death_handler_(new HidlDeathHandler<CallbackType>(
|
||||
std::bind(&HidlCallbackHandler::onObjectDeath, this,
|
||||
std::placeholders::_1))) {}
|
||||
~HidlCallbackHandler() = default;
|
||||
|
||||
bool addCallback(const sp<CallbackType>& cb) {
|
||||
// TODO(b/33818800): Can't compare proxies yet. So, use the cookie
|
||||
// (callback proxy's raw pointer) to track the death of individual clients.
|
||||
uint64_t cookie = reinterpret_cast<uint64_t>(cb.get());
|
||||
if (cb_set_.find(cb) != cb_set_.end()) {
|
||||
LOG(WARNING) << "Duplicate death notification registration";
|
||||
return true;
|
||||
bool addCallback(const sp<CallbackType>& cb) {
|
||||
// TODO(b/33818800): Can't compare proxies yet. So, use the cookie
|
||||
// (callback proxy's raw pointer) to track the death of individual
|
||||
// clients.
|
||||
uint64_t cookie = reinterpret_cast<uint64_t>(cb.get());
|
||||
if (cb_set_.find(cb) != cb_set_.end()) {
|
||||
LOG(WARNING) << "Duplicate death notification registration";
|
||||
return true;
|
||||
}
|
||||
if (!cb->linkToDeath(death_handler_, cookie)) {
|
||||
LOG(ERROR) << "Failed to register death notification";
|
||||
return false;
|
||||
}
|
||||
cb_set_.insert(cb);
|
||||
return true;
|
||||
}
|
||||
if (!cb->linkToDeath(death_handler_, cookie)) {
|
||||
LOG(ERROR) << "Failed to register death notification";
|
||||
return false;
|
||||
|
||||
const std::set<android::sp<CallbackType>>& getCallbacks() {
|
||||
return cb_set_;
|
||||
}
|
||||
cb_set_.insert(cb);
|
||||
return true;
|
||||
}
|
||||
|
||||
const std::set<android::sp<CallbackType>>& getCallbacks() { return cb_set_; }
|
||||
|
||||
// Death notification for callbacks.
|
||||
void onObjectDeath(uint64_t cookie) {
|
||||
CallbackType* cb = reinterpret_cast<CallbackType*>(cookie);
|
||||
const auto& iter = cb_set_.find(cb);
|
||||
if (iter == cb_set_.end()) {
|
||||
LOG(ERROR) << "Unknown callback death notification received";
|
||||
return;
|
||||
// Death notification for callbacks.
|
||||
void onObjectDeath(uint64_t cookie) {
|
||||
CallbackType* cb = reinterpret_cast<CallbackType*>(cookie);
|
||||
const auto& iter = cb_set_.find(cb);
|
||||
if (iter == cb_set_.end()) {
|
||||
LOG(ERROR) << "Unknown callback death notification received";
|
||||
return;
|
||||
}
|
||||
cb_set_.erase(iter);
|
||||
LOG(DEBUG) << "Dead callback removed from list";
|
||||
}
|
||||
cb_set_.erase(iter);
|
||||
LOG(DEBUG) << "Dead callback removed from list";
|
||||
}
|
||||
|
||||
void invalidate() {
|
||||
for (const sp<CallbackType>& cb : cb_set_) {
|
||||
if (!cb->unlinkToDeath(death_handler_)) {
|
||||
LOG(ERROR) << "Failed to deregister death notification";
|
||||
}
|
||||
void invalidate() {
|
||||
for (const sp<CallbackType>& cb : cb_set_) {
|
||||
if (!cb->unlinkToDeath(death_handler_)) {
|
||||
LOG(ERROR) << "Failed to deregister death notification";
|
||||
}
|
||||
}
|
||||
cb_set_.clear();
|
||||
}
|
||||
cb_set_.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
std::set<sp<CallbackType>> cb_set_;
|
||||
sp<HidlDeathHandler<CallbackType>> death_handler_;
|
||||
private:
|
||||
std::set<sp<CallbackType>> cb_set_;
|
||||
sp<HidlDeathHandler<CallbackType>> death_handler_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(HidlCallbackHandler);
|
||||
DISALLOW_COPY_AND_ASSIGN(HidlCallbackHandler);
|
||||
};
|
||||
|
||||
} // namespace hidl_callback_util
|
||||
|
||||
@@ -41,18 +41,15 @@ using namespace android::hardware::wifi::V1_0;
|
||||
// Use for HIDL methods which return only an instance of WifiStatus.
|
||||
template <typename ObjT, typename WorkFuncT, typename... Args>
|
||||
Return<void> validateAndCall(
|
||||
ObjT* obj,
|
||||
WifiStatusCode status_code_if_invalid,
|
||||
WorkFuncT&& work,
|
||||
const std::function<void(const WifiStatus&)>& hidl_cb,
|
||||
Args&&... args) {
|
||||
const auto lock = hidl_sync_util::acquireGlobalLock();
|
||||
if (obj->isValid()) {
|
||||
hidl_cb((obj->*work)(std::forward<Args>(args)...));
|
||||
} else {
|
||||
hidl_cb(createWifiStatus(status_code_if_invalid));
|
||||
}
|
||||
return Void();
|
||||
ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work,
|
||||
const std::function<void(const WifiStatus&)>& hidl_cb, Args&&... args) {
|
||||
const auto lock = hidl_sync_util::acquireGlobalLock();
|
||||
if (obj->isValid()) {
|
||||
hidl_cb((obj->*work)(std::forward<Args>(args)...));
|
||||
} else {
|
||||
hidl_cb(createWifiStatus(status_code_if_invalid));
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Use for HIDL methods which return only an instance of WifiStatus.
|
||||
@@ -60,71 +57,61 @@ Return<void> validateAndCall(
|
||||
// Note: Only used by IWifi::stop() currently.
|
||||
template <typename ObjT, typename WorkFuncT, typename... Args>
|
||||
Return<void> validateAndCallWithLock(
|
||||
ObjT* obj,
|
||||
WifiStatusCode status_code_if_invalid,
|
||||
WorkFuncT&& work,
|
||||
const std::function<void(const WifiStatus&)>& hidl_cb,
|
||||
Args&&... args) {
|
||||
auto lock = hidl_sync_util::acquireGlobalLock();
|
||||
if (obj->isValid()) {
|
||||
hidl_cb((obj->*work)(&lock, std::forward<Args>(args)...));
|
||||
} else {
|
||||
hidl_cb(createWifiStatus(status_code_if_invalid));
|
||||
}
|
||||
return Void();
|
||||
ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work,
|
||||
const std::function<void(const WifiStatus&)>& hidl_cb, Args&&... args) {
|
||||
auto lock = hidl_sync_util::acquireGlobalLock();
|
||||
if (obj->isValid()) {
|
||||
hidl_cb((obj->*work)(&lock, std::forward<Args>(args)...));
|
||||
} else {
|
||||
hidl_cb(createWifiStatus(status_code_if_invalid));
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Use for HIDL methods which return instance of WifiStatus and a single return
|
||||
// value.
|
||||
template <typename ObjT, typename WorkFuncT, typename ReturnT, typename... Args>
|
||||
Return<void> validateAndCall(
|
||||
ObjT* obj,
|
||||
WifiStatusCode status_code_if_invalid,
|
||||
WorkFuncT&& work,
|
||||
ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work,
|
||||
const std::function<void(const WifiStatus&, ReturnT)>& hidl_cb,
|
||||
Args&&... args) {
|
||||
const auto lock = hidl_sync_util::acquireGlobalLock();
|
||||
if (obj->isValid()) {
|
||||
const auto& ret_pair = (obj->*work)(std::forward<Args>(args)...);
|
||||
const WifiStatus& status = std::get<0>(ret_pair);
|
||||
const auto& ret_value = std::get<1>(ret_pair);
|
||||
hidl_cb(status, ret_value);
|
||||
} else {
|
||||
hidl_cb(createWifiStatus(status_code_if_invalid),
|
||||
typename std::remove_reference<ReturnT>::type());
|
||||
}
|
||||
return Void();
|
||||
const auto lock = hidl_sync_util::acquireGlobalLock();
|
||||
if (obj->isValid()) {
|
||||
const auto& ret_pair = (obj->*work)(std::forward<Args>(args)...);
|
||||
const WifiStatus& status = std::get<0>(ret_pair);
|
||||
const auto& ret_value = std::get<1>(ret_pair);
|
||||
hidl_cb(status, ret_value);
|
||||
} else {
|
||||
hidl_cb(createWifiStatus(status_code_if_invalid),
|
||||
typename std::remove_reference<ReturnT>::type());
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Use for HIDL methods which return instance of WifiStatus and 2 return
|
||||
// values.
|
||||
template <typename ObjT,
|
||||
typename WorkFuncT,
|
||||
typename ReturnT1,
|
||||
typename ReturnT2,
|
||||
typename... Args>
|
||||
template <typename ObjT, typename WorkFuncT, typename ReturnT1,
|
||||
typename ReturnT2, typename... Args>
|
||||
Return<void> validateAndCall(
|
||||
ObjT* obj,
|
||||
WifiStatusCode status_code_if_invalid,
|
||||
WorkFuncT&& work,
|
||||
ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work,
|
||||
const std::function<void(const WifiStatus&, ReturnT1, ReturnT2)>& hidl_cb,
|
||||
Args&&... args) {
|
||||
const auto lock = hidl_sync_util::acquireGlobalLock();
|
||||
if (obj->isValid()) {
|
||||
const auto& ret_tuple = (obj->*work)(std::forward<Args>(args)...);
|
||||
const WifiStatus& status = std::get<0>(ret_tuple);
|
||||
const auto& ret_value1 = std::get<1>(ret_tuple);
|
||||
const auto& ret_value2 = std::get<2>(ret_tuple);
|
||||
hidl_cb(status, ret_value1, ret_value2);
|
||||
} else {
|
||||
hidl_cb(createWifiStatus(status_code_if_invalid),
|
||||
typename std::remove_reference<ReturnT1>::type(),
|
||||
typename std::remove_reference<ReturnT2>::type());
|
||||
}
|
||||
return Void();
|
||||
const auto lock = hidl_sync_util::acquireGlobalLock();
|
||||
if (obj->isValid()) {
|
||||
const auto& ret_tuple = (obj->*work)(std::forward<Args>(args)...);
|
||||
const WifiStatus& status = std::get<0>(ret_tuple);
|
||||
const auto& ret_value1 = std::get<1>(ret_tuple);
|
||||
const auto& ret_value2 = std::get<2>(ret_tuple);
|
||||
hidl_cb(status, ret_value1, ret_value2);
|
||||
} else {
|
||||
hidl_cb(createWifiStatus(status_code_if_invalid),
|
||||
typename std::remove_reference<ReturnT1>::type(),
|
||||
typename std::remove_reference<ReturnT2>::type());
|
||||
}
|
||||
return Void();
|
||||
}
|
||||
|
||||
} // namespace hidl_util
|
||||
} // namespace hidl_return_util
|
||||
} // namespace implementation
|
||||
} // namespace V1_2
|
||||
} // namespace wifi
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,8 +19,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <android/hardware/wifi/1.0/types.h>
|
||||
#include <android/hardware/wifi/1.0/IWifiChip.h>
|
||||
#include <android/hardware/wifi/1.0/types.h>
|
||||
#include <android/hardware/wifi/1.1/IWifiChip.h>
|
||||
|
||||
#include "wifi_legacy_hal.h"
|
||||
@@ -41,8 +41,7 @@ using namespace android::hardware::wifi::V1_0;
|
||||
|
||||
// Chip conversion methods.
|
||||
bool convertLegacyFeaturesToHidlChipCapabilities(
|
||||
uint32_t legacy_feature_set,
|
||||
uint32_t legacy_logger_feature_set,
|
||||
uint32_t legacy_feature_set, uint32_t legacy_logger_feature_set,
|
||||
uint32_t* hidl_caps);
|
||||
bool convertLegacyDebugRingBufferStatusToHidl(
|
||||
const legacy_hal::wifi_ring_buffer_status& legacy_status,
|
||||
@@ -58,8 +57,7 @@ legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy(
|
||||
|
||||
// STA iface conversion methods.
|
||||
bool convertLegacyFeaturesToHidlStaCapabilities(
|
||||
uint32_t legacy_feature_set,
|
||||
uint32_t legacy_logger_feature_set,
|
||||
uint32_t legacy_feature_set, uint32_t legacy_logger_feature_set,
|
||||
uint32_t* hidl_caps);
|
||||
bool convertLegacyApfCapabilitiesToHidl(
|
||||
const legacy_hal::PacketFilterCapabilities& legacy_caps,
|
||||
@@ -74,8 +72,7 @@ bool convertHidlGscanParamsToLegacy(
|
||||
// |has_ie_data| indicates whether or not the wifi_scan_result includes 802.11
|
||||
// Information Elements (IEs)
|
||||
bool convertLegacyGscanResultToHidl(
|
||||
const legacy_hal::wifi_scan_result& legacy_scan_result,
|
||||
bool has_ie_data,
|
||||
const legacy_hal::wifi_scan_result& legacy_scan_result, bool has_ie_data,
|
||||
StaScanResult* hidl_scan_result);
|
||||
// |cached_results| is assumed to not include IEs.
|
||||
bool convertLegacyVectorOfCachedGscanResultsToHidl(
|
||||
@@ -101,8 +98,8 @@ bool convertLegacyVectorOfDebugRxPacketFateToHidl(
|
||||
std::vector<WifiDebugRxPacketFateReport>* hidl_fates);
|
||||
|
||||
// NAN iface conversion methods.
|
||||
void convertToWifiNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len,
|
||||
WifiNanStatus* wifiNanStatus);
|
||||
void convertToWifiNanStatus(legacy_hal::NanStatusType type, const char* str,
|
||||
size_t max_len, WifiNanStatus* wifiNanStatus);
|
||||
bool convertHidlNanEnableRequestToLegacy(
|
||||
const NanEnableRequest& hidl_request,
|
||||
legacy_hal::NanEnableRequest* legacy_request);
|
||||
@@ -133,7 +130,8 @@ bool convertLegacyNanCapabilitiesResponseToHidl(
|
||||
bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind,
|
||||
NanMatchInd* hidl_ind);
|
||||
bool convertLegacyNanFollowupIndToHidl(
|
||||
const legacy_hal::NanFollowupInd& legacy_ind, NanFollowupReceivedInd* hidl_ind);
|
||||
const legacy_hal::NanFollowupInd& legacy_ind,
|
||||
NanFollowupReceivedInd* hidl_ind);
|
||||
bool convertLegacyNanDataPathRequestIndToHidl(
|
||||
const legacy_hal::NanDataPathRequestInd& legacy_ind,
|
||||
NanDataPathRequestInd* hidl_ind);
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace implementation {
|
||||
namespace hidl_sync_util {
|
||||
|
||||
std::unique_lock<std::recursive_mutex> acquireGlobalLock() {
|
||||
return std::unique_lock<std::recursive_mutex>{g_mutex};
|
||||
return std::unique_lock<std::recursive_mutex>{g_mutex};
|
||||
}
|
||||
|
||||
} // namespace hidl_sync_util
|
||||
|
||||
@@ -25,20 +25,20 @@ using android::hardware::configureRpcThreadpool;
|
||||
using android::hardware::joinRpcThreadpool;
|
||||
|
||||
int main(int /*argc*/, char** argv) {
|
||||
android::base::InitLogging(argv,
|
||||
android::base::LogdLogger(android::base::SYSTEM));
|
||||
LOG(INFO) << "Wifi Hal is booting up...";
|
||||
android::base::InitLogging(
|
||||
argv, android::base::LogdLogger(android::base::SYSTEM));
|
||||
LOG(INFO) << "Wifi Hal is booting up...";
|
||||
|
||||
configureRpcThreadpool(1, true /* callerWillJoin */);
|
||||
configureRpcThreadpool(1, true /* callerWillJoin */);
|
||||
|
||||
// Setup hwbinder service
|
||||
android::sp<android::hardware::wifi::V1_2::IWifi> service =
|
||||
new android::hardware::wifi::V1_2::implementation::Wifi();
|
||||
CHECK_EQ(service->registerAsService(), android::NO_ERROR)
|
||||
<< "Failed to register wifi HAL";
|
||||
// Setup hwbinder service
|
||||
android::sp<android::hardware::wifi::V1_2::IWifi> service =
|
||||
new android::hardware::wifi::V1_2::implementation::Wifi();
|
||||
CHECK_EQ(service->registerAsService(), android::NO_ERROR)
|
||||
<< "Failed to register wifi HAL";
|
||||
|
||||
joinRpcThreadpool();
|
||||
joinRpcThreadpool();
|
||||
|
||||
LOG(INFO) << "Wifi Hal is terminating...";
|
||||
return 0;
|
||||
LOG(INFO) << "Wifi Hal is terminating...";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -39,164 +39,153 @@ Wifi::Wifi()
|
||||
run_state_(RunState::STOPPED) {}
|
||||
|
||||
bool Wifi::isValid() {
|
||||
// This object is always valid.
|
||||
return true;
|
||||
// This object is always valid.
|
||||
return true;
|
||||
}
|
||||
|
||||
Return<void> Wifi::registerEventCallback(
|
||||
const sp<IWifiEventCallback>& event_callback,
|
||||
registerEventCallback_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::registerEventCallbackInternal,
|
||||
hidl_status_cb,
|
||||
event_callback);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::registerEventCallbackInternal, hidl_status_cb,
|
||||
event_callback);
|
||||
}
|
||||
|
||||
Return<bool> Wifi::isStarted() {
|
||||
return run_state_ != RunState::STOPPED;
|
||||
}
|
||||
Return<bool> Wifi::isStarted() { return run_state_ != RunState::STOPPED; }
|
||||
|
||||
Return<void> Wifi::start(start_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::startInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::startInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> Wifi::stop(stop_cb hidl_status_cb) {
|
||||
return validateAndCallWithLock(this, WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::stopInternal, hidl_status_cb);
|
||||
return validateAndCallWithLock(this, WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::stopInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> Wifi::getChipIds(getChipIds_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::getChipIdsInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::getChipIdsInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> Wifi::getChip(ChipId chip_id, getChip_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::getChipInternal,
|
||||
hidl_status_cb,
|
||||
chip_id);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN,
|
||||
&Wifi::getChipInternal, hidl_status_cb, chip_id);
|
||||
}
|
||||
|
||||
WifiStatus Wifi::registerEventCallbackInternal(
|
||||
const sp<IWifiEventCallback>& event_callback) {
|
||||
if (!event_cb_handler_.addCallback(event_callback)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
|
||||
}
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
if (!event_cb_handler_.addCallback(event_callback)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
|
||||
}
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus Wifi::startInternal() {
|
||||
if (run_state_ == RunState::STARTED) {
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
} else if (run_state_ == RunState::STOPPING) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE,
|
||||
"HAL is stopping");
|
||||
}
|
||||
WifiStatus wifi_status = initializeLegacyHal();
|
||||
if (wifi_status.code == WifiStatusCode::SUCCESS) {
|
||||
// Create the chip instance once the HAL is started.
|
||||
chip_ = new WifiChip(kChipId, legacy_hal_, mode_controller_);
|
||||
run_state_ = RunState::STARTED;
|
||||
for (const auto& callback : event_cb_handler_.getCallbacks()) {
|
||||
if (!callback->onStart().isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onStart callback";
|
||||
};
|
||||
if (run_state_ == RunState::STARTED) {
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
} else if (run_state_ == RunState::STOPPING) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE,
|
||||
"HAL is stopping");
|
||||
}
|
||||
LOG(INFO) << "Wifi HAL started";
|
||||
} else {
|
||||
for (const auto& callback : event_cb_handler_.getCallbacks()) {
|
||||
if (!callback->onFailure(wifi_status).isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onFailure callback";
|
||||
}
|
||||
WifiStatus wifi_status = initializeLegacyHal();
|
||||
if (wifi_status.code == WifiStatusCode::SUCCESS) {
|
||||
// Create the chip instance once the HAL is started.
|
||||
chip_ = new WifiChip(kChipId, legacy_hal_, mode_controller_);
|
||||
run_state_ = RunState::STARTED;
|
||||
for (const auto& callback : event_cb_handler_.getCallbacks()) {
|
||||
if (!callback->onStart().isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onStart callback";
|
||||
};
|
||||
}
|
||||
LOG(INFO) << "Wifi HAL started";
|
||||
} else {
|
||||
for (const auto& callback : event_cb_handler_.getCallbacks()) {
|
||||
if (!callback->onFailure(wifi_status).isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onFailure callback";
|
||||
}
|
||||
}
|
||||
LOG(ERROR) << "Wifi HAL start failed";
|
||||
}
|
||||
LOG(ERROR) << "Wifi HAL start failed";
|
||||
}
|
||||
return wifi_status;
|
||||
return wifi_status;
|
||||
}
|
||||
|
||||
WifiStatus Wifi::stopInternal(
|
||||
/* NONNULL */ std::unique_lock<std::recursive_mutex>* lock) {
|
||||
if (run_state_ == RunState::STOPPED) {
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
} else if (run_state_ == RunState::STOPPING) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE,
|
||||
"HAL is stopping");
|
||||
}
|
||||
// Clear the chip object and its child objects since the HAL is now
|
||||
// stopped.
|
||||
if (chip_.get()) {
|
||||
chip_->invalidate();
|
||||
chip_.clear();
|
||||
}
|
||||
WifiStatus wifi_status = stopLegacyHalAndDeinitializeModeController(lock);
|
||||
if (wifi_status.code == WifiStatusCode::SUCCESS) {
|
||||
for (const auto& callback : event_cb_handler_.getCallbacks()) {
|
||||
if (!callback->onStop().isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onStop callback";
|
||||
};
|
||||
if (run_state_ == RunState::STOPPED) {
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
} else if (run_state_ == RunState::STOPPING) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE,
|
||||
"HAL is stopping");
|
||||
}
|
||||
LOG(INFO) << "Wifi HAL stopped";
|
||||
} else {
|
||||
for (const auto& callback : event_cb_handler_.getCallbacks()) {
|
||||
if (!callback->onFailure(wifi_status).isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onFailure callback";
|
||||
}
|
||||
// Clear the chip object and its child objects since the HAL is now
|
||||
// stopped.
|
||||
if (chip_.get()) {
|
||||
chip_->invalidate();
|
||||
chip_.clear();
|
||||
}
|
||||
LOG(ERROR) << "Wifi HAL stop failed";
|
||||
}
|
||||
return wifi_status;
|
||||
WifiStatus wifi_status = stopLegacyHalAndDeinitializeModeController(lock);
|
||||
if (wifi_status.code == WifiStatusCode::SUCCESS) {
|
||||
for (const auto& callback : event_cb_handler_.getCallbacks()) {
|
||||
if (!callback->onStop().isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onStop callback";
|
||||
};
|
||||
}
|
||||
LOG(INFO) << "Wifi HAL stopped";
|
||||
} else {
|
||||
for (const auto& callback : event_cb_handler_.getCallbacks()) {
|
||||
if (!callback->onFailure(wifi_status).isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onFailure callback";
|
||||
}
|
||||
}
|
||||
LOG(ERROR) << "Wifi HAL stop failed";
|
||||
}
|
||||
return wifi_status;
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<ChipId>> Wifi::getChipIdsInternal() {
|
||||
std::vector<ChipId> chip_ids;
|
||||
if (chip_.get()) {
|
||||
chip_ids.emplace_back(kChipId);
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), std::move(chip_ids)};
|
||||
std::vector<ChipId> chip_ids;
|
||||
if (chip_.get()) {
|
||||
chip_ids.emplace_back(kChipId);
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), std::move(chip_ids)};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, sp<IWifiChip>> Wifi::getChipInternal(ChipId chip_id) {
|
||||
if (!chip_.get()) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_NOT_STARTED), nullptr};
|
||||
}
|
||||
if (chip_id != kChipId) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), chip_};
|
||||
if (!chip_.get()) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_NOT_STARTED), nullptr};
|
||||
}
|
||||
if (chip_id != kChipId) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), chip_};
|
||||
}
|
||||
|
||||
WifiStatus Wifi::initializeLegacyHal() {
|
||||
legacy_hal::wifi_error legacy_status = legacy_hal_->initialize();
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to initialize legacy HAL: "
|
||||
<< legacyErrorToString(legacy_status);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
legacy_hal::wifi_error legacy_status = legacy_hal_->initialize();
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to initialize legacy HAL: "
|
||||
<< legacyErrorToString(legacy_status);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus Wifi::stopLegacyHalAndDeinitializeModeController(
|
||||
/* NONNULL */ std::unique_lock<std::recursive_mutex>* lock) {
|
||||
run_state_ = RunState::STOPPING;
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_->stop(lock, [&]() { run_state_ = RunState::STOPPED; });
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to stop legacy HAL: "
|
||||
<< legacyErrorToString(legacy_status);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
if (!mode_controller_->deinitialize()) {
|
||||
LOG(ERROR) << "Failed to deinitialize firmware mode controller";
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
|
||||
}
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
run_state_ = RunState::STOPPING;
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_->stop(lock, [&]() { run_state_ = RunState::STOPPED; });
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to stop legacy HAL: "
|
||||
<< legacyErrorToString(legacy_status);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
if (!mode_controller_->deinitialize()) {
|
||||
LOG(ERROR) << "Failed to deinitialize firmware mode controller";
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
|
||||
}
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
} // namespace implementation
|
||||
} // namespace V1_2
|
||||
|
||||
@@ -38,45 +38,46 @@ namespace implementation {
|
||||
* Root HIDL interface object used to control the Wifi HAL.
|
||||
*/
|
||||
class Wifi : public V1_2::IWifi {
|
||||
public:
|
||||
Wifi();
|
||||
public:
|
||||
Wifi();
|
||||
|
||||
bool isValid();
|
||||
bool isValid();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiEventCallback>& event_callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<bool> isStarted() override;
|
||||
Return<void> start(start_cb hidl_status_cb) override;
|
||||
Return<void> stop(stop_cb hidl_status_cb) override;
|
||||
Return<void> getChipIds(getChipIds_cb hidl_status_cb) override;
|
||||
Return<void> getChip(ChipId chip_id, getChip_cb hidl_status_cb) override;
|
||||
// HIDL methods exposed.
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiEventCallback>& event_callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<bool> isStarted() override;
|
||||
Return<void> start(start_cb hidl_status_cb) override;
|
||||
Return<void> stop(stop_cb hidl_status_cb) override;
|
||||
Return<void> getChipIds(getChipIds_cb hidl_status_cb) override;
|
||||
Return<void> getChip(ChipId chip_id, getChip_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
enum class RunState { STOPPED, STARTED, STOPPING };
|
||||
private:
|
||||
enum class RunState { STOPPED, STARTED, STOPPING };
|
||||
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiEventCallback>& event_callback);
|
||||
WifiStatus startInternal();
|
||||
WifiStatus stopInternal(std::unique_lock<std::recursive_mutex>* lock);
|
||||
std::pair<WifiStatus, std::vector<ChipId>> getChipIdsInternal();
|
||||
std::pair<WifiStatus, sp<IWifiChip>> getChipInternal(ChipId chip_id);
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiEventCallback>& event_callback);
|
||||
WifiStatus startInternal();
|
||||
WifiStatus stopInternal(std::unique_lock<std::recursive_mutex>* lock);
|
||||
std::pair<WifiStatus, std::vector<ChipId>> getChipIdsInternal();
|
||||
std::pair<WifiStatus, sp<IWifiChip>> getChipInternal(ChipId chip_id);
|
||||
|
||||
WifiStatus initializeLegacyHal();
|
||||
WifiStatus stopLegacyHalAndDeinitializeModeController(
|
||||
std::unique_lock<std::recursive_mutex>* lock);
|
||||
WifiStatus initializeLegacyHal();
|
||||
WifiStatus stopLegacyHalAndDeinitializeModeController(
|
||||
std::unique_lock<std::recursive_mutex>* lock);
|
||||
|
||||
// Instance is created in this root level |IWifi| HIDL interface object
|
||||
// and shared with all the child HIDL interface objects.
|
||||
std::shared_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
std::shared_ptr<mode_controller::WifiModeController> mode_controller_;
|
||||
RunState run_state_;
|
||||
sp<WifiChip> chip_;
|
||||
hidl_callback_util::HidlCallbackHandler<IWifiEventCallback> event_cb_handler_;
|
||||
// Instance is created in this root level |IWifi| HIDL interface object
|
||||
// and shared with all the child HIDL interface objects.
|
||||
std::shared_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
std::shared_ptr<mode_controller::WifiModeController> mode_controller_;
|
||||
RunState run_state_;
|
||||
sp<WifiChip> chip_;
|
||||
hidl_callback_util::HidlCallbackHandler<IWifiEventCallback>
|
||||
event_cb_handler_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Wifi);
|
||||
DISALLOW_COPY_AND_ASSIGN(Wifi);
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -34,70 +34,61 @@ WifiApIface::WifiApIface(
|
||||
: ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
|
||||
|
||||
void WifiApIface::invalidate() {
|
||||
legacy_hal_.reset();
|
||||
is_valid_ = false;
|
||||
legacy_hal_.reset();
|
||||
is_valid_ = false;
|
||||
}
|
||||
|
||||
bool WifiApIface::isValid() {
|
||||
return is_valid_;
|
||||
}
|
||||
bool WifiApIface::isValid() { return is_valid_; }
|
||||
|
||||
Return<void> WifiApIface::getName(getName_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiApIface::getNameInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiApIface::getNameInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiApIface::getType(getType_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiApIface::getTypeInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiApIface::getTypeInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiApIface::setCountryCode(const hidl_array<int8_t, 2>& code,
|
||||
setCountryCode_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiApIface::setCountryCodeInternal,
|
||||
hidl_status_cb,
|
||||
code);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiApIface::setCountryCodeInternal, hidl_status_cb,
|
||||
code);
|
||||
}
|
||||
|
||||
Return<void> WifiApIface::getValidFrequenciesForBand(
|
||||
WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiApIface::getValidFrequenciesForBandInternal,
|
||||
hidl_status_cb,
|
||||
band);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiApIface::getValidFrequenciesForBandInternal,
|
||||
hidl_status_cb, band);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::string> WifiApIface::getNameInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, IfaceType> WifiApIface::getTypeInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::AP};
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::AP};
|
||||
}
|
||||
|
||||
WifiStatus WifiApIface::setCountryCodeInternal(
|
||||
const std::array<int8_t, 2>& code) {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->setCountryCode(ifname_, code);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->setCountryCode(ifname_, code);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
|
||||
WifiApIface::getValidFrequenciesForBandInternal(WifiBand band) {
|
||||
static_assert(sizeof(WifiChannelInMhz) == sizeof(uint32_t), "Size mismatch");
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
std::vector<uint32_t> valid_frequencies;
|
||||
std::tie(legacy_status, valid_frequencies) =
|
||||
legacy_hal_.lock()->getValidFrequenciesForBand(
|
||||
ifname_, hidl_struct_util::convertHidlWifiBandToLegacy(band));
|
||||
return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies};
|
||||
static_assert(sizeof(WifiChannelInMhz) == sizeof(uint32_t),
|
||||
"Size mismatch");
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
std::vector<uint32_t> valid_frequencies;
|
||||
std::tie(legacy_status, valid_frequencies) =
|
||||
legacy_hal_.lock()->getValidFrequenciesForBand(
|
||||
ifname_, hidl_struct_util::convertHidlWifiBandToLegacy(band));
|
||||
return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies};
|
||||
}
|
||||
} // namespace implementation
|
||||
} // namespace V1_2
|
||||
|
||||
@@ -33,34 +33,34 @@ using namespace android::hardware::wifi::V1_0;
|
||||
* HIDL interface object used to control a AP Iface instance.
|
||||
*/
|
||||
class WifiApIface : public V1_0::IWifiApIface {
|
||||
public:
|
||||
WifiApIface(const std::string& ifname,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
public:
|
||||
WifiApIface(const std::string& ifname,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<void> getName(getName_cb hidl_status_cb) override;
|
||||
Return<void> getType(getType_cb hidl_status_cb) override;
|
||||
Return<void> setCountryCode(const hidl_array<int8_t, 2>& code,
|
||||
setCountryCode_cb hidl_status_cb) override;
|
||||
Return<void> getValidFrequenciesForBand(
|
||||
WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) override;
|
||||
// HIDL methods exposed.
|
||||
Return<void> getName(getName_cb hidl_status_cb) override;
|
||||
Return<void> getType(getType_cb hidl_status_cb) override;
|
||||
Return<void> setCountryCode(const hidl_array<int8_t, 2>& code,
|
||||
setCountryCode_cb hidl_status_cb) override;
|
||||
Return<void> getValidFrequenciesForBand(
|
||||
WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, std::string> getNameInternal();
|
||||
std::pair<WifiStatus, IfaceType> getTypeInternal();
|
||||
WifiStatus setCountryCodeInternal(const std::array<int8_t, 2>& code);
|
||||
std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
|
||||
getValidFrequenciesForBandInternal(WifiBand band);
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, std::string> getNameInternal();
|
||||
std::pair<WifiStatus, IfaceType> getTypeInternal();
|
||||
WifiStatus setCountryCodeInternal(const std::array<int8_t, 2>& code);
|
||||
std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
|
||||
getValidFrequenciesForBandInternal(WifiBand band);
|
||||
|
||||
std::string ifname_;
|
||||
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
bool is_valid_;
|
||||
std::string ifname_;
|
||||
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
bool is_valid_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiApIface);
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiApIface);
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -44,168 +44,168 @@ using namespace android::hardware::wifi::V1_0;
|
||||
* identifying handle information stored here.
|
||||
*/
|
||||
class WifiChip : public V1_1::IWifiChip {
|
||||
public:
|
||||
WifiChip(
|
||||
ChipId chip_id,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal,
|
||||
const std::weak_ptr<mode_controller::WifiModeController> mode_controller);
|
||||
// HIDL does not provide a built-in mechanism to let the server invalidate
|
||||
// a HIDL interface object after creation. If any client process holds onto
|
||||
// a reference to the object in their context, any method calls on that
|
||||
// reference will continue to be directed to the server.
|
||||
//
|
||||
// However Wifi HAL needs to control the lifetime of these objects. So, add
|
||||
// a public |invalidate| method to |WifiChip| and it's child objects. This
|
||||
// will be used to mark an object invalid when either:
|
||||
// a) Wifi HAL is stopped, or
|
||||
// b) Wifi Chip is reconfigured.
|
||||
//
|
||||
// All HIDL method implementations should check if the object is still marked
|
||||
// valid before processing them.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
std::set<sp<IWifiChipEventCallback>> getEventCallbacks();
|
||||
public:
|
||||
WifiChip(ChipId chip_id,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal,
|
||||
const std::weak_ptr<mode_controller::WifiModeController>
|
||||
mode_controller);
|
||||
// HIDL does not provide a built-in mechanism to let the server invalidate
|
||||
// a HIDL interface object after creation. If any client process holds onto
|
||||
// a reference to the object in their context, any method calls on that
|
||||
// reference will continue to be directed to the server.
|
||||
//
|
||||
// However Wifi HAL needs to control the lifetime of these objects. So, add
|
||||
// a public |invalidate| method to |WifiChip| and it's child objects. This
|
||||
// will be used to mark an object invalid when either:
|
||||
// a) Wifi HAL is stopped, or
|
||||
// b) Wifi Chip is reconfigured.
|
||||
//
|
||||
// All HIDL method implementations should check if the object is still
|
||||
// marked valid before processing them.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
std::set<sp<IWifiChipEventCallback>> getEventCallbacks();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<void> getId(getId_cb hidl_status_cb) override;
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiChipEventCallback>& event_callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<void> getCapabilities(getCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> getAvailableModes(getAvailableModes_cb hidl_status_cb) override;
|
||||
Return<void> configureChip(ChipModeId mode_id,
|
||||
configureChip_cb hidl_status_cb) override;
|
||||
Return<void> getMode(getMode_cb hidl_status_cb) override;
|
||||
Return<void> requestChipDebugInfo(
|
||||
requestChipDebugInfo_cb hidl_status_cb) override;
|
||||
Return<void> requestDriverDebugDump(
|
||||
requestDriverDebugDump_cb hidl_status_cb) override;
|
||||
Return<void> requestFirmwareDebugDump(
|
||||
requestFirmwareDebugDump_cb hidl_status_cb) override;
|
||||
Return<void> createApIface(createApIface_cb hidl_status_cb) override;
|
||||
Return<void> getApIfaceNames(getApIfaceNames_cb hidl_status_cb) override;
|
||||
Return<void> getApIface(const hidl_string& ifname,
|
||||
getApIface_cb hidl_status_cb) override;
|
||||
Return<void> removeApIface(const hidl_string& ifname,
|
||||
removeApIface_cb hidl_status_cb) override;
|
||||
Return<void> createNanIface(createNanIface_cb hidl_status_cb) override;
|
||||
Return<void> getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) override;
|
||||
Return<void> getNanIface(const hidl_string& ifname,
|
||||
getNanIface_cb hidl_status_cb) override;
|
||||
Return<void> removeNanIface(const hidl_string& ifname,
|
||||
removeNanIface_cb hidl_status_cb) override;
|
||||
Return<void> createP2pIface(createP2pIface_cb hidl_status_cb) override;
|
||||
Return<void> getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) override;
|
||||
Return<void> getP2pIface(const hidl_string& ifname,
|
||||
getP2pIface_cb hidl_status_cb) override;
|
||||
Return<void> removeP2pIface(const hidl_string& ifname,
|
||||
removeP2pIface_cb hidl_status_cb) override;
|
||||
Return<void> createStaIface(createStaIface_cb hidl_status_cb) override;
|
||||
Return<void> getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) override;
|
||||
Return<void> getStaIface(const hidl_string& ifname,
|
||||
getStaIface_cb hidl_status_cb) override;
|
||||
Return<void> removeStaIface(const hidl_string& ifname,
|
||||
removeStaIface_cb hidl_status_cb) override;
|
||||
Return<void> createRttController(
|
||||
const sp<IWifiIface>& bound_iface,
|
||||
createRttController_cb hidl_status_cb) override;
|
||||
Return<void> getDebugRingBuffersStatus(
|
||||
getDebugRingBuffersStatus_cb hidl_status_cb) override;
|
||||
Return<void> startLoggingToDebugRingBuffer(
|
||||
const hidl_string& ring_name,
|
||||
WifiDebugRingBufferVerboseLevel verbose_level,
|
||||
uint32_t max_interval_in_sec,
|
||||
uint32_t min_data_size_in_bytes,
|
||||
startLoggingToDebugRingBuffer_cb hidl_status_cb) override;
|
||||
Return<void> forceDumpToDebugRingBuffer(
|
||||
const hidl_string& ring_name,
|
||||
forceDumpToDebugRingBuffer_cb hidl_status_cb) override;
|
||||
Return<void> stopLoggingToDebugRingBuffer(
|
||||
stopLoggingToDebugRingBuffer_cb hidl_status_cb) override;
|
||||
Return<void> getDebugHostWakeReasonStats(
|
||||
getDebugHostWakeReasonStats_cb hidl_status_cb) override;
|
||||
Return<void> enableDebugErrorAlerts(
|
||||
bool enable, enableDebugErrorAlerts_cb hidl_status_cb) override;
|
||||
Return<void> selectTxPowerScenario(
|
||||
TxPowerScenario scenario,
|
||||
selectTxPowerScenario_cb hidl_status_cb) override;
|
||||
Return<void> resetTxPowerScenario(
|
||||
resetTxPowerScenario_cb hidl_status_cb) override;
|
||||
// HIDL methods exposed.
|
||||
Return<void> getId(getId_cb hidl_status_cb) override;
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiChipEventCallback>& event_callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<void> getCapabilities(getCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> getAvailableModes(
|
||||
getAvailableModes_cb hidl_status_cb) override;
|
||||
Return<void> configureChip(ChipModeId mode_id,
|
||||
configureChip_cb hidl_status_cb) override;
|
||||
Return<void> getMode(getMode_cb hidl_status_cb) override;
|
||||
Return<void> requestChipDebugInfo(
|
||||
requestChipDebugInfo_cb hidl_status_cb) override;
|
||||
Return<void> requestDriverDebugDump(
|
||||
requestDriverDebugDump_cb hidl_status_cb) override;
|
||||
Return<void> requestFirmwareDebugDump(
|
||||
requestFirmwareDebugDump_cb hidl_status_cb) override;
|
||||
Return<void> createApIface(createApIface_cb hidl_status_cb) override;
|
||||
Return<void> getApIfaceNames(getApIfaceNames_cb hidl_status_cb) override;
|
||||
Return<void> getApIface(const hidl_string& ifname,
|
||||
getApIface_cb hidl_status_cb) override;
|
||||
Return<void> removeApIface(const hidl_string& ifname,
|
||||
removeApIface_cb hidl_status_cb) override;
|
||||
Return<void> createNanIface(createNanIface_cb hidl_status_cb) override;
|
||||
Return<void> getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) override;
|
||||
Return<void> getNanIface(const hidl_string& ifname,
|
||||
getNanIface_cb hidl_status_cb) override;
|
||||
Return<void> removeNanIface(const hidl_string& ifname,
|
||||
removeNanIface_cb hidl_status_cb) override;
|
||||
Return<void> createP2pIface(createP2pIface_cb hidl_status_cb) override;
|
||||
Return<void> getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) override;
|
||||
Return<void> getP2pIface(const hidl_string& ifname,
|
||||
getP2pIface_cb hidl_status_cb) override;
|
||||
Return<void> removeP2pIface(const hidl_string& ifname,
|
||||
removeP2pIface_cb hidl_status_cb) override;
|
||||
Return<void> createStaIface(createStaIface_cb hidl_status_cb) override;
|
||||
Return<void> getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) override;
|
||||
Return<void> getStaIface(const hidl_string& ifname,
|
||||
getStaIface_cb hidl_status_cb) override;
|
||||
Return<void> removeStaIface(const hidl_string& ifname,
|
||||
removeStaIface_cb hidl_status_cb) override;
|
||||
Return<void> createRttController(
|
||||
const sp<IWifiIface>& bound_iface,
|
||||
createRttController_cb hidl_status_cb) override;
|
||||
Return<void> getDebugRingBuffersStatus(
|
||||
getDebugRingBuffersStatus_cb hidl_status_cb) override;
|
||||
Return<void> startLoggingToDebugRingBuffer(
|
||||
const hidl_string& ring_name,
|
||||
WifiDebugRingBufferVerboseLevel verbose_level,
|
||||
uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes,
|
||||
startLoggingToDebugRingBuffer_cb hidl_status_cb) override;
|
||||
Return<void> forceDumpToDebugRingBuffer(
|
||||
const hidl_string& ring_name,
|
||||
forceDumpToDebugRingBuffer_cb hidl_status_cb) override;
|
||||
Return<void> stopLoggingToDebugRingBuffer(
|
||||
stopLoggingToDebugRingBuffer_cb hidl_status_cb) override;
|
||||
Return<void> getDebugHostWakeReasonStats(
|
||||
getDebugHostWakeReasonStats_cb hidl_status_cb) override;
|
||||
Return<void> enableDebugErrorAlerts(
|
||||
bool enable, enableDebugErrorAlerts_cb hidl_status_cb) override;
|
||||
Return<void> selectTxPowerScenario(
|
||||
TxPowerScenario scenario,
|
||||
selectTxPowerScenario_cb hidl_status_cb) override;
|
||||
Return<void> resetTxPowerScenario(
|
||||
resetTxPowerScenario_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
void invalidateAndRemoveAllIfaces();
|
||||
private:
|
||||
void invalidateAndRemoveAllIfaces();
|
||||
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, ChipId> getIdInternal();
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiChipEventCallback>& event_callback);
|
||||
std::pair<WifiStatus, uint32_t> getCapabilitiesInternal();
|
||||
std::pair<WifiStatus, std::vector<ChipMode>> getAvailableModesInternal();
|
||||
WifiStatus configureChipInternal(ChipModeId mode_id);
|
||||
std::pair<WifiStatus, uint32_t> getModeInternal();
|
||||
std::pair<WifiStatus, IWifiChip::ChipDebugInfo>
|
||||
requestChipDebugInfoInternal();
|
||||
std::pair<WifiStatus, std::vector<uint8_t>> requestDriverDebugDumpInternal();
|
||||
std::pair<WifiStatus, std::vector<uint8_t>>
|
||||
requestFirmwareDebugDumpInternal();
|
||||
std::pair<WifiStatus, sp<IWifiApIface>> createApIfaceInternal();
|
||||
std::pair<WifiStatus, std::vector<hidl_string>> getApIfaceNamesInternal();
|
||||
std::pair<WifiStatus, sp<IWifiApIface>> getApIfaceInternal(
|
||||
const std::string& ifname);
|
||||
WifiStatus removeApIfaceInternal(const std::string& ifname);
|
||||
std::pair<WifiStatus, sp<IWifiNanIface>> createNanIfaceInternal();
|
||||
std::pair<WifiStatus, std::vector<hidl_string>> getNanIfaceNamesInternal();
|
||||
std::pair<WifiStatus, sp<IWifiNanIface>> getNanIfaceInternal(
|
||||
const std::string& ifname);
|
||||
WifiStatus removeNanIfaceInternal(const std::string& ifname);
|
||||
std::pair<WifiStatus, sp<IWifiP2pIface>> createP2pIfaceInternal();
|
||||
std::pair<WifiStatus, std::vector<hidl_string>> getP2pIfaceNamesInternal();
|
||||
std::pair<WifiStatus, sp<IWifiP2pIface>> getP2pIfaceInternal(
|
||||
const std::string& ifname);
|
||||
WifiStatus removeP2pIfaceInternal(const std::string& ifname);
|
||||
std::pair<WifiStatus, sp<IWifiStaIface>> createStaIfaceInternal();
|
||||
std::pair<WifiStatus, std::vector<hidl_string>> getStaIfaceNamesInternal();
|
||||
std::pair<WifiStatus, sp<IWifiStaIface>> getStaIfaceInternal(
|
||||
const std::string& ifname);
|
||||
WifiStatus removeStaIfaceInternal(const std::string& ifname);
|
||||
std::pair<WifiStatus, sp<IWifiRttController>> createRttControllerInternal(
|
||||
const sp<IWifiIface>& bound_iface);
|
||||
std::pair<WifiStatus, std::vector<WifiDebugRingBufferStatus>>
|
||||
getDebugRingBuffersStatusInternal();
|
||||
WifiStatus startLoggingToDebugRingBufferInternal(
|
||||
const hidl_string& ring_name,
|
||||
WifiDebugRingBufferVerboseLevel verbose_level,
|
||||
uint32_t max_interval_in_sec,
|
||||
uint32_t min_data_size_in_bytes);
|
||||
WifiStatus forceDumpToDebugRingBufferInternal(const hidl_string& ring_name);
|
||||
WifiStatus stopLoggingToDebugRingBufferInternal();
|
||||
std::pair<WifiStatus, WifiDebugHostWakeReasonStats>
|
||||
getDebugHostWakeReasonStatsInternal();
|
||||
WifiStatus enableDebugErrorAlertsInternal(bool enable);
|
||||
WifiStatus selectTxPowerScenarioInternal(TxPowerScenario scenario);
|
||||
WifiStatus resetTxPowerScenarioInternal();
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, ChipId> getIdInternal();
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiChipEventCallback>& event_callback);
|
||||
std::pair<WifiStatus, uint32_t> getCapabilitiesInternal();
|
||||
std::pair<WifiStatus, std::vector<ChipMode>> getAvailableModesInternal();
|
||||
WifiStatus configureChipInternal(ChipModeId mode_id);
|
||||
std::pair<WifiStatus, uint32_t> getModeInternal();
|
||||
std::pair<WifiStatus, IWifiChip::ChipDebugInfo>
|
||||
requestChipDebugInfoInternal();
|
||||
std::pair<WifiStatus, std::vector<uint8_t>>
|
||||
requestDriverDebugDumpInternal();
|
||||
std::pair<WifiStatus, std::vector<uint8_t>>
|
||||
requestFirmwareDebugDumpInternal();
|
||||
std::pair<WifiStatus, sp<IWifiApIface>> createApIfaceInternal();
|
||||
std::pair<WifiStatus, std::vector<hidl_string>> getApIfaceNamesInternal();
|
||||
std::pair<WifiStatus, sp<IWifiApIface>> getApIfaceInternal(
|
||||
const std::string& ifname);
|
||||
WifiStatus removeApIfaceInternal(const std::string& ifname);
|
||||
std::pair<WifiStatus, sp<IWifiNanIface>> createNanIfaceInternal();
|
||||
std::pair<WifiStatus, std::vector<hidl_string>> getNanIfaceNamesInternal();
|
||||
std::pair<WifiStatus, sp<IWifiNanIface>> getNanIfaceInternal(
|
||||
const std::string& ifname);
|
||||
WifiStatus removeNanIfaceInternal(const std::string& ifname);
|
||||
std::pair<WifiStatus, sp<IWifiP2pIface>> createP2pIfaceInternal();
|
||||
std::pair<WifiStatus, std::vector<hidl_string>> getP2pIfaceNamesInternal();
|
||||
std::pair<WifiStatus, sp<IWifiP2pIface>> getP2pIfaceInternal(
|
||||
const std::string& ifname);
|
||||
WifiStatus removeP2pIfaceInternal(const std::string& ifname);
|
||||
std::pair<WifiStatus, sp<IWifiStaIface>> createStaIfaceInternal();
|
||||
std::pair<WifiStatus, std::vector<hidl_string>> getStaIfaceNamesInternal();
|
||||
std::pair<WifiStatus, sp<IWifiStaIface>> getStaIfaceInternal(
|
||||
const std::string& ifname);
|
||||
WifiStatus removeStaIfaceInternal(const std::string& ifname);
|
||||
std::pair<WifiStatus, sp<IWifiRttController>> createRttControllerInternal(
|
||||
const sp<IWifiIface>& bound_iface);
|
||||
std::pair<WifiStatus, std::vector<WifiDebugRingBufferStatus>>
|
||||
getDebugRingBuffersStatusInternal();
|
||||
WifiStatus startLoggingToDebugRingBufferInternal(
|
||||
const hidl_string& ring_name,
|
||||
WifiDebugRingBufferVerboseLevel verbose_level,
|
||||
uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes);
|
||||
WifiStatus forceDumpToDebugRingBufferInternal(const hidl_string& ring_name);
|
||||
WifiStatus stopLoggingToDebugRingBufferInternal();
|
||||
std::pair<WifiStatus, WifiDebugHostWakeReasonStats>
|
||||
getDebugHostWakeReasonStatsInternal();
|
||||
WifiStatus enableDebugErrorAlertsInternal(bool enable);
|
||||
WifiStatus selectTxPowerScenarioInternal(TxPowerScenario scenario);
|
||||
WifiStatus resetTxPowerScenarioInternal();
|
||||
|
||||
WifiStatus handleChipConfiguration(ChipModeId mode_id);
|
||||
WifiStatus registerDebugRingBufferCallback();
|
||||
WifiStatus handleChipConfiguration(ChipModeId mode_id);
|
||||
WifiStatus registerDebugRingBufferCallback();
|
||||
|
||||
ChipId chip_id_;
|
||||
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
std::weak_ptr<mode_controller::WifiModeController> mode_controller_;
|
||||
sp<WifiApIface> ap_iface_;
|
||||
sp<WifiNanIface> nan_iface_;
|
||||
sp<WifiP2pIface> p2p_iface_;
|
||||
sp<WifiStaIface> sta_iface_;
|
||||
std::vector<sp<WifiRttController>> rtt_controllers_;
|
||||
bool is_valid_;
|
||||
uint32_t current_mode_id_;
|
||||
// The legacy ring buffer callback API has only a global callback
|
||||
// registration mechanism. Use this to check if we have already
|
||||
// registered a callback.
|
||||
bool debug_ring_buffer_cb_registered_;
|
||||
hidl_callback_util::HidlCallbackHandler<IWifiChipEventCallback>
|
||||
event_cb_handler_;
|
||||
ChipId chip_id_;
|
||||
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
std::weak_ptr<mode_controller::WifiModeController> mode_controller_;
|
||||
sp<WifiApIface> ap_iface_;
|
||||
sp<WifiNanIface> nan_iface_;
|
||||
sp<WifiP2pIface> p2p_iface_;
|
||||
sp<WifiStaIface> sta_iface_;
|
||||
std::vector<sp<WifiRttController>> rtt_controllers_;
|
||||
bool is_valid_;
|
||||
uint32_t current_mode_id_;
|
||||
// The legacy ring buffer callback API has only a global callback
|
||||
// registration mechanism. Use this to check if we have already
|
||||
// registered a callback.
|
||||
bool debug_ring_buffer_cb_registered_;
|
||||
hidl_callback_util::HidlCallbackHandler<IWifiChipEventCallback>
|
||||
event_cb_handler_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiChip);
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiChip);
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -24,12 +24,12 @@ namespace V1_2 {
|
||||
namespace implementation {
|
||||
|
||||
class WifiFeatureFlags {
|
||||
public:
|
||||
public:
|
||||
#ifdef WIFI_HIDL_FEATURE_AWARE
|
||||
static const bool wifiHidlFeatureAware = true;
|
||||
static const bool wifiHidlFeatureAware = true;
|
||||
#else
|
||||
static const bool wifiHidlFeatureAware = false;
|
||||
#endif // WIFI_HIDL_FEATURE_AWARE
|
||||
static const bool wifiHidlFeatureAware = false;
|
||||
#endif // WIFI_HIDL_FEATURE_AWARE
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,11 +17,11 @@
|
||||
#ifndef WIFI_LEGACY_HAL_H_
|
||||
#define WIFI_LEGACY_HAL_H_
|
||||
|
||||
#include <condition_variable>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
#include <condition_variable>
|
||||
|
||||
#include <wifi_system/interface_tool.h>
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace legacy_hal {
|
||||
|
||||
// APF capabilities supported by the iface.
|
||||
struct PacketFilterCapabilities {
|
||||
uint32_t version;
|
||||
uint32_t max_len;
|
||||
uint32_t version;
|
||||
uint32_t max_len;
|
||||
};
|
||||
|
||||
// WARNING: We don't care about the variable sized members of either
|
||||
@@ -52,13 +52,13 @@ struct PacketFilterCapabilities {
|
||||
// |wifi_radio_stat| structure in the legacy HAL API. Separate that out
|
||||
// into a separate return element to avoid passing pointers around.
|
||||
struct LinkLayerRadioStats {
|
||||
wifi_radio_stat stats;
|
||||
std::vector<uint32_t> tx_time_per_levels;
|
||||
wifi_radio_stat stats;
|
||||
std::vector<uint32_t> tx_time_per_levels;
|
||||
};
|
||||
|
||||
struct LinkLayerStats {
|
||||
wifi_iface_stat iface;
|
||||
std::vector<LinkLayerRadioStats> radios;
|
||||
wifi_iface_stat iface;
|
||||
std::vector<LinkLayerRadioStats> radios;
|
||||
};
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -68,37 +68,38 @@ struct LinkLayerStats {
|
||||
// API. Separate that out into a separate return elements to avoid passing
|
||||
// pointers around.
|
||||
struct WakeReasonStats {
|
||||
WLAN_DRIVER_WAKE_REASON_CNT wake_reason_cnt;
|
||||
std::vector<uint32_t> cmd_event_wake_cnt;
|
||||
std::vector<uint32_t> driver_fw_local_wake_cnt;
|
||||
WLAN_DRIVER_WAKE_REASON_CNT wake_reason_cnt;
|
||||
std::vector<uint32_t> cmd_event_wake_cnt;
|
||||
std::vector<uint32_t> driver_fw_local_wake_cnt;
|
||||
};
|
||||
|
||||
// NAN response and event callbacks struct.
|
||||
struct NanCallbackHandlers {
|
||||
// NotifyResponse invoked to notify the status of the Request.
|
||||
std::function<void(transaction_id, const NanResponseMsg&)> on_notify_response;
|
||||
// Various event callbacks.
|
||||
std::function<void(const NanPublishTerminatedInd&)>
|
||||
on_event_publish_terminated;
|
||||
std::function<void(const NanMatchInd&)> on_event_match;
|
||||
std::function<void(const NanMatchExpiredInd&)> on_event_match_expired;
|
||||
std::function<void(const NanSubscribeTerminatedInd&)>
|
||||
on_event_subscribe_terminated;
|
||||
std::function<void(const NanFollowupInd&)> on_event_followup;
|
||||
std::function<void(const NanDiscEngEventInd&)> on_event_disc_eng_event;
|
||||
std::function<void(const NanDisabledInd&)> on_event_disabled;
|
||||
std::function<void(const NanTCAInd&)> on_event_tca;
|
||||
std::function<void(const NanBeaconSdfPayloadInd&)>
|
||||
on_event_beacon_sdf_payload;
|
||||
std::function<void(const NanDataPathRequestInd&)> on_event_data_path_request;
|
||||
std::function<void(const NanDataPathConfirmInd&)> on_event_data_path_confirm;
|
||||
std::function<void(const NanDataPathEndInd&)> on_event_data_path_end;
|
||||
std::function<void(const NanTransmitFollowupInd&)>
|
||||
on_event_transmit_follow_up;
|
||||
std::function<void(const NanRangeRequestInd&)>
|
||||
on_event_range_request;
|
||||
std::function<void(const NanRangeReportInd&)>
|
||||
on_event_range_report;
|
||||
// NotifyResponse invoked to notify the status of the Request.
|
||||
std::function<void(transaction_id, const NanResponseMsg&)>
|
||||
on_notify_response;
|
||||
// Various event callbacks.
|
||||
std::function<void(const NanPublishTerminatedInd&)>
|
||||
on_event_publish_terminated;
|
||||
std::function<void(const NanMatchInd&)> on_event_match;
|
||||
std::function<void(const NanMatchExpiredInd&)> on_event_match_expired;
|
||||
std::function<void(const NanSubscribeTerminatedInd&)>
|
||||
on_event_subscribe_terminated;
|
||||
std::function<void(const NanFollowupInd&)> on_event_followup;
|
||||
std::function<void(const NanDiscEngEventInd&)> on_event_disc_eng_event;
|
||||
std::function<void(const NanDisabledInd&)> on_event_disabled;
|
||||
std::function<void(const NanTCAInd&)> on_event_tca;
|
||||
std::function<void(const NanBeaconSdfPayloadInd&)>
|
||||
on_event_beacon_sdf_payload;
|
||||
std::function<void(const NanDataPathRequestInd&)>
|
||||
on_event_data_path_request;
|
||||
std::function<void(const NanDataPathConfirmInd&)>
|
||||
on_event_data_path_confirm;
|
||||
std::function<void(const NanDataPathEndInd&)> on_event_data_path_end;
|
||||
std::function<void(const NanTransmitFollowupInd&)>
|
||||
on_event_transmit_follow_up;
|
||||
std::function<void(const NanRangeRequestInd&)> on_event_range_request;
|
||||
std::function<void(const NanRangeReportInd&)> on_event_range_report;
|
||||
};
|
||||
|
||||
// Full scan results contain IE info and are hence passed by reference, to
|
||||
@@ -124,8 +125,7 @@ using on_rtt_results_callback = std::function<void(
|
||||
|
||||
// Callback for ring buffer data.
|
||||
using on_ring_buffer_data_callback =
|
||||
std::function<void(const std::string&,
|
||||
const std::vector<uint8_t>&,
|
||||
std::function<void(const std::string&, const std::vector<uint8_t>&,
|
||||
const wifi_ring_buffer_status&)>;
|
||||
|
||||
// Callback for alerts.
|
||||
@@ -139,221 +139,218 @@ using on_error_alert_callback =
|
||||
* object and will be valid for the lifetime of the process.
|
||||
*/
|
||||
class WifiLegacyHal {
|
||||
public:
|
||||
WifiLegacyHal();
|
||||
public:
|
||||
WifiLegacyHal();
|
||||
|
||||
// Initialize the legacy HAL function table.
|
||||
wifi_error initialize();
|
||||
// Start the legacy HAL and the event looper thread.
|
||||
wifi_error start();
|
||||
// Deinitialize the legacy HAL and wait for the event loop thread to exit
|
||||
// using a predefined timeout.
|
||||
wifi_error stop(std::unique_lock<std::recursive_mutex>* lock,
|
||||
const std::function<void()>& on_complete_callback);
|
||||
// Wrappers for all the functions in the legacy HAL function table.
|
||||
std::pair<wifi_error, std::string> getDriverVersion(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, std::string> getFirmwareVersion(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, std::vector<uint8_t>> requestDriverMemoryDump(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, std::vector<uint8_t>> requestFirmwareMemoryDump(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, uint32_t> getSupportedFeatureSet(
|
||||
const std::string& iface_name);
|
||||
// APF functions.
|
||||
std::pair<wifi_error, PacketFilterCapabilities> getPacketFilterCapabilities(
|
||||
const std::string& iface_name);
|
||||
wifi_error setPacketFilter(
|
||||
const std::string& iface_name, const std::vector<uint8_t>& program);
|
||||
// Gscan functions.
|
||||
std::pair<wifi_error, wifi_gscan_capabilities> getGscanCapabilities(
|
||||
const std::string& iface_name);
|
||||
// These API's provides a simplified interface over the legacy Gscan API's:
|
||||
// a) All scan events from the legacy HAL API other than the
|
||||
// |WIFI_SCAN_FAILED| are treated as notification of results.
|
||||
// This method then retrieves the cached scan results from the legacy
|
||||
// HAL API and triggers the externally provided |on_results_user_callback|
|
||||
// on success.
|
||||
// b) |WIFI_SCAN_FAILED| scan event or failure to retrieve cached scan results
|
||||
// triggers the externally provided |on_failure_user_callback|.
|
||||
// c) Full scan result event triggers the externally provided
|
||||
// |on_full_result_user_callback|.
|
||||
wifi_error startGscan(
|
||||
const std::string& iface_name,
|
||||
wifi_request_id id,
|
||||
const wifi_scan_cmd_params& params,
|
||||
const std::function<void(wifi_request_id)>& on_failure_callback,
|
||||
const on_gscan_results_callback& on_results_callback,
|
||||
const on_gscan_full_result_callback& on_full_result_callback);
|
||||
wifi_error stopGscan(const std::string& iface_name, wifi_request_id id);
|
||||
std::pair<wifi_error, std::vector<uint32_t>> getValidFrequenciesForBand(
|
||||
const std::string& iface_name, wifi_band band);
|
||||
wifi_error setDfsFlag(const std::string& iface_name, bool dfs_on);
|
||||
// Link layer stats functions.
|
||||
wifi_error enableLinkLayerStats(const std::string& iface_name, bool debug);
|
||||
wifi_error disableLinkLayerStats(const std::string& iface_name);
|
||||
std::pair<wifi_error, LinkLayerStats> getLinkLayerStats(
|
||||
const std::string& iface_name);
|
||||
// RSSI monitor functions.
|
||||
wifi_error startRssiMonitoring(
|
||||
const std::string& iface_name, wifi_request_id id, int8_t max_rssi,
|
||||
int8_t min_rssi, const on_rssi_threshold_breached_callback&
|
||||
on_threshold_breached_callback);
|
||||
wifi_error stopRssiMonitoring(
|
||||
const std::string& iface_name, wifi_request_id id);
|
||||
std::pair<wifi_error, wifi_roaming_capabilities> getRoamingCapabilities(
|
||||
const std::string& iface_name);
|
||||
wifi_error configureRoaming(
|
||||
const std::string& iface_name, const wifi_roaming_config& config);
|
||||
wifi_error enableFirmwareRoaming(
|
||||
const std::string& iface_name, fw_roaming_state_t state);
|
||||
wifi_error configureNdOffload(const std::string& iface_name, bool enable);
|
||||
wifi_error startSendingOffloadedPacket(
|
||||
const std::string& iface_name,
|
||||
uint32_t cmd_id,
|
||||
const std::vector<uint8_t>& ip_packet_data,
|
||||
const std::array<uint8_t, 6>& src_address,
|
||||
const std::array<uint8_t, 6>& dst_address,
|
||||
uint32_t period_in_ms);
|
||||
wifi_error stopSendingOffloadedPacket(
|
||||
const std::string& iface_name, uint32_t cmd_id);
|
||||
wifi_error setScanningMacOui(
|
||||
const std::string& iface_name, const std::array<uint8_t, 3>& oui);
|
||||
wifi_error selectTxPowerScenario(
|
||||
const std::string& iface_name, wifi_power_scenario scenario);
|
||||
wifi_error resetTxPowerScenario(const std::string& iface_name);
|
||||
// Logger/debug functions.
|
||||
std::pair<wifi_error, uint32_t> getLoggerSupportedFeatureSet(
|
||||
const std::string& iface_name);
|
||||
wifi_error startPktFateMonitoring(const std::string& iface_name);
|
||||
std::pair<wifi_error, std::vector<wifi_tx_report>> getTxPktFates(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, std::vector<wifi_rx_report>> getRxPktFates(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, WakeReasonStats> getWakeReasonStats(
|
||||
const std::string& iface_name);
|
||||
wifi_error registerRingBufferCallbackHandler(
|
||||
const std::string& iface_name,
|
||||
const on_ring_buffer_data_callback& on_data_callback);
|
||||
wifi_error deregisterRingBufferCallbackHandler(const std::string& iface_name);
|
||||
std::pair<wifi_error, std::vector<wifi_ring_buffer_status>>
|
||||
getRingBuffersStatus(const std::string& iface_name);
|
||||
wifi_error startRingBufferLogging(
|
||||
const std::string& iface_name, const std::string& ring_name,
|
||||
uint32_t verbose_level, uint32_t max_interval_sec,
|
||||
uint32_t min_data_size);
|
||||
wifi_error getRingBufferData(
|
||||
const std::string& iface_name, const std::string& ring_name);
|
||||
wifi_error registerErrorAlertCallbackHandler(
|
||||
const std::string& iface_name,
|
||||
const on_error_alert_callback& on_alert_callback);
|
||||
wifi_error deregisterErrorAlertCallbackHandler(const std::string& iface_name);
|
||||
// RTT functions.
|
||||
wifi_error startRttRangeRequest(
|
||||
const std::string& iface_name,
|
||||
wifi_request_id id,
|
||||
const std::vector<wifi_rtt_config>& rtt_configs,
|
||||
const on_rtt_results_callback& on_results_callback);
|
||||
wifi_error cancelRttRangeRequest(
|
||||
const std::string& iface_name, wifi_request_id id,
|
||||
const std::vector<std::array<uint8_t, 6>>& mac_addrs);
|
||||
std::pair<wifi_error, wifi_rtt_capabilities> getRttCapabilities(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, wifi_rtt_responder> getRttResponderInfo(
|
||||
const std::string& iface_name);
|
||||
wifi_error enableRttResponder(
|
||||
const std::string& iface_name, wifi_request_id id,
|
||||
const wifi_channel_info& channel_hint, uint32_t max_duration_secs,
|
||||
const wifi_rtt_responder& info);
|
||||
wifi_error disableRttResponder(
|
||||
const std::string& iface_name, wifi_request_id id);
|
||||
wifi_error setRttLci(
|
||||
const std::string& iface_name, wifi_request_id id,
|
||||
const wifi_lci_information& info);
|
||||
wifi_error setRttLcr(
|
||||
const std::string& iface_name, wifi_request_id id,
|
||||
const wifi_lcr_information& info);
|
||||
// NAN functions.
|
||||
wifi_error nanRegisterCallbackHandlers(
|
||||
const std::string& iface_name, const NanCallbackHandlers& callbacks);
|
||||
wifi_error nanEnableRequest(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanEnableRequest& msg);
|
||||
wifi_error nanDisableRequest(
|
||||
const std::string& iface_name, transaction_id id);
|
||||
wifi_error nanPublishRequest(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanPublishRequest& msg);
|
||||
wifi_error nanPublishCancelRequest(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanPublishCancelRequest& msg);
|
||||
wifi_error nanSubscribeRequest(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanSubscribeRequest& msg);
|
||||
wifi_error nanSubscribeCancelRequest(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanSubscribeCancelRequest& msg);
|
||||
wifi_error nanTransmitFollowupRequest(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanTransmitFollowupRequest& msg);
|
||||
wifi_error nanStatsRequest(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanStatsRequest& msg);
|
||||
wifi_error nanConfigRequest(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanConfigRequest& msg);
|
||||
wifi_error nanTcaRequest(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanTCARequest& msg);
|
||||
wifi_error nanBeaconSdfPayloadRequest(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanBeaconSdfPayloadRequest& msg);
|
||||
std::pair<wifi_error, NanVersion> nanGetVersion();
|
||||
wifi_error nanGetCapabilities(
|
||||
const std::string& iface_name, transaction_id id);
|
||||
wifi_error nanDataInterfaceCreate(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const std::string& data_iface_name);
|
||||
wifi_error nanDataInterfaceDelete(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const std::string& data_iface_name);
|
||||
wifi_error nanDataRequestInitiator(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanDataPathInitiatorRequest& msg);
|
||||
wifi_error nanDataIndicationResponse(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanDataPathIndicationResponse& msg);
|
||||
wifi_error nanDataEnd(
|
||||
const std::string& iface_name, transaction_id id, uint32_t ndpInstanceId);
|
||||
// AP functions.
|
||||
wifi_error setCountryCode(
|
||||
const std::string& iface_name, std::array<int8_t, 2> code);
|
||||
// Initialize the legacy HAL function table.
|
||||
wifi_error initialize();
|
||||
// Start the legacy HAL and the event looper thread.
|
||||
wifi_error start();
|
||||
// Deinitialize the legacy HAL and wait for the event loop thread to exit
|
||||
// using a predefined timeout.
|
||||
wifi_error stop(std::unique_lock<std::recursive_mutex>* lock,
|
||||
const std::function<void()>& on_complete_callback);
|
||||
// Wrappers for all the functions in the legacy HAL function table.
|
||||
std::pair<wifi_error, std::string> getDriverVersion(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, std::string> getFirmwareVersion(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, std::vector<uint8_t>> requestDriverMemoryDump(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, std::vector<uint8_t>> requestFirmwareMemoryDump(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, uint32_t> getSupportedFeatureSet(
|
||||
const std::string& iface_name);
|
||||
// APF functions.
|
||||
std::pair<wifi_error, PacketFilterCapabilities> getPacketFilterCapabilities(
|
||||
const std::string& iface_name);
|
||||
wifi_error setPacketFilter(const std::string& iface_name,
|
||||
const std::vector<uint8_t>& program);
|
||||
// Gscan functions.
|
||||
std::pair<wifi_error, wifi_gscan_capabilities> getGscanCapabilities(
|
||||
const std::string& iface_name);
|
||||
// These API's provides a simplified interface over the legacy Gscan API's:
|
||||
// a) All scan events from the legacy HAL API other than the
|
||||
// |WIFI_SCAN_FAILED| are treated as notification of results.
|
||||
// This method then retrieves the cached scan results from the legacy
|
||||
// HAL API and triggers the externally provided
|
||||
// |on_results_user_callback| on success.
|
||||
// b) |WIFI_SCAN_FAILED| scan event or failure to retrieve cached scan
|
||||
// results
|
||||
// triggers the externally provided |on_failure_user_callback|.
|
||||
// c) Full scan result event triggers the externally provided
|
||||
// |on_full_result_user_callback|.
|
||||
wifi_error startGscan(
|
||||
const std::string& iface_name, wifi_request_id id,
|
||||
const wifi_scan_cmd_params& params,
|
||||
const std::function<void(wifi_request_id)>& on_failure_callback,
|
||||
const on_gscan_results_callback& on_results_callback,
|
||||
const on_gscan_full_result_callback& on_full_result_callback);
|
||||
wifi_error stopGscan(const std::string& iface_name, wifi_request_id id);
|
||||
std::pair<wifi_error, std::vector<uint32_t>> getValidFrequenciesForBand(
|
||||
const std::string& iface_name, wifi_band band);
|
||||
wifi_error setDfsFlag(const std::string& iface_name, bool dfs_on);
|
||||
// Link layer stats functions.
|
||||
wifi_error enableLinkLayerStats(const std::string& iface_name, bool debug);
|
||||
wifi_error disableLinkLayerStats(const std::string& iface_name);
|
||||
std::pair<wifi_error, LinkLayerStats> getLinkLayerStats(
|
||||
const std::string& iface_name);
|
||||
// RSSI monitor functions.
|
||||
wifi_error startRssiMonitoring(const std::string& iface_name,
|
||||
wifi_request_id id, int8_t max_rssi,
|
||||
int8_t min_rssi,
|
||||
const on_rssi_threshold_breached_callback&
|
||||
on_threshold_breached_callback);
|
||||
wifi_error stopRssiMonitoring(const std::string& iface_name,
|
||||
wifi_request_id id);
|
||||
std::pair<wifi_error, wifi_roaming_capabilities> getRoamingCapabilities(
|
||||
const std::string& iface_name);
|
||||
wifi_error configureRoaming(const std::string& iface_name,
|
||||
const wifi_roaming_config& config);
|
||||
wifi_error enableFirmwareRoaming(const std::string& iface_name,
|
||||
fw_roaming_state_t state);
|
||||
wifi_error configureNdOffload(const std::string& iface_name, bool enable);
|
||||
wifi_error startSendingOffloadedPacket(
|
||||
const std::string& iface_name, uint32_t cmd_id,
|
||||
const std::vector<uint8_t>& ip_packet_data,
|
||||
const std::array<uint8_t, 6>& src_address,
|
||||
const std::array<uint8_t, 6>& dst_address, uint32_t period_in_ms);
|
||||
wifi_error stopSendingOffloadedPacket(const std::string& iface_name,
|
||||
uint32_t cmd_id);
|
||||
wifi_error setScanningMacOui(const std::string& iface_name,
|
||||
const std::array<uint8_t, 3>& oui);
|
||||
wifi_error selectTxPowerScenario(const std::string& iface_name,
|
||||
wifi_power_scenario scenario);
|
||||
wifi_error resetTxPowerScenario(const std::string& iface_name);
|
||||
// Logger/debug functions.
|
||||
std::pair<wifi_error, uint32_t> getLoggerSupportedFeatureSet(
|
||||
const std::string& iface_name);
|
||||
wifi_error startPktFateMonitoring(const std::string& iface_name);
|
||||
std::pair<wifi_error, std::vector<wifi_tx_report>> getTxPktFates(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, std::vector<wifi_rx_report>> getRxPktFates(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, WakeReasonStats> getWakeReasonStats(
|
||||
const std::string& iface_name);
|
||||
wifi_error registerRingBufferCallbackHandler(
|
||||
const std::string& iface_name,
|
||||
const on_ring_buffer_data_callback& on_data_callback);
|
||||
wifi_error deregisterRingBufferCallbackHandler(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, std::vector<wifi_ring_buffer_status>>
|
||||
getRingBuffersStatus(const std::string& iface_name);
|
||||
wifi_error startRingBufferLogging(const std::string& iface_name,
|
||||
const std::string& ring_name,
|
||||
uint32_t verbose_level,
|
||||
uint32_t max_interval_sec,
|
||||
uint32_t min_data_size);
|
||||
wifi_error getRingBufferData(const std::string& iface_name,
|
||||
const std::string& ring_name);
|
||||
wifi_error registerErrorAlertCallbackHandler(
|
||||
const std::string& iface_name,
|
||||
const on_error_alert_callback& on_alert_callback);
|
||||
wifi_error deregisterErrorAlertCallbackHandler(
|
||||
const std::string& iface_name);
|
||||
// RTT functions.
|
||||
wifi_error startRttRangeRequest(
|
||||
const std::string& iface_name, wifi_request_id id,
|
||||
const std::vector<wifi_rtt_config>& rtt_configs,
|
||||
const on_rtt_results_callback& on_results_callback);
|
||||
wifi_error cancelRttRangeRequest(
|
||||
const std::string& iface_name, wifi_request_id id,
|
||||
const std::vector<std::array<uint8_t, 6>>& mac_addrs);
|
||||
std::pair<wifi_error, wifi_rtt_capabilities> getRttCapabilities(
|
||||
const std::string& iface_name);
|
||||
std::pair<wifi_error, wifi_rtt_responder> getRttResponderInfo(
|
||||
const std::string& iface_name);
|
||||
wifi_error enableRttResponder(const std::string& iface_name,
|
||||
wifi_request_id id,
|
||||
const wifi_channel_info& channel_hint,
|
||||
uint32_t max_duration_secs,
|
||||
const wifi_rtt_responder& info);
|
||||
wifi_error disableRttResponder(const std::string& iface_name,
|
||||
wifi_request_id id);
|
||||
wifi_error setRttLci(const std::string& iface_name, wifi_request_id id,
|
||||
const wifi_lci_information& info);
|
||||
wifi_error setRttLcr(const std::string& iface_name, wifi_request_id id,
|
||||
const wifi_lcr_information& info);
|
||||
// NAN functions.
|
||||
wifi_error nanRegisterCallbackHandlers(
|
||||
const std::string& iface_name, const NanCallbackHandlers& callbacks);
|
||||
wifi_error nanEnableRequest(const std::string& iface_name,
|
||||
transaction_id id, const NanEnableRequest& msg);
|
||||
wifi_error nanDisableRequest(const std::string& iface_name,
|
||||
transaction_id id);
|
||||
wifi_error nanPublishRequest(const std::string& iface_name,
|
||||
transaction_id id,
|
||||
const NanPublishRequest& msg);
|
||||
wifi_error nanPublishCancelRequest(const std::string& iface_name,
|
||||
transaction_id id,
|
||||
const NanPublishCancelRequest& msg);
|
||||
wifi_error nanSubscribeRequest(const std::string& iface_name,
|
||||
transaction_id id,
|
||||
const NanSubscribeRequest& msg);
|
||||
wifi_error nanSubscribeCancelRequest(const std::string& iface_name,
|
||||
transaction_id id,
|
||||
const NanSubscribeCancelRequest& msg);
|
||||
wifi_error nanTransmitFollowupRequest(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanTransmitFollowupRequest& msg);
|
||||
wifi_error nanStatsRequest(const std::string& iface_name, transaction_id id,
|
||||
const NanStatsRequest& msg);
|
||||
wifi_error nanConfigRequest(const std::string& iface_name,
|
||||
transaction_id id, const NanConfigRequest& msg);
|
||||
wifi_error nanTcaRequest(const std::string& iface_name, transaction_id id,
|
||||
const NanTCARequest& msg);
|
||||
wifi_error nanBeaconSdfPayloadRequest(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanBeaconSdfPayloadRequest& msg);
|
||||
std::pair<wifi_error, NanVersion> nanGetVersion();
|
||||
wifi_error nanGetCapabilities(const std::string& iface_name,
|
||||
transaction_id id);
|
||||
wifi_error nanDataInterfaceCreate(const std::string& iface_name,
|
||||
transaction_id id,
|
||||
const std::string& data_iface_name);
|
||||
wifi_error nanDataInterfaceDelete(const std::string& iface_name,
|
||||
transaction_id id,
|
||||
const std::string& data_iface_name);
|
||||
wifi_error nanDataRequestInitiator(const std::string& iface_name,
|
||||
transaction_id id,
|
||||
const NanDataPathInitiatorRequest& msg);
|
||||
wifi_error nanDataIndicationResponse(
|
||||
const std::string& iface_name, transaction_id id,
|
||||
const NanDataPathIndicationResponse& msg);
|
||||
wifi_error nanDataEnd(const std::string& iface_name, transaction_id id,
|
||||
uint32_t ndpInstanceId);
|
||||
// AP functions.
|
||||
wifi_error setCountryCode(const std::string& iface_name,
|
||||
std::array<int8_t, 2> code);
|
||||
|
||||
private:
|
||||
// Retrieve interface handles for all the available interfaces.
|
||||
wifi_error retrieveIfaceHandles();
|
||||
wifi_interface_handle getIfaceHandle(const std::string& iface_name);
|
||||
// Run the legacy HAL event loop thread.
|
||||
void runEventLoop();
|
||||
// Retrieve the cached gscan results to pass the results back to the external
|
||||
// callbacks.
|
||||
std::pair<wifi_error, std::vector<wifi_cached_scan_results>>
|
||||
getGscanCachedResults(const std::string& iface_name);
|
||||
void invalidate();
|
||||
private:
|
||||
// Retrieve interface handles for all the available interfaces.
|
||||
wifi_error retrieveIfaceHandles();
|
||||
wifi_interface_handle getIfaceHandle(const std::string& iface_name);
|
||||
// Run the legacy HAL event loop thread.
|
||||
void runEventLoop();
|
||||
// Retrieve the cached gscan results to pass the results back to the
|
||||
// external callbacks.
|
||||
std::pair<wifi_error, std::vector<wifi_cached_scan_results>>
|
||||
getGscanCachedResults(const std::string& iface_name);
|
||||
void invalidate();
|
||||
|
||||
// Global function table of legacy HAL.
|
||||
wifi_hal_fn global_func_table_;
|
||||
// Opaque handle to be used for all global operations.
|
||||
wifi_handle global_handle_;
|
||||
// Map of interface name to handle that is to be used for all interface specific operations.
|
||||
std::map<std::string, wifi_interface_handle> iface_name_to_handle_;
|
||||
// Flag to indicate if we have initiated the cleanup of legacy HAL.
|
||||
std::atomic<bool> awaiting_event_loop_termination_;
|
||||
std::condition_variable_any stop_wait_cv_;
|
||||
// Flag to indicate if the legacy HAL has been started.
|
||||
bool is_started_;
|
||||
wifi_system::InterfaceTool iface_tool_;
|
||||
// Global function table of legacy HAL.
|
||||
wifi_hal_fn global_func_table_;
|
||||
// Opaque handle to be used for all global operations.
|
||||
wifi_handle global_handle_;
|
||||
// Map of interface name to handle that is to be used for all interface
|
||||
// specific operations.
|
||||
std::map<std::string, wifi_interface_handle> iface_name_to_handle_;
|
||||
// Flag to indicate if we have initiated the cleanup of legacy HAL.
|
||||
std::atomic<bool> awaiting_event_loop_termination_;
|
||||
std::condition_variable_any stop_wait_cv_;
|
||||
// Flag to indicate if the legacy HAL has been started.
|
||||
bool is_started_;
|
||||
wifi_system::InterfaceTool iface_tool_;
|
||||
};
|
||||
|
||||
} // namespace legacy_hal
|
||||
|
||||
@@ -28,113 +28,113 @@ struct stubFunction;
|
||||
|
||||
template <typename R, typename... Args>
|
||||
struct stubFunction<R (*)(Args...)> {
|
||||
static constexpr R invoke(Args...) { return WIFI_ERROR_NOT_SUPPORTED; }
|
||||
static constexpr R invoke(Args...) { return WIFI_ERROR_NOT_SUPPORTED; }
|
||||
};
|
||||
template <typename... Args>
|
||||
struct stubFunction<void (*)(Args...)> {
|
||||
static constexpr void invoke(Args...) {}
|
||||
static constexpr void invoke(Args...) {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void populateStubFor(T* val) {
|
||||
*val = &stubFunction<T>::invoke;
|
||||
*val = &stubFunction<T>::invoke;
|
||||
}
|
||||
|
||||
bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) {
|
||||
if (hal_fn == nullptr) {
|
||||
return false;
|
||||
}
|
||||
populateStubFor(&hal_fn->wifi_initialize);
|
||||
populateStubFor(&hal_fn->wifi_cleanup);
|
||||
populateStubFor(&hal_fn->wifi_event_loop);
|
||||
populateStubFor(&hal_fn->wifi_get_error_info);
|
||||
populateStubFor(&hal_fn->wifi_get_supported_feature_set);
|
||||
populateStubFor(&hal_fn->wifi_get_concurrency_matrix);
|
||||
populateStubFor(&hal_fn->wifi_set_scanning_mac_oui);
|
||||
populateStubFor(&hal_fn->wifi_get_supported_channels);
|
||||
populateStubFor(&hal_fn->wifi_is_epr_supported);
|
||||
populateStubFor(&hal_fn->wifi_get_ifaces);
|
||||
populateStubFor(&hal_fn->wifi_get_iface_name);
|
||||
populateStubFor(&hal_fn->wifi_set_iface_event_handler);
|
||||
populateStubFor(&hal_fn->wifi_reset_iface_event_handler);
|
||||
populateStubFor(&hal_fn->wifi_start_gscan);
|
||||
populateStubFor(&hal_fn->wifi_stop_gscan);
|
||||
populateStubFor(&hal_fn->wifi_get_cached_gscan_results);
|
||||
populateStubFor(&hal_fn->wifi_set_bssid_hotlist);
|
||||
populateStubFor(&hal_fn->wifi_reset_bssid_hotlist);
|
||||
populateStubFor(&hal_fn->wifi_set_significant_change_handler);
|
||||
populateStubFor(&hal_fn->wifi_reset_significant_change_handler);
|
||||
populateStubFor(&hal_fn->wifi_get_gscan_capabilities);
|
||||
populateStubFor(&hal_fn->wifi_set_link_stats);
|
||||
populateStubFor(&hal_fn->wifi_get_link_stats);
|
||||
populateStubFor(&hal_fn->wifi_clear_link_stats);
|
||||
populateStubFor(&hal_fn->wifi_get_valid_channels);
|
||||
populateStubFor(&hal_fn->wifi_rtt_range_request);
|
||||
populateStubFor(&hal_fn->wifi_rtt_range_cancel);
|
||||
populateStubFor(&hal_fn->wifi_get_rtt_capabilities);
|
||||
populateStubFor(&hal_fn->wifi_rtt_get_responder_info);
|
||||
populateStubFor(&hal_fn->wifi_enable_responder);
|
||||
populateStubFor(&hal_fn->wifi_disable_responder);
|
||||
populateStubFor(&hal_fn->wifi_set_nodfs_flag);
|
||||
populateStubFor(&hal_fn->wifi_start_logging);
|
||||
populateStubFor(&hal_fn->wifi_set_epno_list);
|
||||
populateStubFor(&hal_fn->wifi_reset_epno_list);
|
||||
populateStubFor(&hal_fn->wifi_set_country_code);
|
||||
populateStubFor(&hal_fn->wifi_get_firmware_memory_dump);
|
||||
populateStubFor(&hal_fn->wifi_set_log_handler);
|
||||
populateStubFor(&hal_fn->wifi_reset_log_handler);
|
||||
populateStubFor(&hal_fn->wifi_set_alert_handler);
|
||||
populateStubFor(&hal_fn->wifi_reset_alert_handler);
|
||||
populateStubFor(&hal_fn->wifi_get_firmware_version);
|
||||
populateStubFor(&hal_fn->wifi_get_ring_buffers_status);
|
||||
populateStubFor(&hal_fn->wifi_get_logger_supported_feature_set);
|
||||
populateStubFor(&hal_fn->wifi_get_ring_data);
|
||||
populateStubFor(&hal_fn->wifi_enable_tdls);
|
||||
populateStubFor(&hal_fn->wifi_disable_tdls);
|
||||
populateStubFor(&hal_fn->wifi_get_tdls_status);
|
||||
populateStubFor(&hal_fn->wifi_get_tdls_capabilities);
|
||||
populateStubFor(&hal_fn->wifi_get_driver_version);
|
||||
populateStubFor(&hal_fn->wifi_set_passpoint_list);
|
||||
populateStubFor(&hal_fn->wifi_reset_passpoint_list);
|
||||
populateStubFor(&hal_fn->wifi_set_lci);
|
||||
populateStubFor(&hal_fn->wifi_set_lcr);
|
||||
populateStubFor(&hal_fn->wifi_start_sending_offloaded_packet);
|
||||
populateStubFor(&hal_fn->wifi_stop_sending_offloaded_packet);
|
||||
populateStubFor(&hal_fn->wifi_start_rssi_monitoring);
|
||||
populateStubFor(&hal_fn->wifi_stop_rssi_monitoring);
|
||||
populateStubFor(&hal_fn->wifi_get_wake_reason_stats);
|
||||
populateStubFor(&hal_fn->wifi_configure_nd_offload);
|
||||
populateStubFor(&hal_fn->wifi_get_driver_memory_dump);
|
||||
populateStubFor(&hal_fn->wifi_start_pkt_fate_monitoring);
|
||||
populateStubFor(&hal_fn->wifi_get_tx_pkt_fates);
|
||||
populateStubFor(&hal_fn->wifi_get_rx_pkt_fates);
|
||||
populateStubFor(&hal_fn->wifi_nan_enable_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_disable_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_publish_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_publish_cancel_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_subscribe_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_subscribe_cancel_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_transmit_followup_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_stats_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_config_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_tca_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_beacon_sdf_payload_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_register_handler);
|
||||
populateStubFor(&hal_fn->wifi_nan_get_version);
|
||||
populateStubFor(&hal_fn->wifi_nan_get_capabilities);
|
||||
populateStubFor(&hal_fn->wifi_nan_data_interface_create);
|
||||
populateStubFor(&hal_fn->wifi_nan_data_interface_delete);
|
||||
populateStubFor(&hal_fn->wifi_nan_data_request_initiator);
|
||||
populateStubFor(&hal_fn->wifi_nan_data_indication_response);
|
||||
populateStubFor(&hal_fn->wifi_nan_data_end);
|
||||
populateStubFor(&hal_fn->wifi_get_packet_filter_capabilities);
|
||||
populateStubFor(&hal_fn->wifi_set_packet_filter);
|
||||
populateStubFor(&hal_fn->wifi_get_roaming_capabilities);
|
||||
populateStubFor(&hal_fn->wifi_enable_firmware_roaming);
|
||||
populateStubFor(&hal_fn->wifi_configure_roaming);
|
||||
populateStubFor(&hal_fn->wifi_select_tx_power_scenario);
|
||||
populateStubFor(&hal_fn->wifi_reset_tx_power_scenario);
|
||||
return true;
|
||||
if (hal_fn == nullptr) {
|
||||
return false;
|
||||
}
|
||||
populateStubFor(&hal_fn->wifi_initialize);
|
||||
populateStubFor(&hal_fn->wifi_cleanup);
|
||||
populateStubFor(&hal_fn->wifi_event_loop);
|
||||
populateStubFor(&hal_fn->wifi_get_error_info);
|
||||
populateStubFor(&hal_fn->wifi_get_supported_feature_set);
|
||||
populateStubFor(&hal_fn->wifi_get_concurrency_matrix);
|
||||
populateStubFor(&hal_fn->wifi_set_scanning_mac_oui);
|
||||
populateStubFor(&hal_fn->wifi_get_supported_channels);
|
||||
populateStubFor(&hal_fn->wifi_is_epr_supported);
|
||||
populateStubFor(&hal_fn->wifi_get_ifaces);
|
||||
populateStubFor(&hal_fn->wifi_get_iface_name);
|
||||
populateStubFor(&hal_fn->wifi_set_iface_event_handler);
|
||||
populateStubFor(&hal_fn->wifi_reset_iface_event_handler);
|
||||
populateStubFor(&hal_fn->wifi_start_gscan);
|
||||
populateStubFor(&hal_fn->wifi_stop_gscan);
|
||||
populateStubFor(&hal_fn->wifi_get_cached_gscan_results);
|
||||
populateStubFor(&hal_fn->wifi_set_bssid_hotlist);
|
||||
populateStubFor(&hal_fn->wifi_reset_bssid_hotlist);
|
||||
populateStubFor(&hal_fn->wifi_set_significant_change_handler);
|
||||
populateStubFor(&hal_fn->wifi_reset_significant_change_handler);
|
||||
populateStubFor(&hal_fn->wifi_get_gscan_capabilities);
|
||||
populateStubFor(&hal_fn->wifi_set_link_stats);
|
||||
populateStubFor(&hal_fn->wifi_get_link_stats);
|
||||
populateStubFor(&hal_fn->wifi_clear_link_stats);
|
||||
populateStubFor(&hal_fn->wifi_get_valid_channels);
|
||||
populateStubFor(&hal_fn->wifi_rtt_range_request);
|
||||
populateStubFor(&hal_fn->wifi_rtt_range_cancel);
|
||||
populateStubFor(&hal_fn->wifi_get_rtt_capabilities);
|
||||
populateStubFor(&hal_fn->wifi_rtt_get_responder_info);
|
||||
populateStubFor(&hal_fn->wifi_enable_responder);
|
||||
populateStubFor(&hal_fn->wifi_disable_responder);
|
||||
populateStubFor(&hal_fn->wifi_set_nodfs_flag);
|
||||
populateStubFor(&hal_fn->wifi_start_logging);
|
||||
populateStubFor(&hal_fn->wifi_set_epno_list);
|
||||
populateStubFor(&hal_fn->wifi_reset_epno_list);
|
||||
populateStubFor(&hal_fn->wifi_set_country_code);
|
||||
populateStubFor(&hal_fn->wifi_get_firmware_memory_dump);
|
||||
populateStubFor(&hal_fn->wifi_set_log_handler);
|
||||
populateStubFor(&hal_fn->wifi_reset_log_handler);
|
||||
populateStubFor(&hal_fn->wifi_set_alert_handler);
|
||||
populateStubFor(&hal_fn->wifi_reset_alert_handler);
|
||||
populateStubFor(&hal_fn->wifi_get_firmware_version);
|
||||
populateStubFor(&hal_fn->wifi_get_ring_buffers_status);
|
||||
populateStubFor(&hal_fn->wifi_get_logger_supported_feature_set);
|
||||
populateStubFor(&hal_fn->wifi_get_ring_data);
|
||||
populateStubFor(&hal_fn->wifi_enable_tdls);
|
||||
populateStubFor(&hal_fn->wifi_disable_tdls);
|
||||
populateStubFor(&hal_fn->wifi_get_tdls_status);
|
||||
populateStubFor(&hal_fn->wifi_get_tdls_capabilities);
|
||||
populateStubFor(&hal_fn->wifi_get_driver_version);
|
||||
populateStubFor(&hal_fn->wifi_set_passpoint_list);
|
||||
populateStubFor(&hal_fn->wifi_reset_passpoint_list);
|
||||
populateStubFor(&hal_fn->wifi_set_lci);
|
||||
populateStubFor(&hal_fn->wifi_set_lcr);
|
||||
populateStubFor(&hal_fn->wifi_start_sending_offloaded_packet);
|
||||
populateStubFor(&hal_fn->wifi_stop_sending_offloaded_packet);
|
||||
populateStubFor(&hal_fn->wifi_start_rssi_monitoring);
|
||||
populateStubFor(&hal_fn->wifi_stop_rssi_monitoring);
|
||||
populateStubFor(&hal_fn->wifi_get_wake_reason_stats);
|
||||
populateStubFor(&hal_fn->wifi_configure_nd_offload);
|
||||
populateStubFor(&hal_fn->wifi_get_driver_memory_dump);
|
||||
populateStubFor(&hal_fn->wifi_start_pkt_fate_monitoring);
|
||||
populateStubFor(&hal_fn->wifi_get_tx_pkt_fates);
|
||||
populateStubFor(&hal_fn->wifi_get_rx_pkt_fates);
|
||||
populateStubFor(&hal_fn->wifi_nan_enable_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_disable_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_publish_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_publish_cancel_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_subscribe_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_subscribe_cancel_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_transmit_followup_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_stats_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_config_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_tca_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_beacon_sdf_payload_request);
|
||||
populateStubFor(&hal_fn->wifi_nan_register_handler);
|
||||
populateStubFor(&hal_fn->wifi_nan_get_version);
|
||||
populateStubFor(&hal_fn->wifi_nan_get_capabilities);
|
||||
populateStubFor(&hal_fn->wifi_nan_data_interface_create);
|
||||
populateStubFor(&hal_fn->wifi_nan_data_interface_delete);
|
||||
populateStubFor(&hal_fn->wifi_nan_data_request_initiator);
|
||||
populateStubFor(&hal_fn->wifi_nan_data_indication_response);
|
||||
populateStubFor(&hal_fn->wifi_nan_data_end);
|
||||
populateStubFor(&hal_fn->wifi_get_packet_filter_capabilities);
|
||||
populateStubFor(&hal_fn->wifi_set_packet_filter);
|
||||
populateStubFor(&hal_fn->wifi_get_roaming_capabilities);
|
||||
populateStubFor(&hal_fn->wifi_enable_firmware_roaming);
|
||||
populateStubFor(&hal_fn->wifi_configure_roaming);
|
||||
populateStubFor(&hal_fn->wifi_select_tx_power_scenario);
|
||||
populateStubFor(&hal_fn->wifi_reset_tx_power_scenario);
|
||||
return true;
|
||||
}
|
||||
} // namespace legacy_hal
|
||||
} // namespace implementation
|
||||
|
||||
@@ -25,25 +25,25 @@ using android::wifi_hal::DriverTool;
|
||||
|
||||
namespace {
|
||||
int convertIfaceTypeToFirmwareMode(IfaceType type) {
|
||||
int mode;
|
||||
switch (type) {
|
||||
case IfaceType::AP:
|
||||
mode = DriverTool::kFirmwareModeAp;
|
||||
break;
|
||||
case IfaceType::P2P:
|
||||
mode = DriverTool::kFirmwareModeP2p;
|
||||
break;
|
||||
case IfaceType::NAN:
|
||||
// NAN is exposed in STA mode currently.
|
||||
mode = DriverTool::kFirmwareModeSta;
|
||||
break;
|
||||
case IfaceType::STA:
|
||||
mode = DriverTool::kFirmwareModeSta;
|
||||
break;
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
int mode;
|
||||
switch (type) {
|
||||
case IfaceType::AP:
|
||||
mode = DriverTool::kFirmwareModeAp;
|
||||
break;
|
||||
case IfaceType::P2P:
|
||||
mode = DriverTool::kFirmwareModeP2p;
|
||||
break;
|
||||
case IfaceType::NAN:
|
||||
// NAN is exposed in STA mode currently.
|
||||
mode = DriverTool::kFirmwareModeSta;
|
||||
break;
|
||||
case IfaceType::STA:
|
||||
mode = DriverTool::kFirmwareModeSta;
|
||||
break;
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
@@ -55,28 +55,29 @@ namespace mode_controller {
|
||||
WifiModeController::WifiModeController() : driver_tool_(new DriverTool) {}
|
||||
|
||||
bool WifiModeController::isFirmwareModeChangeNeeded(IfaceType type) {
|
||||
return driver_tool_->IsFirmwareModeChangeNeeded(
|
||||
convertIfaceTypeToFirmwareMode(type));
|
||||
return driver_tool_->IsFirmwareModeChangeNeeded(
|
||||
convertIfaceTypeToFirmwareMode(type));
|
||||
}
|
||||
|
||||
bool WifiModeController::changeFirmwareMode(IfaceType type) {
|
||||
if (!driver_tool_->LoadDriver()) {
|
||||
LOG(ERROR) << "Failed to load WiFi driver";
|
||||
return false;
|
||||
}
|
||||
if (!driver_tool_->ChangeFirmwareMode(convertIfaceTypeToFirmwareMode(type))) {
|
||||
LOG(ERROR) << "Failed to change firmware mode";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
if (!driver_tool_->LoadDriver()) {
|
||||
LOG(ERROR) << "Failed to load WiFi driver";
|
||||
return false;
|
||||
}
|
||||
if (!driver_tool_->ChangeFirmwareMode(
|
||||
convertIfaceTypeToFirmwareMode(type))) {
|
||||
LOG(ERROR) << "Failed to change firmware mode";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WifiModeController::deinitialize() {
|
||||
if (!driver_tool_->UnloadDriver()) {
|
||||
LOG(ERROR) << "Failed to unload WiFi driver";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
if (!driver_tool_->UnloadDriver()) {
|
||||
LOG(ERROR) << "Failed to unload WiFi driver";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // namespace mode_controller
|
||||
} // namespace implementation
|
||||
|
||||
@@ -35,20 +35,20 @@ using namespace android::hardware::wifi::V1_0;
|
||||
* required state (essentially a wrapper over DriverTool).
|
||||
*/
|
||||
class WifiModeController {
|
||||
public:
|
||||
WifiModeController();
|
||||
public:
|
||||
WifiModeController();
|
||||
|
||||
// Checks if a firmware mode change is necessary to support the specified
|
||||
// iface type operations.
|
||||
bool isFirmwareModeChangeNeeded(IfaceType type);
|
||||
// Change the firmware mode to support the specified iface type operations.
|
||||
bool changeFirmwareMode(IfaceType type);
|
||||
// Unload the driver. This should be invoked whenever |IWifi.stop()| is
|
||||
// invoked.
|
||||
bool deinitialize();
|
||||
// Checks if a firmware mode change is necessary to support the specified
|
||||
// iface type operations.
|
||||
bool isFirmwareModeChangeNeeded(IfaceType type);
|
||||
// Change the firmware mode to support the specified iface type operations.
|
||||
bool changeFirmwareMode(IfaceType type);
|
||||
// Unload the driver. This should be invoked whenever |IWifi.stop()| is
|
||||
// invoked.
|
||||
bool deinitialize();
|
||||
|
||||
private:
|
||||
std::unique_ptr<wifi_hal::DriverTool> driver_tool_;
|
||||
private:
|
||||
std::unique_ptr<wifi_hal::DriverTool> driver_tool_;
|
||||
};
|
||||
|
||||
} // namespace mode_controller
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,101 +35,98 @@ using namespace android::hardware::wifi::V1_0;
|
||||
* HIDL interface object used to control a NAN Iface instance.
|
||||
*/
|
||||
class WifiNanIface : public V1_0::IWifiNanIface {
|
||||
public:
|
||||
WifiNanIface(const std::string& ifname,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
public:
|
||||
WifiNanIface(const std::string& ifname,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<void> getName(getName_cb hidl_status_cb) override;
|
||||
Return<void> getType(getType_cb hidl_status_cb) override;
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiNanIfaceEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<void> getCapabilitiesRequest(uint16_t cmd_id,
|
||||
getCapabilitiesRequest_cb hidl_status_cb) override;
|
||||
Return<void> enableRequest(uint16_t cmd_id,
|
||||
const NanEnableRequest& msg,
|
||||
enableRequest_cb hidl_status_cb) override;
|
||||
Return<void> configRequest(uint16_t cmd_id,
|
||||
const NanConfigRequest& msg,
|
||||
configRequest_cb hidl_status_cb) override;
|
||||
Return<void> disableRequest(uint16_t cmd_id,
|
||||
disableRequest_cb hidl_status_cb) override;
|
||||
Return<void> startPublishRequest(uint16_t cmd_id,
|
||||
const NanPublishRequest& msg,
|
||||
startPublishRequest_cb hidl_status_cb) override;
|
||||
Return<void> stopPublishRequest(uint16_t cmd_id,
|
||||
uint8_t sessionId,
|
||||
stopPublishRequest_cb hidl_status_cb) override;
|
||||
Return<void> startSubscribeRequest(uint16_t cmd_id,
|
||||
const NanSubscribeRequest& msg,
|
||||
startSubscribeRequest_cb hidl_status_cb) override;
|
||||
Return<void> stopSubscribeRequest(uint16_t cmd_id,
|
||||
uint8_t sessionId,
|
||||
stopSubscribeRequest_cb hidl_status_cb) override;
|
||||
Return<void> transmitFollowupRequest(uint16_t cmd_id,
|
||||
const NanTransmitFollowupRequest& msg,
|
||||
transmitFollowupRequest_cb hidl_status_cb) override;
|
||||
Return<void> createDataInterfaceRequest(uint16_t cmd_id,
|
||||
const hidl_string& iface_name,
|
||||
createDataInterfaceRequest_cb hidl_status_cb) override;
|
||||
Return<void> deleteDataInterfaceRequest(uint16_t cmd_id,
|
||||
const hidl_string& iface_name,
|
||||
deleteDataInterfaceRequest_cb hidl_status_cb) override;
|
||||
Return<void> initiateDataPathRequest(uint16_t cmd_id,
|
||||
const NanInitiateDataPathRequest& msg,
|
||||
initiateDataPathRequest_cb hidl_status_cb) override;
|
||||
Return<void> respondToDataPathIndicationRequest(
|
||||
uint16_t cmd_id,
|
||||
const NanRespondToDataPathIndicationRequest& msg,
|
||||
respondToDataPathIndicationRequest_cb hidl_status_cb) override;
|
||||
Return<void> terminateDataPathRequest(uint16_t cmd_id,
|
||||
uint32_t ndpInstanceId,
|
||||
terminateDataPathRequest_cb hidl_status_cb) override;
|
||||
// HIDL methods exposed.
|
||||
Return<void> getName(getName_cb hidl_status_cb) override;
|
||||
Return<void> getType(getType_cb hidl_status_cb) override;
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiNanIfaceEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<void> getCapabilitiesRequest(
|
||||
uint16_t cmd_id, getCapabilitiesRequest_cb hidl_status_cb) override;
|
||||
Return<void> enableRequest(uint16_t cmd_id, const NanEnableRequest& msg,
|
||||
enableRequest_cb hidl_status_cb) override;
|
||||
Return<void> configRequest(uint16_t cmd_id, const NanConfigRequest& msg,
|
||||
configRequest_cb hidl_status_cb) override;
|
||||
Return<void> disableRequest(uint16_t cmd_id,
|
||||
disableRequest_cb hidl_status_cb) override;
|
||||
Return<void> startPublishRequest(
|
||||
uint16_t cmd_id, const NanPublishRequest& msg,
|
||||
startPublishRequest_cb hidl_status_cb) override;
|
||||
Return<void> stopPublishRequest(
|
||||
uint16_t cmd_id, uint8_t sessionId,
|
||||
stopPublishRequest_cb hidl_status_cb) override;
|
||||
Return<void> startSubscribeRequest(
|
||||
uint16_t cmd_id, const NanSubscribeRequest& msg,
|
||||
startSubscribeRequest_cb hidl_status_cb) override;
|
||||
Return<void> stopSubscribeRequest(
|
||||
uint16_t cmd_id, uint8_t sessionId,
|
||||
stopSubscribeRequest_cb hidl_status_cb) override;
|
||||
Return<void> transmitFollowupRequest(
|
||||
uint16_t cmd_id, const NanTransmitFollowupRequest& msg,
|
||||
transmitFollowupRequest_cb hidl_status_cb) override;
|
||||
Return<void> createDataInterfaceRequest(
|
||||
uint16_t cmd_id, const hidl_string& iface_name,
|
||||
createDataInterfaceRequest_cb hidl_status_cb) override;
|
||||
Return<void> deleteDataInterfaceRequest(
|
||||
uint16_t cmd_id, const hidl_string& iface_name,
|
||||
deleteDataInterfaceRequest_cb hidl_status_cb) override;
|
||||
Return<void> initiateDataPathRequest(
|
||||
uint16_t cmd_id, const NanInitiateDataPathRequest& msg,
|
||||
initiateDataPathRequest_cb hidl_status_cb) override;
|
||||
Return<void> respondToDataPathIndicationRequest(
|
||||
uint16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg,
|
||||
respondToDataPathIndicationRequest_cb hidl_status_cb) override;
|
||||
Return<void> terminateDataPathRequest(
|
||||
uint16_t cmd_id, uint32_t ndpInstanceId,
|
||||
terminateDataPathRequest_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, std::string> getNameInternal();
|
||||
std::pair<WifiStatus, IfaceType> getTypeInternal();
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiNanIfaceEventCallback>& callback);
|
||||
WifiStatus getCapabilitiesRequestInternal(uint16_t cmd_id);
|
||||
WifiStatus enableRequestInternal(uint16_t cmd_id,
|
||||
const NanEnableRequest& msg);
|
||||
WifiStatus configRequestInternal(uint16_t cmd_id,
|
||||
const NanConfigRequest& msg);
|
||||
WifiStatus disableRequestInternal(uint16_t cmd_id);
|
||||
WifiStatus startPublishRequestInternal(uint16_t cmd_id,
|
||||
const NanPublishRequest& msg);
|
||||
WifiStatus stopPublishRequestInternal(uint16_t cmd_id, uint8_t sessionId);
|
||||
WifiStatus startSubscribeRequestInternal(uint16_t cmd_id,
|
||||
const NanSubscribeRequest& msg);
|
||||
WifiStatus stopSubscribeRequestInternal(uint16_t cmd_id, uint8_t sessionId);
|
||||
WifiStatus transmitFollowupRequestInternal(
|
||||
uint16_t cmd_id, const NanTransmitFollowupRequest& msg);
|
||||
WifiStatus createDataInterfaceRequestInternal(uint16_t cmd_id,
|
||||
const std::string& iface_name);
|
||||
WifiStatus deleteDataInterfaceRequestInternal(uint16_t cmd_id,
|
||||
const std::string& iface_name);
|
||||
WifiStatus initiateDataPathRequestInternal(
|
||||
uint16_t cmd_id, const NanInitiateDataPathRequest& msg);
|
||||
WifiStatus respondToDataPathIndicationRequestInternal(
|
||||
uint16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg);
|
||||
WifiStatus terminateDataPathRequestInternal(
|
||||
uint16_t cmd_id, uint32_t ndpInstanceId);
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, std::string> getNameInternal();
|
||||
std::pair<WifiStatus, IfaceType> getTypeInternal();
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiNanIfaceEventCallback>& callback);
|
||||
WifiStatus getCapabilitiesRequestInternal(uint16_t cmd_id);
|
||||
WifiStatus enableRequestInternal(uint16_t cmd_id,
|
||||
const NanEnableRequest& msg);
|
||||
WifiStatus configRequestInternal(uint16_t cmd_id,
|
||||
const NanConfigRequest& msg);
|
||||
WifiStatus disableRequestInternal(uint16_t cmd_id);
|
||||
WifiStatus startPublishRequestInternal(uint16_t cmd_id,
|
||||
const NanPublishRequest& msg);
|
||||
WifiStatus stopPublishRequestInternal(uint16_t cmd_id, uint8_t sessionId);
|
||||
WifiStatus startSubscribeRequestInternal(uint16_t cmd_id,
|
||||
const NanSubscribeRequest& msg);
|
||||
WifiStatus stopSubscribeRequestInternal(uint16_t cmd_id, uint8_t sessionId);
|
||||
WifiStatus transmitFollowupRequestInternal(
|
||||
uint16_t cmd_id, const NanTransmitFollowupRequest& msg);
|
||||
WifiStatus createDataInterfaceRequestInternal(
|
||||
uint16_t cmd_id, const std::string& iface_name);
|
||||
WifiStatus deleteDataInterfaceRequestInternal(
|
||||
uint16_t cmd_id, const std::string& iface_name);
|
||||
WifiStatus initiateDataPathRequestInternal(
|
||||
uint16_t cmd_id, const NanInitiateDataPathRequest& msg);
|
||||
WifiStatus respondToDataPathIndicationRequestInternal(
|
||||
uint16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg);
|
||||
WifiStatus terminateDataPathRequestInternal(uint16_t cmd_id,
|
||||
uint32_t ndpInstanceId);
|
||||
|
||||
std::set<sp<IWifiNanIfaceEventCallback>> getEventCallbacks();
|
||||
std::set<sp<IWifiNanIfaceEventCallback>> getEventCallbacks();
|
||||
|
||||
std::string ifname_;
|
||||
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
bool is_valid_;
|
||||
hidl_callback_util::HidlCallbackHandler<IWifiNanIfaceEventCallback>
|
||||
event_cb_handler_;
|
||||
std::string ifname_;
|
||||
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
bool is_valid_;
|
||||
hidl_callback_util::HidlCallbackHandler<IWifiNanIfaceEventCallback>
|
||||
event_cb_handler_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiNanIface);
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiNanIface);
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -33,34 +33,28 @@ WifiP2pIface::WifiP2pIface(
|
||||
: ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
|
||||
|
||||
void WifiP2pIface::invalidate() {
|
||||
legacy_hal_.reset();
|
||||
is_valid_ = false;
|
||||
legacy_hal_.reset();
|
||||
is_valid_ = false;
|
||||
}
|
||||
|
||||
bool WifiP2pIface::isValid() {
|
||||
return is_valid_;
|
||||
}
|
||||
bool WifiP2pIface::isValid() { return is_valid_; }
|
||||
|
||||
Return<void> WifiP2pIface::getName(getName_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiP2pIface::getNameInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiP2pIface::getNameInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiP2pIface::getType(getType_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiP2pIface::getTypeInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiP2pIface::getTypeInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::string> WifiP2pIface::getNameInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, IfaceType> WifiP2pIface::getTypeInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::P2P};
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::P2P};
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -33,27 +33,27 @@ using namespace android::hardware::wifi::V1_0;
|
||||
* HIDL interface object used to control a P2P Iface instance.
|
||||
*/
|
||||
class WifiP2pIface : public V1_0::IWifiP2pIface {
|
||||
public:
|
||||
WifiP2pIface(const std::string& ifname,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
public:
|
||||
WifiP2pIface(const std::string& ifname,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<void> getName(getName_cb hidl_status_cb) override;
|
||||
Return<void> getType(getType_cb hidl_status_cb) override;
|
||||
// HIDL methods exposed.
|
||||
Return<void> getName(getName_cb hidl_status_cb) override;
|
||||
Return<void> getType(getType_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, std::string> getNameInternal();
|
||||
std::pair<WifiStatus, IfaceType> getTypeInternal();
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, std::string> getNameInternal();
|
||||
std::pair<WifiStatus, IfaceType> getTypeInternal();
|
||||
|
||||
std::string ifname_;
|
||||
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
bool is_valid_;
|
||||
std::string ifname_;
|
||||
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
bool is_valid_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiP2pIface);
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiP2pIface);
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -29,269 +29,244 @@ namespace implementation {
|
||||
using hidl_return_util::validateAndCall;
|
||||
|
||||
WifiRttController::WifiRttController(
|
||||
const std::string& iface_name,
|
||||
const sp<IWifiIface>& bound_iface,
|
||||
const std::string& iface_name, const sp<IWifiIface>& bound_iface,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal)
|
||||
: ifname_(iface_name), bound_iface_(bound_iface), legacy_hal_(legacy_hal),
|
||||
: ifname_(iface_name),
|
||||
bound_iface_(bound_iface),
|
||||
legacy_hal_(legacy_hal),
|
||||
is_valid_(true) {}
|
||||
|
||||
void WifiRttController::invalidate() {
|
||||
legacy_hal_.reset();
|
||||
event_callbacks_.clear();
|
||||
is_valid_ = false;
|
||||
legacy_hal_.reset();
|
||||
event_callbacks_.clear();
|
||||
is_valid_ = false;
|
||||
}
|
||||
|
||||
bool WifiRttController::isValid() {
|
||||
return is_valid_;
|
||||
}
|
||||
bool WifiRttController::isValid() { return is_valid_; }
|
||||
|
||||
std::vector<sp<IWifiRttControllerEventCallback>>
|
||||
WifiRttController::getEventCallbacks() {
|
||||
return event_callbacks_;
|
||||
return event_callbacks_;
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::getBoundIface(getBoundIface_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::getBoundIfaceInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(
|
||||
this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::getBoundIfaceInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::registerEventCallback(
|
||||
const sp<IWifiRttControllerEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::registerEventCallbackInternal,
|
||||
hidl_status_cb,
|
||||
callback);
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::registerEventCallbackInternal,
|
||||
hidl_status_cb, callback);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::rangeRequest(
|
||||
uint32_t cmd_id,
|
||||
const hidl_vec<RttConfig>& rtt_configs,
|
||||
uint32_t cmd_id, const hidl_vec<RttConfig>& rtt_configs,
|
||||
rangeRequest_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::rangeRequestInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
rtt_configs);
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::rangeRequestInternal,
|
||||
hidl_status_cb, cmd_id, rtt_configs);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::rangeCancel(
|
||||
uint32_t cmd_id,
|
||||
const hidl_vec<hidl_array<uint8_t, 6>>& addrs,
|
||||
uint32_t cmd_id, const hidl_vec<hidl_array<uint8_t, 6>>& addrs,
|
||||
rangeCancel_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::rangeCancelInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
addrs);
|
||||
return validateAndCall(
|
||||
this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::rangeCancelInternal, hidl_status_cb, cmd_id, addrs);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::getCapabilities(
|
||||
getCapabilities_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::getCapabilitiesInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(
|
||||
this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::getCapabilitiesInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::setLci(uint32_t cmd_id,
|
||||
const RttLciInformation& lci,
|
||||
setLci_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::setLciInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
lci);
|
||||
return validateAndCall(
|
||||
this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::setLciInternal, hidl_status_cb, cmd_id, lci);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::setLcr(uint32_t cmd_id,
|
||||
const RttLcrInformation& lcr,
|
||||
setLcr_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::setLcrInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
lcr);
|
||||
return validateAndCall(
|
||||
this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::setLcrInternal, hidl_status_cb, cmd_id, lcr);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::getResponderInfo(
|
||||
getResponderInfo_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::getResponderInfoInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(
|
||||
this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::getResponderInfoInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::enableResponder(
|
||||
uint32_t cmd_id,
|
||||
const WifiChannelInfo& channel_hint,
|
||||
uint32_t max_duration_seconds,
|
||||
const RttResponder& info,
|
||||
uint32_t cmd_id, const WifiChannelInfo& channel_hint,
|
||||
uint32_t max_duration_seconds, const RttResponder& info,
|
||||
enableResponder_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::enableResponderInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
channel_hint,
|
||||
max_duration_seconds,
|
||||
info);
|
||||
return validateAndCall(
|
||||
this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::enableResponderInternal, hidl_status_cb, cmd_id,
|
||||
channel_hint, max_duration_seconds, info);
|
||||
}
|
||||
|
||||
Return<void> WifiRttController::disableResponder(
|
||||
uint32_t cmd_id, disableResponder_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::disableResponderInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id);
|
||||
return validateAndCall(
|
||||
this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID,
|
||||
&WifiRttController::disableResponderInternal, hidl_status_cb, cmd_id);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, sp<IWifiIface>>
|
||||
WifiRttController::getBoundIfaceInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), bound_iface_};
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), bound_iface_};
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::registerEventCallbackInternal(
|
||||
const sp<IWifiRttControllerEventCallback>& callback) {
|
||||
// TODO(b/31632518): remove the callback when the client is destroyed
|
||||
event_callbacks_.emplace_back(callback);
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
// TODO(b/31632518): remove the callback when the client is destroyed
|
||||
event_callbacks_.emplace_back(callback);
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::rangeRequestInternal(
|
||||
uint32_t cmd_id, const std::vector<RttConfig>& rtt_configs) {
|
||||
std::vector<legacy_hal::wifi_rtt_config> legacy_configs;
|
||||
if (!hidl_struct_util::convertHidlVectorOfRttConfigToLegacy(
|
||||
rtt_configs, &legacy_configs)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
android::wp<WifiRttController> weak_ptr_this(this);
|
||||
const auto& on_results_callback = [weak_ptr_this](
|
||||
legacy_hal::wifi_request_id id,
|
||||
const std::vector<const legacy_hal::wifi_rtt_result*>& results) {
|
||||
const auto shared_ptr_this = weak_ptr_this.promote();
|
||||
if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
|
||||
LOG(ERROR) << "Callback invoked on an invalid object";
|
||||
return;
|
||||
std::vector<legacy_hal::wifi_rtt_config> legacy_configs;
|
||||
if (!hidl_struct_util::convertHidlVectorOfRttConfigToLegacy(
|
||||
rtt_configs, &legacy_configs)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
std::vector<RttResult> hidl_results;
|
||||
if (!hidl_struct_util::convertLegacyVectorOfRttResultToHidl(
|
||||
results, &hidl_results)) {
|
||||
LOG(ERROR) << "Failed to convert rtt results to HIDL structs";
|
||||
return;
|
||||
}
|
||||
for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
|
||||
callback->onResults(id, hidl_results);
|
||||
}
|
||||
};
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->startRttRangeRequest(
|
||||
ifname_, cmd_id, legacy_configs, on_results_callback);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
android::wp<WifiRttController> weak_ptr_this(this);
|
||||
const auto& on_results_callback =
|
||||
[weak_ptr_this](
|
||||
legacy_hal::wifi_request_id id,
|
||||
const std::vector<const legacy_hal::wifi_rtt_result*>& results) {
|
||||
const auto shared_ptr_this = weak_ptr_this.promote();
|
||||
if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
|
||||
LOG(ERROR) << "Callback invoked on an invalid object";
|
||||
return;
|
||||
}
|
||||
std::vector<RttResult> hidl_results;
|
||||
if (!hidl_struct_util::convertLegacyVectorOfRttResultToHidl(
|
||||
results, &hidl_results)) {
|
||||
LOG(ERROR) << "Failed to convert rtt results to HIDL structs";
|
||||
return;
|
||||
}
|
||||
for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
|
||||
callback->onResults(id, hidl_results);
|
||||
}
|
||||
};
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->startRttRangeRequest(
|
||||
ifname_, cmd_id, legacy_configs, on_results_callback);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::rangeCancelInternal(
|
||||
uint32_t cmd_id, const std::vector<hidl_array<uint8_t, 6>>& addrs) {
|
||||
std::vector<std::array<uint8_t, 6>> legacy_addrs;
|
||||
for (const auto& addr : addrs) {
|
||||
legacy_addrs.push_back(addr);
|
||||
}
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->cancelRttRangeRequest(ifname_, cmd_id, legacy_addrs);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
std::vector<std::array<uint8_t, 6>> legacy_addrs;
|
||||
for (const auto& addr : addrs) {
|
||||
legacy_addrs.push_back(addr);
|
||||
}
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->cancelRttRangeRequest(ifname_, cmd_id,
|
||||
legacy_addrs);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, RttCapabilities>
|
||||
WifiRttController::getCapabilitiesInternal() {
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
legacy_hal::wifi_rtt_capabilities legacy_caps;
|
||||
std::tie(legacy_status, legacy_caps) =
|
||||
legacy_hal_.lock()->getRttCapabilities(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
RttCapabilities hidl_caps;
|
||||
if (!hidl_struct_util::convertLegacyRttCapabilitiesToHidl(legacy_caps,
|
||||
&hidl_caps)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
legacy_hal::wifi_rtt_capabilities legacy_caps;
|
||||
std::tie(legacy_status, legacy_caps) =
|
||||
legacy_hal_.lock()->getRttCapabilities(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
RttCapabilities hidl_caps;
|
||||
if (!hidl_struct_util::convertLegacyRttCapabilitiesToHidl(legacy_caps,
|
||||
&hidl_caps)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::setLciInternal(uint32_t cmd_id,
|
||||
const RttLciInformation& lci) {
|
||||
legacy_hal::wifi_lci_information legacy_lci;
|
||||
if (!hidl_struct_util::convertHidlRttLciInformationToLegacy(lci,
|
||||
&legacy_lci)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->setRttLci(ifname_, cmd_id, legacy_lci);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_lci_information legacy_lci;
|
||||
if (!hidl_struct_util::convertHidlRttLciInformationToLegacy(lci,
|
||||
&legacy_lci)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->setRttLci(ifname_, cmd_id, legacy_lci);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::setLcrInternal(uint32_t cmd_id,
|
||||
const RttLcrInformation& lcr) {
|
||||
legacy_hal::wifi_lcr_information legacy_lcr;
|
||||
if (!hidl_struct_util::convertHidlRttLcrInformationToLegacy(lcr,
|
||||
&legacy_lcr)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->setRttLcr(ifname_, cmd_id, legacy_lcr);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_lcr_information legacy_lcr;
|
||||
if (!hidl_struct_util::convertHidlRttLcrInformationToLegacy(lcr,
|
||||
&legacy_lcr)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->setRttLcr(ifname_, cmd_id, legacy_lcr);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, RttResponder>
|
||||
WifiRttController::getResponderInfoInternal() {
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
legacy_hal::wifi_rtt_responder legacy_responder;
|
||||
std::tie(legacy_status, legacy_responder) =
|
||||
legacy_hal_.lock()->getRttResponderInfo(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
RttResponder hidl_responder;
|
||||
if (!hidl_struct_util::convertLegacyRttResponderToHidl(legacy_responder,
|
||||
&hidl_responder)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_responder};
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
legacy_hal::wifi_rtt_responder legacy_responder;
|
||||
std::tie(legacy_status, legacy_responder) =
|
||||
legacy_hal_.lock()->getRttResponderInfo(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
RttResponder hidl_responder;
|
||||
if (!hidl_struct_util::convertLegacyRttResponderToHidl(legacy_responder,
|
||||
&hidl_responder)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_responder};
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::enableResponderInternal(
|
||||
uint32_t cmd_id,
|
||||
const WifiChannelInfo& channel_hint,
|
||||
uint32_t max_duration_seconds,
|
||||
const RttResponder& info) {
|
||||
legacy_hal::wifi_channel_info legacy_channel_info;
|
||||
if (!hidl_struct_util::convertHidlWifiChannelInfoToLegacy(
|
||||
channel_hint, &legacy_channel_info)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
legacy_hal::wifi_rtt_responder legacy_responder;
|
||||
if (!hidl_struct_util::convertHidlRttResponderToLegacy(info,
|
||||
&legacy_responder)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableRttResponder(
|
||||
ifname_, cmd_id, legacy_channel_info, max_duration_seconds,
|
||||
legacy_responder);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
uint32_t cmd_id, const WifiChannelInfo& channel_hint,
|
||||
uint32_t max_duration_seconds, const RttResponder& info) {
|
||||
legacy_hal::wifi_channel_info legacy_channel_info;
|
||||
if (!hidl_struct_util::convertHidlWifiChannelInfoToLegacy(
|
||||
channel_hint, &legacy_channel_info)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
legacy_hal::wifi_rtt_responder legacy_responder;
|
||||
if (!hidl_struct_util::convertHidlRttResponderToLegacy(info,
|
||||
&legacy_responder)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->enableRttResponder(
|
||||
ifname_, cmd_id, legacy_channel_info, max_duration_seconds,
|
||||
legacy_responder);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiRttController::disableResponderInternal(uint32_t cmd_id) {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->disableRttResponder(ifname_, cmd_id);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->disableRttResponder(ifname_, cmd_id);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
} // namespace implementation
|
||||
} // namespace V1_2
|
||||
|
||||
@@ -34,68 +34,66 @@ namespace implementation {
|
||||
* HIDL interface object used to control all RTT operations.
|
||||
*/
|
||||
class WifiRttController : public V1_0::IWifiRttController {
|
||||
public:
|
||||
WifiRttController(
|
||||
const std::string& iface_name, const sp<IWifiIface>& bound_iface,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
std::vector<sp<IWifiRttControllerEventCallback>> getEventCallbacks();
|
||||
public:
|
||||
WifiRttController(
|
||||
const std::string& iface_name, const sp<IWifiIface>& bound_iface,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
std::vector<sp<IWifiRttControllerEventCallback>> getEventCallbacks();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<void> getBoundIface(getBoundIface_cb hidl_status_cb) override;
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiRttControllerEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<void> rangeRequest(uint32_t cmd_id,
|
||||
const hidl_vec<RttConfig>& rtt_configs,
|
||||
rangeRequest_cb hidl_status_cb) override;
|
||||
Return<void> rangeCancel(uint32_t cmd_id,
|
||||
const hidl_vec<hidl_array<uint8_t, 6>>& addrs,
|
||||
rangeCancel_cb hidl_status_cb) override;
|
||||
Return<void> getCapabilities(getCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> setLci(uint32_t cmd_id,
|
||||
const RttLciInformation& lci,
|
||||
setLci_cb hidl_status_cb) override;
|
||||
Return<void> setLcr(uint32_t cmd_id,
|
||||
const RttLcrInformation& lcr,
|
||||
setLcr_cb hidl_status_cb) override;
|
||||
Return<void> getResponderInfo(getResponderInfo_cb hidl_status_cb) override;
|
||||
Return<void> enableResponder(uint32_t cmd_id,
|
||||
const WifiChannelInfo& channel_hint,
|
||||
uint32_t max_duration_seconds,
|
||||
const RttResponder& info,
|
||||
enableResponder_cb hidl_status_cb) override;
|
||||
Return<void> disableResponder(uint32_t cmd_id,
|
||||
disableResponder_cb hidl_status_cb) override;
|
||||
// HIDL methods exposed.
|
||||
Return<void> getBoundIface(getBoundIface_cb hidl_status_cb) override;
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiRttControllerEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<void> rangeRequest(uint32_t cmd_id,
|
||||
const hidl_vec<RttConfig>& rtt_configs,
|
||||
rangeRequest_cb hidl_status_cb) override;
|
||||
Return<void> rangeCancel(uint32_t cmd_id,
|
||||
const hidl_vec<hidl_array<uint8_t, 6>>& addrs,
|
||||
rangeCancel_cb hidl_status_cb) override;
|
||||
Return<void> getCapabilities(getCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> setLci(uint32_t cmd_id, const RttLciInformation& lci,
|
||||
setLci_cb hidl_status_cb) override;
|
||||
Return<void> setLcr(uint32_t cmd_id, const RttLcrInformation& lcr,
|
||||
setLcr_cb hidl_status_cb) override;
|
||||
Return<void> getResponderInfo(getResponderInfo_cb hidl_status_cb) override;
|
||||
Return<void> enableResponder(uint32_t cmd_id,
|
||||
const WifiChannelInfo& channel_hint,
|
||||
uint32_t max_duration_seconds,
|
||||
const RttResponder& info,
|
||||
enableResponder_cb hidl_status_cb) override;
|
||||
Return<void> disableResponder(uint32_t cmd_id,
|
||||
disableResponder_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, sp<IWifiIface>> getBoundIfaceInternal();
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiRttControllerEventCallback>& callback);
|
||||
WifiStatus rangeRequestInternal(uint32_t cmd_id,
|
||||
const std::vector<RttConfig>& rtt_configs);
|
||||
WifiStatus rangeCancelInternal(
|
||||
uint32_t cmd_id, const std::vector<hidl_array<uint8_t, 6>>& addrs);
|
||||
std::pair<WifiStatus, RttCapabilities> getCapabilitiesInternal();
|
||||
WifiStatus setLciInternal(uint32_t cmd_id, const RttLciInformation& lci);
|
||||
WifiStatus setLcrInternal(uint32_t cmd_id, const RttLcrInformation& lcr);
|
||||
std::pair<WifiStatus, RttResponder> getResponderInfoInternal();
|
||||
WifiStatus enableResponderInternal(uint32_t cmd_id,
|
||||
const WifiChannelInfo& channel_hint,
|
||||
uint32_t max_duration_seconds,
|
||||
const RttResponder& info);
|
||||
WifiStatus disableResponderInternal(uint32_t cmd_id);
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, sp<IWifiIface>> getBoundIfaceInternal();
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiRttControllerEventCallback>& callback);
|
||||
WifiStatus rangeRequestInternal(uint32_t cmd_id,
|
||||
const std::vector<RttConfig>& rtt_configs);
|
||||
WifiStatus rangeCancelInternal(
|
||||
uint32_t cmd_id, const std::vector<hidl_array<uint8_t, 6>>& addrs);
|
||||
std::pair<WifiStatus, RttCapabilities> getCapabilitiesInternal();
|
||||
WifiStatus setLciInternal(uint32_t cmd_id, const RttLciInformation& lci);
|
||||
WifiStatus setLcrInternal(uint32_t cmd_id, const RttLcrInformation& lcr);
|
||||
std::pair<WifiStatus, RttResponder> getResponderInfoInternal();
|
||||
WifiStatus enableResponderInternal(uint32_t cmd_id,
|
||||
const WifiChannelInfo& channel_hint,
|
||||
uint32_t max_duration_seconds,
|
||||
const RttResponder& info);
|
||||
WifiStatus disableResponderInternal(uint32_t cmd_id);
|
||||
|
||||
std::string ifname_;
|
||||
sp<IWifiIface> bound_iface_;
|
||||
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
std::vector<sp<IWifiRttControllerEventCallback>> event_callbacks_;
|
||||
bool is_valid_;
|
||||
std::string ifname_;
|
||||
sp<IWifiIface> bound_iface_;
|
||||
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
std::vector<sp<IWifiRttControllerEventCallback>> event_callbacks_;
|
||||
bool is_valid_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiRttController);
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiRttController);
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -32,599 +32,548 @@ WifiStaIface::WifiStaIface(
|
||||
const std::string& ifname,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal)
|
||||
: ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {
|
||||
// Turn on DFS channel usage for STA iface.
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->setDfsFlag(ifname_, true);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to set DFS flag; DFS channels may be unavailable.";
|
||||
}
|
||||
// Turn on DFS channel usage for STA iface.
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->setDfsFlag(ifname_, true);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
LOG(ERROR)
|
||||
<< "Failed to set DFS flag; DFS channels may be unavailable.";
|
||||
}
|
||||
}
|
||||
|
||||
void WifiStaIface::invalidate() {
|
||||
legacy_hal_.reset();
|
||||
event_cb_handler_.invalidate();
|
||||
is_valid_ = false;
|
||||
legacy_hal_.reset();
|
||||
event_cb_handler_.invalidate();
|
||||
is_valid_ = false;
|
||||
}
|
||||
|
||||
bool WifiStaIface::isValid() {
|
||||
return is_valid_;
|
||||
}
|
||||
bool WifiStaIface::isValid() { return is_valid_; }
|
||||
|
||||
std::set<sp<IWifiStaIfaceEventCallback>> WifiStaIface::getEventCallbacks() {
|
||||
return event_cb_handler_.getCallbacks();
|
||||
return event_cb_handler_.getCallbacks();
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getName(getName_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getNameInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getNameInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getType(getType_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getTypeInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getTypeInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::registerEventCallback(
|
||||
const sp<IWifiStaIfaceEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::registerEventCallbackInternal,
|
||||
hidl_status_cb,
|
||||
callback);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::registerEventCallbackInternal,
|
||||
hidl_status_cb, callback);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getCapabilities(getCapabilities_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getCapabilitiesInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getCapabilitiesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getApfPacketFilterCapabilities(
|
||||
getApfPacketFilterCapabilities_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getApfPacketFilterCapabilitiesInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(
|
||||
this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getApfPacketFilterCapabilitiesInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::installApfPacketFilter(
|
||||
uint32_t cmd_id,
|
||||
const hidl_vec<uint8_t>& program,
|
||||
uint32_t cmd_id, const hidl_vec<uint8_t>& program,
|
||||
installApfPacketFilter_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::installApfPacketFilterInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
program);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::installApfPacketFilterInternal,
|
||||
hidl_status_cb, cmd_id, program);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getBackgroundScanCapabilities(
|
||||
getBackgroundScanCapabilities_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getBackgroundScanCapabilitiesInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getBackgroundScanCapabilitiesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getValidFrequenciesForBand(
|
||||
WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getValidFrequenciesForBandInternal,
|
||||
hidl_status_cb,
|
||||
band);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getValidFrequenciesForBandInternal,
|
||||
hidl_status_cb, band);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::startBackgroundScan(
|
||||
uint32_t cmd_id,
|
||||
const StaBackgroundScanParameters& params,
|
||||
uint32_t cmd_id, const StaBackgroundScanParameters& params,
|
||||
startBackgroundScan_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::startBackgroundScanInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
params);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::startBackgroundScanInternal,
|
||||
hidl_status_cb, cmd_id, params);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::stopBackgroundScan(
|
||||
uint32_t cmd_id, stopBackgroundScan_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::stopBackgroundScanInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::stopBackgroundScanInternal,
|
||||
hidl_status_cb, cmd_id);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::enableLinkLayerStatsCollection(
|
||||
bool debug, enableLinkLayerStatsCollection_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::enableLinkLayerStatsCollectionInternal,
|
||||
hidl_status_cb,
|
||||
debug);
|
||||
return validateAndCall(
|
||||
this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::enableLinkLayerStatsCollectionInternal, hidl_status_cb,
|
||||
debug);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::disableLinkLayerStatsCollection(
|
||||
disableLinkLayerStatsCollection_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::disableLinkLayerStatsCollectionInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(
|
||||
this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::disableLinkLayerStatsCollectionInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getLinkLayerStats(
|
||||
getLinkLayerStats_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getLinkLayerStatsInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getLinkLayerStatsInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::startRssiMonitoring(
|
||||
uint32_t cmd_id,
|
||||
int32_t max_rssi,
|
||||
int32_t min_rssi,
|
||||
uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi,
|
||||
startRssiMonitoring_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::startRssiMonitoringInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
max_rssi,
|
||||
min_rssi);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::startRssiMonitoringInternal,
|
||||
hidl_status_cb, cmd_id, max_rssi, min_rssi);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::stopRssiMonitoring(
|
||||
uint32_t cmd_id, stopRssiMonitoring_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::stopRssiMonitoringInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::stopRssiMonitoringInternal,
|
||||
hidl_status_cb, cmd_id);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getRoamingCapabilities(
|
||||
getRoamingCapabilities_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getRoamingCapabilitiesInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getRoamingCapabilitiesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::configureRoaming(
|
||||
const StaRoamingConfig& config, configureRoaming_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::configureRoamingInternal,
|
||||
hidl_status_cb,
|
||||
config);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::configureRoamingInternal,
|
||||
hidl_status_cb, config);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::setRoamingState(StaRoamingState state,
|
||||
setRoamingState_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::setRoamingStateInternal,
|
||||
hidl_status_cb,
|
||||
state);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::setRoamingStateInternal,
|
||||
hidl_status_cb, state);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::enableNdOffload(bool enable,
|
||||
enableNdOffload_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::enableNdOffloadInternal,
|
||||
hidl_status_cb,
|
||||
enable);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::enableNdOffloadInternal,
|
||||
hidl_status_cb, enable);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::startSendingKeepAlivePackets(
|
||||
uint32_t cmd_id,
|
||||
const hidl_vec<uint8_t>& ip_packet_data,
|
||||
uint16_t ether_type,
|
||||
const hidl_array<uint8_t, 6>& src_address,
|
||||
const hidl_array<uint8_t, 6>& dst_address,
|
||||
uint32_t period_in_ms,
|
||||
uint32_t cmd_id, const hidl_vec<uint8_t>& ip_packet_data,
|
||||
uint16_t ether_type, const hidl_array<uint8_t, 6>& src_address,
|
||||
const hidl_array<uint8_t, 6>& dst_address, uint32_t period_in_ms,
|
||||
startSendingKeepAlivePackets_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::startSendingKeepAlivePacketsInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id,
|
||||
ip_packet_data,
|
||||
ether_type,
|
||||
src_address,
|
||||
dst_address,
|
||||
period_in_ms);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::startSendingKeepAlivePacketsInternal,
|
||||
hidl_status_cb, cmd_id, ip_packet_data, ether_type,
|
||||
src_address, dst_address, period_in_ms);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::stopSendingKeepAlivePackets(
|
||||
uint32_t cmd_id, stopSendingKeepAlivePackets_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::stopSendingKeepAlivePacketsInternal,
|
||||
hidl_status_cb,
|
||||
cmd_id);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::stopSendingKeepAlivePacketsInternal,
|
||||
hidl_status_cb, cmd_id);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::setScanningMacOui(
|
||||
const hidl_array<uint8_t, 3>& oui, setScanningMacOui_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::setScanningMacOuiInternal,
|
||||
hidl_status_cb,
|
||||
oui);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::setScanningMacOuiInternal,
|
||||
hidl_status_cb, oui);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::startDebugPacketFateMonitoring(
|
||||
startDebugPacketFateMonitoring_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::startDebugPacketFateMonitoringInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(
|
||||
this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::startDebugPacketFateMonitoringInternal, hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getDebugTxPacketFates(
|
||||
getDebugTxPacketFates_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getDebugTxPacketFatesInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getDebugTxPacketFatesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
Return<void> WifiStaIface::getDebugRxPacketFates(
|
||||
getDebugRxPacketFates_cb hidl_status_cb) {
|
||||
return validateAndCall(this,
|
||||
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getDebugRxPacketFatesInternal,
|
||||
hidl_status_cb);
|
||||
return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
|
||||
&WifiStaIface::getDebugRxPacketFatesInternal,
|
||||
hidl_status_cb);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::string> WifiStaIface::getNameInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, IfaceType> WifiStaIface::getTypeInternal() {
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::STA};
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::STA};
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::registerEventCallbackInternal(
|
||||
const sp<IWifiStaIfaceEventCallback>& callback) {
|
||||
if (!event_cb_handler_.addCallback(callback)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
|
||||
}
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
if (!event_cb_handler_.addCallback(callback)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
|
||||
}
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, uint32_t> WifiStaIface::getCapabilitiesInternal() {
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
uint32_t legacy_feature_set;
|
||||
std::tie(legacy_status, legacy_feature_set) =
|
||||
legacy_hal_.lock()->getSupportedFeatureSet(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), 0};
|
||||
}
|
||||
uint32_t legacy_logger_feature_set;
|
||||
std::tie(legacy_status, legacy_logger_feature_set) =
|
||||
legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
// some devices don't support querying logger feature set
|
||||
legacy_logger_feature_set = 0;
|
||||
}
|
||||
uint32_t hidl_caps;
|
||||
if (!hidl_struct_util::convertLegacyFeaturesToHidlStaCapabilities(
|
||||
legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
uint32_t legacy_feature_set;
|
||||
std::tie(legacy_status, legacy_feature_set) =
|
||||
legacy_hal_.lock()->getSupportedFeatureSet(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), 0};
|
||||
}
|
||||
uint32_t legacy_logger_feature_set;
|
||||
std::tie(legacy_status, legacy_logger_feature_set) =
|
||||
legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
// some devices don't support querying logger feature set
|
||||
legacy_logger_feature_set = 0;
|
||||
}
|
||||
uint32_t hidl_caps;
|
||||
if (!hidl_struct_util::convertLegacyFeaturesToHidlStaCapabilities(
|
||||
legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, StaApfPacketFilterCapabilities>
|
||||
WifiStaIface::getApfPacketFilterCapabilitiesInternal() {
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
legacy_hal::PacketFilterCapabilities legacy_caps;
|
||||
std::tie(legacy_status, legacy_caps) =
|
||||
legacy_hal_.lock()->getPacketFilterCapabilities(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
StaApfPacketFilterCapabilities hidl_caps;
|
||||
if (!hidl_struct_util::convertLegacyApfCapabilitiesToHidl(legacy_caps,
|
||||
&hidl_caps)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
legacy_hal::PacketFilterCapabilities legacy_caps;
|
||||
std::tie(legacy_status, legacy_caps) =
|
||||
legacy_hal_.lock()->getPacketFilterCapabilities(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
StaApfPacketFilterCapabilities hidl_caps;
|
||||
if (!hidl_struct_util::convertLegacyApfCapabilitiesToHidl(legacy_caps,
|
||||
&hidl_caps)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::installApfPacketFilterInternal(
|
||||
uint32_t /* cmd_id */, const std::vector<uint8_t>& program) {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->setPacketFilter(ifname_, program);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->setPacketFilter(ifname_, program);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, StaBackgroundScanCapabilities>
|
||||
WifiStaIface::getBackgroundScanCapabilitiesInternal() {
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
legacy_hal::wifi_gscan_capabilities legacy_caps;
|
||||
std::tie(legacy_status, legacy_caps) =
|
||||
legacy_hal_.lock()->getGscanCapabilities(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
StaBackgroundScanCapabilities hidl_caps;
|
||||
if (!hidl_struct_util::convertLegacyGscanCapabilitiesToHidl(legacy_caps,
|
||||
&hidl_caps)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
legacy_hal::wifi_gscan_capabilities legacy_caps;
|
||||
std::tie(legacy_status, legacy_caps) =
|
||||
legacy_hal_.lock()->getGscanCapabilities(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
StaBackgroundScanCapabilities hidl_caps;
|
||||
if (!hidl_struct_util::convertLegacyGscanCapabilitiesToHidl(legacy_caps,
|
||||
&hidl_caps)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
|
||||
WifiStaIface::getValidFrequenciesForBandInternal(WifiBand band) {
|
||||
static_assert(sizeof(WifiChannelInMhz) == sizeof(uint32_t), "Size mismatch");
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
std::vector<uint32_t> valid_frequencies;
|
||||
std::tie(legacy_status, valid_frequencies) =
|
||||
legacy_hal_.lock()->getValidFrequenciesForBand(
|
||||
ifname_, hidl_struct_util::convertHidlWifiBandToLegacy(band));
|
||||
return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies};
|
||||
static_assert(sizeof(WifiChannelInMhz) == sizeof(uint32_t),
|
||||
"Size mismatch");
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
std::vector<uint32_t> valid_frequencies;
|
||||
std::tie(legacy_status, valid_frequencies) =
|
||||
legacy_hal_.lock()->getValidFrequenciesForBand(
|
||||
ifname_, hidl_struct_util::convertHidlWifiBandToLegacy(band));
|
||||
return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies};
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::startBackgroundScanInternal(
|
||||
uint32_t cmd_id, const StaBackgroundScanParameters& params) {
|
||||
legacy_hal::wifi_scan_cmd_params legacy_params;
|
||||
if (!hidl_struct_util::convertHidlGscanParamsToLegacy(params,
|
||||
&legacy_params)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
android::wp<WifiStaIface> weak_ptr_this(this);
|
||||
const auto& on_failure_callback =
|
||||
[weak_ptr_this](legacy_hal::wifi_request_id id) {
|
||||
legacy_hal::wifi_scan_cmd_params legacy_params;
|
||||
if (!hidl_struct_util::convertHidlGscanParamsToLegacy(params,
|
||||
&legacy_params)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
android::wp<WifiStaIface> weak_ptr_this(this);
|
||||
const auto& on_failure_callback =
|
||||
[weak_ptr_this](legacy_hal::wifi_request_id id) {
|
||||
const auto shared_ptr_this = weak_ptr_this.promote();
|
||||
if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
|
||||
LOG(ERROR) << "Callback invoked on an invalid object";
|
||||
return;
|
||||
}
|
||||
for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
|
||||
if (!callback->onBackgroundScanFailure(id).isOk()) {
|
||||
LOG(ERROR)
|
||||
<< "Failed to invoke onBackgroundScanFailure callback";
|
||||
}
|
||||
}
|
||||
};
|
||||
const auto& on_results_callback =
|
||||
[weak_ptr_this](
|
||||
legacy_hal::wifi_request_id id,
|
||||
const std::vector<legacy_hal::wifi_cached_scan_results>& results) {
|
||||
const auto shared_ptr_this = weak_ptr_this.promote();
|
||||
if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
|
||||
LOG(ERROR) << "Callback invoked on an invalid object";
|
||||
return;
|
||||
}
|
||||
std::vector<StaScanData> hidl_scan_datas;
|
||||
if (!hidl_struct_util::
|
||||
convertLegacyVectorOfCachedGscanResultsToHidl(
|
||||
results, &hidl_scan_datas)) {
|
||||
LOG(ERROR) << "Failed to convert scan results to HIDL structs";
|
||||
return;
|
||||
}
|
||||
for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
|
||||
if (!callback->onBackgroundScanResults(id, hidl_scan_datas)
|
||||
.isOk()) {
|
||||
LOG(ERROR)
|
||||
<< "Failed to invoke onBackgroundScanResults callback";
|
||||
}
|
||||
}
|
||||
};
|
||||
const auto& on_full_result_callback = [weak_ptr_this](
|
||||
legacy_hal::wifi_request_id id,
|
||||
const legacy_hal::
|
||||
wifi_scan_result* result,
|
||||
uint32_t buckets_scanned) {
|
||||
const auto shared_ptr_this = weak_ptr_this.promote();
|
||||
if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
|
||||
LOG(ERROR) << "Callback invoked on an invalid object";
|
||||
return;
|
||||
LOG(ERROR) << "Callback invoked on an invalid object";
|
||||
return;
|
||||
}
|
||||
StaScanResult hidl_scan_result;
|
||||
if (!hidl_struct_util::convertLegacyGscanResultToHidl(
|
||||
*result, true, &hidl_scan_result)) {
|
||||
LOG(ERROR) << "Failed to convert full scan results to HIDL structs";
|
||||
return;
|
||||
}
|
||||
for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
|
||||
if (!callback->onBackgroundScanFailure(id).isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onBackgroundScanFailure callback";
|
||||
}
|
||||
if (!callback
|
||||
->onBackgroundFullScanResult(id, buckets_scanned,
|
||||
hidl_scan_result)
|
||||
.isOk()) {
|
||||
LOG(ERROR)
|
||||
<< "Failed to invoke onBackgroundFullScanResult callback";
|
||||
}
|
||||
}
|
||||
};
|
||||
const auto& on_results_callback = [weak_ptr_this](
|
||||
legacy_hal::wifi_request_id id,
|
||||
const std::vector<legacy_hal::wifi_cached_scan_results>& results) {
|
||||
const auto shared_ptr_this = weak_ptr_this.promote();
|
||||
if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
|
||||
LOG(ERROR) << "Callback invoked on an invalid object";
|
||||
return;
|
||||
}
|
||||
std::vector<StaScanData> hidl_scan_datas;
|
||||
if (!hidl_struct_util::convertLegacyVectorOfCachedGscanResultsToHidl(
|
||||
results, &hidl_scan_datas)) {
|
||||
LOG(ERROR) << "Failed to convert scan results to HIDL structs";
|
||||
return;
|
||||
}
|
||||
for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
|
||||
if (!callback->onBackgroundScanResults(id, hidl_scan_datas).isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onBackgroundScanResults callback";
|
||||
}
|
||||
}
|
||||
};
|
||||
const auto& on_full_result_callback = [weak_ptr_this](
|
||||
legacy_hal::wifi_request_id id,
|
||||
const legacy_hal::wifi_scan_result* result,
|
||||
uint32_t buckets_scanned) {
|
||||
const auto shared_ptr_this = weak_ptr_this.promote();
|
||||
if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
|
||||
LOG(ERROR) << "Callback invoked on an invalid object";
|
||||
return;
|
||||
}
|
||||
StaScanResult hidl_scan_result;
|
||||
if (!hidl_struct_util::convertLegacyGscanResultToHidl(
|
||||
*result, true, &hidl_scan_result)) {
|
||||
LOG(ERROR) << "Failed to convert full scan results to HIDL structs";
|
||||
return;
|
||||
}
|
||||
for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
|
||||
if (!callback->onBackgroundFullScanResult(
|
||||
id, buckets_scanned, hidl_scan_result).isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onBackgroundFullScanResult callback";
|
||||
}
|
||||
}
|
||||
};
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->startGscan(ifname_,
|
||||
cmd_id,
|
||||
legacy_params,
|
||||
on_failure_callback,
|
||||
on_results_callback,
|
||||
on_full_result_callback);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
};
|
||||
legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startGscan(
|
||||
ifname_, cmd_id, legacy_params, on_failure_callback,
|
||||
on_results_callback, on_full_result_callback);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::stopBackgroundScanInternal(uint32_t cmd_id) {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->stopGscan(ifname_, cmd_id);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->stopGscan(ifname_, cmd_id);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::enableLinkLayerStatsCollectionInternal(bool debug) {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->enableLinkLayerStats(ifname_, debug);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->enableLinkLayerStats(ifname_, debug);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::disableLinkLayerStatsCollectionInternal() {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->disableLinkLayerStats(ifname_);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->disableLinkLayerStats(ifname_);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, StaLinkLayerStats>
|
||||
WifiStaIface::getLinkLayerStatsInternal() {
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
legacy_hal::LinkLayerStats legacy_stats;
|
||||
std::tie(legacy_status, legacy_stats) =
|
||||
legacy_hal_.lock()->getLinkLayerStats(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
StaLinkLayerStats hidl_stats;
|
||||
if (!hidl_struct_util::convertLegacyLinkLayerStatsToHidl(legacy_stats,
|
||||
&hidl_stats)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_stats};
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
legacy_hal::LinkLayerStats legacy_stats;
|
||||
std::tie(legacy_status, legacy_stats) =
|
||||
legacy_hal_.lock()->getLinkLayerStats(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
StaLinkLayerStats hidl_stats;
|
||||
if (!hidl_struct_util::convertLegacyLinkLayerStatsToHidl(legacy_stats,
|
||||
&hidl_stats)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_stats};
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::startRssiMonitoringInternal(uint32_t cmd_id,
|
||||
int32_t max_rssi,
|
||||
int32_t min_rssi) {
|
||||
android::wp<WifiStaIface> weak_ptr_this(this);
|
||||
const auto& on_threshold_breached_callback = [weak_ptr_this](
|
||||
legacy_hal::wifi_request_id id,
|
||||
std::array<uint8_t, 6> bssid,
|
||||
int8_t rssi) {
|
||||
const auto shared_ptr_this = weak_ptr_this.promote();
|
||||
if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
|
||||
LOG(ERROR) << "Callback invoked on an invalid object";
|
||||
return;
|
||||
}
|
||||
for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
|
||||
if (!callback->onRssiThresholdBreached(id, bssid, rssi).isOk()) {
|
||||
LOG(ERROR) << "Failed to invoke onRssiThresholdBreached callback";
|
||||
}
|
||||
}
|
||||
};
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->startRssiMonitoring(
|
||||
ifname_, cmd_id, max_rssi, min_rssi, on_threshold_breached_callback);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
android::wp<WifiStaIface> weak_ptr_this(this);
|
||||
const auto& on_threshold_breached_callback =
|
||||
[weak_ptr_this](legacy_hal::wifi_request_id id,
|
||||
std::array<uint8_t, 6> bssid, int8_t rssi) {
|
||||
const auto shared_ptr_this = weak_ptr_this.promote();
|
||||
if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) {
|
||||
LOG(ERROR) << "Callback invoked on an invalid object";
|
||||
return;
|
||||
}
|
||||
for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
|
||||
if (!callback->onRssiThresholdBreached(id, bssid, rssi)
|
||||
.isOk()) {
|
||||
LOG(ERROR)
|
||||
<< "Failed to invoke onRssiThresholdBreached callback";
|
||||
}
|
||||
}
|
||||
};
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->startRssiMonitoring(ifname_, cmd_id, max_rssi,
|
||||
min_rssi,
|
||||
on_threshold_breached_callback);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::stopRssiMonitoringInternal(uint32_t cmd_id) {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->stopRssiMonitoring(ifname_, cmd_id);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->stopRssiMonitoring(ifname_, cmd_id);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, StaRoamingCapabilities>
|
||||
WifiStaIface::getRoamingCapabilitiesInternal() {
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
legacy_hal::wifi_roaming_capabilities legacy_caps;
|
||||
std::tie(legacy_status, legacy_caps) =
|
||||
legacy_hal_.lock()->getRoamingCapabilities(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
StaRoamingCapabilities hidl_caps;
|
||||
if (!hidl_struct_util::convertLegacyRoamingCapabilitiesToHidl(legacy_caps,
|
||||
&hidl_caps)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
legacy_hal::wifi_roaming_capabilities legacy_caps;
|
||||
std::tie(legacy_status, legacy_caps) =
|
||||
legacy_hal_.lock()->getRoamingCapabilities(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
StaRoamingCapabilities hidl_caps;
|
||||
if (!hidl_struct_util::convertLegacyRoamingCapabilitiesToHidl(legacy_caps,
|
||||
&hidl_caps)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps};
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::configureRoamingInternal(
|
||||
const StaRoamingConfig& config) {
|
||||
legacy_hal::wifi_roaming_config legacy_config;
|
||||
if (!hidl_struct_util::convertHidlRoamingConfigToLegacy(config,
|
||||
&legacy_config)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->configureRoaming(ifname_, legacy_config);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_roaming_config legacy_config;
|
||||
if (!hidl_struct_util::convertHidlRoamingConfigToLegacy(config,
|
||||
&legacy_config)) {
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
|
||||
}
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->configureRoaming(ifname_, legacy_config);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::setRoamingStateInternal(StaRoamingState state) {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->enableFirmwareRoaming(
|
||||
ifname_, hidl_struct_util::convertHidlRoamingStateToLegacy(state));
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->enableFirmwareRoaming(
|
||||
ifname_, hidl_struct_util::convertHidlRoamingStateToLegacy(state));
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::enableNdOffloadInternal(bool enable) {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->configureNdOffload(ifname_, enable);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->configureNdOffload(ifname_, enable);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::startSendingKeepAlivePacketsInternal(
|
||||
uint32_t cmd_id,
|
||||
const std::vector<uint8_t>& ip_packet_data,
|
||||
uint16_t /* ether_type */,
|
||||
const std::array<uint8_t, 6>& src_address,
|
||||
const std::array<uint8_t, 6>& dst_address,
|
||||
uint32_t period_in_ms) {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->startSendingOffloadedPacket(
|
||||
ifname_, cmd_id, ip_packet_data, src_address, dst_address,
|
||||
period_in_ms);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
uint32_t cmd_id, const std::vector<uint8_t>& ip_packet_data,
|
||||
uint16_t /* ether_type */, const std::array<uint8_t, 6>& src_address,
|
||||
const std::array<uint8_t, 6>& dst_address, uint32_t period_in_ms) {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->startSendingOffloadedPacket(
|
||||
ifname_, cmd_id, ip_packet_data, src_address, dst_address,
|
||||
period_in_ms);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::stopSendingKeepAlivePacketsInternal(uint32_t cmd_id) {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->stopSendingOffloadedPacket(ifname_, cmd_id);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->stopSendingOffloadedPacket(ifname_, cmd_id);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::setScanningMacOuiInternal(
|
||||
const std::array<uint8_t, 3>& oui) {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->setScanningMacOui(ifname_, oui);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->setScanningMacOui(ifname_, oui);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
WifiStatus WifiStaIface::startDebugPacketFateMonitoringInternal() {
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->startPktFateMonitoring(ifname_);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
legacy_hal::wifi_error legacy_status =
|
||||
legacy_hal_.lock()->startPktFateMonitoring(ifname_);
|
||||
return createWifiStatusFromLegacyError(legacy_status);
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<WifiDebugTxPacketFateReport>>
|
||||
WifiStaIface::getDebugTxPacketFatesInternal() {
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
std::vector<legacy_hal::wifi_tx_report> legacy_fates;
|
||||
std::tie(legacy_status, legacy_fates) =
|
||||
legacy_hal_.lock()->getTxPktFates(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
std::vector<WifiDebugTxPacketFateReport> hidl_fates;
|
||||
if (!hidl_struct_util::convertLegacyVectorOfDebugTxPacketFateToHidl(
|
||||
legacy_fates, &hidl_fates)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_fates};
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
std::vector<legacy_hal::wifi_tx_report> legacy_fates;
|
||||
std::tie(legacy_status, legacy_fates) =
|
||||
legacy_hal_.lock()->getTxPktFates(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
std::vector<WifiDebugTxPacketFateReport> hidl_fates;
|
||||
if (!hidl_struct_util::convertLegacyVectorOfDebugTxPacketFateToHidl(
|
||||
legacy_fates, &hidl_fates)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_fates};
|
||||
}
|
||||
|
||||
std::pair<WifiStatus, std::vector<WifiDebugRxPacketFateReport>>
|
||||
WifiStaIface::getDebugRxPacketFatesInternal() {
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
std::vector<legacy_hal::wifi_rx_report> legacy_fates;
|
||||
std::tie(legacy_status, legacy_fates) =
|
||||
legacy_hal_.lock()->getRxPktFates(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
std::vector<WifiDebugRxPacketFateReport> hidl_fates;
|
||||
if (!hidl_struct_util::convertLegacyVectorOfDebugRxPacketFateToHidl(
|
||||
legacy_fates, &hidl_fates)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_fates};
|
||||
legacy_hal::wifi_error legacy_status;
|
||||
std::vector<legacy_hal::wifi_rx_report> legacy_fates;
|
||||
std::tie(legacy_status, legacy_fates) =
|
||||
legacy_hal_.lock()->getRxPktFates(ifname_);
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
return {createWifiStatusFromLegacyError(legacy_status), {}};
|
||||
}
|
||||
std::vector<WifiDebugRxPacketFateReport> hidl_fates;
|
||||
if (!hidl_struct_util::convertLegacyVectorOfDebugRxPacketFateToHidl(
|
||||
legacy_fates, &hidl_fates)) {
|
||||
return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}};
|
||||
}
|
||||
return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_fates};
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -35,128 +35,120 @@ using namespace android::hardware::wifi::V1_0;
|
||||
* HIDL interface object used to control a STA Iface instance.
|
||||
*/
|
||||
class WifiStaIface : public V1_0::IWifiStaIface {
|
||||
public:
|
||||
WifiStaIface(const std::string& ifname,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
std::set<sp<IWifiStaIfaceEventCallback>> getEventCallbacks();
|
||||
public:
|
||||
WifiStaIface(const std::string& ifname,
|
||||
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
|
||||
// Refer to |WifiChip::invalidate()|.
|
||||
void invalidate();
|
||||
bool isValid();
|
||||
std::set<sp<IWifiStaIfaceEventCallback>> getEventCallbacks();
|
||||
|
||||
// HIDL methods exposed.
|
||||
Return<void> getName(getName_cb hidl_status_cb) override;
|
||||
Return<void> getType(getType_cb hidl_status_cb) override;
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiStaIfaceEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<void> getCapabilities(getCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> getApfPacketFilterCapabilities(
|
||||
getApfPacketFilterCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> installApfPacketFilter(
|
||||
uint32_t cmd_id,
|
||||
const hidl_vec<uint8_t>& program,
|
||||
installApfPacketFilter_cb hidl_status_cb) override;
|
||||
Return<void> getBackgroundScanCapabilities(
|
||||
getBackgroundScanCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> getValidFrequenciesForBand(
|
||||
WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) override;
|
||||
Return<void> startBackgroundScan(
|
||||
uint32_t cmd_id,
|
||||
const StaBackgroundScanParameters& params,
|
||||
startBackgroundScan_cb hidl_status_cb) override;
|
||||
Return<void> stopBackgroundScan(
|
||||
uint32_t cmd_id, stopBackgroundScan_cb hidl_status_cb) override;
|
||||
Return<void> enableLinkLayerStatsCollection(
|
||||
bool debug, enableLinkLayerStatsCollection_cb hidl_status_cb) override;
|
||||
Return<void> disableLinkLayerStatsCollection(
|
||||
disableLinkLayerStatsCollection_cb hidl_status_cb) override;
|
||||
Return<void> getLinkLayerStats(getLinkLayerStats_cb hidl_status_cb) override;
|
||||
Return<void> startRssiMonitoring(
|
||||
uint32_t cmd_id,
|
||||
int32_t max_rssi,
|
||||
int32_t min_rssi,
|
||||
startRssiMonitoring_cb hidl_status_cb) override;
|
||||
Return<void> stopRssiMonitoring(
|
||||
uint32_t cmd_id, stopRssiMonitoring_cb hidl_status_cb) override;
|
||||
Return<void> getRoamingCapabilities(
|
||||
getRoamingCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> configureRoaming(const StaRoamingConfig& config,
|
||||
configureRoaming_cb hidl_status_cb) override;
|
||||
Return<void> setRoamingState(StaRoamingState state,
|
||||
setRoamingState_cb hidl_status_cb) override;
|
||||
Return<void> enableNdOffload(bool enable,
|
||||
enableNdOffload_cb hidl_status_cb) override;
|
||||
Return<void> startSendingKeepAlivePackets(
|
||||
uint32_t cmd_id,
|
||||
const hidl_vec<uint8_t>& ip_packet_data,
|
||||
uint16_t ether_type,
|
||||
const hidl_array<uint8_t, 6>& src_address,
|
||||
const hidl_array<uint8_t, 6>& dst_address,
|
||||
uint32_t period_in_ms,
|
||||
startSendingKeepAlivePackets_cb hidl_status_cb) override;
|
||||
Return<void> stopSendingKeepAlivePackets(
|
||||
uint32_t cmd_id, stopSendingKeepAlivePackets_cb hidl_status_cb) override;
|
||||
Return<void> setScanningMacOui(const hidl_array<uint8_t, 3>& oui,
|
||||
setScanningMacOui_cb hidl_status_cb) override;
|
||||
Return<void> startDebugPacketFateMonitoring(
|
||||
startDebugPacketFateMonitoring_cb hidl_status_cb) override;
|
||||
Return<void> getDebugTxPacketFates(
|
||||
getDebugTxPacketFates_cb hidl_status_cb) override;
|
||||
Return<void> getDebugRxPacketFates(
|
||||
getDebugRxPacketFates_cb hidl_status_cb) override;
|
||||
// HIDL methods exposed.
|
||||
Return<void> getName(getName_cb hidl_status_cb) override;
|
||||
Return<void> getType(getType_cb hidl_status_cb) override;
|
||||
Return<void> registerEventCallback(
|
||||
const sp<IWifiStaIfaceEventCallback>& callback,
|
||||
registerEventCallback_cb hidl_status_cb) override;
|
||||
Return<void> getCapabilities(getCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> getApfPacketFilterCapabilities(
|
||||
getApfPacketFilterCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> installApfPacketFilter(
|
||||
uint32_t cmd_id, const hidl_vec<uint8_t>& program,
|
||||
installApfPacketFilter_cb hidl_status_cb) override;
|
||||
Return<void> getBackgroundScanCapabilities(
|
||||
getBackgroundScanCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> getValidFrequenciesForBand(
|
||||
WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) override;
|
||||
Return<void> startBackgroundScan(
|
||||
uint32_t cmd_id, const StaBackgroundScanParameters& params,
|
||||
startBackgroundScan_cb hidl_status_cb) override;
|
||||
Return<void> stopBackgroundScan(
|
||||
uint32_t cmd_id, stopBackgroundScan_cb hidl_status_cb) override;
|
||||
Return<void> enableLinkLayerStatsCollection(
|
||||
bool debug, enableLinkLayerStatsCollection_cb hidl_status_cb) override;
|
||||
Return<void> disableLinkLayerStatsCollection(
|
||||
disableLinkLayerStatsCollection_cb hidl_status_cb) override;
|
||||
Return<void> getLinkLayerStats(
|
||||
getLinkLayerStats_cb hidl_status_cb) override;
|
||||
Return<void> startRssiMonitoring(
|
||||
uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi,
|
||||
startRssiMonitoring_cb hidl_status_cb) override;
|
||||
Return<void> stopRssiMonitoring(
|
||||
uint32_t cmd_id, stopRssiMonitoring_cb hidl_status_cb) override;
|
||||
Return<void> getRoamingCapabilities(
|
||||
getRoamingCapabilities_cb hidl_status_cb) override;
|
||||
Return<void> configureRoaming(const StaRoamingConfig& config,
|
||||
configureRoaming_cb hidl_status_cb) override;
|
||||
Return<void> setRoamingState(StaRoamingState state,
|
||||
setRoamingState_cb hidl_status_cb) override;
|
||||
Return<void> enableNdOffload(bool enable,
|
||||
enableNdOffload_cb hidl_status_cb) override;
|
||||
Return<void> startSendingKeepAlivePackets(
|
||||
uint32_t cmd_id, const hidl_vec<uint8_t>& ip_packet_data,
|
||||
uint16_t ether_type, const hidl_array<uint8_t, 6>& src_address,
|
||||
const hidl_array<uint8_t, 6>& dst_address, uint32_t period_in_ms,
|
||||
startSendingKeepAlivePackets_cb hidl_status_cb) override;
|
||||
Return<void> stopSendingKeepAlivePackets(
|
||||
uint32_t cmd_id,
|
||||
stopSendingKeepAlivePackets_cb hidl_status_cb) override;
|
||||
Return<void> setScanningMacOui(
|
||||
const hidl_array<uint8_t, 3>& oui,
|
||||
setScanningMacOui_cb hidl_status_cb) override;
|
||||
Return<void> startDebugPacketFateMonitoring(
|
||||
startDebugPacketFateMonitoring_cb hidl_status_cb) override;
|
||||
Return<void> getDebugTxPacketFates(
|
||||
getDebugTxPacketFates_cb hidl_status_cb) override;
|
||||
Return<void> getDebugRxPacketFates(
|
||||
getDebugRxPacketFates_cb hidl_status_cb) override;
|
||||
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, std::string> getNameInternal();
|
||||
std::pair<WifiStatus, IfaceType> getTypeInternal();
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiStaIfaceEventCallback>& callback);
|
||||
std::pair<WifiStatus, uint32_t> getCapabilitiesInternal();
|
||||
std::pair<WifiStatus, StaApfPacketFilterCapabilities>
|
||||
getApfPacketFilterCapabilitiesInternal();
|
||||
WifiStatus installApfPacketFilterInternal(
|
||||
uint32_t cmd_id, const std::vector<uint8_t>& program);
|
||||
std::pair<WifiStatus, StaBackgroundScanCapabilities>
|
||||
getBackgroundScanCapabilitiesInternal();
|
||||
std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
|
||||
getValidFrequenciesForBandInternal(WifiBand band);
|
||||
WifiStatus startBackgroundScanInternal(
|
||||
uint32_t cmd_id, const StaBackgroundScanParameters& params);
|
||||
WifiStatus stopBackgroundScanInternal(uint32_t cmd_id);
|
||||
WifiStatus enableLinkLayerStatsCollectionInternal(bool debug);
|
||||
WifiStatus disableLinkLayerStatsCollectionInternal();
|
||||
std::pair<WifiStatus, StaLinkLayerStats> getLinkLayerStatsInternal();
|
||||
WifiStatus startRssiMonitoringInternal(uint32_t cmd_id,
|
||||
int32_t max_rssi,
|
||||
int32_t min_rssi);
|
||||
WifiStatus stopRssiMonitoringInternal(uint32_t cmd_id);
|
||||
std::pair<WifiStatus, StaRoamingCapabilities>
|
||||
getRoamingCapabilitiesInternal();
|
||||
WifiStatus configureRoamingInternal(const StaRoamingConfig& config);
|
||||
WifiStatus setRoamingStateInternal(StaRoamingState state);
|
||||
WifiStatus enableNdOffloadInternal(bool enable);
|
||||
WifiStatus startSendingKeepAlivePacketsInternal(
|
||||
uint32_t cmd_id,
|
||||
const std::vector<uint8_t>& ip_packet_data,
|
||||
uint16_t ether_type,
|
||||
const std::array<uint8_t, 6>& src_address,
|
||||
const std::array<uint8_t, 6>& dst_address,
|
||||
uint32_t period_in_ms);
|
||||
WifiStatus stopSendingKeepAlivePacketsInternal(uint32_t cmd_id);
|
||||
WifiStatus setScanningMacOuiInternal(const std::array<uint8_t, 3>& oui);
|
||||
WifiStatus startDebugPacketFateMonitoringInternal();
|
||||
std::pair<WifiStatus, std::vector<WifiDebugTxPacketFateReport>>
|
||||
getDebugTxPacketFatesInternal();
|
||||
std::pair<WifiStatus, std::vector<WifiDebugRxPacketFateReport>>
|
||||
getDebugRxPacketFatesInternal();
|
||||
private:
|
||||
// Corresponding worker functions for the HIDL methods.
|
||||
std::pair<WifiStatus, std::string> getNameInternal();
|
||||
std::pair<WifiStatus, IfaceType> getTypeInternal();
|
||||
WifiStatus registerEventCallbackInternal(
|
||||
const sp<IWifiStaIfaceEventCallback>& callback);
|
||||
std::pair<WifiStatus, uint32_t> getCapabilitiesInternal();
|
||||
std::pair<WifiStatus, StaApfPacketFilterCapabilities>
|
||||
getApfPacketFilterCapabilitiesInternal();
|
||||
WifiStatus installApfPacketFilterInternal(
|
||||
uint32_t cmd_id, const std::vector<uint8_t>& program);
|
||||
std::pair<WifiStatus, StaBackgroundScanCapabilities>
|
||||
getBackgroundScanCapabilitiesInternal();
|
||||
std::pair<WifiStatus, std::vector<WifiChannelInMhz>>
|
||||
getValidFrequenciesForBandInternal(WifiBand band);
|
||||
WifiStatus startBackgroundScanInternal(
|
||||
uint32_t cmd_id, const StaBackgroundScanParameters& params);
|
||||
WifiStatus stopBackgroundScanInternal(uint32_t cmd_id);
|
||||
WifiStatus enableLinkLayerStatsCollectionInternal(bool debug);
|
||||
WifiStatus disableLinkLayerStatsCollectionInternal();
|
||||
std::pair<WifiStatus, StaLinkLayerStats> getLinkLayerStatsInternal();
|
||||
WifiStatus startRssiMonitoringInternal(uint32_t cmd_id, int32_t max_rssi,
|
||||
int32_t min_rssi);
|
||||
WifiStatus stopRssiMonitoringInternal(uint32_t cmd_id);
|
||||
std::pair<WifiStatus, StaRoamingCapabilities>
|
||||
getRoamingCapabilitiesInternal();
|
||||
WifiStatus configureRoamingInternal(const StaRoamingConfig& config);
|
||||
WifiStatus setRoamingStateInternal(StaRoamingState state);
|
||||
WifiStatus enableNdOffloadInternal(bool enable);
|
||||
WifiStatus startSendingKeepAlivePacketsInternal(
|
||||
uint32_t cmd_id, const std::vector<uint8_t>& ip_packet_data,
|
||||
uint16_t ether_type, const std::array<uint8_t, 6>& src_address,
|
||||
const std::array<uint8_t, 6>& dst_address, uint32_t period_in_ms);
|
||||
WifiStatus stopSendingKeepAlivePacketsInternal(uint32_t cmd_id);
|
||||
WifiStatus setScanningMacOuiInternal(const std::array<uint8_t, 3>& oui);
|
||||
WifiStatus startDebugPacketFateMonitoringInternal();
|
||||
std::pair<WifiStatus, std::vector<WifiDebugTxPacketFateReport>>
|
||||
getDebugTxPacketFatesInternal();
|
||||
std::pair<WifiStatus, std::vector<WifiDebugRxPacketFateReport>>
|
||||
getDebugRxPacketFatesInternal();
|
||||
|
||||
std::string ifname_;
|
||||
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
bool is_valid_;
|
||||
hidl_callback_util::HidlCallbackHandler<IWifiStaIfaceEventCallback>
|
||||
event_cb_handler_;
|
||||
std::string ifname_;
|
||||
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
|
||||
bool is_valid_;
|
||||
hidl_callback_util::HidlCallbackHandler<IWifiStaIfaceEventCallback>
|
||||
event_cb_handler_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiStaIface);
|
||||
DISALLOW_COPY_AND_ASSIGN(WifiStaIface);
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
@@ -23,80 +23,80 @@ namespace V1_2 {
|
||||
namespace implementation {
|
||||
|
||||
std::string legacyErrorToString(legacy_hal::wifi_error error) {
|
||||
switch (error) {
|
||||
case legacy_hal::WIFI_SUCCESS:
|
||||
return "SUCCESS";
|
||||
case legacy_hal::WIFI_ERROR_UNINITIALIZED:
|
||||
return "UNINITIALIZED";
|
||||
case legacy_hal::WIFI_ERROR_NOT_AVAILABLE:
|
||||
return "NOT_AVAILABLE";
|
||||
case legacy_hal::WIFI_ERROR_NOT_SUPPORTED:
|
||||
return "NOT_SUPPORTED";
|
||||
case legacy_hal::WIFI_ERROR_INVALID_ARGS:
|
||||
return "INVALID_ARGS";
|
||||
case legacy_hal::WIFI_ERROR_INVALID_REQUEST_ID:
|
||||
return "INVALID_REQUEST_ID";
|
||||
case legacy_hal::WIFI_ERROR_TIMED_OUT:
|
||||
return "TIMED_OUT";
|
||||
case legacy_hal::WIFI_ERROR_TOO_MANY_REQUESTS:
|
||||
return "TOO_MANY_REQUESTS";
|
||||
case legacy_hal::WIFI_ERROR_OUT_OF_MEMORY:
|
||||
return "OUT_OF_MEMORY";
|
||||
case legacy_hal::WIFI_ERROR_BUSY:
|
||||
return "BUSY";
|
||||
case legacy_hal::WIFI_ERROR_UNKNOWN:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
switch (error) {
|
||||
case legacy_hal::WIFI_SUCCESS:
|
||||
return "SUCCESS";
|
||||
case legacy_hal::WIFI_ERROR_UNINITIALIZED:
|
||||
return "UNINITIALIZED";
|
||||
case legacy_hal::WIFI_ERROR_NOT_AVAILABLE:
|
||||
return "NOT_AVAILABLE";
|
||||
case legacy_hal::WIFI_ERROR_NOT_SUPPORTED:
|
||||
return "NOT_SUPPORTED";
|
||||
case legacy_hal::WIFI_ERROR_INVALID_ARGS:
|
||||
return "INVALID_ARGS";
|
||||
case legacy_hal::WIFI_ERROR_INVALID_REQUEST_ID:
|
||||
return "INVALID_REQUEST_ID";
|
||||
case legacy_hal::WIFI_ERROR_TIMED_OUT:
|
||||
return "TIMED_OUT";
|
||||
case legacy_hal::WIFI_ERROR_TOO_MANY_REQUESTS:
|
||||
return "TOO_MANY_REQUESTS";
|
||||
case legacy_hal::WIFI_ERROR_OUT_OF_MEMORY:
|
||||
return "OUT_OF_MEMORY";
|
||||
case legacy_hal::WIFI_ERROR_BUSY:
|
||||
return "BUSY";
|
||||
case legacy_hal::WIFI_ERROR_UNKNOWN:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
WifiStatus createWifiStatus(WifiStatusCode code,
|
||||
const std::string& description) {
|
||||
return {code, description};
|
||||
return {code, description};
|
||||
}
|
||||
|
||||
WifiStatus createWifiStatus(WifiStatusCode code) {
|
||||
return createWifiStatus(code, "");
|
||||
return createWifiStatus(code, "");
|
||||
}
|
||||
|
||||
WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error,
|
||||
const std::string& desc) {
|
||||
switch (error) {
|
||||
case legacy_hal::WIFI_ERROR_UNINITIALIZED:
|
||||
case legacy_hal::WIFI_ERROR_NOT_AVAILABLE:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, desc);
|
||||
switch (error) {
|
||||
case legacy_hal::WIFI_ERROR_UNINITIALIZED:
|
||||
case legacy_hal::WIFI_ERROR_NOT_AVAILABLE:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, desc);
|
||||
|
||||
case legacy_hal::WIFI_ERROR_NOT_SUPPORTED:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED, desc);
|
||||
case legacy_hal::WIFI_ERROR_NOT_SUPPORTED:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED, desc);
|
||||
|
||||
case legacy_hal::WIFI_ERROR_INVALID_ARGS:
|
||||
case legacy_hal::WIFI_ERROR_INVALID_REQUEST_ID:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS, desc);
|
||||
case legacy_hal::WIFI_ERROR_INVALID_ARGS:
|
||||
case legacy_hal::WIFI_ERROR_INVALID_REQUEST_ID:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS, desc);
|
||||
|
||||
case legacy_hal::WIFI_ERROR_TIMED_OUT:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
|
||||
desc + ", timed out");
|
||||
case legacy_hal::WIFI_ERROR_TIMED_OUT:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
|
||||
desc + ", timed out");
|
||||
|
||||
case legacy_hal::WIFI_ERROR_TOO_MANY_REQUESTS:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
|
||||
desc + ", too many requests");
|
||||
case legacy_hal::WIFI_ERROR_TOO_MANY_REQUESTS:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
|
||||
desc + ", too many requests");
|
||||
|
||||
case legacy_hal::WIFI_ERROR_OUT_OF_MEMORY:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
|
||||
desc + ", out of memory");
|
||||
case legacy_hal::WIFI_ERROR_OUT_OF_MEMORY:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
|
||||
desc + ", out of memory");
|
||||
|
||||
case legacy_hal::WIFI_ERROR_BUSY:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_BUSY);
|
||||
case legacy_hal::WIFI_ERROR_BUSY:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_BUSY);
|
||||
|
||||
case legacy_hal::WIFI_ERROR_NONE:
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS, desc);
|
||||
case legacy_hal::WIFI_ERROR_NONE:
|
||||
return createWifiStatus(WifiStatusCode::SUCCESS, desc);
|
||||
|
||||
case legacy_hal::WIFI_ERROR_UNKNOWN:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, "unknown");
|
||||
}
|
||||
case legacy_hal::WIFI_ERROR_UNKNOWN:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, "unknown");
|
||||
}
|
||||
}
|
||||
|
||||
WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error) {
|
||||
return createWifiStatusFromLegacyError(error, "");
|
||||
return createWifiStatusFromLegacyError(error, "");
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
|
||||
Reference in New Issue
Block a user