Commit 97028dd8 authored by Mohd Bilal's avatar Mohd Bilal
Browse files

added receiver to station

parent fdba4046
......@@ -58,7 +58,9 @@ class TIMGSNClient:
start = overpass['start_date_str'] + ' ' + overpass[
'start_time_str']
end = overpass['end_date_str'] + ' ' + overpass['end_time_str']
uid = overpass['uid']
schedule.append({
"uid": uid,
"contact_type": contact_type,
"norad": norad,
"start": start,
......
......@@ -11,6 +11,7 @@
"schedule": {
"timgsn": [
{
"uid": "",
"contact_type": "TELEMETRY",
"norad": 39446,
"start": "2021-04-20 13:54:30",
......@@ -18,7 +19,8 @@
"updated_on": "2021-04-20 13:54:30",
"scheduling_method": "Event"
},
{
{
"uid": "",
"contact_type": "TELEMETRY",
"norad": 39446,
"start": "2021-04-23 02:17:53",
......@@ -26,7 +28,8 @@
"updated_on": "2021-04-23 02:17:53",
"scheduling_method": "EVENT"
},
{
{
"uid": "",
"contact_type": "TELEMETRY",
"norad": 39446,
"start": "2021-04-23 02:17:53",
......
......@@ -9,6 +9,7 @@ import requests
import logging
import traceback
import json
import time
logger = logging.getLogger(__name__)
......@@ -52,6 +53,36 @@ class Station(ThreadedModule):
logger.info(f"{self.name}: Stopping operation...")
def _loop(self):
try:
if time.monotonic() - self.last_overpass_check >= self.overpass_check_interval:
ops = self.get_current_overpasses()
for op in ops.get("local"):
#TODO: local tracking to start but data not sent to timgsn
logger.info(f"overpass started: {op['uid']}")
for op in ops.get("timgsn"):
kwargs_ = {
"username": self.owner.username,
"station_long": self.longitude,
"station_lat": self.latitude,
"sat_freq": self.owner.get_satellite(op['norad']).get_frequency(),
"samp_rate": 20000,
"rf_gain": 20,
"password": self.owner.password,
"overpass_uid": op['uid']
"norad_id": op['norad']
"if_gain": 20,
"gsn_name": self.name
"device_arg": self.current_device.get("args")
}
overpass_uid = op['uid']
receiver = Receiver()
self.last_overpass_check = time.monotonic()
except Exception as err:
logger.debug(traceback.format_exc())
self.force_loop()
try:
start = datetime.datetime.utcnow()
end = datetime.datetime.utcnow() + datetime.timedelta(
......@@ -71,15 +102,20 @@ class Station(ThreadedModule):
self.force_loop()
def get_current_overpasses(self):
op = []
op = {}
local =[]
for schedule in self.schedule.get("local"):
if schedule['start'] <= datetime.datetime.utcnow(
) and schedule['end'] >= datetime.datetime.utcnow():
op.append(schedule)
local.append(schedule)
op.update({"local": schedule})
timgsn = []
for schedule in self.schedule.get("timgsn"):
if schedule['start'] <= datetime.datetime.utcnow(
) and schedule['end'] >= datetime.datetime.utcnow():
op.append(schedule)
timgsn.append(schedule)
op.update({"timgsn": timgsn})
return op
def respond_to_request(self, tracking_request):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment