Esempio n. 1
0
 def uploadSpot(self, spot):
     config = Config.get()
     # function=wspr&date=210114&time=1732&sig=-15&dt=0.5&drift=0&tqrg=7.040019&tcall=DF2UU&tgrid=JN48&dbm=37&version=2.3.0-rc3&rcall=DD5JFK&rgrid=JN58SC&rqrg=7.040047&mode=2
     # {'timestamp': 1610655960000, 'db': -23.0, 'dt': 0.3, 'freq': 7040048, 'drift': -1, 'msg': 'LA3JJ JO59 37', 'callsign': 'LA3JJ', 'locator': 'JO59', 'mode': 'WSPR'}
     date = datetime.fromtimestamp(spot["timestamp"] / 1000, tz=timezone.utc)
     data = parse.urlencode(
         {
             "function": "wspr",
             "date": date.strftime("%y%m%d"),
             "time": date.strftime("%H%M"),
             "sig": spot["db"],
             "dt": spot["dt"],
             # FST4W does not have drift
             "drift": spot["drift"] if "drift" in spot else 0,
             "tqrg": spot["freq"] / 1e6,
             "tcall": spot["callsign"],
             "tgrid": spot["locator"],
             "dbm": spot["dbm"],
             "version": openwebrx_version,
             "rcall": config["wsprnet_callsign"],
             "rgrid": Locator.fromCoordinates(config["receiver_gps"]),
             "mode": self._getMode(spot),
         }
     ).encode()
     request.urlopen("http://wsprnet.org/post/", data, timeout=60)
Esempio n. 2
0
 def __dict__(self):
     receiver_info = super().__dict__()
     try:
         receiver_info["locator"] = Locator.fromCoordinates(receiver_info["receiver_gps"])
     except ValueError as e:
         logger.error("invalid receiver location, check in settings: %s", str(e))
     return receiver_info
Esempio n. 3
0
 def getReceiverInformation(self):
     pm = Config.get()
     callsign = pm["pskreporter_callsign"]
     locator = Locator.fromCoordinates(pm["receiver_gps"])
     decodingSoftware = "OpenWebRX " + openwebrx_version
     body = [
         b for s in [callsign, locator, decodingSoftware]
         for b in self.encodeString(s)
     ]
     body = self.pad(body, 4)
     body = bytes(Uploader.receieverDelimiter +
                  list((len(body) + 4).to_bytes(2, "big")) + body)
     return body
Esempio n. 4
0
 def getReceiverInformation(self):
     pm = Config.get()
     bodyFields = [
         # callsign
         pm["pskreporter_callsign"],
         # locator
         Locator.fromCoordinates(pm["receiver_gps"]),
         # decodingSoftware
         "OpenWebRX " + openwebrx_version,
     ]
     if "pskreporter_antenna_information" in pm and pm["pskreporter_antenna_information"] is not None:
         bodyFields += [pm["pskreporter_antenna_information"]]
     body = [b for s in bodyFields for b in self.encodeString(s)]
     body = self.pad(body, 4)
     body = bytes(Uploader.receieverDelimiter + list((len(body) + 4).to_bytes(2, "big")) + body)
     return body
Esempio 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)
Esempio n. 6
0
 def __dict__(self):
     receiver_info = super().__dict__()
     receiver_info["locator"] = Locator.fromCoordinates(
         receiver_info["receiver_gps"])
     return receiver_info