Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added selectable items for the database recording, so the user can ch… #533

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions main/datalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,13 +532,13 @@ func isDataLogReady() bool {
}

func logSituation() {
if globalSettings.ReplayLog && isDataLogReady() {
if globalSettings.ReplayLog && isDataLogReady() && globalSettings.RecordSituation {
dataLogChan <- DataLogRow{tbl: "mySituation", data: mySituation}
}
}

func logStatus() {
if globalSettings.ReplayLog && isDataLogReady() {
if globalSettings.ReplayLog && isDataLogReady() && globalSettings.RecordStatus {
dataLogChan <- DataLogRow{tbl: "status", data: globalStatus}
}
}
Expand All @@ -550,25 +550,25 @@ func logSettings() {
}

func logTraffic(ti TrafficInfo) {
if globalSettings.ReplayLog && isDataLogReady() {
if globalSettings.ReplayLog && isDataLogReady() && globalSettings.RecordTraffic {
dataLogChan <- DataLogRow{tbl: "traffic", data: ti}
}
}

func logMsg(m msg) {
if globalSettings.ReplayLog && isDataLogReady() {
if globalSettings.ReplayLog && isDataLogReady() && globalSettings.RecordUAT {
dataLogChan <- DataLogRow{tbl: "messages", data: m}
}
}

func logESMsg(m esmsg) {
if globalSettings.ReplayLog && isDataLogReady() {
if globalSettings.ReplayLog && isDataLogReady() && globalSettings.Record1090ES {
dataLogChan <- DataLogRow{tbl: "es_messages", data: m}
}
}

func logDump1090TermMessage(m Dump1090TermMessage) {
if globalSettings.DEBUG && globalSettings.ReplayLog && isDataLogReady() {
if globalSettings.DEBUG && globalSettings.ReplayLog && isDataLogReady() && globalSettings.Record1090ES {
dataLogChan <- DataLogRow{tbl: "dump1090_terminal", data: m}
}
}
Expand Down
140 changes: 77 additions & 63 deletions main/gen_gdl90.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,78 @@ type ADSBTower struct {
var ADSBTowers map[string]ADSBTower // Running list of all towers seen. (lat,lng) -> ADSBTower
var ADSBTowerMutex *sync.Mutex

type settings struct {
UAT_Enabled bool
ES_Enabled bool
Ping_Enabled bool
GPS_Enabled bool
NetworkOutputs []networkConnection
SerialOutputs map[string]serialConnection
AHRS_Enabled bool
DisplayTrafficSource bool
DEBUG bool
ReplayLog bool
PPM int
OwnshipModeS string
WatchList string
DeveloperMode bool
RecordSituation bool
RecordTraffic bool
RecordUAT bool
Record1090ES bool
RecordStatus bool
}

type status struct {
Version string
Build string
HardwareBuild string
Devices uint32
Connected_Users uint
DiskBytesFree uint64
UAT_messages_last_minute uint
UAT_messages_max uint
ES_messages_last_minute uint
ES_messages_max uint
UAT_traffic_targets_tracking uint16
ES_traffic_targets_tracking uint16
Ping_connected bool
GPS_satellites_locked uint16
GPS_satellites_seen uint16
GPS_satellites_tracked uint16
GPS_position_accuracy float32
GPS_connected bool
GPS_solution string
RY835AI_connected bool
Uptime int64
UptimeClock time.Time
CPUTemp float32
NetworkDataMessagesSent uint64
NetworkDataMessagesSentNonqueueable uint64
NetworkDataBytesSent uint64
NetworkDataBytesSentNonqueueable uint64
NetworkDataMessagesSentLastSec uint64
NetworkDataMessagesSentNonqueueableLastSec uint64
NetworkDataBytesSentLastSec uint64
NetworkDataBytesSentNonqueueableLastSec uint64
UAT_METAR_total uint32
UAT_TAF_total uint32
UAT_NEXRAD_total uint32
UAT_SIGMET_total uint32
UAT_PIREP_total uint32
UAT_NOTAM_total uint32
UAT_OTHER_total uint32
Errors []string
Logfile_Size int64
WebsocketClientCount int
TrackIsRecording bool
TrackRecordingStatus string
}

var globalSettings settings
var globalStatus status


// Construct the CRC table. Adapted from FAA ref above.
func crcInit() {
var i uint16
Expand Down Expand Up @@ -977,69 +1049,6 @@ func getProductNameFromId(product_id int) string {
return fmt.Sprintf("Unknown (%d)", product_id)
}

type settings struct {
UAT_Enabled bool
ES_Enabled bool
Ping_Enabled bool
GPS_Enabled bool
NetworkOutputs []networkConnection
SerialOutputs map[string]serialConnection
AHRS_Enabled bool
DisplayTrafficSource bool
DEBUG bool
ReplayLog bool
PPM int
OwnshipModeS string
WatchList string
DeveloperMode bool
}

type status struct {
Version string
Build string
HardwareBuild string
Devices uint32
Connected_Users uint
DiskBytesFree uint64
UAT_messages_last_minute uint
UAT_messages_max uint
ES_messages_last_minute uint
ES_messages_max uint
UAT_traffic_targets_tracking uint16
ES_traffic_targets_tracking uint16
Ping_connected bool
GPS_satellites_locked uint16
GPS_satellites_seen uint16
GPS_satellites_tracked uint16
GPS_position_accuracy float32
GPS_connected bool
GPS_solution string
RY835AI_connected bool
Uptime int64
UptimeClock time.Time
CPUTemp float32
NetworkDataMessagesSent uint64
NetworkDataMessagesSentNonqueueable uint64
NetworkDataBytesSent uint64
NetworkDataBytesSentNonqueueable uint64
NetworkDataMessagesSentLastSec uint64
NetworkDataMessagesSentNonqueueableLastSec uint64
NetworkDataBytesSentLastSec uint64
NetworkDataBytesSentNonqueueableLastSec uint64
UAT_METAR_total uint32
UAT_TAF_total uint32
UAT_NEXRAD_total uint32
UAT_SIGMET_total uint32
UAT_PIREP_total uint32
UAT_NOTAM_total uint32
UAT_OTHER_total uint32

Errors []string
}

var globalSettings settings
var globalStatus status

func defaultSettings() {
globalSettings.UAT_Enabled = true
globalSettings.ES_Enabled = true
Expand All @@ -1055,6 +1064,11 @@ func defaultSettings() {
globalSettings.ReplayLog = false //TODO: 'true' for debug builds.
globalSettings.OwnshipModeS = "F00000"
globalSettings.DeveloperMode = false
globalSettings.Record1090ES = true
globalSettings.RecordStatus = true
globalSettings.RecordSituation = true
globalSettings.RecordTraffic = true
globalSettings.RecordUAT = true
}

func readSettings() {
Expand Down
10 changes: 10 additions & 0 deletions main/managementinterface.go
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,16 @@ func handleSettingsSetRequest(w http.ResponseWriter, r *http.Request) {
for key, val := range msg {
// log.Printf("handleSettingsSetRequest:json: testing for key:%s of type %s\n", key, reflect.TypeOf(val))
switch key {
case "RecordSituation":
globalSettings.RecordSituation = val.(bool)
case "RecordTraffic":
globalSettings.RecordTraffic = val.(bool)
case "RecordStatus":
globalSettings.RecordStatus = val.(bool)
case "RecordUAT":
globalSettings.RecordUAT = val.(bool)
case "Record1090ES":
globalSettings.Record1090ES = val.(bool)
case "UAT_Enabled":
globalSettings.UAT_Enabled = val.(bool)
case "ES_Enabled":
Expand Down
1 change: 1 addition & 0 deletions web/maui/css/mobile-angular-ui-base.css
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@
.fa-warning:before,
.fa-exclamation-triangle:before {
content: "\f071";
list-style-type: none;
}

.fa-plane:before {
Expand Down
7 changes: 6 additions & 1 deletion web/plates/js/settings.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {

$scope.$parent.helppage = 'plates/settings-help.html';

var toggles = ['UAT_Enabled', 'ES_Enabled', 'Ping_Enabled', 'GPS_Enabled', 'AHRS_Enabled', 'DisplayTrafficSource', 'DEBUG', 'ReplayLog'];
var toggles = ['UAT_Enabled', 'ES_Enabled', 'Ping_Enabled', 'GPS_Enabled', 'AHRS_Enabled', 'DisplayTrafficSource', 'DEBUG', 'ReplayLog', 'RecordSituation', 'RecordTraffic', 'RecordUAT', 'Record1090ES', 'RecordStatus' ];
var settings = {};
for (i = 0; i < toggles.length; i++) {
settings[toggles[i]] = undefined;
Expand Down Expand Up @@ -34,6 +34,11 @@ function SettingsCtrl($rootScope, $scope, $state, $location, $window, $http) {
$scope.WatchList = settings.WatchList;
$scope.OwnshipModeS = settings.OwnshipModeS;
$scope.DeveloperMode = settings.DeveloperMode;
$scope.RecordSituation = settings.RecordSituation;
$scope.RecordTraffic = settings.RecordTraffic;
$scope.RecordUAT = settings.RecordUAT;
$scope.Record1090ES = settings.Record1090ES;
$scope.RecordStatus = settings.RecordStatus;
}

function getSettings() {
Expand Down
45 changes: 30 additions & 15 deletions web/plates/settings.html
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,36 @@
<ui-switch ng-model='ReplayLog' settings-change></ui-switch>
</div>
</div>
<div class="form-group" ng-class="{ 'section_invisible': (!ReplayLog)}">
<label class="control-label col-xs-7">Record Situation</label>
<div class="col-xs-5">
<ui-switch ng-model='RecordSituation' settings-change></ui-switch>
</div>
</div>
<div class="form-group" ng-class="{ 'section_invisible': (!ReplayLog)}">
<label class="control-label col-xs-7">Record Traffic</label>
<div class="col-xs-5">
<ui-switch ng-model='RecordTraffic' settings-change></ui-switch>
</div>
</div>
<div class="form-group" ng-class="{ 'section_invisible': (!ReplayLog)}">
<label class="control-label col-xs-7">Record UAT</label>
<div class="col-xs-5">
<ui-switch ng-model='RecordUAT' settings-change></ui-switch>
</div>
</div>
<div class="form-group" ng-class="{ 'section_invisible': (!ReplayLog)}">
<label class="control-label col-xs-7">Record 1090ES</label>
<div class="col-xs-5">
<ui-switch ng-model='Record1090ES' settings-change></ui-switch>
</div>
</div>
<div class="form-group" ng-class="{ 'section_invisible': (!ReplayLog)}">
<label class="control-label col-xs-7">Record Status</label>
<div class="col-xs-5">
<ui-switch ng-model='RecordStatus' settings-change></ui-switch>
</div>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -132,22 +162,7 @@
</div>
</div>
</div>

</div>
<!-- Developer mode area -->
<div class="col-sm-12">
<div ng-show="DeveloperMode" class="panel-group col-sm-6">
<div class="panel panel-default">
<div class="panel-heading">Developer Options</div>
<div class="panel-body">
<div class="col-xs-12">
<p>Coming soon</p>
</div>
</div>
</div>
</div>
</div>


<!--
<div class="col-sm-12">
Expand Down