Introduced way to get available profile names in order.
This commit is contained in:
parent
e2c3a4a150
commit
772f4136b3
|
|
@ -290,7 +290,8 @@ class OpenWebRxReceiverClient(OpenWebRxClient, SdrSourceEventClient):
|
|||
self.setSdr()
|
||||
|
||||
def _sendProfiles(self, *args):
|
||||
profiles = [{"id": pid, "name": name} for pid, name in SdrService.getAvailableProfiles().items()]
|
||||
# profiles = [{"id": pid, "name": name} for pid, name in SdrService.getAvailableProfiles().items()]
|
||||
profiles = [{"id": pid, "name": name} for pid, name in SdrService.getAvailableProfileNames().items()]
|
||||
self.write_profiles(profiles)
|
||||
|
||||
def handleTextMessage(self, conn, message):
|
||||
|
|
|
|||
12
owrx/sdr.py
12
owrx/sdr.py
|
|
@ -272,3 +272,15 @@ class SdrService(object):
|
|||
def stopAllSources():
|
||||
for source in SdrService.getAllSources().values():
|
||||
source.stop()
|
||||
|
||||
# This function always returns sources and profiles in the same order
|
||||
# they are stored in the corresponding property layers, as opposed to
|
||||
# the AvailableProfiles class.
|
||||
@staticmethod
|
||||
def getAvailableProfileNames():
|
||||
result = {}
|
||||
for s_id, source in SdrService.getAllSources().items():
|
||||
if source.isEnabled() and not source.isFailed():
|
||||
for p_id, profile in source.getProfiles().items():
|
||||
result["{}|{}".format(s_id, p_id)] = "{} {}".format(source.getName(), profile["name"])
|
||||
return result
|
||||
|
|
|
|||
Loading…
Reference in New Issue