Permalink
Browse files

Added Features to allow SatPC32 to act as a Radio interface with Clou…

…dlog

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`;
  • Loading branch information...
magicbug committed Nov 16, 2016
1 parent 4f5b8ed commit 6832ec031de2e29171fbb7d2c40b2b150a677b85
@@ -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
@@ -66,7 +66,21 @@ function frequency($id) {
{
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,15 +92,76 @@ function mode($id) {
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');
if ($query->num_rows() > 0)
{
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;
}
}
}
View
@@ -15,27 +15,59 @@ function update($result) {
if ($query->num_rows() > 0)
{
// Update the record
foreach ($query->result() as $row)
{
$radio_id = $row->id;
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)
{
$radio_id = $row->id;
$data = array(
'frequency' => $result['frequency'],
'mode' => $result['mode']
);
$data = array(
'frequency' => $result['frequency'],
'mode' => $result['mode'],
);
$this->db->where('id', $radio_id);
$this->db->update('cat', $data);
$this->db->where('id', $radio_id);
$this->db->update('cat', $data);
}
}
} else {
// Add a new record
$data = array(
'radio' => $result['radio'],
'frequency' => $result['frequency'],
'mode' => $result['mode']
);
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);
@@ -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) {
$('#frequency').val(result);
$(".band").val(frequencyToBand(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);
});
}
};
@@ -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`;
View
@@ -5,4 +5,6 @@ CREATE TABLE IF NOT EXISTS `cat` (
`mode` varchar(10) NOT NULL,
`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
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`;

0 comments on commit 6832ec0

Please sign in to comment.