prevent runtime properties in the config

This commit is contained in:
Jakob Ketterl 2021-02-24 22:30:28 +01:00
parent 2785f43c6a
commit 388d9d46fe

View File

@ -68,13 +68,21 @@ class SdrSource(ABC):
self.props = PropertyStack() self.props = PropertyStack()
# layer 0 reserved for profile properties # layer 0 reserved for profile properties
self.props.addLayer(1, props)
# layer for runtime writeable properties
# these may be set during runtime, but should not be persisted to disk with the configuration
self.props.addLayer(1, PropertyLayer().filter("profile_id"))
# props from our device config
self.props.addLayer(2, props)
# the sdr_id is constant, so we put it in a separate layer # the sdr_id is constant, so we put it in a separate layer
# this is used to detect device changes, that are then sent to the client # this is used to detect device changes, that are then sent to the client
sdrIdLayer = PropertyLayer() self.props.addLayer(3, PropertyLayer(sdr_id=id).readonly())
sdrIdLayer["sdr_id"] = id
self.props.addLayer(2, sdrIdLayer.readonly()) # finally, accept global config properties from the top-level config
self.props.addLayer(3, Config.get()) self.props.addLayer(4, Config.get())
self.sdrProps = self.props.filter(*self.getEventNames()) self.sdrProps = self.props.filter(*self.getEventNames())
self.profile_id = None self.profile_id = None