From 388d9d46fe9efd7fd735752966d8e6baa60e82c2 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Wed, 24 Feb 2021 22:30:28 +0100 Subject: [PATCH] prevent runtime properties in the config --- owrx/source/__init__.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/owrx/source/__init__.py b/owrx/source/__init__.py index d4e2410..d71ca10 100644 --- a/owrx/source/__init__.py +++ b/owrx/source/__init__.py @@ -68,13 +68,21 @@ class SdrSource(ABC): self.props = PropertyStack() # 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 # this is used to detect device changes, that are then sent to the client - sdrIdLayer = PropertyLayer() - sdrIdLayer["sdr_id"] = id - self.props.addLayer(2, sdrIdLayer.readonly()) - self.props.addLayer(3, Config.get()) + self.props.addLayer(3, PropertyLayer(sdr_id=id).readonly()) + + # finally, accept global config properties from the top-level config + self.props.addLayer(4, Config.get()) + self.sdrProps = self.props.filter(*self.getEventNames()) self.profile_id = None