godxmap

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2024 License: MIT Imports: 6 Imported by: 2

README

goDXMap

This is a simple Go library to integrate with F5UUI's HamDXMap. It opens a websocket and allows to display different things on the map, using the wtSock protocol.

Example

// see also ./example/main.go
func main() {
	server := godxmap.NewServer(":12345")

	go serveCallsigns(server)

	err := server.Serve()
	if err != nil && err != http.ErrServerClosed {
		log.Fatal(err)
	}
}

func serveCallsigns(server *godxmap.Server) {
	callsigns := []string{"F5UII", "W1AW", "PY1PY", "DL3NEY", "ZL2CTM"}
	for _, callsign := range callsigns {
		time.Sleep(10 * time.Second)
		server.ShowPartialCall(callsign)
	}
	err := server.Close()
	if err != nil {
		log.Printf("error closing the server: %v", err)
	}
}

License

This library is published under the MIT License.

Copyright Florian Thienel

Documentation

Overview

The package godxmap provides a simple way to integrate F5UII's HamDXMap into Go programs. This allows to show callsigns, dx spots or gab chat messages (a Win-Test peculiarity) on the map.

For more information about the used protocol, please refer to the [wtSock API reference]

[wtSock API reference] : https://dxmap.f5uii.net/help/index.html.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server opens a websocket and allows to send wtSock frames to all connected websocket clients.

func NewServer

func NewServer(addr string) *Server

NewServer creates a new server instance for the given listening address. To actually start the server instance, use the Serve method.

func (*Server) Close

func (s *Server) Close() error

Close the active connections, all active net.Listeners, and stop the server.

Close returns any error returned from closing the Server's underlying Listener(s).

func (*Server) Serve

func (s *Server) Serve() error

Serve starts this server on its dedicated listening address. It accepts incoming websocket connections and will distribute wtSock frames to all connected clients.

Serve always returns a non-nil error. After [Server.Shutdown] or Server.Close, the returned error is [ErrServerClosed].

func (*Server) ShowDXSpot

func (s *Server) ShowDXSpot(spot string, spotter string, frequencyKHz float64, comments string)

ShowDXSpot adds information about a DX spot to the map.

func (*Server) ShowGab

func (s *Server) ShowGab(from string, to string, message string)

ShowGab displays a gab chat message next to the map.

func (*Server) ShowLoggedCall

func (s *Server) ShowLoggedCall(call string, frequencyKHz float64)

ShowLoggedCall adds information about a logged callsign to the map.

func (*Server) ShowPartialCall

func (s *Server) ShowPartialCall(call string)

ShowPartialCall shows the position of a (partially) entered callsign on the map.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL