Allow user to skip specifying BSSID
This commit is contained in:
@@ -231,7 +231,7 @@ class RepeaterManager(private val parent: TetheringFragment) : Manager(), Servic
|
||||
} else holder.config?.let { master ->
|
||||
val binder = binder
|
||||
if (binder?.group?.networkName != config.ssid || master.psk != config.passphrase || master.bssid != config.bssid) try {
|
||||
withContext(Dispatchers.Default) { master.update(config.ssid!!, config.passphrase!!, config.bssid!!) }
|
||||
withContext(Dispatchers.Default) { master.update(config.ssid!!, config.passphrase!!, config.bssid) }
|
||||
(this.binder ?: binder)?.group = null
|
||||
} catch (e: Exception) {
|
||||
Timber.w(e)
|
||||
|
||||
@@ -144,13 +144,15 @@ class P2pSupplicantConfiguration(private val group: WifiP2pGroup?, vararg ownerA
|
||||
val psk = group?.passphrase ?: content.target.psk!!
|
||||
val bssid = MacAddressCompat.fromString(content.target.bssid!!)
|
||||
|
||||
fun update(ssid: String, psk: String, bssid: MacAddressCompat) {
|
||||
fun update(ssid: String, psk: String, bssid: MacAddressCompat?) {
|
||||
val (lines, block, persistentMacLine, legacy) = content
|
||||
persistentMacLine?.let { lines[it] = PERSISTENT_MAC + bssid }
|
||||
block[block.ssidLine!!] = "\tssid=" + ssid.toByteArray()
|
||||
.joinToString("") { (it.toInt() and 255).toString(16).padStart(2, '0') }
|
||||
block[block.pskLine!!] = "\tpsk=\"$psk\"" // no control chars or weird stuff
|
||||
block[block.bssidLine!!] = "\tbssid=$bssid"
|
||||
if (bssid != null) {
|
||||
persistentMacLine?.let { lines[it] = PERSISTENT_MAC + bssid }
|
||||
block[block.bssidLine!!] = "\tbssid=$bssid"
|
||||
}
|
||||
val tempFile = File.createTempFile("vpnhotspot-", ".conf", app.deviceStorage.cacheDir)
|
||||
try {
|
||||
tempFile.printWriter().use { writer ->
|
||||
|
||||
Reference in New Issue
Block a user