mirror of
https://github.com/Lukas0025/YAGS.git
synced 2025-04-10 17:32:17 +01:00
Station position from YAGS server
This commit is contained in:
parent
bd51a52ad3
commit
fed902d45e
@ -1,8 +1,10 @@
|
|||||||
masterUrl = "http://10.0.3.41:8000"
|
masterUrl = "http://10.0.3.41:8000"
|
||||||
pullInterval = 10 # in sec
|
pullInterval = 10 # in sec
|
||||||
apiKey = "7b105947-65d6-40ba-bb4c-50b95a3ec1c8"
|
apiKey = "7b105947-65d6-40ba-bb4c-50b95a3ec1c8"
|
||||||
|
|
||||||
|
# do not edit
|
||||||
station = {
|
station = {
|
||||||
"lat": 49.2397383,
|
"lat": 0,
|
||||||
"lon": 16.5684175,
|
"lon": 0,
|
||||||
"alt": 0.277 #KM
|
"alt": 0 #KM
|
||||||
}
|
}
|
@ -14,6 +14,11 @@ def getNewJobs():
|
|||||||
data_json = json.loads(response.read())
|
data_json = json.loads(response.read())
|
||||||
return data_json
|
return data_json
|
||||||
|
|
||||||
|
def getInfo():
|
||||||
|
response = urlopen(config.masterUrl + "/api/station/APIinfo?key=" + config.apiKey)
|
||||||
|
data_json = json.loads(response.read())
|
||||||
|
return data_json
|
||||||
|
|
||||||
def apiSend(url, data, files=None):
|
def apiSend(url, data, files=None):
|
||||||
r = requests.post(url=config.masterUrl + url, data=data, files=files)
|
r = requests.post(url=config.masterUrl + url, data=data, files=files)
|
||||||
return r.text
|
return r.text
|
||||||
@ -65,6 +70,17 @@ def parseNewJobs(jobs):
|
|||||||
|
|
||||||
watingJobs.append(job)
|
watingJobs.append(job)
|
||||||
|
|
||||||
|
def parseInfo(info):
|
||||||
|
if "gps" in info:
|
||||||
|
config.lat = info["gps"]["lat"]
|
||||||
|
config.lon = info["gps"]["lon"]
|
||||||
|
config.alt = info["gps"]["alt"] / 1000
|
||||||
|
|
||||||
|
print(f"[INFO] loaded locator from YAGS server LAT: {config.lat}, LON: {config.lon}, ALT: {config.alt}")
|
||||||
|
|
||||||
def pull():
|
def pull():
|
||||||
|
#get station info
|
||||||
|
info = getInfo()
|
||||||
|
parseInfo(info)
|
||||||
jobs = getNewJobs()
|
jobs = getNewJobs()
|
||||||
parseNewJobs(jobs)
|
parseNewJobs(jobs)
|
@ -41,7 +41,7 @@ class recorder(threading.Thread):
|
|||||||
|
|
||||||
# find supported FS
|
# find supported FS
|
||||||
for sample in self.job["receiver"]["params"]["fs"]:
|
for sample in self.job["receiver"]["params"]["fs"]:
|
||||||
if (sample > (int(self.job['transmitter']['bandwidth']) * 2)) and (sample < fs):
|
if (sample > int(self.job['transmitter']['bandwidth'])) and (sample < fs):
|
||||||
fs = sample
|
fs = sample
|
||||||
|
|
||||||
time.sleep(50)
|
time.sleep(50)
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
//register API functions
|
//register API functions
|
||||||
include_once(__DIR__ . "/observations.php");
|
include_once(__DIR__ . "/observations.php");
|
||||||
|
include_once(__DIR__ . "/stations.php");
|
||||||
|
|
||||||
//init API
|
//init API
|
||||||
$api->serve($router->getArgs());
|
$api->serve($router->getArgs());
|
11
web/API/stations.php
Normal file
11
web/API/stations.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
namespace API\station;
|
||||||
|
|
||||||
|
function APIinfo($params) {
|
||||||
|
|
||||||
|
$station = new \DAL\station()
|
||||||
|
|
||||||
|
$station->find("apiKey", $params["key"])
|
||||||
|
|
||||||
|
return ["id" => $station->id->get(), "name" => $station->name->get(), "locator" => $station->locator->get()];
|
||||||
|
}
|
@ -56,9 +56,9 @@
|
|||||||
/**
|
/**
|
||||||
* Get used size
|
* Get used size
|
||||||
*/
|
*/
|
||||||
$context["usedSize"] = round(foldersize(__DIR__ . "/../artefacts/") / 1000000);
|
$context["usedSize"] = round(foldersize(__DIR__ . "/../ARTEFACTS/") / 1000000);
|
||||||
$context["imagesSize"] = round(foldersize(__DIR__ . "/../artefacts/", "png") / 1000000);
|
$context["imagesSize"] = round(foldersize(__DIR__ . "/../ARTEFACTS/", "png") / 1000000);
|
||||||
$context["basebandSize"] = round(foldersize(__DIR__ . "/../artefacts/", "s8") / 1000000);
|
$context["basebandSize"] = round(foldersize(__DIR__ . "/../ARTEFACTS/", "s8") / 1000000);
|
||||||
$context["otherSize"] = $context["usedSize"] - $context["imagesSize"] + $context["basebandSize"];
|
$context["otherSize"] = $context["usedSize"] - $context["imagesSize"] + $context["basebandSize"];
|
||||||
$context["freeSize"] = $context["artefactsSpace"] - $context["usedSize"];
|
$context["freeSize"] = $context["artefactsSpace"] - $context["usedSize"];
|
||||||
|
|
||||||
|
@ -38,6 +38,13 @@
|
|||||||
*/
|
*/
|
||||||
$myStation = new \DAL\station();
|
$myStation = new \DAL\station();
|
||||||
$myStation->name->set("default");
|
$myStation->name->set("default");
|
||||||
|
$myStation->locator->set([
|
||||||
|
"gps" => [
|
||||||
|
"lat" => 49.2397383,
|
||||||
|
"lon" => 16.5684175,
|
||||||
|
"alt" => 277
|
||||||
|
]
|
||||||
|
]);
|
||||||
$myStation->commit();
|
$myStation->commit();
|
||||||
|
|
||||||
$myStation137 = new \DAL\receiver();
|
$myStation137 = new \DAL\receiver();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user