From cd366e59ca572c12a5b7a0051bcb65602d9b52b5 Mon Sep 17 00:00:00 2001 From: Jim Jacobsen Date: Wed, 23 Nov 2016 07:38:50 +0000 Subject: [PATCH] Added selectable items for the database recording, so the user can choose which database items to record --- main/datalog.go | 12 +- main/gen_gdl90.go | 140 +++++++++++++----------- main/managementinterface.go | 10 ++ web/maui/css/mobile-angular-ui-base.css | 1 + web/plates/js/settings.js | 7 +- web/plates/settings.html | 45 +++++--- 6 files changed, 130 insertions(+), 85 deletions(-) mode change 100755 => 100644 main/gen_gdl90.go mode change 100755 => 100644 main/managementinterface.go mode change 100755 => 100644 web/plates/js/settings.js mode change 100755 => 100644 web/plates/settings.html diff --git a/main/datalog.go b/main/datalog.go index eda48cd50..6b36f95ba 100644 --- a/main/datalog.go +++ b/main/datalog.go @@ -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} } } @@ -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} } } diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go old mode 100755 new mode 100644 index 971e5d766..044086c38 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -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 @@ -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 @@ -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() { diff --git a/main/managementinterface.go b/main/managementinterface.go old mode 100755 new mode 100644 index 8ed2dfd8c..6bab63b59 --- a/main/managementinterface.go +++ b/main/managementinterface.go @@ -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": diff --git a/web/maui/css/mobile-angular-ui-base.css b/web/maui/css/mobile-angular-ui-base.css index 67a8ffcff..6222dd5e4 100644 --- a/web/maui/css/mobile-angular-ui-base.css +++ b/web/maui/css/mobile-angular-ui-base.css @@ -850,6 +850,7 @@ .fa-warning:before, .fa-exclamation-triangle:before { content: "\f071"; + list-style-type: none; } .fa-plane:before { diff --git a/web/plates/js/settings.js b/web/plates/js/settings.js old mode 100755 new mode 100644 index 52b180995..7699c081c --- a/web/plates/js/settings.js +++ b/web/plates/js/settings.js @@ -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; @@ -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() { diff --git a/web/plates/settings.html b/web/plates/settings.html old mode 100755 new mode 100644 index d3987a01d..dc9559a20 --- a/web/plates/settings.html +++ b/web/plates/settings.html @@ -60,6 +60,36 @@ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
@@ -132,22 +162,7 @@ - - -
-
-
-
Developer Options
-
-
-

Coming soon

-
-
-
-
-
-