server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeStat

type NodeStat struct {
	Received  int `json:"received"`
	Collision int `json:"collision"`
	Sending   int `json:"sending"`
}

type Server

type Server struct {
	sync.RWMutex

	*echo.Echo
	// contains filtered or unexported fields
}

Server represents the LoRa emu webserver that hosts the frontend and REST API.

func New

func New(emulator *emu.Emulator) *Server

New creates a new Server instance that is bound to an emulator instance.

func (*Server) ConnectedNodes

func (s *Server) ConnectedNodes() int

func (*Server) SetBackgroundImage

func (s *Server) SetBackgroundImage(image image.Image)

SetBackgroundImage sets a background image that should be displayed in the emu.

func (*Server) SetDebug

func (s *Server) SetDebug(state bool)

SetDebug sets the debug state of the server. If debug is enabled the server expects the vite dev server of the frontend to be running.

func (*Server) SetLogger

func (s *Server) SetLogger(logger logr.Logger)

SetLogger sets the logger of the server. If no logger is present no logs will be printed.

func (*Server) SetMobility

func (s *Server) SetMobility(mobility *emu.Mobility)

SetMobility sets a target mobility instance. This will enable the server to pause and resume the mobility.

func (*Server) SetOrigin

func (s *Server) SetOrigin(x float64, y float64)

func (*Server) Start

func (s *Server) Start(bind string) error

Start the LoRa emu server that hosts the frontend of the emulator.

func (*Server) Stop

func (s *Server) Stop() error

Stop the server.

Jump to

Keyboard shortcuts

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