Compare commits
3 Commits
fd29ec745e
...
desktopApp
Author | SHA1 | Date | |
---|---|---|---|
744fdcd0d9 | |||
1b8c97f5e7 | |||
eaa0c62892 |
9
app.go
9
app.go
@ -38,11 +38,12 @@ func NewApp() *Application {
|
||||
|
||||
Sep := widget.NewSeparator()
|
||||
|
||||
SpotLabelDX := canvas.NewText("t", color.Black)
|
||||
SpotLabelFreqMhz := canvas.NewText("t", color.Black)
|
||||
SpotLabelBand := canvas.NewText("t", color.Black)
|
||||
SpotLabelDX := canvas.NewText("DX: ", color.Black)
|
||||
SpotLabelFreqMhz := canvas.NewText("Freq: ", color.Black)
|
||||
SpotLabelBand := canvas.NewText("Band: ", color.Black)
|
||||
Spot := container.NewHBox(SpotLabelDX, SpotLabelFreqMhz, SpotLabelBand)
|
||||
|
||||
content := container.NewVBox(servicesLabel, Sep, TCPClientAll, FlexRadioAll, Sep, SpotLabelDX, SpotLabelFreqMhz, SpotLabelBand)
|
||||
content := container.NewVBox(servicesLabel, Sep, TCPClientAll, FlexRadioAll, Sep, Spot)
|
||||
w.SetContent(content)
|
||||
|
||||
app := &Application{
|
||||
|
@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
@ -51,13 +50,13 @@ func NewConfig(configPath string) *Config {
|
||||
|
||||
file, err := os.Open(configPath)
|
||||
if err != nil {
|
||||
log.Println("could not open config file")
|
||||
Log.Errorln("could not open config file")
|
||||
}
|
||||
defer file.Close()
|
||||
d := yaml.NewDecoder(file)
|
||||
|
||||
if err := d.Decode(&Cfg); err != nil {
|
||||
log.Println("could not decod config file")
|
||||
Log.Errorln("could not decod config file")
|
||||
}
|
||||
|
||||
return Cfg
|
||||
|
4
main.go
4
main.go
@ -73,8 +73,6 @@ func main() {
|
||||
go TCPClient.StartClient()
|
||||
go TCPServer.StartServer()
|
||||
|
||||
Application.Start()
|
||||
|
||||
// Gracely closing all connextions if signal is received
|
||||
go func() {
|
||||
for sig := range sigCh {
|
||||
@ -97,4 +95,6 @@ func main() {
|
||||
os.Exit(0)
|
||||
}
|
||||
}()
|
||||
|
||||
Application.Start()
|
||||
}
|
||||
|
25
spot.go
25
spot.go
@ -134,60 +134,61 @@ func ProcessTelnetSpot(re *regexp.Regexp, spotRaw string, SpotChanToFlex chan Te
|
||||
}
|
||||
|
||||
func (spot *TelnetSpot) GetBand() {
|
||||
freq := FreqMhztoHz(spot.Frequency)
|
||||
switch true {
|
||||
case strings.HasPrefix(spot.Frequency, "1.8"):
|
||||
case strings.HasPrefix(freq, "1.8"):
|
||||
spot.Band = "160M"
|
||||
if spot.Mode == "SSB" {
|
||||
spot.Mode = "LSB"
|
||||
}
|
||||
case strings.HasPrefix(spot.Frequency, "3"):
|
||||
case strings.HasPrefix(freq, "3."):
|
||||
spot.Band = "80M"
|
||||
if spot.Mode == "SSB" {
|
||||
spot.Mode = "LSB"
|
||||
}
|
||||
case strings.HasPrefix(spot.Frequency, "5."):
|
||||
case strings.HasPrefix(freq, "5."):
|
||||
spot.Band = "60M"
|
||||
if spot.Mode == "SSB" {
|
||||
spot.Mode = "LSB"
|
||||
}
|
||||
case strings.HasPrefix(spot.Frequency, "7"):
|
||||
case strings.HasPrefix(freq, "7."):
|
||||
spot.Band = "40M"
|
||||
if spot.Mode == "SSB" {
|
||||
spot.Mode = "LSB"
|
||||
}
|
||||
case strings.HasPrefix(spot.Frequency, "10"):
|
||||
case strings.HasPrefix(freq, "10."):
|
||||
spot.Band = "30M"
|
||||
case strings.HasPrefix(spot.Frequency, "14"):
|
||||
case strings.HasPrefix(freq, "14."):
|
||||
spot.Band = "20M"
|
||||
if spot.Mode == "SSB" {
|
||||
spot.Mode = "USB"
|
||||
}
|
||||
case strings.HasPrefix(spot.Frequency, "18"):
|
||||
case strings.HasPrefix(freq, "18."):
|
||||
spot.Band = "17M"
|
||||
if spot.Mode == "SSB" {
|
||||
spot.Mode = "USB"
|
||||
}
|
||||
case strings.HasPrefix(spot.Frequency, "21"):
|
||||
case strings.HasPrefix(freq, "21."):
|
||||
spot.Band = "15M"
|
||||
if spot.Mode == "SSB" {
|
||||
spot.Mode = "USB"
|
||||
}
|
||||
case strings.HasPrefix(spot.Frequency, "24"):
|
||||
case strings.HasPrefix(freq, "24."):
|
||||
spot.Band = "12M"
|
||||
if spot.Mode == "SSB" {
|
||||
spot.Mode = "USB"
|
||||
}
|
||||
case strings.HasPrefix(spot.Frequency, "28"):
|
||||
case strings.HasPrefix(freq, "28."):
|
||||
spot.Band = "10M"
|
||||
if spot.Mode == "SSB" {
|
||||
spot.Mode = "USB"
|
||||
}
|
||||
case strings.HasPrefix(spot.Frequency, "29"):
|
||||
case strings.HasPrefix(freq, "29."):
|
||||
spot.Band = "10M"
|
||||
if spot.Mode == "SSB" {
|
||||
spot.Mode = "USB"
|
||||
}
|
||||
case strings.HasPrefix(spot.Frequency, "50"):
|
||||
case strings.HasPrefix(freq, "50."):
|
||||
spot.Band = "6M"
|
||||
if spot.Mode == "SSB" {
|
||||
spot.Mode = "USB"
|
||||
|
Reference in New Issue
Block a user