pull/501/head
Christopher Young 2016-10-01 11:48:27 -04:00
rodzic d67f2fe1db
commit 8929116f00
2 zmienionych plików z 54 dodań i 54 usunięć

Wyświetl plik

@ -770,18 +770,18 @@ func registerADSBTextMessageReceived(msg string) {
var wm WeatherMessage var wm WeatherMessage
if (x[0] == "METAR") || (x[0] == "SPECI") { if (x[0] == "METAR") || (x[0] == "SPECI") {
globalStatus.UAT_METAR_total++ globalStatus.UAT_METAR_total++
} }
if (x[0] == "TAF") || (x[0] == "TAF.AMD") { if (x[0] == "TAF") || (x[0] == "TAF.AMD") {
globalStatus.UAT_TAF_total++ globalStatus.UAT_TAF_total++
} }
if x[0] == "WINDS" { if x[0] == "WINDS" {
globalStatus.UAT_TAF_total++ globalStatus.UAT_TAF_total++
} }
if x[0] == "PIREP" { if x[0] == "PIREP" {
globalStatus.UAT_PIREP_total++ globalStatus.UAT_PIREP_total++
} }
wm.Type = x[0] wm.Type = x[0]
wm.Location = x[1] wm.Location = x[1]
@ -796,26 +796,26 @@ func registerADSBTextMessageReceived(msg string) {
} }
func UpdateUATStats(ProductID uint32) { func UpdateUATStats(ProductID uint32) {
switch ProductID { switch ProductID {
case 0,20: case 0, 20:
globalStatus.UAT_METAR_total++ globalStatus.UAT_METAR_total++
case 1,21: case 1, 21:
globalStatus.UAT_TAF_total++ globalStatus.UAT_TAF_total++
case 51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83: case 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 81, 82, 83:
globalStatus.UAT_NEXRAD_total++ globalStatus.UAT_NEXRAD_total++
// AIRMET and SIGMETS // AIRMET and SIGMETS
case 2,3,4,6,11,12,22,23,24,26,254: case 2, 3, 4, 6, 11, 12, 22, 23, 24, 26, 254:
globalStatus.UAT_SIGMET_total++ globalStatus.UAT_SIGMET_total++
case 5,25: case 5, 25:
globalStatus.UAT_PIREP_total++ globalStatus.UAT_PIREP_total++
case 8: case 8:
globalStatus.UAT_NOTAM_total++ globalStatus.UAT_NOTAM_total++
case 413: case 413:
// Do nothing in the case since text is recorded elsewhere // Do nothing in the case since text is recorded elsewhere
return return
default: default:
globalStatus.UAT_OTHER_total++ globalStatus.UAT_OTHER_total++
} }
} }
func parseInput(buf string) ([]byte, uint16) { func parseInput(buf string) ([]byte, uint16) {
@ -904,7 +904,7 @@ func parseInput(buf string) ([]byte, uint16) {
// Get all of the "product ids". // Get all of the "product ids".
for _, f := range uatMsg.Frames { for _, f := range uatMsg.Frames {
thisMsg.Products = append(thisMsg.Products, f.Product_id) thisMsg.Products = append(thisMsg.Products, f.Product_id)
UpdateUATStats(f.Product_id) UpdateUATStats(f.Product_id)
} }
// Get all of the text reports. // Get all of the text reports.
textReports, _ := uatMsg.GetTextReports() textReports, _ := uatMsg.GetTextReports()
@ -1047,7 +1047,7 @@ type status struct {
UAT_NOTAM_total uint32 UAT_NOTAM_total uint32
UAT_OTHER_total uint32 UAT_OTHER_total uint32
Errors []string Errors []string
} }
var globalSettings settings var globalSettings settings

Wyświetl plik

@ -71,7 +71,7 @@ const (
NETWORK_AHRS_FFSIM = 2 NETWORK_AHRS_FFSIM = 2
NETWORK_AHRS_GDL90 = 4 NETWORK_AHRS_GDL90 = 4
dhcp_lease_file = "/var/lib/dhcp/dhcpd.leases" dhcp_lease_file = "/var/lib/dhcp/dhcpd.leases"
extra_hosts_file = "/etc/stratux-static-hosts.conf" extra_hosts_file = "/etc/stratux-static-hosts.conf"
) )
// Read the "dhcpd.leases" file and parse out IP/hostname. // Read the "dhcpd.leases" file and parse out IP/hostname.
@ -99,23 +99,23 @@ func getDHCPLeases() (map[string]string, error) {
} }
} }
// Added the ability to have static IP hosts stored in /etc/stratux-static-hosts.conf // Added the ability to have static IP hosts stored in /etc/stratux-static-hosts.conf
dat2, err := ioutil.ReadFile(extra_hosts_file) dat2, err := ioutil.ReadFile(extra_hosts_file)
if err != nil { if err != nil {
return ret, nil return ret, nil
} }
iplines := strings.Split(string(dat2), "\n") iplines := strings.Split(string(dat2), "\n")
block_ip2 := "" block_ip2 := ""
for _, ipline := range iplines { for _, ipline := range iplines {
spacedip := strings.Split(ipline, " ") spacedip := strings.Split(ipline, " ")
if len(spacedip) == 2 { if len(spacedip) == 2 {
// The ip is in block_ip2 // The ip is in block_ip2
block_ip2 = spacedip[0] block_ip2 = spacedip[0]
// the hostname is here // the hostname is here
ret[block_ip2] = spacedip[1] ret[block_ip2] = spacedip[1]
} }
} }
return ret, nil return ret, nil