clean up profile handling
This commit is contained in:
parent
2e28694b49
commit
1b44229ec3
@ -66,6 +66,8 @@ class SdrProfileCarousel(PropertyCarousel):
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
for profile_id, profile in props["profiles"].items():
|
for profile_id, profile in props["profiles"].items():
|
||||||
self.addLayer(profile_id, profile)
|
self.addLayer(profile_id, profile)
|
||||||
|
# activate first available profile
|
||||||
|
self.switch()
|
||||||
|
|
||||||
props["profiles"].wire(self.handleProfileUpdate)
|
props["profiles"].wire(self.handleProfileUpdate)
|
||||||
|
|
||||||
@ -114,8 +116,6 @@ class SdrSource(ABC):
|
|||||||
|
|
||||||
self.sdrProps = self.props.filter(*self.getEventNames())
|
self.sdrProps = self.props.filter(*self.getEventNames())
|
||||||
|
|
||||||
self.profile_id = None
|
|
||||||
self.activateProfile()
|
|
||||||
self.wireEvents()
|
self.wireEvents()
|
||||||
|
|
||||||
self.port = getAvailablePort()
|
self.port = getAvailablePort()
|
||||||
@ -179,22 +179,18 @@ class SdrSource(ABC):
|
|||||||
def getCommand(self):
|
def getCommand(self):
|
||||||
return [self.getCommandMapper().map(self.getCommandValues())]
|
return [self.getCommandMapper().map(self.getCommandValues())]
|
||||||
|
|
||||||
def activateProfile(self, profile_id=None):
|
def activateProfile(self, profile_id):
|
||||||
if profile_id is None:
|
logger.debug("activating profile {0} for {1}".format(profile_id, self.getId()))
|
||||||
profiles = self.props["profiles"]
|
|
||||||
profile_id = list(profiles.keys())[0]
|
|
||||||
logger.debug("activating profile {0}".format(profile_id))
|
|
||||||
try:
|
try:
|
||||||
self.profileCarousel.switch(profile_id)
|
self.profileCarousel.switch(profile_id)
|
||||||
self.profile_id = profile_id
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logger.warning("invalid profile %s for sdr %s. ignoring", profile_id, self.id)
|
logger.warning("invalid profile %s for sdr %s. ignoring", profile_id, self.getId())
|
||||||
|
|
||||||
def getId(self):
|
def getId(self):
|
||||||
return self.id
|
return self.id
|
||||||
|
|
||||||
def getProfileId(self):
|
def getProfileId(self):
|
||||||
return self.profile_id
|
return self.props["profile_id"]
|
||||||
|
|
||||||
def getProfiles(self):
|
def getProfiles(self):
|
||||||
return self.props["profiles"]
|
return self.props["profiles"]
|
||||||
|
Loading…
Reference in New Issue
Block a user