kopia lustrzana https://github.com/cyoung/stratux
Formatting.
rodzic
d67f2fe1db
commit
8929116f00
|
@ -769,20 +769,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++
|
||||
}
|
||||
|
||||
|
||||
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]
|
||||
|
@ -796,26 +796,26 @@ func registerADSBTextMessageReceived(msg string) {
|
|||
}
|
||||
|
||||
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++
|
||||
}
|
||||
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) {
|
||||
|
@ -904,7 +904,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)
|
||||
UpdateUATStats(f.Product_id)
|
||||
}
|
||||
// Get all of the text reports.
|
||||
textReports, _ := uatMsg.GetTextReports()
|
||||
|
@ -1046,8 +1046,8 @@ type status struct {
|
|||
UAT_PIREP_total uint32
|
||||
UAT_NOTAM_total uint32
|
||||
UAT_OTHER_total uint32
|
||||
|
||||
Errors []string
|
||||
|
||||
Errors []string
|
||||
}
|
||||
|
||||
var globalSettings settings
|
||||
|
|
|
@ -71,7 +71,7 @@ const (
|
|||
NETWORK_AHRS_FFSIM = 2
|
||||
NETWORK_AHRS_GDL90 = 4
|
||||
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.
|
||||
|
@ -98,26 +98,26 @@ func getDHCPLeases() (map[string]string, error) {
|
|||
ret[block_ip] = ""
|
||||
}
|
||||
}
|
||||
|
||||
// Added the ability to have static IP hosts stored in /etc/stratux-static-hosts.conf
|
||||
|
||||
dat2, err := ioutil.ReadFile(extra_hosts_file)
|
||||
if err != nil {
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
iplines := strings.Split(string(dat2), "\n")
|
||||
|
||||
// Added the ability to have static IP hosts stored in /etc/stratux-static-hosts.conf
|
||||
|
||||
dat2, err := ioutil.ReadFile(extra_hosts_file)
|
||||
if err != nil {
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
iplines := strings.Split(string(dat2), "\n")
|
||||
block_ip2 := ""
|
||||
for _, ipline := range iplines {
|
||||
spacedip := strings.Split(ipline, " ")
|
||||
if len(spacedip) == 2 {
|
||||
// The ip is in block_ip2
|
||||
block_ip2 = spacedip[0]
|
||||
// the hostname is here
|
||||
ret[block_ip2] = spacedip[1]
|
||||
}
|
||||
if len(spacedip) == 2 {
|
||||
// The ip is in block_ip2
|
||||
block_ip2 = spacedip[0]
|
||||
// the hostname is here
|
||||
ret[block_ip2] = spacedip[1]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue