From d0359b3ac70bc1964acfd7763f09943f49404f4a Mon Sep 17 00:00:00 2001 From: Lukas Plevac Date: Tue, 6 Aug 2024 08:29:32 +0200 Subject: [PATCH] Added support for upliks and setup wizzard --- web/API/crons.php | 33 ++ web/API/main.php | 1 + web/API/observations.php | 67 ++- web/API/stations.php | 11 + web/API/transmitters.php | 9 + web/API/uplinks.php | 112 ++++ web/CONTROLLERS/logout.php | 8 + web/CONTROLLERS/setup.php | 14 + web/CONTROLLERS/uplinks.php | 17 + web/DAL/transmitter.php | 17 +- web/DAL/uplink.php | 42 ++ web/VIEWS/blocks/uplink-item.html | 15 + web/VIEWS/observation.html | 20 +- web/VIEWS/setup.html | 264 ++++++++++ web/VIEWS/target.html | 35 +- web/VIEWS/uplinks.html | 149 ++++++ web/index.php | 9 +- web/seeds.php | 835 +++++++++++++++++------------- web/static/js/setup.js | 183 +++++++ web/static/js/target.js | 26 + web/static/js/uplinks.js | 35 ++ 21 files changed, 1536 insertions(+), 366 deletions(-) create mode 100644 web/API/uplinks.php create mode 100644 web/CONTROLLERS/logout.php create mode 100644 web/CONTROLLERS/setup.php create mode 100644 web/CONTROLLERS/uplinks.php create mode 100644 web/DAL/uplink.php create mode 100644 web/VIEWS/blocks/uplink-item.html create mode 100644 web/VIEWS/setup.html create mode 100644 web/VIEWS/uplinks.html create mode 100644 web/static/js/setup.js create mode 100644 web/static/js/uplinks.js diff --git a/web/API/crons.php b/web/API/crons.php index ac58d13..a3cac02 100644 --- a/web/API/crons.php +++ b/web/API/crons.php @@ -50,4 +50,37 @@ $fob->commit(); } + } + + function setup($params) { + $system = new \DAL\system(); + + // detect if is seeded + if (!$system->find("name", "seeds")) { + //include seeds and seed DB + include __DIR__ . "/../seeds.php"; + + $params["plans"] = json_decode($params["plans"]); + $params["params"] = json_decode($params["params"]); + + $params["lat"] = floatval($params["lat"]); + $params["lon"] = floatval($params["lon"]); + $params["alt"] = floatval($params["alt"]); + + $data = seed($params); + + $system->name->set("seeds"); + $system->value->set("true"); + $system->commit(); + + //login as user + $container = new \wsos\structs\container(); + $auth = $container->get("auth"); + + $auth->login($params["user"], $params["pass"]); + + return ["status" => true, "gsId" => $data["gs"], "apikey" => $data["apiKey"]]; + } + + return ["status" => false]; } \ No newline at end of file diff --git a/web/API/main.php b/web/API/main.php index 9acd417..6aadd76 100644 --- a/web/API/main.php +++ b/web/API/main.php @@ -17,6 +17,7 @@ include_once(__DIR__ . "/crons.php"); include_once(__DIR__ . "/transmitters.php"); include_once(__DIR__ . "/receivers.php"); + include_once(__DIR__ . "/uplinks.php"); //init API $api->serve($router->getArgs()); \ No newline at end of file diff --git a/web/API/observations.php b/web/API/observations.php index bbd1bc4..3ae2c68 100644 --- a/web/API/observations.php +++ b/web/API/observations.php @@ -54,7 +54,12 @@ "transmitter" => [ "centerFrequency" => $plan->transmitter->get()->centerFrequency->get(), - "bandwidth" => $plan->transmitter->get()->bandwidth->get() + "bandwidth" => $plan->transmitter->get()->bandwidth->get(), + "modulation" => $plan->transmitter->get()->modulation->get()->name->get(), + "sf" => $plan->transmitter->get()->sf->get(), + "codingRate" => $plan->transmitter->get()->codingRate->get(), + "syncWord" => $plan->transmitter->get()->syncWord->get(), + "preambleLength" => $plan->transmitter->get()->preambleLength->get() ], "receiver" => [ @@ -64,7 +69,10 @@ "proccessPipe" => $plan->transmitter->get()->processPipe->get()->pipe->get(), "start" => $plan->start->get(), - "end" => $plan->end->get() + "end" => $plan->end->get(), + + "startEpoch" => $plan->start->value, + "endEpoch" => $plan->end->value ]); } @@ -162,6 +170,61 @@ return ["status" => true]; } + function addPacket($params) { + if (is_null($params["data"]) || is_null($params["id"])) { + print_r($_POST); + return ["status" => "data or observation ID is not set"]; + } + + $adir = __DIR__ . "/../ARTEFACTS/" . $params["id"]; + + mkdir($adir, 0777, true); + + $packets = []; + + // check if packets file alredy exists + if (file_exists($adir . "/packets.json")) { + $packets = json_decode(file_get_contents($adir . "/packets.json"), true); + } else { + $obs = new \DAL\observation(); + $obs->id->set($params["id"]); + $obs->fetch(); + + //get current artefacts + $artefacts = $obs->artefacts->get(); + + $artefacts[] = "/ARTEFACTS/{$params['id']}/packets.json"; + + //done artefact save + $obs->artefacts->set($artefacts); + $obs->commit(); + } + + $packet = [ + "time" => time(), + "data" => $params["data"] + ]; + + if (!is_null($params["snr"])) { + $packet["snr"] = $params["snr"]; + } + + if (!is_null($params["ferror"])) { + $packet["ferror"] = $params["ferror"]; + } + + if (!is_null($params["rssi"])) { + $packet["rssi"] = $params["rssi"]; + } + + array_push($packets, $packet); + + // write back to file + file_put_contents($adir . "/packets.json", json_encode($packets)); + + return ["status" => true]; + } + function addArtefacts($params) { if (is_null($params["fname"]) || is_null($params["id"])) { diff --git a/web/API/stations.php b/web/API/stations.php index 7d7825d..881a0fa 100644 --- a/web/API/stations.php +++ b/web/API/stations.php @@ -92,4 +92,15 @@ $myStation->commit(); return ["id" => $myStation->id->get()]; + } + + function amIActive($params) { + $station = new \DAL\station(); + + $station->find("apiKey", $params["apiKey"]); + + return [ + "status" => $station->lastSeen->delta() < 3600, + "delta" => $station->lastSeen->delta() + ]; } \ No newline at end of file diff --git a/web/API/transmitters.php b/web/API/transmitters.php index 749e19b..822869c 100644 --- a/web/API/transmitters.php +++ b/web/API/transmitters.php @@ -41,6 +41,15 @@ $transmitter->antenna->set($params["antenna"]); $transmitter->target->set($params["target"]); + + if ($params["lora"] == "true") { + $transmitter->sf ->set($params["sf"]); + $transmitter->codingRate ->set($params["codingRate"]); + $transmitter->syncWord ->set($params["syncWord"]); + $transmitter->preambleLength->set($params["preambleLength"]); + } + + $transmitter->commit(); return [ diff --git a/web/API/uplinks.php b/web/API/uplinks.php new file mode 100644 index 0000000..434525d --- /dev/null +++ b/web/API/uplinks.php @@ -0,0 +1,112 @@ +fetch(); + $transmitter->fetch(); + + $plan = new \DAL\uplink(); + $plan->status ->set("planed"); + $plan->locator ->set($receiver->target->get()->locator->get()); + $plan->transmitter->set($transmitter); + $plan->receiver ->set($receiver); + $plan->start ->set($params["start"]); + $plan->data ->set($params["data"]); + $plan->delay ->set($params["delay"]); + + $plan->commit(); + + return ["status" => true, "id" => $plan->id->get()]; + } + + function forStation($params) { + //get GS and set last seen + $station = new \DAL\station(); + if (!$station->find("apiKey", $params["key"])) return ["status" => "bad api key"]; + + $station->lastSeen->now(); + $station->commit(); + + //get all jobs for ground station + $table = new \wsos\database\core\table(\DAL\uplink::class); + + $dummyObservation = new \DAL\uplink(); + $dummyObservation->status->set("planed"); + + $planed = $table->query("(status == ?) && (transmitter.station.id == ?)", [$dummyObservation->status->value, $station->id->get()]); + + $jobs = new \wsos\structs\vector(); + foreach ($planed->values as $plan) { + $jobs->append([ + "id" => $plan->id->get(), + "target" => [ + "id" => $plan->receiver->get()->target->get()->id->get(), + "name" => $plan->receiver->get()->target->get()->name->get(), + "locator" => $plan->locator->get() + ], + + "receiver" => [ + "centerFrequency" => $plan->receiver->get()->centerFrequency->get(), + "bandwidth" => $plan->receiver->get()->bandwidth->get(), + "modulation" => $plan->receiver->get()->modulation->get()->name->get(), + "sf" => $plan->receiver->get()->sf->get(), + "codingRate" => $plan->receiver->get()->codingRate->get(), + "syncWord" => $plan->receiver->get()->syncWord->get(), + "preambleLength" => $plan->receiver->get()->preambleLength->get() + ], + + "transmitter" => [ + "params" => $plan->transmitter->get()->params->get() + ], + + "data" => $plan->data->get(), + + "start" => $plan->start->get(), + "end" => $plan->end->get(), + + "delay" => $plan->delay->get(), + + "startEpoch" => $plan->start->value, + "endEpoch" => $plan->end->value + ]); + } + + return $jobs->values; + } + + function fail($params) { + if (is_null($params["id"])) { + return ["status" => "observation ID is not set"]; + } + + $obs = new \DAL\uplink(); + $obs->id->set($params["id"]); + $obs->fetch(); + + $obs->start->value = time(); + $obs->status->set("fail"); + $obs->commit(); + + return ["status" => true]; + } + + function done($params) { + if (is_null($params["id"])) { + return ["status" => "observation ID is not set"]; + } + + $obs = new \DAL\uplink(); + $obs->id->set($params["id"]); + $obs->fetch(); + + $obs->start->value = time(); + $obs->status->set("done"); + $obs->commit(); + + return ["status" => true]; + } \ No newline at end of file diff --git a/web/CONTROLLERS/logout.php b/web/CONTROLLERS/logout.php new file mode 100644 index 0000000..d5515c6 --- /dev/null +++ b/web/CONTROLLERS/logout.php @@ -0,0 +1,8 @@ +get("auth"); + + $auth->logout(); + + header('Location: /'); +?> \ No newline at end of file diff --git a/web/CONTROLLERS/setup.php b/web/CONTROLLERS/setup.php new file mode 100644 index 0000000..d6e9abb --- /dev/null +++ b/web/CONTROLLERS/setup.php @@ -0,0 +1,14 @@ +get("templateLoader"); + $context = $container->get("context"); + + $protocol = (!empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) == 'on' || $_SERVER['HTTPS'] == '1')) ? 'https://' : 'http://'; + $port = $_SERVER['SERVER_PORT'] ? ':'.$_SERVER['SERVER_PORT'] : ''; + + $context["apiHost"] = $protocol . $_SERVER['SERVER_NAME'] . $port; + + $templates->load("setup.html"); + $templates->render($context); + $templates->show(); \ No newline at end of file diff --git a/web/CONTROLLERS/uplinks.php b/web/CONTROLLERS/uplinks.php new file mode 100644 index 0000000..b2f2fc4 --- /dev/null +++ b/web/CONTROLLERS/uplinks.php @@ -0,0 +1,17 @@ +get("templateLoader"); + $context = $container->get("context"); + $auth = $container->get("auth"); + + // to show this page user must be logined + $auth->requireLogin(); + + $context["uplinks"] = (new \wsos\database\core\table(\DAL\uplink::class))->query("", [], "DESC start")->values; + $context["transmitters"] = new \wsos\database\core\table(\DAL\receiver::class); + $context["receivers"] = new \wsos\database\core\table(\DAL\transmitter::class); + + $templates->load("uplinks.html"); + $templates->render($context); + $templates->show(); \ No newline at end of file diff --git a/web/DAL/transmitter.php b/web/DAL/transmitter.php index 9907d45..94e8611 100644 --- a/web/DAL/transmitter.php +++ b/web/DAL/transmitter.php @@ -4,12 +4,16 @@ class transmitter extends \wsos\database\core\row { public \wsos\database\types\reference $target; // object what hame this transmitter public \wsos\database\types\reference $antenna; // YAGI, DISH, .... - public \wsos\database\types\reference $modulation; // BPSK, QPSK, AM, FM, .... + public \wsos\database\types\reference $modulation; // BPSK, QPSK, AM, FM, LORA, .... public \wsos\database\types\reference $dataType; // MSR, TELEMETRY, .... public \wsos\database\types\reference $processPipe; // process pipe for transmitter public \wsos\database\types\integer $centerFrequency; // in Hz public \wsos\database\types\integer $bandwidth; // in Hz public \wsos\database\types\integer $priority; // priority of transmitter + public \wsos\database\types\integer $sf; // spreading factor for LORA + public \wsos\database\types\integer $codingRate; // coding rate + public \wsos\database\types\text $syncWord; // sync word + public \wsos\database\types\integer $preambleLength; // preamble length for LORA function __construct( $id = null, @@ -20,7 +24,11 @@ $centerFrequency = 0, $bandwidth = 0, $priority = 0, - $processPipe = null + $processPipe = null, + $sf = 7, + $codingRate = 5, + $syncWord = "34", + $preambleLength = 8 ) { parent::__construct($id); $this->target = new \wsos\database\types\reference($target, \DAL\target::class); @@ -32,6 +40,11 @@ $this->centerFrequency = new \wsos\database\types\integer($centerFrequency); $this->bandwidth = new \wsos\database\types\integer($bandwidth); $this->priority = new \wsos\database\types\integer($priority); + + $this->sf = new \wsos\database\types\integer($sf); + $this->codingRate = new \wsos\database\types\integer($codingRate); + $this->syncWord = new \wsos\database\types\text($syncWord); + $this->preambleLength = new \wsos\database\types\integer($preambleLength); } } ?> \ No newline at end of file diff --git a/web/DAL/uplink.php b/web/DAL/uplink.php new file mode 100644 index 0000000..a73176e --- /dev/null +++ b/web/DAL/uplink.php @@ -0,0 +1,42 @@ + null, "gps" => null, "url" => null], + $start = "2000-01-01 00:10:00", + $end = "2000-01-01 00:10:00", + $delay = 0 + ) { + parent::__construct($id); + $this->transmitter = new \wsos\database\types\reference($transmitter, \DAL\receiver::class); + $this->receiver = new \wsos\database\types\reference($receiver, \DAL\transmitter::class); + $this->status = new \wsos\database\types\enum($status, [ + "fail", + "done", + "planed", + "unknow" + ], "unknow"); + + $this->data = new \wsos\database\types\text($data); + $this->locator = new \wsos\database\types\json($locator); + $this->start = new \wsos\database\types\timestamp($start); + $this->end = new \wsos\database\types\timestamp($end); + $this->delay = new \wsos\database\types\integer($delay); + } + } +?> \ No newline at end of file diff --git a/web/VIEWS/blocks/uplink-item.html b/web/VIEWS/blocks/uplink-item.html new file mode 100644 index 0000000..ab5bbcf --- /dev/null +++ b/web/VIEWS/blocks/uplink-item.html @@ -0,0 +1,15 @@ + + {% BIND item.transmitter.station.name %} + {% BIND item.receiver.target.name %} + {% BIND item.receiver.modulation.name %} + {% BIND item.receiver.dataType.name %} + {% BIND item.receiver.centerFrequency %}Hz + + {% BIND item.status %} + + {% BIND item.start %} + \ No newline at end of file diff --git a/web/VIEWS/observation.html b/web/VIEWS/observation.html index a6d9da3..0c9f6cc 100644 --- a/web/VIEWS/observation.html +++ b/web/VIEWS/observation.html @@ -104,6 +104,22 @@
Receiver gain
{% BIND observation.receiver.gain %}
+
+
Spreading Factor
+
{% BIND observation.transmitter.sf %}
+
+
+
Coding Rate
+
{% BIND observation.transmitter.codingRate %}
+
+
+
Sync Word
+
0x{% BIND observation.transmitter.syncWord %}
+
+
+
Preamble Length
+
{% BIND observation.transmitter.preambleLength %}
+
@@ -253,6 +269,8 @@ var json = request.responseText; + console.log(json); + var options = { fontFamily: '"Fira Mono", monospace', colors: ['gray', '#090', '#c00', 'purple', '#00c', '#ccc', '#333', 'yellow', 'rgb(240,240,240)'] @@ -286,4 +304,4 @@ - \ No newline at end of file + diff --git a/web/VIEWS/setup.html b/web/VIEWS/setup.html new file mode 100644 index 0000000..e139798 --- /dev/null +++ b/web/VIEWS/setup.html @@ -0,0 +1,264 @@ + + + +{% INCLUDE layout/head.html %} + + +
+
+
+ + {% BIND appName %} + +
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Welcome to {% BIND appName %}!

+

Welcome to YAGS, Yet Another Ground Station, the advanced HAM ground station manager that brings a new level of sophistication and convenience to your radio operations. YAGS is designed to help you seamlessly plan and manage Radio RX (receiving) and TX (transmitting) events across multiple HAM ground stations.

+
+
+ + + + + + + + + + + + + +
+ +
+
+
+
+
+
+
+ +
+
+
+ + + \ No newline at end of file diff --git a/web/VIEWS/target.html b/web/VIEWS/target.html index 0a1b16d..e8c9353 100644 --- a/web/VIEWS/target.html +++ b/web/VIEWS/target.html @@ -229,7 +229,7 @@
- {% FOREACH modulations USE '' %}
@@ -249,6 +249,37 @@
+ diff --git a/web/VIEWS/uplinks.html b/web/VIEWS/uplinks.html new file mode 100644 index 0000000..a4a34ed --- /dev/null +++ b/web/VIEWS/uplinks.html @@ -0,0 +1,149 @@ + + + {% INCLUDE layout/head.html %} + +
+ {% BINDINCLUDE layout/header.html logined %} + + + +
+
+
+ + +
+
+
+

Planed, Done and Faild

+
+
+ + + + + + + + + + + + + + {% FOREACH uplinks RENDER blocks/uplink-item.html %} + +
StationTargetModulationTypeFrequencyStatusTime
+
+
+
+
+
+
+ + + + + + + +
+ + \ No newline at end of file diff --git a/web/index.php b/web/index.php index 19cd36f..08d3662 100644 --- a/web/index.php +++ b/web/index.php @@ -15,6 +15,7 @@ $sites = [ "sites" => [ "observations" => ["controller" => __DIR__ . "/CONTROLLERS/observations.php", "name" => "Observations", "icon" => "/static/icons/telescope.svg", "menu" => true], + "uplinks" => ["controller" => __DIR__ . "/CONTROLLERS/uplinks.php", "name" => "Uplinks", "icon" => "/static/icons/wave-sine.svg", "menu" => true], "targets" => ["controller" => __DIR__ . "/CONTROLLERS/targets.php", "name" => "Targets", "icon" => "/static/icons/focus-2.svg", "menu" => true], //"modulations" => ["controller" => __DIR__ . "/CONTROLLERS/telemetry.php", "name" => "Telemetry", "icon" => "/static/icons/wave-sine.svg", "menu" => true], /* @@ -27,6 +28,8 @@ "target" => ["controller" => __DIR__ . "/CONTROLLERS/target.php", "name" => "Target", "menu" => false], "login" => ["controller" => __DIR__ . "/CONTROLLERS/login.php", "name" => "Login", "menu" => false], "api" => ["controller" => __DIR__ . "/API/main.php", "name" => "api", "menu" => false], + "setup" => ["controller" => __DIR__ . "/CONTROLLERS/setup.php", "name" => "setup", "menu" => false], + "logout" => ["controller" => __DIR__ . "/CONTROLLERS/logout.php", "name" => "logout", "menu" => false], ], "controller" => __DIR__ . "/CONTROLLERS/dashboard.php", @@ -56,11 +59,7 @@ // detect if is seeded if (!$system->find("name", "seeds")) { - include "seeds.php"; - - $system->name->set("seeds"); - $system->value->set("true"); - $system->commit(); + if (strpos($url, '/api/') === false) $router->route("/setup"); } $router->route($url); diff --git a/web/seeds.php b/web/seeds.php index 32371fa..286a9f4 100644 --- a/web/seeds.php +++ b/web/seeds.php @@ -1,409 +1,536 @@ userName->set("admin"); - $admin->pass->set("admin"); - $admin->admin->set(true); - $admin->commit(); /* commit changes to DB */ + function seed($data) { + /** + * Create default user + */ + $admin = new \DAL\user(); + $admin->userName->set($data["user"]); + $admin->pass->set($data["pass"]); + $admin->admin->set(true); + $admin->commit(); /* commit changes to DB */ - $leoWSatTape = new \DAL\targetType(); - $leoWSatTape->name->set("Weather Satellite"); - $leoWSatTape->commit(); + $leoWSatTape = new \DAL\targetType(); + $leoWSatTape->name->set("Weather Satellite"); + $leoWSatTape->commit(); - $nanosatelliteType = new \DAL\targetType(); - $nanosatelliteType->name->set("Nanosatellite"); - $nanosatelliteType->commit(); + $nanosatelliteType = new \DAL\targetType(); + $nanosatelliteType->name->set("Nanosatellite"); + $nanosatelliteType->commit(); - $avhrrType = new \DAL\dataType(); - $avhrrType->name->set("AVHRR"); - $avhrrType->commit(); + $avhrrType = new \DAL\dataType(); + $avhrrType->name->set("AVHRR"); + $avhrrType->commit(); - $msumrType = new \DAL\dataType(); - $msumrType->name->set("MSU-MR"); - $msumrType->commit(); + $msumrType = new \DAL\dataType(); + $msumrType->name->set("MSU-MR"); + $msumrType->commit(); - $beaconType = new \DAL\dataType(); - $beaconType->name->set("Beacon"); - $beaconType->commit(); + $beaconType = new \DAL\dataType(); + $beaconType->name->set("Beacon"); + $beaconType->commit(); - $telemetryType = new \DAL\dataType(); - $telemetryType->name->set("Telemetry"); - $telemetryType->commit(); + $telemetryType = new \DAL\dataType(); + $telemetryType->name->set("Telemetry"); + $telemetryType->commit(); - /** - * Antennas seeds - */ + /** + * Antennas seeds + */ - $yagi = new \DAL\Antenna(); - $yagi->name->set("YAGI"); - $yagi->commit(); + $yagi = new \DAL\Antenna(); + $yagi->name->set("YAGI"); + $yagi->commit(); - $dish = new \DAL\Antenna(); - $dish->name->set("DISH"); - $dish->commit(); + $dish = new \DAL\Antenna(); + $dish->name->set("DISH"); + $dish->commit(); - $qfh = new \DAL\Antenna(); - $qfh->name->set("QFH"); - $qfh->commit(); + $qfh = new \DAL\Antenna(); + $qfh->name->set("QFH"); + $qfh->commit(); - $dipole = new \DAL\Antenna(); - $dipole->name->set("Dipole"); - $dipole->commit(); + $dipole = new \DAL\Antenna(); + $dipole->name->set("Dipole"); + $dipole->commit(); + + $noneAnt = new \DAL\Antenna(); + $noneAnt->name->set("none"); + $noneAnt->commit(); - /** - * Test station - */ - $myStation = new \DAL\station(); - $myStation->name->set("default"); - $myStation->locator->set([ - "gps" => [ - "lat" => 49.2397383, - "lon" => 16.5684175, - "alt" => 277 - ] - ]); - $myStation->commit(); + /** + * First station + */ + $myStation = new \DAL\station(); + $myStation->name->set("My first station"); + $myStation->locator->set([ + "gps" => [ + "lat" => $data["lat"], + "lon" => $data["lon"], + "alt" => $data["alt"] + ] + ]); + $myStation->commit(); - $myStation137 = new \DAL\receiver(); - $myStation137->station->set($myStation); - $myStation137->params->set([ - "radio" => "rtlsdr", - "gain" => 45, - "agc" => false, - "bias" => false, - "fs" => [250000, 1024000, 1536000, 1792000, 1920000, 2048000, 2160000, 2400000, 2560000, 2880000, 3200000] - ]); - $myStation137->antenna->set($yagi); - $myStation137->centerFrequency->set(433500000); - $myStation137->gain->set(45); - $myStation137->commit(); + $myStationRcv = new \DAL\receiver(); + $myStationRcv->station->set($myStation); + $myStationRcv->params->set($data["params"]); + $myStationRcv->antenna->set($noneAnt); + $myStationRcv->centerFrequency->set(0); + $myStationRcv->gain->set(0); + $myStationRcv->commit(); - /* - $myStation2G = new \DAL\receiver(); - $myStation2G->station->set($myStation); - $myStation2G->params->set([ - "radio" => "hackrf", - "amp" => true, - "bias" => false, - "lna_gain" => 45, - "vga_gain" => 10, - "bias" => true - ]); - $myStation2G->antenna->set($yagi); - $myStation2G->centerFrequency->set(1700000000); - $myStation2G->gain->set(45); - $myStation2G->commit(); - */ + /* + $myStation2G = new \DAL\receiver(); + $myStation2G->station->set($myStation); + $myStation2G->params->set([ + "radio" => "hackrf", + "amp" => true, + "bias" => false, + "lna_gain" => 45, + "vga_gain" => 10, + "bias" => true + ]); + $myStation2G->antenna->set($yagi); + $myStation2G->centerFrequency->set(1700000000); + $myStation2G->gain->set(45); + $myStation2G->commit(); + */ - /** - * Modulations - */ + /** + * Modulations + */ - $apt = new \DAL\modulation(); - $apt->name->set("APT"); - $apt->commit(); + $apt = new \DAL\modulation(); + $apt->name->set("APT"); + $apt->commit(); - $bpsk = new \DAL\modulation(); - $bpsk->name->set("BPSK"); - $bpsk->commit(); + $bpsk = new \DAL\modulation(); + $bpsk->name->set("BPSK"); + $bpsk->commit(); - $hrpt = new \DAL\modulation(); - $hrpt->name->set("HRPT"); - $hrpt->commit(); + $gfsk = new \DAL\modulation(); + $gfsk->name->set("GFSK"); + $gfsk->commit(); - $dsb = new \DAL\modulation(); - $dsb->name->set("DSB"); - $dsb->commit(); + $hrpt = new \DAL\modulation(); + $hrpt->name->set("HRPT"); + $hrpt->commit(); - $lrpt = new \DAL\modulation(); - $lrpt->name->set("LRPT"); - $lrpt->commit(); + $dsb = new \DAL\modulation(); + $dsb->name->set("DSB"); + $dsb->commit(); - $cw = new \DAL\modulation(); - $cw->name->set("CW"); - $cw->commit(); + $lrpt = new \DAL\modulation(); + $lrpt->name->set("LRPT"); + $lrpt->commit(); - /** - * Process pipes - */ - $aptPipe = new \DAL\processPipe(); - $aptPipe->name->set("NOAA APT"); - $aptPipe->pipe->set([ - "satdump noaa_apt baseband {baseband} {artefactDir} --samplerate {fs} --satellite_number {targetNum} --start_timestamp {start} --autocrop_wedges --baseband_format s8", - "baseband_spectogram.py {baseband} {artefactDir}/spectogram.png -fs {fs} -fc {freq}", - "cp {baseband} {artefactDir}/{dtstart}_{fs}SPS_{freq}Hz.s8" - ]); + $cw = new \DAL\modulation(); + $cw->name->set("CW"); + $cw->commit(); - $aptPipe->commit(); + $lora = new \DAL\modulation(); + $lora->name->set("LORA"); + $lora->commit(); - $lrptPipe = new \DAL\processPipe(); - $lrptPipe->name->set("METEOR LRPT"); - $lrptPipe->pipe->set([ - "satdump meteor_m2-x_lrpt baseband {baseband} {artefactDir} --samplerate {fs} --baseband_format s8", - "baseband_spectogram.py {baseband} {artefactDir}/spectogram.png -fs {fs} -fc {freq}", - "cp {baseband} {artefactDir}/{dtstart}_{fs}SPS_{freq}Hz.s8" - ]); + /** + * Process pipes + */ + $aptPipe = new \DAL\processPipe(); + $aptPipe->name->set("NOAA APT"); + $aptPipe->pipe->set([ + "satdump noaa_apt baseband {baseband} {artefactDir} --samplerate {fs} --satellite_number {targetNum} --start_timestamp {start} --autocrop_wedges --baseband_format s8", + "baseband_spectogram.py {baseband} {artefactDir}/spectogram.png -fs {fs} -fc {freq}", + "cp {baseband} {artefactDir}/{dtstart}_{fs}SPS_{freq}Hz.s8" + ]); - $lrptPipe->commit(); + $aptPipe->commit(); - $spectogramPipe = new \DAL\processPipe(); - $spectogramPipe->name->set("Spectogram"); - $spectogramPipe->pipe->set([ - "baseband_spectogram.py {baseband} {artefactDir}/spectogram.png -fs {fs} -fc {freq}", - "cp {baseband} {artefactDir}/{dtstart}_{fs}SPS_{freq}Hz.s8", - ]); + $lrptPipe = new \DAL\processPipe(); + $lrptPipe->name->set("METEOR LRPT"); + $lrptPipe->pipe->set([ + "satdump meteor_m2-x_lrpt baseband {baseband} {artefactDir} --samplerate {fs} --baseband_format s8", + "baseband_spectogram.py {baseband} {artefactDir}/spectogram.png -fs {fs} -fc {freq}", + "cp {baseband} {artefactDir}/{dtstart}_{fs}SPS_{freq}Hz.s8" + ]); - $spectogramPipe->commit(); + $lrptPipe->commit(); - $cwPipe = new \DAL\processPipe(); - $cwPipe->name->set("CW Morse"); - $cwPipe->pipe->set([ - "baseband_spectogram.py {baseband} {artefactDir}/spectogram.png -fs {fs} -fc {freq}", - "cw_morse.py {baseband} {artefactDir}/morse.txt -fs {fs} -fc \"[?]\"", - "cp {baseband} {artefactDir}/{dtstart}_{fs}SPS_{freq}Hz.s8" - ]); + $spectogramPipe = new \DAL\processPipe(); + $spectogramPipe->name->set("Spectogram"); + $spectogramPipe->pipe->set([ + "baseband_spectogram.py {baseband} {artefactDir}/spectogram.png -fs {fs} -fc {freq}", + "cp {baseband} {artefactDir}/{dtstart}_{fs}SPS_{freq}Hz.s8", + ]); - $cwPipe->commit(); + $spectogramPipe->commit(); - $luckyPipe = new \DAL\processPipe(); - $luckyPipe->name->set("Lucky7-UHF"); - $luckyPipe->pipe->set([ - "satdump lucky7_link baseband {baseband} {artefactDir} --samplerate {fs} --dc_block --start_timestamp {start} --enable_doppler --baseband_format s8", - "baseband_spectogram.py {baseband} {artefactDir}/spectogram.png -fs {fs} -fc {freq}", - "/decoders/lucky7 {artefactDir}/lucky7_link.frm {start} > {artefactDir}/telemetry.json", - "cp {baseband} {artefactDir}/{dtstart}_{fs}SPS_{freq}Hz.s8", - "test -f {artefactDir}/lucky7_link.frm" - ]); + $cwPipe = new \DAL\processPipe(); + $cwPipe->name->set("CW Morse"); + $cwPipe->pipe->set([ + "baseband_spectogram.py {baseband} {artefactDir}/spectogram.png -fs {fs} -fc {freq}", + "cw_morse.py {baseband} {artefactDir}/morse.txt -fs {fs} -fc \"[?]\"", + "cp {baseband} {artefactDir}/{dtstart}_{fs}SPS_{freq}Hz.s8" + ]); - $luckyPipe->commit(); + $cwPipe->commit(); + $luckyPipe = new \DAL\processPipe(); + $luckyPipe->name->set("Lucky7-UHF"); + $luckyPipe->pipe->set([ + "satdump lucky7_link baseband {baseband} {artefactDir} --samplerate {fs} --dc_block --start_timestamp {start} --enable_doppler --baseband_format s8", + "baseband_spectogram.py {baseband} {artefactDir}/spectogram.png -fs {fs} -fc {freq}", + "/decoders/lucky7 {artefactDir}/lucky7_link.frm {start} > {artefactDir}/telemetry.json", + "cp {baseband} {artefactDir}/{dtstart}_{fs}SPS_{freq}Hz.s8", + "test -f {artefactDir}/lucky7_link.frm" + ]); + $luckyPipe->commit(); - /** - * NOAA 19 - */ - $noaa19 = new \DAL\target(); - $noaa19->name->set("NOAA 19"); - $noaa19->type->set($leoWSatTape); - $noaa19->orbit->set("leo"); - $noaa19->description->set("NOAA 19 is the fifth in a series of five Polar-orbiting Operational Environmental Satellites (POES) with advanced microwave sounding instruments that provide imaging and sounding capabilities."); - $noaa19->locator->set([ - "tle" => [ - "line1" => "1 33591U 09005A 23243.18101660 .00000207 00000-0 13587-3 0 9998", - "line2" => "2 33591 99.0938 290.2850 0014342 35.8617 324.3514 14.12812127750532" - ] - ]); - $noaa19->commit(); + $stratosatPipe = new \DAL\processPipe(); + $stratosatPipe->name->set("Stratosat_TK1-UHF"); + $stratosatPipe->pipe->set([ + "satdump stratosat_tk1_uhf baseband {baseband} {artefactDir} --samplerate {fs} --dc_block --start_timestamp {start} --enable_doppler --baseband_format s8", + "baseband_spectogram.py {baseband} {artefactDir}/spectogram.png -fs {fs} -fc {freq}", + "cp {baseband} {artefactDir}/{dtstart}_{fs}SPS_{freq}Hz.s8" + ]); - $noaa19APT = new \DAL\transmitter(); - $noaa19APT->target->set($noaa19); - $noaa19APT->dataType->set($avhrrType); - $noaa19APT->bandwidth->set(34000); - $noaa19APT->centerFrequency->set(137100000); - $noaa19APT->modulation->set($apt); - $noaa19APT->antenna->set($qfh); - $noaa19APT->priority->set(2); - $noaa19APT->processPipe->set($aptPipe); - $noaa19APT->commit(); + $stratosatPipe->commit(); - $noaa19DSB = new \DAL\transmitter(); - $noaa19DSB->target->set($noaa19); - $noaa19DSB->dataType->set($avhrrType); - $noaa19DSB->bandwidth->set(34000); - $noaa19DSB->centerFrequency->set(137770000); - $noaa19DSB->modulation->set($dsb); - $noaa19DSB->antenna->set($qfh); - $noaa19DSB->commit(); + /** + * NOAA 19 + */ + $noaa19 = new \DAL\target(); + $noaa19->name->set("NOAA 19"); + $noaa19->type->set($leoWSatTape); + $noaa19->orbit->set("leo"); + $noaa19->description->set("NOAA 19 is the fifth in a series of five Polar-orbiting Operational Environmental Satellites (POES) with advanced microwave sounding instruments that provide imaging and sounding capabilities."); + $noaa19->locator->set([ + "tle" => [ + "line1" => "1 33591U 09005A 23243.18101660 .00000207 00000-0 13587-3 0 9998", + "line2" => "2 33591 99.0938 290.2850 0014342 35.8617 324.3514 14.12812127750532" + ] + ]); + $noaa19->commit(); - $noaa19HRPT = new \DAL\transmitter(); - $noaa19HRPT->target->set($noaa19); - $noaa19HRPT->dataType->set($avhrrType); - $noaa19HRPT->bandwidth->set(3000000); - $noaa19HRPT->centerFrequency->set(1698000000); - $noaa19HRPT->modulation->set($hrpt); - $noaa19HRPT->antenna->set($qfh); - $noaa19HRPT->commit(); + $noaa19APT = new \DAL\transmitter(); + $noaa19APT->target->set($noaa19); + $noaa19APT->dataType->set($avhrrType); + $noaa19APT->bandwidth->set(34000); + $noaa19APT->centerFrequency->set(137100000); + $noaa19APT->modulation->set($apt); + $noaa19APT->antenna->set($qfh); + $noaa19APT->priority->set(2); + $noaa19APT->processPipe->set($aptPipe); + $noaa19APT->commit(); - /** - * NOAA 18 - */ - $noaa18 = new \DAL\target(); - $noaa18->name->set("NOAA 18"); - $noaa18->type->set($leoWSatTape); - $noaa18->orbit->set("leo"); - $noaa18->description->set("NOAA 18, known before launch as NOAA-N, is a weather forecasting satellite run by NOAA. NOAA-N (18) was launched into a sun-synchronous orbit at an altitude of 854 km above the Earth, with an orbital period of 102 minutes. It hosts the AMSU-A, MHS, AVHRR, Space Environment Monitor SEM/2 instrument and High Resolution Infrared Radiation Sounder (HIRS) instruments, as well as the SBUV/2 ozone-monitoring instrument."); - $noaa18->locator->set([ - "tle" => [ - "line1" => "1 28654U 05018A 23250.34978256 .00000271 00000-0 16921-3 0 9997", - "line2" => "2 28654 98.9045 324.3258 0015006 144.5825 215.6347 14.13000434943172" - ] - ]); - $noaa18->commit(); + $noaa19DSB = new \DAL\transmitter(); + $noaa19DSB->target->set($noaa19); + $noaa19DSB->dataType->set($avhrrType); + $noaa19DSB->bandwidth->set(34000); + $noaa19DSB->centerFrequency->set(137770000); + $noaa19DSB->modulation->set($dsb); + $noaa19DSB->antenna->set($qfh); + $noaa19DSB->commit(); - $noaa18APT = new \DAL\transmitter(); - $noaa18APT->target->set($noaa18); - $noaa18APT->dataType->set($avhrrType); - $noaa18APT->bandwidth->set(34000); - $noaa18APT->centerFrequency->set(137912500); - $noaa18APT->modulation->set($apt); - $noaa18APT->antenna->set($qfh); - $noaa18APT->priority->set(1); - $noaa18APT->processPipe->set($aptPipe); - $noaa18APT->commit(); + $noaa19HRPT = new \DAL\transmitter(); + $noaa19HRPT->target->set($noaa19); + $noaa19HRPT->dataType->set($avhrrType); + $noaa19HRPT->bandwidth->set(3000000); + $noaa19HRPT->centerFrequency->set(1698000000); + $noaa19HRPT->modulation->set($hrpt); + $noaa19HRPT->antenna->set($qfh); + $noaa19HRPT->commit(); - $noaa18DSB = new \DAL\transmitter(); - $noaa18DSB->target->set($noaa18); - $noaa18DSB->dataType->set($avhrrType); - $noaa18DSB->bandwidth->set(34000); - $noaa18DSB->centerFrequency->set(137350000); - $noaa18DSB->modulation->set($dsb); - $noaa18DSB->antenna->set($qfh); - $noaa18DSB->commit(); + /** + * NOAA 18 + */ + $noaa18 = new \DAL\target(); + $noaa18->name->set("NOAA 18"); + $noaa18->type->set($leoWSatTape); + $noaa18->orbit->set("leo"); + $noaa18->description->set("NOAA 18, known before launch as NOAA-N, is a weather forecasting satellite run by NOAA. NOAA-N (18) was launched into a sun-synchronous orbit at an altitude of 854 km above the Earth, with an orbital period of 102 minutes. It hosts the AMSU-A, MHS, AVHRR, Space Environment Monitor SEM/2 instrument and High Resolution Infrared Radiation Sounder (HIRS) instruments, as well as the SBUV/2 ozone-monitoring instrument."); + $noaa18->locator->set([ + "tle" => [ + "line1" => "1 28654U 05018A 23250.34978256 .00000271 00000-0 16921-3 0 9997", + "line2" => "2 28654 98.9045 324.3258 0015006 144.5825 215.6347 14.13000434943172" + ] + ]); + $noaa18->commit(); - $noaa18HRPT = new \DAL\transmitter(); - $noaa18HRPT->target->set($noaa18); - $noaa18HRPT->dataType->set($avhrrType); - $noaa18HRPT->bandwidth->set(3000000); - $noaa18HRPT->centerFrequency->set(1707000000); - $noaa18HRPT->modulation->set($hrpt); - $noaa18HRPT->antenna->set($qfh); - $noaa18HRPT->commit(); + $noaa18APT = new \DAL\transmitter(); + $noaa18APT->target->set($noaa18); + $noaa18APT->dataType->set($avhrrType); + $noaa18APT->bandwidth->set(34000); + $noaa18APT->centerFrequency->set(137912500); + $noaa18APT->modulation->set($apt); + $noaa18APT->antenna->set($qfh); + $noaa18APT->priority->set(1); + $noaa18APT->processPipe->set($aptPipe); + $noaa18APT->commit(); - /** - * NOAA 15 - */ - $noaa15 = new \DAL\target(); - $noaa15->name->set("NOAA 15"); - $noaa15->type->set($leoWSatTape); - $noaa15->orbit->set("leo"); - $noaa15->description->set(""); - $noaa15->locator->set([ - "tle" => [ - "line1" => "1 25338U 98030A 23256.05271705 .00000271 00000-0 13068-3 0 9997", - "line2" => "2 25338 98.6015 283.5892 0011307 61.1013 299.1300 14.26387191317785" - ] - ]); - $noaa15->commit(); + $noaa18DSB = new \DAL\transmitter(); + $noaa18DSB->target->set($noaa18); + $noaa18DSB->dataType->set($avhrrType); + $noaa18DSB->bandwidth->set(34000); + $noaa18DSB->centerFrequency->set(137350000); + $noaa18DSB->modulation->set($dsb); + $noaa18DSB->antenna->set($qfh); + $noaa18DSB->commit(); - $noaa15APT = new \DAL\transmitter(); - $noaa15APT->target->set($noaa15); - $noaa15APT->dataType->set($avhrrType); - $noaa15APT->bandwidth->set(34000); - $noaa15APT->centerFrequency->set(137620000); - $noaa15APT->modulation->set($apt); - $noaa15APT->antenna->set($qfh); - $noaa15APT->priority->set(100); - $noaa15APT->processPipe->set($aptPipe); - $noaa15APT->commit(); + $noaa18HRPT = new \DAL\transmitter(); + $noaa18HRPT->target->set($noaa18); + $noaa18HRPT->dataType->set($avhrrType); + $noaa18HRPT->bandwidth->set(3000000); + $noaa18HRPT->centerFrequency->set(1707000000); + $noaa18HRPT->modulation->set($hrpt); + $noaa18HRPT->antenna->set($qfh); + $noaa18HRPT->commit(); - $noaa15DSB = new \DAL\transmitter(); - $noaa15DSB->target->set($noaa15); - $noaa15DSB->dataType->set($avhrrType); - $noaa15DSB->bandwidth->set(34000); - $noaa15DSB->centerFrequency->set(1377700000); - $noaa15DSB->modulation->set($dsb); - $noaa15DSB->antenna->set($qfh); - $noaa15DSB->commit(); + /** + * NOAA 15 + */ + $noaa15 = new \DAL\target(); + $noaa15->name->set("NOAA 15"); + $noaa15->type->set($leoWSatTape); + $noaa15->orbit->set("leo"); + $noaa15->description->set(""); + $noaa15->locator->set([ + "tle" => [ + "line1" => "1 25338U 98030A 23256.05271705 .00000271 00000-0 13068-3 0 9997", + "line2" => "2 25338 98.6015 283.5892 0011307 61.1013 299.1300 14.26387191317785" + ] + ]); + $noaa15->commit(); - $noaa15HRPT = new \DAL\transmitter(); - $noaa15HRPT->target->set($noaa15); - $noaa15HRPT->dataType->set($avhrrType); - $noaa15HRPT->bandwidth->set(3000000); - $noaa15HRPT->centerFrequency->set(1702500000); - $noaa15HRPT->modulation->set($hrpt); - $noaa15HRPT->antenna->set($qfh); - $noaa15HRPT->commit(); + $noaa15APT = new \DAL\transmitter(); + $noaa15APT->target->set($noaa15); + $noaa15APT->dataType->set($avhrrType); + $noaa15APT->bandwidth->set(34000); + $noaa15APT->centerFrequency->set(137620000); + $noaa15APT->modulation->set($apt); + $noaa15APT->antenna->set($qfh); + $noaa15APT->priority->set(100); + $noaa15APT->processPipe->set($aptPipe); + $noaa15APT->commit(); - $meteor23 = new \DAL\target(); - $meteor23->name->set("METEOR M2-3"); - $meteor23->type->set($leoWSatTape); - $meteor23->orbit->set("leo"); - $meteor23->description->set(""); - $meteor23->locator->set([ - "tle" => [ - "line1" => "1 57166U 23091A 23258.09139909 .00000046 00000-0 39414-4 0 9995", - "line2" => "2 57166 98.7568 309.6443 0003662 194.1864 165.9212 14.23842173 11338" - ] - ]); - $meteor23->commit(); + $noaa15DSB = new \DAL\transmitter(); + $noaa15DSB->target->set($noaa15); + $noaa15DSB->dataType->set($avhrrType); + $noaa15DSB->bandwidth->set(34000); + $noaa15DSB->centerFrequency->set(1377700000); + $noaa15DSB->modulation->set($dsb); + $noaa15DSB->antenna->set($qfh); + $noaa15DSB->commit(); - $meteor23LRPT1 = new \DAL\transmitter(); - $meteor23LRPT1->target->set($meteor23); - $meteor23LRPT1->dataType->set($msumrType); - $meteor23LRPT1->bandwidth->set(120000); - $meteor23LRPT1->centerFrequency->set(137900000); - $meteor23LRPT1->modulation->set($lrpt); - $meteor23LRPT1->antenna->set($qfh); - $meteor23LRPT1->priority->set(3); - $meteor23LRPT1->processPipe->set($lrptPipe); - $meteor23LRPT1->commit(); + $noaa15HRPT = new \DAL\transmitter(); + $noaa15HRPT->target->set($noaa15); + $noaa15HRPT->dataType->set($avhrrType); + $noaa15HRPT->bandwidth->set(3000000); + $noaa15HRPT->centerFrequency->set(1702500000); + $noaa15HRPT->modulation->set($hrpt); + $noaa15HRPT->antenna->set($qfh); + $noaa15HRPT->commit(); - $meteor23LRPT2 = new \DAL\transmitter(); - $meteor23LRPT2->target->set($meteor23); - $meteor23LRPT2->dataType->set($msumrType); - $meteor23LRPT2->bandwidth->set(120000); - $meteor23LRPT2->centerFrequency->set(137100000); - $meteor23LRPT2->modulation->set($lrpt); - $meteor23LRPT2->antenna->set($qfh); - $meteor23LRPT2->processPipe->set($lrptPipe); - $meteor23LRPT2->commit(); + /** + * METEOR M2-3 + */ - $meteor23HRPT = new \DAL\transmitter(); - $meteor23HRPT->target->set($meteor23); - $meteor23HRPT->dataType->set($msumrType); - $meteor23HRPT->bandwidth->set(3000000); - $meteor23HRPT->centerFrequency->set(1700000000); - $meteor23HRPT->modulation->set($hrpt); - $meteor23HRPT->antenna->set($qfh); - $meteor23HRPT->commit(); + $meteor23 = new \DAL\target(); + $meteor23->name->set("METEOR M2-3"); + $meteor23->type->set($leoWSatTape); + $meteor23->orbit->set("leo"); + $meteor23->description->set(""); + $meteor23->locator->set([ + "tle" => [ + "line1" => "1 57166U 23091A 23258.09139909 .00000046 00000-0 39414-4 0 9995", + "line2" => "2 57166 98.7568 309.6443 0003662 194.1864 165.9212 14.23842173 11338" + ] + ]); + $meteor23->commit(); - $maxvalier = new \DAL\target(); - $maxvalier->name->set("MAX VALIER SAT"); - $maxvalier->type->set($nanosatelliteType); - $maxvalier->orbit->set("leo"); - $maxvalier->description->set(""); - $maxvalier->locator->set([ - "tle" => [ - "line1" => "1 42778U 17036P 23282.84620820 .00050788 00000-0 10567-2 0 9991", - "line2" => "2 42778 97.1421 315.3778 0008233 57.6254 302.5791 15.45432755350391" - ] - ]); - $maxvalier->commit(); + $meteor23LRPT1 = new \DAL\transmitter(); + $meteor23LRPT1->target->set($meteor23); + $meteor23LRPT1->dataType->set($msumrType); + $meteor23LRPT1->bandwidth->set(120000); + $meteor23LRPT1->centerFrequency->set(137900000); + $meteor23LRPT1->modulation->set($lrpt); + $meteor23LRPT1->antenna->set($qfh); + $meteor23LRPT1->priority->set(3); + $meteor23LRPT1->processPipe->set($lrptPipe); + $meteor23LRPT1->commit(); - $maxvalierCW = new \DAL\transmitter(); - $maxvalierCW->target->set($maxvalier); - $maxvalierCW->dataType->set($beaconType); - $maxvalierCW->bandwidth->set(120000); - $maxvalierCW->centerFrequency->set(145960000); - $maxvalierCW->modulation->set($cw); - $maxvalierCW->antenna->set($yagi); - $maxvalierCW->priority->set(0); - $maxvalierCW->processPipe->set($cwPipe); - $maxvalierCW->commit(); + $meteor23LRPT2 = new \DAL\transmitter(); + $meteor23LRPT2->target->set($meteor23); + $meteor23LRPT2->dataType->set($msumrType); + $meteor23LRPT2->bandwidth->set(120000); + $meteor23LRPT2->centerFrequency->set(137100000); + $meteor23LRPT2->modulation->set($lrpt); + $meteor23LRPT2->antenna->set($qfh); + $meteor23LRPT2->processPipe->set($lrptPipe); + $meteor23LRPT2->commit(); - $lucky7 = new \DAL\target(); - $lucky7->name->set("Lucky 7"); - $lucky7->type->set($nanosatelliteType); - $lucky7->orbit->set("sso"); - $lucky7->description->set("It is a single unit CubeSat with a size of 112×112×113.5 mm, to be easily traceable in space, available by launch cost and compatible with a variety of launch opportunities. Its aim is to test everyday electronics tweaked for deep space or long-lasting missions such as to the Moon, Mars, and beyond. As their lucky number is seven and it is supposed to be the seventh Czech made satellite in a row, they called it simply Lucky-7."); - $lucky7->locator->set([ - "tle" => [ - "line1" => "1 44406U 19038W 24094.95219425 .00026482 00000-0 71098-3 0 9995", - "line2" => "2 44406 97.7044 89.1200 0014055 7.8960 352.2502 15.37821998262930" - ] - ]); - $lucky7->commit(); + $meteor23HRPT = new \DAL\transmitter(); + $meteor23HRPT->target->set($meteor23); + $meteor23HRPT->dataType->set($msumrType); + $meteor23HRPT->bandwidth->set(3000000); + $meteor23HRPT->centerFrequency->set(1700000000); + $meteor23HRPT->modulation->set($hrpt); + $meteor23HRPT->antenna->set($qfh); + $meteor23HRPT->commit(); - $lucky7Telem = new \DAL\transmitter(); - $lucky7Telem->target->set($lucky7); - $lucky7Telem->dataType->set($telemetryType); - $lucky7Telem->bandwidth->set(120000); - $lucky7Telem->centerFrequency->set(437525000); - $lucky7Telem->modulation->set($bpsk); - $lucky7Telem->antenna->set($dipole); - $lucky7Telem->priority->set(0); - $lucky7Telem->processPipe->set($luckyPipe); - $lucky7Telem->commit(); + /** + * METEOR M2-4 + */ + + $meteor24 = new \DAL\target(); + $meteor24->name->set("METEOR M2-4"); + $meteor24->type->set($leoWSatTape); + $meteor24->orbit->set("leo"); + $meteor24->description->set(""); + $meteor24->locator->set([ + "tle" => [ + "line1" => "1 57166U 23091A 23258.09139909 .00000046 00000-0 39414-4 0 9995", + "line2" => "2 57166 98.7568 309.6443 0003662 194.1864 165.9212 14.23842173 11338" + ] + ]); + $meteor24->commit(); + + $meteor24LRPT1 = new \DAL\transmitter(); + $meteor24LRPT1->target->set($meteor23); + $meteor24LRPT1->dataType->set($msumrType); + $meteor24LRPT1->bandwidth->set(120000); + $meteor24LRPT1->centerFrequency->set(137900000); + $meteor24LRPT1->modulation->set($lrpt); + $meteor24LRPT1->antenna->set($qfh); + $meteor24LRPT1->priority->set(3); + $meteor24LRPT1->processPipe->set($lrptPipe); + $meteor24LRPT1->commit(); + + $meteor24LRPT2 = new \DAL\transmitter(); + $meteor24LRPT2->target->set($meteor23); + $meteor24LRPT2->dataType->set($msumrType); + $meteor24LRPT2->bandwidth->set(120000); + $meteor24LRPT2->centerFrequency->set(137100000); + $meteor24LRPT2->modulation->set($lrpt); + $meteor24LRPT2->antenna->set($qfh); + $meteor24LRPT2->processPipe->set($lrptPipe); + $meteor24LRPT2->commit(); + + $meteor24HRPT = new \DAL\transmitter(); + $meteor24HRPT->target->set($meteor23); + $meteor24HRPT->dataType->set($msumrType); + $meteor24HRPT->bandwidth->set(3000000); + $meteor24HRPT->centerFrequency->set(1700000000); + $meteor24HRPT->modulation->set($hrpt); + $meteor24HRPT->antenna->set($qfh); + $meteor24HRPT->commit(); + + /** + * Max valier sat + */ + + $maxvalier = new \DAL\target(); + $maxvalier->name->set("MAX VALIER SAT"); + $maxvalier->type->set($nanosatelliteType); + $maxvalier->orbit->set("leo"); + $maxvalier->description->set(""); + $maxvalier->locator->set([ + "tle" => [ + "line1" => "1 42778U 17036P 23282.84620820 .00050788 00000-0 10567-2 0 9991", + "line2" => "2 42778 97.1421 315.3778 0008233 57.6254 302.5791 15.45432755350391" + ] + ]); + $maxvalier->commit(); + + $maxvalierCW = new \DAL\transmitter(); + $maxvalierCW->target->set($maxvalier); + $maxvalierCW->dataType->set($beaconType); + $maxvalierCW->bandwidth->set(120000); + $maxvalierCW->centerFrequency->set(145960000); + $maxvalierCW->modulation->set($cw); + $maxvalierCW->antenna->set($yagi); + $maxvalierCW->priority->set(0); + $maxvalierCW->processPipe->set($cwPipe); + $maxvalierCW->commit(); + + /** + * Lucky 7 + */ + + $lucky7 = new \DAL\target(); + $lucky7->name->set("Lucky 7"); + $lucky7->type->set($nanosatelliteType); + $lucky7->orbit->set("sso"); + $lucky7->description->set("It is a single unit CubeSat with a size of 112×112×113.5 mm, to be easily traceable in space, available by launch cost and compatible with a variety of launch opportunities. Its aim is to test everyday electronics tweaked for deep space or long-lasting missions such as to the Moon, Mars, and beyond. As their lucky number is seven and it is supposed to be the seventh Czech made satellite in a row, they called it simply Lucky-7."); + $lucky7->locator->set([ + "tle" => [ + "line1" => "1 44406U 19038W 24094.95219425 .00026482 00000-0 71098-3 0 9995", + "line2" => "2 44406 97.7044 89.1200 0014055 7.8960 352.2502 15.37821998262930" + ] + ]); + $lucky7->commit(); + + $lucky7Telem = new \DAL\transmitter(); + $lucky7Telem->target->set($lucky7); + $lucky7Telem->dataType->set($telemetryType); + $lucky7Telem->bandwidth->set(120000); + $lucky7Telem->centerFrequency->set(437525000); + $lucky7Telem->modulation->set($gfsk); + $lucky7Telem->antenna->set($dipole); + $lucky7Telem->priority->set(0); + $lucky7Telem->processPipe->set($luckyPipe); + $lucky7Telem->commit(); + + /** + * Stratosat TK-1 + */ + + $stratosattk = new \DAL\target(); + $stratosattk->name->set("StratoSat TK-1"); + $stratosattk->type->set($nanosatelliteType); + $stratosattk->orbit->set("sso"); + $stratosattk->description->set("3U Cubesat StratoSat TK-1 is a Stratonautica satellite, created on the basis of a shortened satellite platform Geoscan 3U. One of the three units is a transport container for the delivery of 6 pocketcubes into low Earth orbit (StratoSat TK-1-A, StratoSat TK-1-B, StratoSat TK-1-C, StratoSat TK-1-D, StratoSat TK-1-E, StratoSat TK-1-F). These pico-satellites are intended for educational programs for high school students. Most pocketcubes were made by high school or university students. Each pocketcube operates on an independent power supply system and has radio transmitters and cameras on board. The process of the exit of the satellites from the transport container will be filmed using high-resolution photo and video cameras that are installed on the middle unit. All imagery data taken during the mission will be transmitted to amateurs around the world using open radio-protocol."); + $stratosattk->locator->set([ + "tle" => [ + "line1" => "1 57167U 23091B 24146.85238156 .00015568 00000+0 91391-3 0 9996", + "line2" => "2 57167 97.6120 199.9936 0015849 190.6793 169.4102 15.11710813 50186" + ] + ]); + $stratosattk->commit(); + + $stratosattkTelem = new \DAL\transmitter(); + $stratosattkTelem->target->set($stratosattk); + $stratosattkTelem->dataType->set($telemetryType); + $stratosattkTelem->bandwidth->set(120000); + $stratosattkTelem->centerFrequency->set(435870000); + $stratosattkTelem->modulation->set($gfsk); + $stratosattkTelem->antenna->set($dipole); + $stratosattkTelem->priority->set(0); + $stratosattkTelem->processPipe->set($stratosatPipe); + $stratosattkTelem->commit(); + + /** + * Set autoplans + */ + $autoplan = []; + + foreach ($data["plans"] as $target) { + if ($target == "noaa19apt") $autoplan[] = $noaa19APT->id->get(); + if ($target == "noaa18apt") $autoplan[] = $noaa18APT->id->get(); + if ($target == "noaa15apt") $autoplan[] = $noaa15APT->id->get(); + if ($target == "meteorm23") $autoplan[] = $meteor23LRPT1->id->get(); + if ($target == "meteorm24") $autoplan[] = $meteor24LRPT1->id->get(); + if ($target == "lucky7") $autoplan[] = $lucky7Telem->id->get(); + if ($target == "stratosat") $autoplan[] = $stratosattkTelem->id->get(); + } + + $myStationRcv->autoPlan->set($autoplan); + + $myStationRcv->commit(); + + return [ + "gs" => $myStation->id->get(), + "apiKey" => $myStation->apiKey->get() + ]; + } diff --git a/web/static/js/setup.js b/web/static/js/setup.js new file mode 100644 index 0000000..625243f --- /dev/null +++ b/web/static/js/setup.js @@ -0,0 +1,183 @@ +var pages = ["welcome", "users", "station", "rxtx", "plan", "connect"]; +var pagesCntr = [dummyCntr, processUser, processStation, processRxTx, processPlan, connectCntr]; +var aPage = 0; +var data = {}; +var apiKey = ""; + +function dummyCntr() { + return true; +} + +function connectCntr() { + alert("Waiting until client is connected"); + return false; +} + +function nextPage(useCntr = true) { + if (aPage + 1 > pages.length) { + window.location.href = "/"; + return; + } + + if (useCntr && !pagesCntr[aPage]()) return; + + document.getElementById(pages[aPage]).style.display = "none"; + + aPage++; + + if (aPage + 1 > pages.length) document.getElementById("done").style.display = "block"; + else document.getElementById(pages[aPage]).style.display = "block"; + + document.getElementById("progress-bar").style.width = aPage / pages.length * 100 + "%"; +} + +function processUser() { + data["user"] = document.getElementById("username").value; + data["pass"] = document.getElementById("pass1").value; + + if (data["user"] == "") { + alert("Username cant be empty"); + return false; + } + + if (data["pass"] == "") { + alert("Password cant be empty"); + return false; + } + + if (data["pass"] != document.getElementById("pass2").value) { + alert("Passwords is not same"); + return false; + } + + return true; +} + +function processStation() { + data["lat"] = document.getElementById("lat").value; + data["lon"] = document.getElementById("lon").value; + data["alt"] = document.getElementById("alt").value; + + if (data["alt"] == "") { + alert("alt cant be empty"); + return false; + } + + if (data["lon"] == "") { + alert("lon cant be empty"); + return false; + } + + if (data["lat"] == "") { + alert("lat cant be empty"); + return false; + } + + return true; +} + +function processRxTx() { + var radio = document.getElementById("radio").value; + + if (radio == "RTLSDR") data["params"] = "{\"radio\":\"rtlsdr\",\"gain\":45,\"agc\":false,\"bias\":false,\"fs\":[250000,1024000,1536000,1792000,1920000,2048000,2160000,2400000,2560000,2880000,3200000],\"comment\":\"Auto created by SETUP\"}"; + else if (radio == "RFM95") { + var dio = document.getElementById("dio").value; + var nss = document.getElementById("nss").value; + + if (dio == "" || nss == "") { + alert("Need dio0 and nss pin"); + return false; + } + + data["params"] = "{\"radio\":\"RFM95\",\"nss\":" + nss + ",\"dio0\":" + dio + ",\"power\":10,\"comment\":\"Auto created by SETUP\"}"; + } + + return true; +} + +function radioChange() { + if (document.getElementById("radio").value == "RFM95") document.getElementById("rfm-options").style.display = "block"; + else document.getElementById("rfm-options").style.display = "none"; +} + +function processPlan() { + data["plans"] = []; + + if (document.getElementById("noaa19").checked) data["plans"].push("noaa19apt"); + if (document.getElementById("noaa18").checked) data["plans"].push("noaa18apt"); + if (document.getElementById("noaa15").checked) data["plans"].push("noaa15apt"); + if (document.getElementById("meteorm23").checked) data["plans"].push("meteorm23lrpt"); + if (document.getElementById("meteorm24").checked) data["plans"].push("meteorm24lrpt"); + if (document.getElementById("lucky7").checked) data["plans"].push("lucky7"); + if (document.getElementById("stratosat").checked) data["plans"].push("stratosat"); + + data["plans"] = JSON.stringify(data["plans"]); + + // now create req on API and create seeds + var dataP = new FormData(); + + for (var key in data) { + dataP.append(key, data[key]); + } + + document.getElementById("nextBtn").style.display = "none"; + + var xhttp = new XMLHttpRequest(); + xhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + const json = JSON.parse(this.responseText); + + console.log(json); + + if (json["status"] == false) { + alert("Error when try setup DB: " + req.responseText) + return; + } + + document.getElementById("apiKey").value = json["apikey"]; + apiKey = json["apikey"]; + + // pull status every 10s + setTimeout(() => { + getClientStatus(); + }, 10000); + + nextPage(false); + + document.getElementById("nextBtn").style.display = "block"; + } + }; + + xhttp.open("POST", "/api/cron/setup", true); + xhttp.send(dataP); + + return false; +} + +function getClientStatus() { + var xhttp = new XMLHttpRequest(); + xhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + const json = JSON.parse(this.responseText); + + if (json["status"] == true) { + document.getElementById("waiting").style.display = "none"; + document.getElementById("connected").style.display = "block"; + + if (aPage == 5) { + setTimeout(() => { + nextPage(false); + }, 2000); + } + } + } + }; + + xhttp.open("GET", "/api/station/amIActive?apiKey=" + apiKey, true); + xhttp.send(); + + // pull status every 10s + setTimeout(() => { + getClientStatus(); + }, 10000); +} \ No newline at end of file diff --git a/web/static/js/target.js b/web/static/js/target.js index 6b5de65..f66c830 100644 --- a/web/static/js/target.js +++ b/web/static/js/target.js @@ -1,8 +1,20 @@ var openTransmitter = null; +function modulationChange() { + var modulation = document.getElementById("transmitter-modulation"); + + if (modulation.options[modulation.selectedIndex].text == "LORA") { + document.getElementById("lora-params").style.display = "flex"; + } else { + document.getElementById("lora-params").style.display = "none"; + } +} + function save(targetID) { var transmitter = new FormData(); + var modulationEl = document.getElementById("transmitter-modulation"); + var freq = document.getElementById("transmitter-freq").value; var band = document.getElementById("transmitter-band").value; var antenna = document.getElementById("transmitter-antenna").value; @@ -10,6 +22,12 @@ function save(targetID) { var datatype = document.getElementById("transmitter-datatype").value; var priority = document.getElementById("transmitter-priority").value; var pipe = document.getElementById("transmitter-pipe").value; + + var sf = document.getElementById("transmitter-sf").value; + var codingrate = document.getElementById("transmitter-codingrate").value; + var syncword = document.getElementById("transmitter-syncword").value; + var preamble = document.getElementById("transmitter-preamble").value; + var id = openTransmitter; transmitter.append('id', id); @@ -22,6 +40,14 @@ function save(targetID) { transmitter.append('pipe', pipe); transmitter.append('target', targetID); + if (modulationEl.options[modulationEl.selectedIndex].text == "LORA") { + transmitter.append('lora', 'true'); + transmitter.append('sf', sf); + transmitter.append('codingRate', codingrate); + transmitter.append('syncWord', syncword); + transmitter.append('preambleLength', preamble); + } + var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { diff --git a/web/static/js/uplinks.js b/web/static/js/uplinks.js new file mode 100644 index 0000000..83cc5ba --- /dev/null +++ b/web/static/js/uplinks.js @@ -0,0 +1,35 @@ +function plan() { + var plan = new FormData(); + + var transmitter = document.getElementById("plan-transmitter").value; + var receiver = document.getElementById("plan-receiver").value; + var start = document.getElementById("plan-start").value; + var delay = document.getElementById("plan-after-down").value; + var data = document.getElementById("plan-data").value; + + var delaydUse = document.getElementById("delayd-uplink").checked; + + if (delaydUse) { + // 0xFFFFFFFF + start = "2106-02-07T06:28:15"; + } else { + delay = 0; + } + + plan.append('transmitter', transmitter); + plan.append('receiver', receiver); + plan.append('start', start); + plan.append('delay', delay); + plan.append('data', data); + + var xhttp = new XMLHttpRequest(); + xhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + document.getElementById("created-id").innerHTML = JSON.parse(this.responseText).id; + document.getElementById("created-alert").style.display = "block"; + } + }; + + xhttp.open("POST", "/api/uplink/plan", true); + xhttp.send(plan); +} \ No newline at end of file