Added Features to allow SatPC32 to act as a Radio interface with Cloudlog

This required extra SQL so you'll need to run the SQL query.

ALTER TABLE `cat` ADD `downlink_freq` INT(11) NOT NULL AFTER `mode`, ADD
`uplink_freq` INT(11) NOT NULL AFTER `downlink_freq`, ADD
`downlink_mode` VARCHAR(255) NOT NULL AFTER `uplink_freq`, ADD
`uplink_mode` VARCHAR(255) NOT NULL AFTER `downlink_mode`, ADD
`sat_name` VARCHAR(255) NOT NULL AFTER `uplink_mode`;
pull/203/head
Peter Goodhall 2016-11-16 16:59:53 +00:00
rodzic 4f5b8edd86
commit 6832ec031d
6 zmienionych plików z 150 dodań i 25 usunięć

Wyświetl plik

@ -13,7 +13,7 @@
*/
$config['app_name'] = "Cloudlog";
$config['app_version'] = "1.1";
$config['app_version'] = "1.5";
$config['directory'] = "logbook";
$config['callbook'] = "hamqth"; // Options are hamqth or qrz

Wyświetl plik

@ -66,10 +66,24 @@
{
foreach ($query->result() as $row)
{
if( $row->frequency == "0") {
$this->db->select('uplink_freq');
$this->db->where('id', $id);
$query = $this->db->get('cat');
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
echo strtoupper($row->uplink_freq);
}
}
} else {
echo $row->frequency;
}
}
}
}
function mode($id) {
@ -78,7 +92,7 @@
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
//$this->db->where('radio', $result['radio']);
$this->db->select('mode');
$this->db->select('mode, radio, uplink_mode');
$this->db->where('id', $id);
$query = $this->db->get('cat');
@ -86,7 +100,68 @@
{
foreach ($query->result() as $row)
{
if($row->radio != "SatPC32") {
echo strtoupper($row->mode);
} else {
echo strtoupper($row->uplink_mode);
}
}
}
}
function satname($id) {
// Check Auth
$this->load->model('user_model');
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
//$this->db->where('radio', $result['radio']);
$this->db->select('sat_name');
$this->db->where('id', $id);
$query = $this->db->get('cat');
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
echo strtoupper($row->sat_name);
}
}
}
function satmode($id) {
// Check Auth
$this->load->model('user_model');
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
//$this->db->where('radio', $result['radio']);
$this->db->select('uplink_freq, downlink_freq');
$this->db->where('id', $id);
$query = $this->db->get('cat');
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
if ($row->uplink_freq > 144000000 && $row->uplink_freq < 147000000) {
$uplink_mode = "V";
} elseif ($row->uplink_freq > 432000000 && $row->uplink_freq < 438000000) {
$uplink_mode = "U";
} elseif ($row->uplink_freq > 28000000 && $row->uplink_freq < 30000000) {
$uplink_mode = "A";
}
if ($row->downlink_freq > 144000000 && $row->downlink_freq < 147000000) {
$downlink_mode = "V";
} elseif ($row->downlink_freq > 432000000 && $row->downlink_freq < 438000000) {
$downlink_mode = "U";
} elseif ($row->downlink_freq > 28000000 && $row->downlink_freq < 30000000) {
$downlink_mode = "A";
}
echo $uplink_mode."/".$downlink_mode;
}
}
}

Wyświetl plik

