Ejemplo n.º 1
0
    def __init__(self, conn):
        super().__init__(conn)

        self.dsp = None
        self.dspLock = threading.Lock()
        self.sdr = None
        self.configSubs = []
        self.bookmarkSub = None
        self.connectionProperties = {}

        try:
            ClientRegistry.getSharedInstance().addClient(self)
        except TooManyClientsException:
            self.write_backoff_message("Too many clients")
            self.close()
            raise

        self.setupGlobalConfig()
        self.stack = self.setupStack()

        self.setSdr()

        features = FeatureDetector().feature_availability()
        self.write_features(features)

        modes = Modes.getModes()
        self.write_modes(modes)

        self.configSubs.append(SdrService.getActiveSources().wire(
            self._onSdrDeviceChanges))
        self.configSubs.append(SdrService.getAvailableProfiles().wire(
            self._sendProfiles))
        self._sendProfiles()

        CpuUsageThread.getSharedInstance().add_client(self)
Ejemplo n.º 2
0
    def __init__(self, conn):
        super().__init__(conn)

        self.dsp = None
        self.sdr = None
        self.configSub = None
        self.connectionProperties = {}

        try:
            ClientRegistry.getSharedInstance().addClient(self)
        except TooManyClientsException:
            self.write_backoff_message("Too many clients")
            self.close()
            raise

        self.setSdr()

        features = FeatureDetector().feature_availability()
        self.write_features(features)

        modes = Modes.getModes()
        self.write_modes(modes)

        self.__sendProfiles()

        CpuUsageThread.getSharedInstance().add_client(self)
Ejemplo n.º 3
0
 def close(self):
     self.stopDsp()
     CpuUsageThread.getSharedInstance().remove_client(self)
     ClientRegistry.getSharedInstance().removeClient(self)
     if self.configSub is not None:
         self.configSub.cancel()
         self.configSub = None
     super().close()
Ejemplo n.º 4
0
 def close(self, error: bool = False):
     if self.sdr is not None:
         self.sdr.removeClient(self)
     self.stopDsp()
     CpuUsageThread.getSharedInstance().remove_client(self)
     ClientRegistry.getSharedInstance().removeClient(self)
     while self.configSubs:
         self.configSubs.pop().cancel()
     if self.bookmarkSub is not None:
         self.bookmarkSub.cancel()
         self.bookmarkSub = None
     super().close(error)
Ejemplo n.º 5
0
    def __init__(self, conn):
        super().__init__(conn)

        self.dsp = None
        self.sdr = None
        self.configSub = None
        self.connectionProperties = {}

        try:
            ClientRegistry.getSharedInstance().addClient(self)
        except TooManyClientsException:
            self.write_backoff_message("Too many clients")
            self.close()
            raise

        pm = PropertyManager.getSharedInstance()

        self.setSdr()

        # send receiver info
        receiver_keys = [
            "receiver_name",
            "receiver_location",
            "receiver_asl",
            "receiver_gps",
            "photo_title",
            "photo_desc",
        ]
        receiver_details = dict((key, pm.getPropertyValue(key)) for key in receiver_keys)
        receiver_details["locator"] = Locator.fromCoordinates(receiver_details["receiver_gps"])
        self.write_receiver_details(receiver_details)

        self.__sendProfiles()

        features = FeatureDetector().feature_availability()
        self.write_features(features)

        CpuUsageThread.getSharedInstance().add_client(self)
Ejemplo n.º 6
0
 def __init__(self):
     self.metrics = {}
     self.addMetric(
         "openwebrx.users",
         DirectMetric(ClientRegistry.getSharedInstance().clientCount))