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)
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)
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()
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)
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)