@ -15,6 +15,24 @@
if ($query->num_rows() > 0)
{
if($result['radio'] == "SatPC32") {
// Update the record
foreach ($query->result() as $row)
{
$radio_id = $row->id;
$data = array(
'sat_name' => $result['sat_name'],
'downlink_freq' => $result['downlink_freq'],
'uplink_freq' => $result['uplink_freq'],
'downlink_mode' => $result['downlink_mode'],
'uplink_mode' => $result['uplink_mode'],
);
$this->db->where('id', $radio_id);
$this->db->update('cat', $data);
}
} else {
// Update the record
foreach ($query->result() as $row)
{
@ -22,20 +40,34 @@
$data = array(
'frequency' => $result['frequency'],
'mode' => $result['mode']
'mode' => $result['mode'],
);
$this->db->where('id', $radio_id);
$this->db->update('cat', $data);
}
}
} else {
// Add a new record
if($result['radio'] == "SatPC32") {
$data = array(
'radio' => $result['radio'],
'frequency' => $result['frequency'],
'mode' => $result['mode'],
'sat_name' => $result['sat_name'],
'downlink_freq' => $result['downlink_freq'],
'uplink_freq' => $result['uplink_freq'],
'downlink_mode' => $result['downlink_mode'],
'uplink_mode' => $result['uplink_mode'],
);
} else {
$data = array(
'radio' => $result['radio'],
'frequency' => $result['frequency'],
'mode' => $result['mode']
);
}
$this->db->insert('cat', $data);

Wyświetl plik

@ -209,12 +209,12 @@
<table>
<tr>
<td>Sat Name</td>
<td><input id="sat_name" type="text" name="sat_name" value="<?php echo $this->session->userdata('sat_name'); ?>" /></td>
<td><input id="sat_name" type="text" name="sat_name" class="sat_name" value="<?php echo $this->session->userdata('sat_name'); ?>" /></td>
</tr>
<tr>
<td>Sat Mode</td>
<td><input id="sat_mode" type="text" name="sat_mode" value="<?php echo $this->session->userdata('sat_mode'); ?>" /></td>
<td><input id="sat_mode" type="text" name="sat_mode" class="sat_mode" value="<?php echo $this->session->userdata('sat_mode'); ?>" /></td>
</tr>
</table>
</div>
@ -303,8 +303,12 @@
if($('select.radios option:selected').val() != '0') {
// Get frequency
$.get('radio/frequency/' + $('select.radios option:selected').val(), function(result) {
if(result == "0") {
} else {
$('#frequency').val(result);
$(".band").val(frequencyToBand(result));
}
});
// Get Mode
@ -315,6 +319,16 @@
$(".mode").val(result);
}
});
// Get SAT_Name
$.get('radio/satname/' + $('select.radios option:selected').val(), function(result) {
$(".sat_name").val(result);
});
// Get SAT_Name
$.get('radio/satmode/' + $('select.radios option:selected').val(), function(result) {
$(".sat_mode").val(result);
});
}
};

Wyświetl plik

@ -3806,3 +3806,5 @@ CREATE TABLE IF NOT EXISTS `config` (
INSERT INTO `config` (`id`, `lotw_download_url`, `lotw_upload_url`, `lotw_rcvd_mark`, `lotw_login_url`, `eqsl_download_url`, `eqsl_rcvd_mark`) VALUES
(1, 'https://p1k.arrl.org/lotwuser/lotwreport.adi', 'https://p1k.arrl.org/lotwuser/upload', 'Y', 'https://p1k.arrl.org/lotwuser/default', 'http://www.eqsl.cc/qslcard/DownloadInBox.cfm', 'Y');
ALTER TABLE `cat` ADD `downlink_freq` INT(11) NOT NULL AFTER `mode`, ADD `uplink_freq` INT(11) NOT NULL AFTER `downlink_freq`, ADD `downlink_mode` VARCHAR(255) NOT NULL AFTER `uplink_freq`, ADD `uplink_mode` VARCHAR(255) NOT NULL AFTER `downlink_mode`, ADD `sat_name` VARCHAR(255) NOT NULL AFTER `uplink_mode`;

Wyświetl plik

@ -6,3 +6,5 @@ CREATE TABLE IF NOT EXISTS `cat` (
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
ALTER TABLE `cat` ADD `downlink_freq` INT(11) NOT NULL AFTER `mode`, ADD `uplink_freq` INT(11) NOT NULL AFTER `downlink_freq`, ADD `downlink_mode` VARCHAR(255) NOT NULL AFTER `uplink_freq`, ADD `uplink_mode` VARCHAR(255) NOT NULL AFTER `downlink_mode`, ADD `sat_name` VARCHAR(255) NOT NULL AFTER `uplink_mode`;