aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Biren <gbiren@google.com>2023-12-11 16:15:59 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2023-12-11 16:15:59 +0000
commit825b9bbbf9da3edaca974ab3b0d7dd07891f8792 (patch)
treeb23817e6f7a8acaee17dc655a8903b651e2a4e12
parent10066c03ce9fa8f0bd6c4ce6272342ae3239aa1f (diff)
parenta5d0a6aa0dfca3db803c0a174c558ba5ef07ba6f (diff)
downloadwpa_supplicant_8-825b9bbbf9da3edaca974ab3b0d7dd07891f8792.tar.gz
Merge "Add default implementations in supplicant service for findWithParams and connectWithParams." into main
-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(