aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Biren <gbiren@google.com>2023-12-08 01:11:00 +0000
committerGabriel Biren <gbiren@google.com>2023-12-08 01:11:00 +0000
commita5d0a6aa0dfca3db803c0a174c558ba5ef07ba6f (patch)
treed33efcf6056606d1f6144206c04372aa902ec2f7
parent86b6fd078ec16f115d6427ce15814cda96f76d44 (diff)
downloadwpa_supplicant_8-a5d0a6aa0dfca3db803c0a174c558ba5ef07ba6f.tar.gz
Add default implementations in supplicant service
for findWithParams and connectWithParams. Bug: 296069900 Test: atest VtsHalWifiSupplicantP2pIfaceTargetTest Change-Id: Ia6c05d88e711f2a636e4365efcc246bac31b0401
-rw-r--r--wpa_supplicant/aidl/p2p_iface.cpp42
-rw-r--r--wpa_supplicant/aidl/p2p_iface.h6
2 files changed, 48 insertions, 0 deletions
diff --git a/wpa_supplicant/aidl/p2p_iface.cpp b/wpa_supplicant/aidl/p2p_iface.cpp
index 33db802d..ec52b440 100644
--- a/wpa_supplicant/aidl/p2p_iface.cpp
+++ b/wpa_supplicant/aidl/p2p_iface.cpp
@@ -815,6 +815,21 @@ ndk::ScopedAStatus P2pIface::addGroup(
in_ipAddressGo, in_ipAddressMask, in_ipAddressStart, in_ipAddressEnd);
}
+::ndk::ScopedAStatus P2pIface::connectWithParams(
+ const P2pConnectInfo& in_connectInfo, std::string* _aidl_return)
+{
+ return validateAndCall(
+ this, SupplicantStatusCode::FAILURE_IFACE_INVALID,
+ &P2pIface::connectWithParamsInternal, _aidl_return, in_connectInfo);
+}
+
+::ndk::ScopedAStatus P2pIface::findWithParams(const P2pDiscoveryInfo& in_discoveryInfo)
+{
+ return validateAndCall(
+ this, SupplicantStatusCode::FAILURE_IFACE_INVALID,
+ &P2pIface::findWithParamsInternal, in_discoveryInfo);
+}
+
std::pair<std::string, ndk::ScopedAStatus> P2pIface::getNameInternal()
{
return {ifname_, ndk::ScopedAStatus::ok()};
@@ -1852,6 +1867,33 @@ ndk::ScopedAStatus P2pIface::configureEapolIpAddressAllocationParamsInternal(
return ndk::ScopedAStatus::ok();
}
+std::pair<std::string, ndk::ScopedAStatus> P2pIface::connectWithParamsInternal(
+ const P2pConnectInfo& connectInfo)
+{
+ std::vector<uint8_t> peerAddressVec {
+ connectInfo.peerAddress.begin(), connectInfo.peerAddress.end()};
+ return connectInternal(peerAddressVec, connectInfo.provisionMethod,
+ connectInfo.preSelectedPin, connectInfo.joinExistingGroup,
+ connectInfo.persistent, connectInfo.goIntent);
+}
+
+ndk::ScopedAStatus P2pIface::findWithParamsInternal(const P2pDiscoveryInfo& discoveryInfo)
+{
+ switch (discoveryInfo.scanType) {
+ case P2pScanType::FULL:
+ return findInternal(discoveryInfo.timeoutInSec);
+ case P2pScanType::SOCIAL:
+ return findOnSocialChannelsInternal(discoveryInfo.timeoutInSec);
+ case P2pScanType::SPECIFIC_FREQ:
+ return findOnSpecificFrequencyInternal(
+ discoveryInfo.frequencyMhz, discoveryInfo.timeoutInSec);
+ default:
+ wpa_printf(MSG_DEBUG,
+ "findWithParams received invalid scan type %d", discoveryInfo.scanType);
+ return createStatus(SupplicantStatusCode::FAILURE_ARGS_INVALID);
+ }
+}
+
/**
* Retrieve the underlying |wpa_supplicant| struct
* pointer for this iface.
diff --git a/wpa_supplicant/aidl/p2p_iface.h b/wpa_supplicant/aidl/p2p_iface.h
index 61972f26..c4f036c8 100644
--- a/wpa_supplicant/aidl/p2p_iface.h
+++ b/wpa_supplicant/aidl/p2p_iface.h
@@ -175,6 +175,9 @@ public:
::ndk::ScopedAStatus configureEapolIpAddressAllocationParams(
int32_t in_ipAddressGo, int32_t in_ipAddressMask,
int32_t in_ipAddressStart, int32_t in_ipAddressEnd) override;
+ ::ndk::ScopedAStatus connectWithParams(
+ const P2pConnectInfo& in_connectInfo, std::string* _aidl_return) override;
+ ::ndk::ScopedAStatus findWithParams(const P2pDiscoveryInfo& in_discoveryInfo) override;
private:
// Corresponding worker functions for the AIDL methods.
@@ -298,6 +301,9 @@ private:
::ndk::ScopedAStatus configureEapolIpAddressAllocationParamsInternal(
uint32_t ipAddressGo, uint32_t ipAddressMask,
uint32_t ipAddressStart, uint32_t ipAddressEnd);
+ std::pair<std::string, ndk::ScopedAStatus> connectWithParamsInternal(
+ const P2pConnectInfo& connectInfo);
+ ndk::ScopedAStatus findWithParamsInternal(const P2pDiscoveryInfo& discoveryInfo);
struct wpa_supplicant* retrieveIfacePtr();
struct wpa_supplicant* retrieveGroupIfacePtr(