Meshtastic-Apple/Meshtastic/Extensions/CoreData/MQTTConfigEntityExtension.swift

36 lines
1.2 KiB
Swift
Raw Permalink Normal View History

2026-04-16 12:10:00 -07:00
import SwiftData
import MeshtasticProtobufs
extension MQTTConfigEntity {
2026-04-16 12:10:00 -07:00
convenience init(config: ModuleConfig.MQTTConfig) {
self.init()
self.enabled = config.enabled
self.proxyToClientEnabled = config.proxyToClientEnabled
self.address = config.address
self.username = config.username
self.password = config.password
self.root = config.root
self.encryptionEnabled = config.encryptionEnabled
self.jsonEnabled = config.jsonEnabled
self.tlsEnabled = config.tlsEnabled
self.mapReportingEnabled = config.mapReportingEnabled
self.mapPositionPrecision = Int32(config.mapReportSettings.positionPrecision)
self.mapPublishIntervalSecs = Int32(config.mapReportSettings.publishIntervalSecs)
}
2024-06-28 19:41:17 -07:00
func update(with config: ModuleConfig.MQTTConfig) {
enabled = config.enabled
proxyToClientEnabled = config.proxyToClientEnabled
address = config.address
username = config.username
password = config.password
root = config.root
encryptionEnabled = config.encryptionEnabled
jsonEnabled = config.jsonEnabled
tlsEnabled = config.tlsEnabled
mapReportingEnabled = config.mapReportingEnabled
mapPositionPrecision = Int32(config.mapReportSettings.positionPrecision)
mapPublishIntervalSecs = Int32(config.mapReportSettings.publishIntervalSecs)
}
}