Add Wifi HAL to get factory MAC address
Add getFactoryMacAddress method to retrieve the factory MAC of Sta
interface.
Bug: 111634904
Test: Manual Verification
Test: run vts with command "mma -j64 && adb sync data && adb shell data/nativetest64/VtsHalWifiV1_3TargetTest/VtsHalWifiV1_3TargetTest"
Change-Id: I82b47366d3576201ef54a4e89a3f864c31fff42c
diff --git a/wifi/1.3/default/wifi_sta_iface.cpp b/wifi/1.3/default/wifi_sta_iface.cpp
index b0fa1ae..f7157a3 100644
--- a/wifi/1.3/default/wifi_sta_iface.cpp
+++ b/wifi/1.3/default/wifi_sta_iface.cpp
@@ -255,6 +255,13 @@
mac);
}
+Return<void> WifiStaIface::getFactoryMacAddress(
+ getFactoryMacAddress_cb hidl_status_cb) {
+ return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
+ &WifiStaIface::getFactoryMacAddressInternal,
+ hidl_status_cb);
+}
+
std::pair<WifiStatus, std::string> WifiStaIface::getNameInternal() {
return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
}
@@ -633,6 +640,13 @@
return createWifiStatus(WifiStatusCode::SUCCESS);
}
+std::pair<WifiStatus, std::array<uint8_t, 6>>
+WifiStaIface::getFactoryMacAddressInternal() {
+ std::array<uint8_t, 6> mac =
+ iface_tool_.GetFactoryMacAddress(ifname_.c_str());
+ return {createWifiStatus(WifiStatusCode::SUCCESS), mac};
+}
+
} // namespace implementation
} // namespace V1_3
} // namespace wifi
diff --git a/wifi/1.3/default/wifi_sta_iface.h b/wifi/1.3/default/wifi_sta_iface.h
index bc3090f..69cb82a 100644
--- a/wifi/1.3/default/wifi_sta_iface.h
+++ b/wifi/1.3/default/wifi_sta_iface.h
@@ -109,6 +109,8 @@
getDebugRxPacketFates_cb hidl_status_cb) override;
Return<void> setMacAddress(const hidl_array<uint8_t, 6>& mac,
setMacAddress_cb hidl_status_cb) override;
+ Return<void> getFactoryMacAddress(
+ getFactoryMacAddress_cb hidl_status_cb) override;
private:
// Corresponding worker functions for the HIDL methods.
@@ -155,6 +157,8 @@
std::pair<WifiStatus, std::vector<WifiDebugRxPacketFateReport>>
getDebugRxPacketFatesInternal();
WifiStatus setMacAddressInternal(const std::array<uint8_t, 6>& mac);
+ std::pair<WifiStatus, std::array<uint8_t, 6>>
+ getFactoryMacAddressInternal();
std::string ifname_;
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;