From 2815ea6ea02970ad60a86f4b10d3dd924c784906 Mon Sep 17 00:00:00 2001 From: Greg Date: Thu, 21 Aug 2025 18:02:49 +0200 Subject: [PATCH] update working --- flexradio.go | 13 ++++++++----- utils.go | 12 ++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/flexradio.go b/flexradio.go index 6ff1021..e523841 100644 --- a/flexradio.go +++ b/flexradio.go @@ -286,11 +286,14 @@ func (fc *FlexClient) ReadLine() { Log.Errorf("could not find spot by flex spot number in database: %s", err) } - msg := fmt.Sprintf(`To ALL de %s <%s> : Clicked on "%s" at %s`, Cfg.General.Callsign, spot.UTCTime, spot.DX, spot.FrequencyHz) - if len(fc.TCPServer.Clients) > 0 { - fc.MsgChan <- msg - Log.Infof("%s clicked on spot \"%s\" at %s", Cfg.General.Callsign, spot.DX, spot.FrequencyMhz) - } + // Sending the callsign to Log4OM + SendUDPMessage("" + spot.DX) + + // msg := fmt.Sprintf(`To ALL de %s <%s> : Clicked on "%s" at %s`, Cfg.General.Callsign, spot.UTCTime, spot.DX, spot.FrequencyHz) + // if len(fc.TCPServer.Clients) > 0 { + // fc.MsgChan <- msg + // Log.Infof("%s clicked on spot \"%s\" at %s", Cfg.General.Callsign, spot.DX, spot.FrequencyMhz) + // } } // Status when a spot is deleted diff --git a/utils.go b/utils.go index d3a771f..f0268ec 100644 --- a/utils.go +++ b/utils.go @@ -1,7 +1,9 @@ package main import ( + "fmt" "log" + "net" "os" "os/signal" "strconv" @@ -56,3 +58,13 @@ func CheckSignal(TCPClient *TCPClient, TCPServer *TCPServer, FlexClient *FlexCli os.Exit(0) } } + +func SendUDPMessage(message string) { + conn, err := net.Dial("udp", "127.0.0.1:2241") + if err != nil { + fmt.Printf("Some error %v", err) + return + } + conn.Write([]byte(message)) + conn.Close() +}