Support vendor elements for p2p

This commit is contained in:
Mygod
2022-07-16 01:03:04 -04:00
parent ed2426f77e
commit 4ad5afa75d
10 changed files with 99 additions and 26 deletions

View File

@@ -1,5 +1,6 @@
package be.mygod.vpnhotspot.root
import android.net.wifi.ScanResult
import android.net.wifi.p2p.WifiP2pManager
import android.os.Looper
import android.os.Parcelable
@@ -11,6 +12,7 @@ import be.mygod.librootkotlinx.*
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.deletePersistentGroup
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.requestDeviceAddress
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.requestPersistentGroupInfo
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.setVendorElements
import be.mygod.vpnhotspot.net.wifi.WifiP2pManagerHelper.setWifiP2pChannels
import be.mygod.vpnhotspot.util.Services
import kotlinx.parcelize.Parcelize
@@ -55,6 +57,14 @@ object RepeaterCommands {
}
}
@Parcelize
@RequiresApi(33)
data class SetVendorElements(private val ve: List<ScanResult.InformationElement>) : RootCommand<ParcelableInt?> {
override suspend fun execute() = Services.p2p!!.run {
setVendorElements(obtainChannel(), ve)?.let { ParcelableInt(it) }
}
}
@Parcelize
data class WriteP2pConfig(val data: String, val legacy: Boolean) : RootCommandNoResult {
override suspend fun execute(): Parcelable? {