Merge pull request #490 from jamez70/UAT_Statistics

Added UAT statistics to the status page
pull/491/head
cyoung 2016-09-25 20:44:26 -04:00 zatwierdzone przez GitHub
commit f711e61a1f
3 zmienionych plików z 85 dodań i 3 usunięć

47
main/gen_gdl90.go 100644 → 100755
Wyświetl plik

@ -766,7 +766,20 @@ func registerADSBTextMessageReceived(msg string) {
}
var wm WeatherMessage
if (x[0] == "METAR") || (x[0] == "SPECI") {
globalStatus.UAT_METAR_total++
}
if (x[0] == "TAF") || (x[0] == "TAF.AMD") {
globalStatus.UAT_TAF_total++
}
if x[0] == "WINDS" {
globalStatus.UAT_TAF_total++
}
if x[0] == "PIREP" {
globalStatus.UAT_PIREP_total++
}
wm.Type = x[0]
wm.Location = x[1]
wm.Time = x[2]
@ -779,6 +792,29 @@ func registerADSBTextMessageReceived(msg string) {
weatherUpdate.Send(wmJSON)
}
func UpdateUATStats(ProductID uint32) {
switch ProductID {
case 0,20:
globalStatus.UAT_METAR_total++
case 1,21:
globalStatus.UAT_TAF_total++
case 51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83:
globalStatus.UAT_NEXRAD_total++
// AIRMET and SIGMETS
case 2,3,4,6,11,12,22,23,24,26,254:
globalStatus.UAT_SIGMET_total++
case 5,25:
globalStatus.UAT_PIREP_total++
case 8:
globalStatus.UAT_NOTAM_total++
case 413:
// Do nothing in the case since text is recorded elsewhere
return
default:
globalStatus.UAT_OTHER_total++
}
}
func parseInput(buf string) ([]byte, uint16) {
//FIXME: We're ignoring all invalid format UAT messages (not sending to datalog).
x := strings.Split(buf, ";") // Discard everything after the first ';'.
@ -865,6 +901,7 @@ func parseInput(buf string) ([]byte, uint16) {
// Get all of the "product ids".
for _, f := range uatMsg.Frames {
thisMsg.Products = append(thisMsg.Products, f.Product_id)
UpdateUATStats(f.Product_id)
}
// Get all of the text reports.
textReports, _ := uatMsg.GetTextReports()
@ -999,6 +1036,14 @@ type status struct {
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
}

Wyświetl plik

@ -56,7 +56,13 @@ function StatusCtrl($rootScope, $scope, $state, $http, $interval) {
$scope.GPS_solution = status.GPS_solution;
$scope.GPS_position_accuracy = String(status.GPS_solution ? ", " + status.GPS_position_accuracy.toFixed(1) : "");
$scope.RY835AI_connected = status.RY835AI_connected;
$scope.UAT_METAR_total = status.UAT_METAR_total;
$scope.UAT_TAF_total = status.UAT_TAF_total;
$scope.UAT_NEXRAD_total = status.UAT_NEXRAD_total;
$scope.UAT_SIGMET_total = status.UAT_SIGMET_total;
$scope.UAT_PIREP_total = status.UAT_PIREP_total;
$scope.UAT_NOTAM_total = status.UAT_NOTAM_total;
$scope.UAT_OTHER_total = status.UAT_OTHER_total;
// Errors array.
if (status.Errors.length > 0) {
$scope.visible_errors = true;

Wyświetl plik

@ -89,7 +89,38 @@
</div>
<div class="row"><span class="col-xs-1">&nbsp;</span></div>
<div class="separator"></div>
<div class="row" ng-class="{'section_invisible': !visible_uat}">
<div class="col-sm-6">
<span><strong>UAT Statistics</strong></span>
</div>
</div>
<div class="row" ng-class="{'section_invisible': !visible_uat}">
<div class="col-sm-12">
<span align="center" class="col-xs-2">METARS</span>
<span align="center" class="col-xs-1">TAFS</span>
<span align="center" class="col-xs-2">NEXRAD</span>
<span align="center" class="col-xs-1">PIREP</span>
<span align="center" class="col-xs-2">SIGMET</span>
<span align="center" class="col-xs-2">NOTAMS</span>
<span align="center" class="col-xs-2">Other</span>
</div>
</div>
<div class="row" ng-class="{'section_invisible': !visible_uat}">
<div class="col-sm-12">
<span align="center" class="col-xs-2">{{UAT_METAR_total}}</span>
<span align="center" class="col-xs-1">{{UAT_TAF_total}}</span>
<span align="center" class="col-xs-2">{{UAT_NEXRAD_total}}</span>
<span align="center" class="col-xs-1">{{UAT_PIREP_total}}</span>
<span align="center" class="col-xs-2">{{UAT_SIGMET_total}}</span>
<span align="center" class="col-xs-2">{{UAT_NOTAM_total}}</span>
<span align="center" class="col-xs-2">{{UAT_OTHER_total}}</span>
</div>
</div>
<div class="row" ng-class="{'section_invisible': !visible_uat}">
<div class="separator"></div>
<div class="row"><span class="col-xs-1">&nbsp;</span></div>
<div class="separator"></div>
<div class="row">
<div class="col-sm-4 label_adj">
<span class="col-xs-5"><strong>Uptime:</strong></span>