kopia lustrzana https://github.com/magicbug/Cloudlog
[Clublog] Remap Sat names to conform with LoTW names
This addresses issue where Clublog uses the SAT_NAMES from LOTW rather than the real names/oscar numbers. It also adds a parameter to the AdifHelper library to accept satellite_remap to rename thempull/2998/head
rodzic
b78c307f80
commit
94f3ebf53d
|
@ -2,7 +2,14 @@
|
||||||
|
|
||||||
class AdifHelper {
|
class AdifHelper {
|
||||||
|
|
||||||
public function getAdifLine($qso) {
|
/**
|
||||||
|
* Generates an ADIF line for a QSO record.
|
||||||
|
*
|
||||||
|
* @param object $qso The QSO record.
|
||||||
|
* @param bool $satellite_remap Flag indicating whether to remap satellite names.
|
||||||
|
* @return string The ADIF line.
|
||||||
|
*/
|
||||||
|
public function getAdifLine($qso, $satellite_remap = false) {
|
||||||
$normalFields = array(
|
$normalFields = array(
|
||||||
'ADDRESS',
|
'ADDRESS',
|
||||||
'AGE',
|
'AGE',
|
||||||
|
@ -80,7 +87,6 @@ class AdifHelper {
|
||||||
'RST_SENT',
|
'RST_SENT',
|
||||||
'RX_PWR',
|
'RX_PWR',
|
||||||
'SAT_MODE',
|
'SAT_MODE',
|
||||||
'SAT_NAME',
|
|
||||||
'SFI',
|
'SFI',
|
||||||
'SILENT_KEY',
|
'SILENT_KEY',
|
||||||
'SKCC',
|
'SKCC',
|
||||||
|
@ -183,11 +189,23 @@ class AdifHelper {
|
||||||
$line .= $this->getAdifFieldLine("MY_GRIDSQUARE", $qso->station_gridsquare);
|
$line .= $this->getAdifFieldLine("MY_GRIDSQUARE", $qso->station_gridsquare);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($qso->COL_SAT_NAME) {
|
||||||
|
if($satellite_remap === true) {
|
||||||
|
$satname = $this->lotw_satellite_map($qso->COL_SAT_NAME);
|
||||||
|
if($satname) {
|
||||||
|
$line .= $this->getAdifFieldLine("SAT_NAME", $satname);
|
||||||
|
} else {
|
||||||
|
$line .= $this->getAdifFieldLine("SAT_NAME", $qso->COL_SAT_NAME);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$line .= $this->getAdifFieldLine("SAT_NAME", $qso->COL_SAT_NAME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$line .= $this->getAdifFieldLine("MY_IOTA", $qso->station_iota);
|
$line .= $this->getAdifFieldLine("MY_IOTA", $qso->station_iota);
|
||||||
|
|
||||||
$line .= $this->getAdifFieldLine("MY_SOTA_REF", $qso->station_sota);
|
$line .= $this->getAdifFieldLine("MY_SOTA_REF", $qso->station_sota);
|
||||||
|
|
||||||
|
|
||||||
$line .= $this->getAdifFieldLine("MY_POTA_REF", $qso->station_pota);
|
$line .= $this->getAdifFieldLine("MY_POTA_REF", $qso->station_pota);
|
||||||
|
|
||||||
$line .= $this->getAdifFieldLine("MY_CQ_ZONE", $qso->station_cq);
|
$line .= $this->getAdifFieldLine("MY_CQ_ZONE", $qso->station_cq);
|
||||||
|
@ -258,4 +276,36 @@ class AdifHelper {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
| Function: lotw_satellite_map
|
||||||
|
| Requires: OSCAR Satellite name $satname
|
||||||
|
|
|
||||||
|
| Outputs if LoTW uses a different satellite name
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
function lotw_satellite_map($satname) {
|
||||||
|
$arr = array(
|
||||||
|
"ARISS" => "ISS",
|
||||||
|
"UKUBE1" => "UKUBE-1",
|
||||||
|
"KEDR" => "ARISSAT-1",
|
||||||
|
"TO-108" => "CAS-6",
|
||||||
|
"TAURUS" => "TAURUS-1",
|
||||||
|
"AISAT1" => "AISAT-1",
|
||||||
|
'UVSQ' => "UVSQ-SAT",
|
||||||
|
'CAS-3H' => "LILACSAT-2",
|
||||||
|
'IO-117' => "GREENCUBE",
|
||||||
|
"TEVEL1" => "TEVEL-1",
|
||||||
|
"TEVEL2" => "TEVEL-2",
|
||||||
|
"TEVEL3" => "TEVEL-3",
|
||||||
|
"TEVEL4" => "TEVEL-4",
|
||||||
|
"TEVEL5" => "TEVEL-5",
|
||||||
|
"TEVEL6" => "TEVEL-6",
|
||||||
|
"TEVEL7" => "TEVEL-7",
|
||||||
|
"TEVEL8" => "TEVEL-8",
|
||||||
|
"INSPR7" => "INSPIRE-SAT 7",
|
||||||
|
);
|
||||||
|
|
||||||
|
return array_search(strtoupper($satname),$arr,true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,5 @@ $CI =& get_instance();
|
||||||
$CI->load->library('AdifHelper');
|
$CI->load->library('AdifHelper');
|
||||||
|
|
||||||
foreach ($qsos->result() as $qso) {
|
foreach ($qsos->result() as $qso) {
|
||||||
echo $CI->adifhelper->getAdifLine($qso);
|
echo $CI->adifhelper->getAdifLine($qso, $satellite_remap = true);
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue