2024-06-07 22:09:20 -05:00
|
|
|
import CoreData
|
|
|
|
|
import MeshtasticProtobufs
|
|
|
|
|
|
|
|
|
|
extension MQTTConfigEntity {
|
|
|
|
|
convenience init(
|
|
|
|
|
context: NSManagedObjectContext,
|
|
|
|
|
config: ModuleConfig.MQTTConfig
|
|
|
|
|
) {
|
|
|
|
|
self.init(context: context)
|
|
|
|
|
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
|
|
|
|
2024-06-07 22:09:20 -05: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)
|
|
|
|
|
}
|
|
|
|
|
}
|