update
This commit is contained in:
27
flexradio.go
27
flexradio.go
@ -142,11 +142,14 @@ func (fc *FlexClient) SendSpottoFlex(spot TelnetSpot) {
|
||||
Worked: spot.CallsignWorked,
|
||||
}
|
||||
|
||||
flexSpot.Comment = flexSpot.Comment + " [" + flexSpot.Mode + "] [" + flexSpot.SpotterCallsign + "]"
|
||||
|
||||
// If new DXCC
|
||||
if spot.NewDXCC {
|
||||
flexSpot.Color = "#3bf908"
|
||||
flexSpot.Priority = "1"
|
||||
flexSpot.BackgroundColor = "#000000"
|
||||
flexSpot.Comment = flexSpot.Comment + " [ New DXCC ]"
|
||||
} else if spot.DX == Cfg.SQLite.Callsign {
|
||||
flexSpot.Color = "#ff0000"
|
||||
flexSpot.Priority = "1"
|
||||
@ -155,25 +158,28 @@ func (fc *FlexClient) SendSpottoFlex(spot TelnetSpot) {
|
||||
flexSpot.Color = "#000000"
|
||||
flexSpot.BackgroundColor = "#00c0c0"
|
||||
flexSpot.Priority = "5"
|
||||
flexSpot.Comment = flexSpot.Comment + " [ Worked ]"
|
||||
} else if spot.NewMode && spot.NewBand {
|
||||
flexSpot.Color = "#c603fc"
|
||||
flexSpot.Priority = "1"
|
||||
flexSpot.BackgroundColor = "#000000"
|
||||
flexSpot.Comment = flexSpot.Comment + " [ New Band & Mode ]"
|
||||
} else if spot.NewMode && !spot.NewBand {
|
||||
flexSpot.Color = "#f9a908"
|
||||
flexSpot.Priority = "2"
|
||||
flexSpot.BackgroundColor = "#000000"
|
||||
flexSpot.Comment = flexSpot.Comment + " [ New Mode ]"
|
||||
} else if spot.NewBand && !spot.NewMode {
|
||||
flexSpot.Color = "#f9f508"
|
||||
flexSpot.Priority = "3"
|
||||
flexSpot.BackgroundColor = "#000000"
|
||||
flexSpot.Comment = flexSpot.Comment + " [ New Band ]"
|
||||
} else if !spot.NewBand && !spot.NewMode && !spot.NewDXCC && !spot.CallsignWorked {
|
||||
flexSpot.Color = "#eaeaea"
|
||||
flexSpot.Priority = "5"
|
||||
flexSpot.BackgroundColor = "#000000"
|
||||
}
|
||||
|
||||
flexSpot.Comment = flexSpot.Comment + " [" + flexSpot.Mode + "] [" + flexSpot.SpotterCallsign + "]"
|
||||
flexSpot.Comment = strings.ReplaceAll(flexSpot.Comment, " ", "\u00A0")
|
||||
|
||||
srcFlexSpot, err := fc.Repo.FindDXSameBand(flexSpot)
|
||||
@ -204,10 +210,10 @@ func (fc *FlexClient) SendSpottoFlex(spot TelnetSpot) {
|
||||
stringSpot = fmt.Sprintf("C%v|spot add rx_freq=%v callsign=%s mode=%s source=%s spotter_callsign=%s timestamp=%v lifetime_seconds=%s comment=%s color=%s background_color=%s priority=%s", flexSpot.CommandNumber, flexSpot.FrequencyMhz,
|
||||
flexSpot.DX, flexSpot.Mode, flexSpot.Source, flexSpot.SpotterCallsign, flexSpot.TimeStamp, flexSpot.LifeTime, flexSpot.Comment, flexSpot.Color, flexSpot.BackgroundColor, flexSpot.Priority)
|
||||
CommandNumber++
|
||||
|
||||
}
|
||||
|
||||
fc.SendSpot(stringSpot)
|
||||
Log.Debugf("Sending spot to FlexRadio: %s", stringSpot)
|
||||
}
|
||||
|
||||
func (fc *FlexClient) SendSpot(stringSpot string) {
|
||||
@ -223,6 +229,8 @@ func (fc *FlexClient) ReadLine() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
Log.Debugf("Received message from FlexRadio: %s", strings.Trim(message, "\n"))
|
||||
|
||||
regRespSpot := *regexp.MustCompile(`R(\d+)\|0\|(\d+)\n`)
|
||||
respSpot := regRespSpot.FindStringSubmatch(message)
|
||||
|
||||
@ -271,18 +279,3 @@ func (fc *FlexClient) Write(data string) (n int, err error) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (fc *FlexClient) parseMessage(message string) {
|
||||
msgType := string(message[0])
|
||||
|
||||
switch msgType {
|
||||
case "R":
|
||||
// reply
|
||||
case "S":
|
||||
// status
|
||||
case "V":
|
||||
// Version
|
||||
case "M":
|
||||
// Message
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user