Added function to API to allow adding a QSO by sending ADIF
这个提交包含在:
父节点
7fef104c35
当前提交
2afa5697c6
共有 2 个文件被更改,包括 43 次插入 和 1 次删除
|
|
@ -336,6 +336,49 @@ class API extends CI_Controller {
|
||||||
return $arguments;
|
return $arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function qso() {
|
||||||
|
header('Content-type: application/json');
|
||||||
|
|
||||||
|
$this->load->model('api_model');
|
||||||
|
|
||||||
|
// Decode JSON and store
|
||||||
|
$obj = json_decode(file_get_contents("php://input"), true);
|
||||||
|
|
||||||
|
if(!isset($obj['key']) || $this->api_model->authorize($obj['key']) == 0) {
|
||||||
|
echo json_encode(['status' => 'failed', 'reason' => "missing api key"]);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
if($obj['type'] == "adif" && $obj['string'] != "") {
|
||||||
|
// Load the logbook model for adding QSO records
|
||||||
|
$this->load->model('logbook_model');
|
||||||
|
|
||||||
|
// Load ADIF Parser
|
||||||
|
$this->load->library('adif_parser');
|
||||||
|
|
||||||
|
// Feed in the ADIF string
|
||||||
|
$this->adif_parser->feed($obj['string']);
|
||||||
|
|
||||||
|
// Create QSO Record
|
||||||
|
while($record = $this->adif_parser->get_record())
|
||||||
|
{
|
||||||
|
if(count($record) == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
};
|
||||||
|
|
||||||
|
$this->logbook_model->import($record);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
echo json_encode(['status' => 'success', 'type' => $obj['type'], 'string' => $obj['string']]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ENDPOINT for Rig Control */
|
/* ENDPOINT for Rig Control */
|
||||||
|
|
||||||
function radio() {
|
function radio() {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
- Update Edit
|
- Update Edit
|
||||||
- Store Radio Information
|
- Store Radio Information
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用