refactor: subscribe MQTT channels with downlink_enabled

This commit is contained in:
andrekir 2023-10-16 17:40:37 -03:00
parent 5ece09b4ce
commit 47bc9218dc
2 changed files with 25 additions and 7 deletions

View file

@ -30,6 +30,12 @@ fun Uri.toChannelSet(): ChannelSet {
return ChannelSet.parseFrom(bytes)
}
/**
* @return A list of globally unique channel IDs usable with MQTT subscribe()
*/
val ChannelSet.subscribeList: List<String>
get() = settingsList.filter { it.downlinkEnabled }.map { Channel(it, loraConfig).name }
/**
* Return the primary channel info
*/