2026-04-16 12:10:00 -07:00
|
|
|
import SwiftData
|
2024-06-07 22:09:20 -05:00
|
|
|
import MeshtasticProtobufs
|
|
|
|
|
|
|
|
|
|
extension SerialConfigEntity {
|
2026-04-16 12:10:00 -07:00
|
|
|
convenience init(config: ModuleConfig.SerialConfig) {
|
|
|
|
|
self.init()
|
2024-06-07 22:09:20 -05:00
|
|
|
self.enabled = config.enabled
|
|
|
|
|
self.echo = config.echo
|
|
|
|
|
self.rxd = Int32(config.rxd)
|
|
|
|
|
self.txd = Int32(config.txd)
|
|
|
|
|
self.baudRate = Int32(config.baud.rawValue)
|
|
|
|
|
self.timeout = Int32(config.timeout)
|
|
|
|
|
self.mode = Int32(config.mode.rawValue)
|
|
|
|
|
}
|
2024-06-28 19:41:17 -07:00
|
|
|
|
2024-06-07 22:09:20 -05:00
|
|
|
func update(with config: ModuleConfig.SerialConfig) {
|
|
|
|
|
enabled = config.enabled
|
|
|
|
|
echo = config.echo
|
|
|
|
|
rxd = Int32(config.rxd)
|
|
|
|
|
txd = Int32(config.txd)
|
|
|
|
|
baudRate = Int32(config.baud.rawValue)
|
|
|
|
|
timeout = Int32(config.timeout)
|
|
|
|
|
mode = Int32(config.mode.rawValue)
|
|
|
|
|
}
|
|
|
|
|
}
|