convert channel builders to dsl

This commit is contained in:
andrekir 2022-09-16 18:17:47 -03:00
parent 68558e4078
commit 5612d7d7c9
2 changed files with 25 additions and 24 deletions

View file

@ -1,7 +1,9 @@
package com.geeksville.mesh.model
import com.geeksville.mesh.ChannelProtos
import com.geeksville.mesh.ConfigKt.loRaConfig
import com.geeksville.mesh.ConfigProtos
import com.geeksville.mesh.channelSettings
import com.google.protobuf.ByteString
/** Utility function to make it easy to declare byte arrays - FIXME move someplace better */
@ -25,12 +27,8 @@ data class Channel(
// The default channel that devices ship with
val default = Channel(
ChannelProtos.ChannelSettings.newBuilder()
.setPsk(ByteString.copyFrom(defaultPSK))
.build(),
ConfigProtos.Config.LoRaConfig.newBuilder()
.setModemPreset(ConfigProtos.Config.LoRaConfig.ModemPreset.LongFast)
.build()
channelSettings { psk = ByteString.copyFrom(defaultPSK) },
loRaConfig { modemPreset = ConfigProtos.Config.LoRaConfig.ModemPreset.LongFast }
)
}