getChannelPreviewForAdd

fun getChannelPreviewForAdd(existing: List<ChannelSettings>, incoming: List<ChannelSettings>, loraConfig: Config.LoRaConfig, maxChannels: Int): ChannelAddPreview(source)

Builds the filtered ADD-mode preview for QR import: existing channels followed by only the unique incoming channels.

Incoming channels that are semantic duplicates (same effective name + effective PSK) of an existing or earlier incoming channel are omitted from the preview. Unique incoming channels are appended in scanned order and selected by default while firmware channel capacity remains; unique channels beyond maxChannels stay visible but unchecked.

Semantic identity is resolved via the Channel domain model so preset/default channels match correctly across modem presets: empty names resolve to the preset display name, and 1-byte PSK markers expand to the full default key.

Return

A ChannelAddPreview whose settings and selections are aligned and size-matched.

Parameters

existing

The current ChannelSettings list on the radio. Always shown, always selected.

incoming

The imported ChannelSettings list. Duplicates omitted; uniques appended in order.

loraConfig

The current Config.LoRaConfig, used to resolve effective channel identity.

maxChannels

Firmware channel limit. Unique incoming selections stop when this is reached.