def start_receiver(): print(""" OpenWebRX - Open Source SDR Web App for Everyone! | for license see LICENSE file in the package _________________________________________________________________________________________________ Author contact info: Jakob Ketterl, DD5JFK <*****@*****.**> Documentation: https://github.com/jketterl/openwebrx/wiki Support and info: https://groups.io/g/openwebrx """) logger.info( "OpenWebRX version {0} starting up...".format(openwebrx_version)) for sig in [signal.SIGINT, signal.SIGTERM]: signal.signal(sig, handleSignal) # config warmup Config.validateConfig() coreConfig = CoreConfig() featureDetector = FeatureDetector() failed = featureDetector.get_failed_requirements("core") if failed: logger.error( "you are missing required dependencies to run openwebrx. " "please check that the following core requirements are installed and up to date: %s", ", ".join(failed)) for f in failed: description = featureDetector.get_requirement_description(f) if description: logger.error("description for %s:\n%s", f, description) return 1 # Get error messages about unknown / unavailable features as soon as possible # start up "always-on" sources right away SdrService.getAllSources() Services.start() try: server = ThreadedHttpServer(("0.0.0.0", coreConfig.get_web_port()), RequestHandler) server.serve_forever() except SignalException: pass WebSocketConnection.closeAll() Services.stop() SdrService.stopAllSources() ReportingEngine.stopAll() DecoderQueue.stopAll() return 0
def render_device(device_id, config): sources = SdrService.getAllSources() source = sources[device_id] if device_id in sources else None additional_info = "" state_info = "Unknown" if source is not None: profiles = source.getProfiles() currentProfile = profiles[source.getProfileId()] clients = {c: len(source.getClients(c)) for c in SdrClientClass} clients = {c: v for c, v in clients.items() if v} connections = len([c for c in source.getClients() if isinstance(c, OpenWebRxReceiverClient)]) additional_info = """ <div>{num_profiles} profile(s)</div> <div>Current profile: {current_profile}</div> <div>Clients: {clients}</div> <div>Connections: {connections}</div> """.format( num_profiles=len(config["profiles"]), current_profile=currentProfile["name"], clients=", ".join("{cls}: {count}".format(cls=c.name, count=v) for c, v in clients.items()), connections=connections, ) state_info = ", ".join( s for s in [ str(source.getState()), None if source.isEnabled() else "Disabled", "Failed" if source.isFailed() else None, ] if s is not None ) return """ <li class="list-group-item"> <div class="row"> <div class="col-6"> <a href="{device_link}"> <h3>{device_name}</h3> </a> <div>State: {state}</div> </div> <div class="col-6"> {additional_info} </div> </div> </li> """.format( device_name=config["name"] if config["name"] else "[Unnamed device]", device_link="{}settings/sdr/{}".format(self.get_document_root(), quote(device_id)), state=state_info, additional_info=additional_info, )