From 8929116f00cc5a31a8f455bbd78af88238e7ab17 Mon Sep 17 00:00:00 2001 From: Christopher Young Date: Sat, 1 Oct 2016 11:48:27 -0400 Subject: [PATCH] Formatting. --- main/gen_gdl90.go | 74 +++++++++++++++++++++++------------------------ main/network.go | 34 +++++++++++----------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index 8cbe25e5..e1724e97 100755 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -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 diff --git a/main/network.go b/main/network.go index 8f7727d5..9a11f651 100755 --- a/main/network.go +++ b/main/network.go @@ -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 }