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_name'] = "Cloudlog";
$config['app_version'] = "1.1"; $config['app_version'] = "1.5";
$config['directory'] = "logbook"; $config['directory'] = "logbook";
$config['callbook'] = "hamqth"; // Options are hamqth or qrz $config['callbook'] = "hamqth"; // Options are hamqth or qrz

Wyświetl plik

@ -66,7 +66,21 @@
{ {
foreach ($query->result() as $row) foreach ($query->result() as $row)
{ {
echo $row->frequency; 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;
}
} }
} }
} }
@ -78,7 +92,7 @@
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } 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->where('radio', $result['radio']);
$this->db->select('mode'); $this->db->select('mode, radio, uplink_mode');
$this->db->where('id', $id); $this->db->where('id', $id);
$query = $this->db->get('cat'); $query = $this->db->get('cat');
@ -86,7 +100,68 @@
{ {
foreach ($query->result() as $row) foreach ($query->result() as $row)
{ {
echo strtoupper($row->mode); 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,27 +15,59 @@
if ($query->num_rows() > 0) if ($query->num_rows() > 0)
{ {
// Update the record if($result['radio'] == "SatPC32") {
foreach ($query->result() as $row) // Update the record
{ foreach ($query->result() as $row)
$radio_id = $row->id; {
$radio_id = $row->id;
$data = array(
'frequency' => $result['frequency'], $data = array(
'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'],
);
$this->db->where('id', $radio_id); $this->db->where('id', $radio_id);
$this->db->update('cat', $data); $this->db->update('cat', $data);
}
} else {
// Update the record
foreach ($query->result() as $row)
{
$radio_id = $row->id;
$data = array(
'frequency' => $result['frequency'],
'mode' => $result['mode'],
);
$this->db->where('id', $radio_id);
$this->db->update('cat', $data);
}
} }
} else { } else {
// Add a new record // Add a new record
$data = array( if($result['radio'] == "SatPC32") {
'radio' => $result['radio'], $data = array(
'frequency' => $result['frequency'], 'radio' => $result['radio'],
'mode' => $result['mode'] '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); $this->db->insert('cat', $data);

Wyświetl plik

@ -209,12 +209,12 @@
<table> <table>
<tr> <tr>
<td>Sat Name</td> <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>
<tr> <tr>
<td>Sat Mode</td> <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> </tr>
</table> </table>
</div> </div>
@ -303,8 +303,12 @@
if($('select.radios option:selected').val() != '0') { if($('select.radios option:selected').val() != '0') {
// Get frequency // Get frequency
$.get('radio/frequency/' + $('select.radios option:selected').val(), function(result) { $.get('radio/frequency/' + $('select.radios option:selected').val(), function(result) {
$('#frequency').val(result);
$(".band").val(frequencyToBand(result)); if(result == "0") {
} else {
$('#frequency').val(result);
$(".band").val(frequencyToBand(result));
}
}); });
// Get Mode // Get Mode
@ -315,6 +319,16 @@
$(".mode").val(result); $(".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 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'); (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

@ -5,4 +5,6 @@ CREATE TABLE IF NOT EXISTS `cat` (
`mode` varchar(10) NOT NULL, `mode` varchar(10) NOT NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ; ) 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`;