Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
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,10 @@ 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 b64ssid = Base64.Default.encode(ssid.encodeToByteArray())
val b64passwd = Base64.Default.encode(passwd.encodeToByteArray())
writeSerial("SET BWIFI $b64ssid $b64passwd")
addLog("-> SET BWIFI $b64ssid ${"*".repeat(b64passwd.length)}\n")
}

override fun getCurrentPort(): SlimeSerialPort? = this.currentPort
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,11 @@ class DesktopSerialHandler :
val os = currentPort?.outputStream ?: return
val writer = OutputStreamWriter(os)
try {
writer.append("SET WIFI \"").append(ssid).append("\" \"").append(passwd).append("\"\n")
val b64ssid = Base64.Default.encode(ssid.encodeToByteArray())
val b64passwd = Base64.Default.encode(passwd.encodeToByteArray())
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 ${StringUtils.repeat('*', b64passwd.length)}\n")
Comment thread
ButterscotchV marked this conversation as resolved.
Outdated
} catch (e: IOException) {
addLog("$e\n")
LogManager.warning("[SerialHandler] Serial port write error", e)
Expand Down
Loading