Password API¶
Some Waveshare frames support a password. The default password is 1234.
The PasswordApi class exposes the 0xFFFE commands used by the frame:
query()— reports whether the frame has a password.unlock(password)— unlocks the frame.enable(password)— sets/enables the password.disable(current)— disables the password after checking the current one.change(current, next)— changes the password.
val api = PasswordApi(transceiver)
when (api.query()) {
PasswordApi.Status.OK -> api.unlock(byteArrayOf('1'.code.toByte(), /* ... */))
PasswordApi.Status.NO_PASSWORD -> api.enable(byteArrayOf(/* ... */))
else -> // handle error
}