Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,11 @@ class AndroidSerialHandler(val activity: AppCompatActivity) :

@Synchronized
override fun setWifi(ssid: String, passwd: String) {
writeSerial("SET WIFI \"${ssid}\" \"${passwd}\"")
addLog("-> SET WIFI \"$ssid\" \"${passwd.replace(".".toRegex(), "*")}\"\n")
val encoder = java.util.Base64.getEncoder()
val b64ssid = encoder.encodeToString(ssid.toByteArray(StandardCharsets.UTF_8))
val b64passwd = encoder.encodeToString(passwd.toByteArray(StandardCharsets.UTF_8))
Comment thread
JeromeRGero marked this conversation as resolved.
Outdated
writeSerial("SET BWIFI $b64ssid $b64passwd")
addLog("-> SET BWIFI $b64ssid ${b64passwd.replace(".".toRegex(), "*")}\n")
Comment thread
JeromeRGero marked this conversation as resolved.
Outdated
}

override fun getCurrentPort(): SlimeSerialPort? = this.currentPort
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,12 @@ class DesktopSerialHandler :
val os = currentPort?.outputStream ?: return
val writer = OutputStreamWriter(os)
try {
writer.append("SET WIFI \"").append(ssid).append("\" \"").append(passwd).append("\"\n")
val encoder = java.util.Base64.getEncoder()
val b64ssid = encoder.encodeToString(ssid.toByteArray(StandardCharsets.UTF_8))
val b64passwd = encoder.encodeToString(passwd.toByteArray(StandardCharsets.UTF_8))
Comment thread
JeromeRGero marked this conversation as resolved.
Outdated
writer.append("SET BWIFI ").append(b64ssid).append(" ").append(b64passwd).append("\n")
writer.flush()
addLog("-> SET WIFI \"$ssid\" \"${passwd.replace(".".toRegex(), "*")}\"\n")
addLog("-> SET BWIFI $b64ssid ${b64passwd.replace(".".toRegex(), "*")}\n")
Comment thread
JeromeRGero marked this conversation as resolved.
Outdated
} catch (e: IOException) {
addLog("$e\n")
LogManager.warning("[SerialHandler] Serial port write error", e)
Expand Down