mirror of
https://github.com/hak5/nano-tetra-modules.git
synced 2025-10-29 16:58:09 +00:00
Add modules to repository
This commit is contained in:
267
dump1090/api/module.php
Normal file
267
dump1090/api/module.php
Normal file
@@ -0,0 +1,267 @@
|
||||
<?php namespace pineapple;
|
||||
putenv('LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH').':/sd/lib:/sd/usr/lib');
|
||||
putenv('PATH='.getenv('PATH').':/sd/usr/bin:/sd/usr/sbin');
|
||||
|
||||
class dump1090 extends Module
|
||||
{
|
||||
public function route()
|
||||
{
|
||||
switch ($this->request->action) {
|
||||
case 'refreshInfo':
|
||||
$this->refreshInfo();
|
||||
break;
|
||||
case 'refreshOutput':
|
||||
$this->refreshOutput();
|
||||
break;
|
||||
case 'clearOutput':
|
||||
$this->clearOutput();
|
||||
break;
|
||||
case 'refreshStatus':
|
||||
$this->refreshStatus();
|
||||
break;
|
||||
case 'toggledump1090':
|
||||
$this->toggledump1090();
|
||||
break;
|
||||
case 'handleDependencies':
|
||||
$this->handleDependencies();
|
||||
break;
|
||||
case 'handleDependenciesStatus':
|
||||
$this->handleDependenciesStatus();
|
||||
break;
|
||||
case 'refreshHistory':
|
||||
$this->refreshHistory();
|
||||
break;
|
||||
case 'deleteHistory':
|
||||
$this->deleteHistory();
|
||||
break;
|
||||
case 'downloadHistory':
|
||||
$this->downloadHistory();
|
||||
break;
|
||||
case 'viewHistory':
|
||||
$this->viewHistory();
|
||||
break;
|
||||
case 'getSettings':
|
||||
$this->getSettings();
|
||||
break;
|
||||
case 'setSettings':
|
||||
$this->setSettings();
|
||||
break;
|
||||
case 'refreshList':
|
||||
$this->refreshList();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkDependency($dependencyName)
|
||||
{
|
||||
return ((exec("which {$dependencyName}") == '' ? false : true) && ($this->uciGet("dump1090.module.installed")));
|
||||
}
|
||||
|
||||
protected function getDevice()
|
||||
{
|
||||
return trim(exec("cat /proc/cpuinfo | grep machine | awk -F: '{print $2}'"));
|
||||
}
|
||||
|
||||
protected function refreshInfo()
|
||||
{
|
||||
$moduleInfo = @json_decode(file_get_contents("/pineapple/modules/dump1090/module.info"));
|
||||
$this->response = array('title' => $moduleInfo->title, 'version' => $moduleInfo->version);
|
||||
}
|
||||
|
||||
private function handleDependencies()
|
||||
{
|
||||
if(!$this->checkDependency("dump1090"))
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/dump1090/scripts/dependencies.sh install ".$this->request->destination);
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/dump1090/scripts/dependencies.sh remove");
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
}
|
||||
|
||||
private function handleDependenciesStatus()
|
||||
{
|
||||
if (!file_exists('/tmp/dump1090.progress'))
|
||||
{
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = array('success' => false);
|
||||
}
|
||||
}
|
||||
|
||||
private function toggledump1090()
|
||||
{
|
||||
if(!$this->checkRunning("dump1090"))
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/dump1090/scripts/dump1090.sh start");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/dump1090/scripts/dump1090.sh stop");
|
||||
}
|
||||
}
|
||||
|
||||
private function refreshStatus()
|
||||
{
|
||||
if (!file_exists('/tmp/dump1090.progress'))
|
||||
{
|
||||
if (!$this->checkDependency("dump1090"))
|
||||
{
|
||||
$installed = false;
|
||||
$install = "Not installed";
|
||||
$installLabel = "danger";
|
||||
$processing = false;
|
||||
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
$running = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$installed = true;
|
||||
$install = "Installed";
|
||||
$installLabel = "success";
|
||||
$processing = false;
|
||||
|
||||
if ($this->checkRunning("dump1090"))
|
||||
{
|
||||
$status = "Stop";
|
||||
$statusLabel = "danger";
|
||||
$running = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
$running = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$installed = false;
|
||||
$install = "Installing...";
|
||||
$installLabel = "warning";
|
||||
$processing = true;
|
||||
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
$running = false;
|
||||
}
|
||||
|
||||
$device = $this->getDevice();
|
||||
$sdAvailable = $this->isSDAvailable();
|
||||
|
||||
$this->response = array("device" => $device, "sdAvailable" => $sdAvailable, "status" => $status, "statusLabel" => $statusLabel, "installed" => $installed, "install" => $install, "installLabel" => $installLabel, "processing" => $processing, "running" => $running);
|
||||
}
|
||||
|
||||
private function refreshOutput()
|
||||
{
|
||||
if ($this->checkDependency("dump1090"))
|
||||
{
|
||||
if (file_exists("/tmp/dump1090_capture.log"))
|
||||
{
|
||||
$output = file_get_contents("/tmp/dump1090_capture.log");
|
||||
if(!empty($output))
|
||||
$this->response = $output;
|
||||
else
|
||||
$this->response = "dump1090 is running...";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = "dump1090 is not running...";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = "dump1090 is not installed...";
|
||||
}
|
||||
}
|
||||
|
||||
private function clearOutput()
|
||||
{
|
||||
exec("rm -rf /tmp/dump1090_capture.log");
|
||||
}
|
||||
|
||||
private function refreshHistory()
|
||||
{
|
||||
$this->streamFunction = function () {
|
||||
$log_list = array_reverse(glob("/pineapple/modules/dump1090/log/*.log"));
|
||||
|
||||
echo '[';
|
||||
for($i=0;$i<count($log_list);$i++)
|
||||
{
|
||||
$info = explode("_", basename($log_list[$i]));
|
||||
$entryDate = gmdate('Y-m-d H-i-s', $info[1]);
|
||||
$entryName = basename($log_list[$i],".log");
|
||||
|
||||
if(file_exists("/pineapple/modules/dump1090/log/".$entryName.".csv"))
|
||||
echo json_encode(array($entryDate, $entryName.".log", $entryName.".csv"));
|
||||
else
|
||||
echo json_encode(array($entryDate, $entryName.".log", ''));
|
||||
|
||||
if($i!=count($log_list)-1) echo ',';
|
||||
}
|
||||
echo ']';
|
||||
};
|
||||
}
|
||||
|
||||
private function downloadHistory()
|
||||
{
|
||||
$this->response = array("download" => $this->downloadFile("/pineapple/modules/dump1090/log/".$this->request->file));
|
||||
}
|
||||
|
||||
private function viewHistory()
|
||||
{
|
||||
$log_date = gmdate("F d Y H:i:s", filemtime("/pineapple/modules/dump1090/log/".$this->request->file));
|
||||
exec ("strings /pineapple/modules/dump1090/log/".$this->request->file, $output);
|
||||
|
||||
if(!empty($output))
|
||||
$this->response = array("output" => implode("\n", $output), "date" => $log_date);
|
||||
else
|
||||
$this->response = array("output" => "Empty log...", "date" => $log_date);
|
||||
}
|
||||
|
||||
private function deleteHistory()
|
||||
{
|
||||
$file = basename($this->request->file,".log");
|
||||
exec("rm -rf /pineapple/modules/dump1090/log/".$file.".*");
|
||||
}
|
||||
|
||||
private function getSettings()
|
||||
{
|
||||
$settings = array(
|
||||
'csv' => $this->uciGet("dump1090.settings.csv"),
|
||||
'gain' => $this->uciGet("dump1090.settings.gain"),
|
||||
'frequency' => $this->uciGet("dump1090.settings.frequency"),
|
||||
'metrics' => $this->uciGet("dump1090.settings.metrics"),
|
||||
'agc' => $this->uciGet("dump1090.settings.agc"),
|
||||
'aggressive' => $this->uciGet("dump1090.settings.aggressive")
|
||||
);
|
||||
$this->response = array('settings' => $settings);
|
||||
}
|
||||
|
||||
private function setSettings()
|
||||
{
|
||||
$settings = $this->request->settings;
|
||||
$this->uciSet("dump1090.settings.gain", $settings->gain);
|
||||
$this->uciSet("dump1090.settings.frequency", $settings->frequency);
|
||||
if ($settings->csv) $this->uciSet("dump1090.settings.csv", 1); else $this->uciSet("dump1090.settings.csv", 0);
|
||||
if ($settings->metrics) $this->uciSet("dump1090.settings.metrics", 1); else $this->uciSet("dump1090.settings.metrics", 0);
|
||||
if ($settings->agc) $this->uciSet("dump1090.settings.agc", 1); else $this->uciSet("dump1090.settings.agc", 0);
|
||||
if ($settings->aggressive) $this->uciSet("dump1090.settings.aggressive", 1); else $this->uciSet("dump1090.settings.aggressive", 0);
|
||||
}
|
||||
|
||||
private function refreshList()
|
||||
{
|
||||
$this->streamFunction = function () {
|
||||
echo file_get_contents("http://127.0.0.1:9090/data.json");
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
338
dump1090/js/module.js
Normal file
338
dump1090/js/module.js
Normal file
@@ -0,0 +1,338 @@
|
||||
registerController('dump1090_Controller', ['$api', '$scope', '$rootScope', '$interval', '$timeout', function($api, $scope, $rootScope, $interval, $timeout) {
|
||||
$scope.title = "Loading...";
|
||||
$scope.version = "Loading...";
|
||||
|
||||
$scope.refreshInfo = (function() {
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: "refreshInfo"
|
||||
}, function(response) {
|
||||
$scope.title = response.title;
|
||||
$scope.version = "v"+response.version;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.refreshInfo();
|
||||
|
||||
}]);
|
||||
|
||||
registerController('dump1090_ControlsController', ['$api', '$scope', '$rootScope', '$interval', '$timeout', function($api, $scope, $rootScope, $interval, $timeout) {
|
||||
$scope.status = "Loading...";
|
||||
$scope.statusLabel = "default";
|
||||
$scope.starting = false;
|
||||
|
||||
$scope.install = "Loading...";
|
||||
$scope.installLabel = "default";
|
||||
$scope.processing = false;
|
||||
|
||||
$scope.device = '';
|
||||
$scope.sdAvailable = false;
|
||||
|
||||
$rootScope.status = {
|
||||
installed : false,
|
||||
running : false,
|
||||
refreshOutput : false,
|
||||
refreshHistory : false
|
||||
};
|
||||
|
||||
$scope.refreshStatus = (function() {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "refreshStatus"
|
||||
}, function(response) {
|
||||
$scope.status = response.status;
|
||||
$scope.statusLabel = response.statusLabel;
|
||||
|
||||
$rootScope.status.installed = response.installed;
|
||||
$scope.device = response.device;
|
||||
$scope.sdAvailable = response.sdAvailable;
|
||||
if(response.processing) $scope.processing = true;
|
||||
$scope.install = response.install;
|
||||
$scope.installLabel = response.installLabel;
|
||||
$rootScope.status.running = response.running;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.toggledump1090 = (function() {
|
||||
if($scope.status != "Stop")
|
||||
$scope.status = "Starting...";
|
||||
else
|
||||
$scope.status = "Stopping...";
|
||||
|
||||
$scope.statusLabel = "warning";
|
||||
$scope.starting = true;
|
||||
|
||||
$rootScope.status.refreshOutput = false;
|
||||
$rootScope.status.refreshHistory = false;
|
||||
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'toggledump1090',
|
||||
command: $rootScope.command
|
||||
}, function(response) {
|
||||
$timeout(function(){
|
||||
$rootScope.status.refreshOutput = true;
|
||||
$rootScope.status.refreshHistory = true;
|
||||
|
||||
$scope.starting = false;
|
||||
$scope.refreshStatus();
|
||||
|
||||
}, 2000);
|
||||
})
|
||||
});
|
||||
|
||||
$scope.handleDependencies = (function(param) {
|
||||
if(!$rootScope.status.installed)
|
||||
$scope.install = "Installing...";
|
||||
else
|
||||
$scope.install = "Removing...";
|
||||
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'handleDependencies',
|
||||
destination: param
|
||||
}, function(response){
|
||||
if (response.success === true) {
|
||||
$scope.installLabel = "warning";
|
||||
$scope.processing = true;
|
||||
|
||||
$scope.handleDependenciesInterval = $interval(function(){
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'handleDependenciesStatus'
|
||||
}, function(response) {
|
||||
if (response.success === true){
|
||||
$scope.processing = false;
|
||||
$interval.cancel($scope.handleDependenciesInterval);
|
||||
$scope.refreshStatus();
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.refreshStatus();
|
||||
}]);
|
||||
|
||||
registerController('dump1090_OutputController', ['$api', '$scope', '$rootScope', '$interval', function($api, $scope, $rootScope, $interval) {
|
||||
$scope.output = 'Loading...';
|
||||
|
||||
$scope.refreshLabelON = "default";
|
||||
$scope.refreshLabelOFF = "danger";
|
||||
|
||||
$scope.refreshOutput = (function() {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "refreshOutput"
|
||||
}, function(response) {
|
||||
$scope.output = response;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.clearOutput = (function() {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "clearOutput"
|
||||
}, function(response) {
|
||||
$scope.refreshOutput();
|
||||
})
|
||||
});
|
||||
|
||||
$scope.toggleAutoRefresh = (function() {
|
||||
if($scope.autoRefreshInterval)
|
||||
{
|
||||
$interval.cancel($scope.autoRefreshInterval);
|
||||
$scope.autoRefreshInterval = null;
|
||||
$scope.refreshLabelON = "default";
|
||||
$scope.refreshLabelOFF = "danger";
|
||||
}
|
||||
else
|
||||
{
|
||||
$scope.refreshLabelON = "success";
|
||||
$scope.refreshLabelOFF = "default";
|
||||
|
||||
$scope.autoRefreshInterval = $interval(function(){
|
||||
$scope.refreshOutput();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
|
||||
$scope.refreshOutput();
|
||||
|
||||
$rootScope.$watch('status.refreshOutput', function(param) {
|
||||
if(param) {
|
||||
$scope.refreshOutput();
|
||||
}
|
||||
});
|
||||
|
||||
}]);
|
||||
|
||||
registerController('dump1090_HistoryController', ['$api', '$scope', '$rootScope', function($api, $scope, $rootScope) {
|
||||
$scope.history = [];
|
||||
$scope.historyOutput = 'Loading...';
|
||||
$scope.historyDate = 'Loading...';
|
||||
|
||||
$scope.refreshHistory = (function() {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "refreshHistory"
|
||||
}, function(response) {
|
||||
$scope.history = response;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.viewHistory = (function(param) {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "viewHistory",
|
||||
file: param
|
||||
}, function(response) {
|
||||
$scope.historyOutput = response.output;
|
||||
$scope.historyDate = response.date;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.deleteHistory = (function(param) {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "deleteHistory",
|
||||
file: param
|
||||
}, function(response) {
|
||||
$scope.refreshHistory();
|
||||
})
|
||||
});
|
||||
|
||||
$scope.downloadHistory = (function(param) {
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'downloadHistory',
|
||||
file: param
|
||||
}, function(response) {
|
||||
if (response.error === undefined) {
|
||||
window.location = '/api/?download=' + response.download;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.refreshHistory();
|
||||
|
||||
$rootScope.$watch('status.refreshHistory', function(param) {
|
||||
if(param) {
|
||||
$scope.refreshHistory();
|
||||
}
|
||||
});
|
||||
|
||||
}]);
|
||||
|
||||
registerController('dump1090_MapController', ['$api', '$scope', '$rootScope', '$timeout', '$location', '$sce', function($api, $scope, $rootScope, $timeout, $location, $sce) {
|
||||
|
||||
$scope.getMapSrc = (function(param) {
|
||||
return $sce.trustAsResourceUrl('http://' + $location.host() + ':9090/');
|
||||
});
|
||||
|
||||
$scope.refreshMap = (function(param) {
|
||||
document.getElementById('map').src += '';
|
||||
});
|
||||
|
||||
$rootScope.$watch('status.refreshOutput', function(param) {
|
||||
if(param) {
|
||||
$scope.refreshMap();
|
||||
}
|
||||
});
|
||||
|
||||
}]);
|
||||
|
||||
registerController('dump1090_ListController', ['$api', '$scope', '$rootScope', '$timeout', '$interval', function($api, $scope, $rootScope, $timeout, $interval) {
|
||||
$scope.list = [];
|
||||
|
||||
$scope.refreshLabelON = "default";
|
||||
$scope.refreshLabelOFF = "danger";
|
||||
|
||||
$scope.toggleAutoRefresh = (function() {
|
||||
if($scope.autoRefreshInterval)
|
||||
{
|
||||
$interval.cancel($scope.autoRefreshInterval);
|
||||
$scope.autoRefreshInterval = null;
|
||||
$scope.refreshLabelON = "default";
|
||||
$scope.refreshLabelOFF = "danger";
|
||||
}
|
||||
else
|
||||
{
|
||||
$scope.refreshLabelON = "success";
|
||||
$scope.refreshLabelOFF = "default";
|
||||
|
||||
$scope.autoRefreshInterval = $interval(function(){
|
||||
$scope.refreshList();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
|
||||
$scope.refreshList = (function() {
|
||||
$api.request({
|
||||
module: "dump1090",
|
||||
action: "refreshList"
|
||||
}, function(response) {
|
||||
$scope.list = response;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.refreshList();
|
||||
|
||||
$rootScope.$watch('status.refreshOutput', function(param) {
|
||||
if(param) {
|
||||
$scope.refreshList();
|
||||
}
|
||||
});
|
||||
|
||||
}]);
|
||||
|
||||
registerController('dump1090_SettingsController', ['$api', '$scope', '$rootScope', '$timeout', function($api, $scope, $rootScope, $timeout) {
|
||||
$scope.settings = {
|
||||
csv : false,
|
||||
gain : "",
|
||||
frequency : "",
|
||||
metrics : false,
|
||||
agc : false,
|
||||
aggressive : false
|
||||
};
|
||||
|
||||
$scope.saveSettingsLabel = "primary";
|
||||
$scope.saveSettings = "Save";
|
||||
$scope.saving = false;
|
||||
|
||||
$scope.getSettings = function() {
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'getSettings'
|
||||
}, function(response) {
|
||||
$scope.settings = response.settings;
|
||||
});
|
||||
};
|
||||
|
||||
$scope.setSettings = function() {
|
||||
$scope.saveSettingsLabel = "warning";
|
||||
$scope.saveSettings = "Saving...";
|
||||
$scope.saving = true;
|
||||
|
||||
$api.request({
|
||||
module: 'dump1090',
|
||||
action: 'setSettings',
|
||||
settings: $scope.settings
|
||||
}, function(response) {
|
||||
$scope.getSettings();
|
||||
|
||||
$scope.saveSettingsLabel = "success";
|
||||
$scope.saveSettings = "Saved";
|
||||
|
||||
$timeout(function(){
|
||||
$scope.saveSettingsLabel = "primary";
|
||||
$scope.saveSettings = "Save";
|
||||
$scope.saving = false;
|
||||
}, 2000);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getSettings();
|
||||
|
||||
}]);
|
||||
253
dump1090/module.html
Normal file
253
dump1090/module.html
Normal file
@@ -0,0 +1,253 @@
|
||||
<div class="panel panel-default" ng-controller="dump1090_Controller"><div class="panel-heading"><h4 class="panel-title pull-left">{{title}}</h4><span class="pull-right">{{version}}</span><div class="clearfix"></div></div></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="panel panel-default" ng-controller="dump1090_ControlsController">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Controls</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<td style="padding-bottom: .5em;" class="text-muted">Dependencies</td>
|
||||
<td ng-hide="$root.status.installed" style="text-align:right;padding-bottom: .5em;"><button type="button" style="width: 90px;" class="btn btn-{{installLabel}} btn-xs" data-toggle="modal" data-target="#dependenciesInstallModal" ng-disabled="processing">{{install}}</button></td>
|
||||
<td ng-show="$root.status.installed" style="text-align:right;padding-bottom: .5em;"><button type="button" style="width: 90px;" class="btn btn-{{installLabel}} btn-xs" data-toggle="modal" data-target="#dependenciesRemoveModal" ng-disabled="processing">{{install}}</button></td>
|
||||
</tr>
|
||||
<tr ng-show="$root.status.installed">
|
||||
<td style="padding-bottom: .5em;" class="text-muted">dump1090</td>
|
||||
<td style="text-align:right;padding-bottom: .5em;"><button type="button" style="width: 90px;" class="btn btn-{{statusLabel}} btn-xs" ng-disabled="starting" ng-click="toggledump1090()">{{status}}</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="dependenciesInstallModal" tabindex="-1" role="dialog" aria-labelledby="dependenciesModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="dependenciesInstallModalLabel">Install dependencies</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
All required dependencies have to be installed first. This may take a few minutes.<br /><br />
|
||||
Please wait, do not leave or refresh this page. Once the install is complete, this page will refresh automatically.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-info" ng-click="handleDependencies('internal')" data-dismiss="modal">Internal</button>
|
||||
<button type="button" class="btn btn-info" ng-hide="device == 'tetra' || sdAvailable == false" ng-click="handleDependencies('sd')" data-dismiss="modal">SD Card</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="dependenciesRemoveModal" tabindex="-1" role="dialog" aria-labelledby="dependenciesModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="dependenciesRemoveModalLabel">Remove dependencies</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
All required dependencies will be removed. This may take a few minutes.<br /><br />
|
||||
Please wait, do not leave or refresh this page. Once the remove is complete, this page will refresh automatically.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-info" ng-click="handleDependencies()" data-dismiss="modal">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" ng-show="$root.status.installed" ng-controller="dump1090_SettingsController">
|
||||
<div class="panel-heading pointer" data-toggle="collapse" data-target="#Settings">
|
||||
<h4 class="panel-title">Settings</h4>
|
||||
</div>
|
||||
<div id="Settings" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="btn-group pull-right">
|
||||
<button class="btn btn-{{saveSettingsLabel}} btn-sm" ng-disabled="saving" ng-click="setSettings()">{{saveSettings}}</button>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon input-sm">Gain</span>
|
||||
<input type="text" class="form-control input-sm" ng-model="settings.gain" placeholder="Default: max gain. Use -100 for auto-gain">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon input-sm">Frequency</span>
|
||||
<input type="text" class="form-control input-sm" ng-model="settings.frequency" placeholder="Default: 1090 Mhz">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="checkbox"><label><input type="checkbox" ng-model="settings.metrics"> Use metric units</label></div>
|
||||
<div class="checkbox"><label><input type="checkbox" ng-model="settings.agc"> Enable the Automatic Gain Control</label></div>
|
||||
<div class="checkbox"><label><input type="checkbox" ng-model="settings.aggressive"> Agressive. More CPU for mores messages (two bits fixes, ...)</label></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="checkbox"><label><input type="checkbox" ng-model="settings.csv"> Log output to csv</label></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" ng-show="$root.status.installed && $root.status.running" ng-controller="dump1090_MapController">
|
||||
<div class="panel-heading pointer" data-toggle="collapse" data-target="#Map">
|
||||
<h4 class="panel-title">Map</h4>
|
||||
</div>
|
||||
<div id="Map" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
<iframe id="map" width="100%" style="min-height: 500px;" ng-src="{{getMapSrc()}}"></iframe>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" ng-show="$root.status.installed && $root.status.running" ng-controller="dump1090_ListController">
|
||||
<div class="panel-heading pointer" data-toggle="collapse" data-target="#List">
|
||||
<h4 class="panel-title">List <span class="badge">{{list.length}}</span></h4>
|
||||
</div>
|
||||
<div id="List" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
<div class="pull-left">
|
||||
Auto-refresh <div class="btn-group">
|
||||
<button ng-click="toggleAutoRefresh()" class="btn btn-xs btn-{{refreshLabelON}}">ON</button>
|
||||
<button ng-click="toggleAutoRefresh()" class="btn btn-xs btn-{{refreshLabelOFF}}">OFF</button>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary btn-sm pull-right" ng-click="refreshList()">Refresh List</button><div class="clearfix"></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered table-hover" ng-hide="(list.length == 0)">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Hex</th>
|
||||
<th>Squawk</th>
|
||||
<th>Flight</th>
|
||||
<th>Lat</th>
|
||||
<th>Lon</th>
|
||||
<th>Valid Position</th>
|
||||
<th>Altitude</th>
|
||||
<th>Vert Rate</th>
|
||||
<th>Track</th>
|
||||
<th>Valid Track</th>
|
||||
<th>Speed</th>
|
||||
<th>Messages</th>
|
||||
<th>Seen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="entry in list" ng-if="entry != ''">
|
||||
<td>{{entry['hex']}}</td>
|
||||
<td>{{entry['squawk']}}</td>
|
||||
<td>{{entry['flight']}}</td>
|
||||
<td>{{entry['lat']}}</td>
|
||||
<td>{{entry['lon']}}</td>
|
||||
<td>{{entry['validposition']}}</td>
|
||||
<td>{{entry['altitude']}}</td>
|
||||
<td>{{entry['vert_rate']}}</td>
|
||||
<td>{{entry['track']}}</td>
|
||||
<td>{{entry['validtrack']}}</td>
|
||||
<td>{{entry['speed']}}</td>
|
||||
<td>{{entry['messages']}}</td>
|
||||
<td>{{entry['seen']}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="well" ng-show="(list.length === 0)">No entry...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel panel-default" ng-show="$root.status.installed" ng-controller="dump1090_OutputController">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title pull-left">Output</h4>
|
||||
<div class="pull-right">
|
||||
Auto-refresh <div class="btn-group">
|
||||
<button ng-click="toggleAutoRefresh()" class="btn btn-xs btn-{{refreshLabelON}}">ON</button>
|
||||
<button ng-click="toggleAutoRefresh()" class="btn btn-xs btn-{{refreshLabelOFF}}">OFF</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="btn-group pull-right">
|
||||
<button class="btn btn-primary btn-sm" ng-click="refreshOutput()">Refresh Log</button>
|
||||
<button class="btn btn-danger btn-sm" ng-click="clearOutput()">Clear Log</button>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<pre class="scrollable-pre log-pre">{{output}}</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" ng-show="$root.status.installed" ng-controller="dump1090_HistoryController">
|
||||
<div class="panel-heading pointer" data-toggle="collapse" data-target="#History">
|
||||
<h4 class="panel-title">History <span class="badge">{{history.length}}</span></h4>
|
||||
</div>
|
||||
<div id="History" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
<button class="btn btn-primary btn-sm pull-right" ng-click="refreshHistory()">Refresh History</button><div class="clearfix"></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered table-hover" ng-hide="(history.length == 0)">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="entry in history" ng-if="entry != ''">
|
||||
<td>{{entry[0]}}</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-fixed-length btn-sm btn-default" data-toggle="modal" data-target="#historyModal" ng-click="viewHistory(entry[1])">View</button>
|
||||
<button type="button" class="btn btn-sm btn-default" ng-click="downloadHistory(entry[1])">Download log</button>
|
||||
<button type="button" class="btn btn-sm btn-default" ng-show="entry[2] != ''" ng-click="downloadHistory(entry[2])">Download csv</button>
|
||||
<button type="button" class="btn btn-fixed-length btn-sm btn-danger" ng-click="deleteHistory(entry[1])">Delete</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="well" ng-show="(history.length === 0)">No history...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="historyModal" tabindex="-1" role="dialog" aria-labelledby="historyModalLabel">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="historyModalLabel">View History - {{historyDate}}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<pre class="scrollable-pre log-pre">{{historyOutput}}</pre>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
10
dump1090/module.info
Normal file
10
dump1090/module.info
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"author": "Whistle Master",
|
||||
"description": "Track aircraft ADS-B beacons with RTS-SDR using dump1090",
|
||||
"devices": [
|
||||
"nano",
|
||||
"tetra"
|
||||
],
|
||||
"title": "dump1090",
|
||||
"version": "1.1"
|
||||
}
|
||||
37
dump1090/scripts/dependencies.sh
Executable file
37
dump1090/scripts/dependencies.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
#2015 - Whistle Master
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/sd/lib:/sd/usr/lib
|
||||
export PATH=$PATH:/sd/usr/bin:/sd/usr/sbin
|
||||
|
||||
[[ -f /tmp/dump1090.progress ]] && {
|
||||
exit 0
|
||||
}
|
||||
|
||||
touch /tmp/dump1090.progress
|
||||
|
||||
if [ "$1" = "install" ]; then
|
||||
if [ "$2" = "internal" ]; then
|
||||
opkg update
|
||||
opkg install dump1090
|
||||
elif [ "$2" = "sd" ]; then
|
||||
opkg update
|
||||
opkg install dump1090 --dest sd
|
||||
|
||||
ln -s /sd/usr/share/dump1090/ /usr/share/dump1090
|
||||
|
||||
fi
|
||||
|
||||
touch /etc/config/dump1090
|
||||
echo "config dump1090 'settings'" > /etc/config/dump1090
|
||||
echo "config dump1090 'module'" >> /etc/config/dump1090
|
||||
|
||||
uci set dump1090.module.installed=1
|
||||
uci commit dump1090.module.installed
|
||||
|
||||
elif [ "$1" = "remove" ]; then
|
||||
opkg remove dump1090
|
||||
rm -rf /etc/config/dump1090
|
||||
fi
|
||||
|
||||
rm /tmp/dump1090.progress
|
||||
43
dump1090/scripts/dump1090.sh
Executable file
43
dump1090/scripts/dump1090.sh
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
#2015 - Whistle Master
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/sd/lib:/sd/usr/lib
|
||||
export PATH=$PATH:/sd/usr/bin:/sd/usr/sbin
|
||||
|
||||
MYTIME=`date +%s`
|
||||
|
||||
OPTIONS=''
|
||||
GAIN=`uci get dump1090.settings.gain`
|
||||
FREQUENCY=`uci get dump1090.settings.frequency`
|
||||
METRICS=`uci get dump1090.settings.metrics`
|
||||
AGC=`uci get dump1090.settings.agc`
|
||||
AGGRESSIVE=`uci get dump1090.settings.aggressive`
|
||||
|
||||
CSV=`uci get dump1090.settings.csv`
|
||||
|
||||
if [ "$1" = "start" ]; then
|
||||
|
||||
if [ -n "$GAIN" ]; then
|
||||
OPTIONS="${OPTIONS} --gain ${GAIN}"
|
||||
fi
|
||||
|
||||
if [ -n "$FREQUENCY" ]; then
|
||||
OPTIONS="${OPTIONS} --freq ${FREQUENCY}"
|
||||
fi
|
||||
|
||||
if [ "$METRICS" -ne 0 ]; then OPTIONS="${OPTIONS} --metric"; fi
|
||||
if [ "$AGC" -ne 0 ]; then OPTIONS="${OPTIONS} --enable-agc"; fi
|
||||
if [ "$AGGRESSIVE" -ne 0 ]; then OPTIONS="${OPTIONS} --aggressive"; fi
|
||||
|
||||
dump1090 --net --net-http-port 9090 ${OPTIONS} 1> /pineapple/modules/dump1090/log/output_${MYTIME}.log 2> /tmp/dump1090_capture.log &
|
||||
|
||||
sleep 2
|
||||
|
||||
if [ "$CSV" -ne 0 ]; then
|
||||
nc 127.0.0.1 30003 > /pineapple/modules/dump1090/log/output_${MYTIME}.csv &
|
||||
fi
|
||||
|
||||
elif [ "$1" = "stop" ]; then
|
||||
killall -9 dump1090
|
||||
killall -9 nc
|
||||
fi
|
||||
Reference in New Issue
Block a user