ChannelHelpers

Channel validation and helper utilities.

Types

Link copied to clipboard
data class ValidationResult(val isValid: Boolean, val errors: List<String> = emptyList())

Validation result for channel configuration.

Properties

Link copied to clipboard
const val MAX_NAME_LENGTH: Int = 11

Maximum allowed channel name length.

Link copied to clipboard
const val MAX_PSK_LENGTH: Int = 32

Maximum PSK length (256-bit AES).

Link copied to clipboard
const val MIN_PSK_LENGTH: Int = 16

Minimum PSK length for secure channels (128-bit AES).

Functions

Link copied to clipboard
fun createSettings(name: String, psk: ByteArray = byteArrayOf(0x01)): ChannelSettings?

Creates a ChannelSettings only when name and psk pass validate.

Link copied to clipboard
fun findEmptySlot(channels: List<Channel>, maxChannels: Int = 8): Int?

Finds the first writable channel slot after the primary channel.

Link copied to clipboard
fun validate(name: String, psk: ByteArray, role: Channel.Role = Channel.Role.SECONDARY): ChannelHelpers.ValidationResult

Validates channel metadata before it is sent to the device.