appcore

package
v0.0.0-...-4d64c08 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

This is the core of a number of applications. It contains functionality to read from an input file (typically either a text file or a serial line connected to a device which is sending NTRIP messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppCore

type AppCore struct {
	Config   *jsonconfig.Config
	Channels []chan rtcm.Message
}

func New

func New(conf *jsonconfig.Config, channels []chan rtcm.Message) *AppCore

func (*AppCore) HandleMessages

func (appCore *AppCore) HandleMessages(startTime time.Time)

HandleMessages repeatedly searches for and reads the input file(s) specified in the config, converts the data to RTCM messages and sends them to the message channel. If input is provided indefinitely, it will run until the calling application is shut down.

It's assumed that the input files are the device names of a device that is sending data on a serial connection and will do so indefinitely. If the device is connecting on a serial USB connection and connectivity is lost and then restored, the device name this time will be different from the one use last time. The config should specify all the possible device file names. If the device is connected using an RS/232 serial line then the config just needs to specify one name, the name of that device.

func (*AppCore) HandleMessagesUntilEOF

func (appCore *AppCore) HandleMessagesUntilEOF(startTime time.Time, reader *bufio.Reader) int

HandleMessagesUntilEOF takes the given reader, creates a file handler and runs it.

Whenever it receives a message from the handler, it sends a copy to each of the AppCore's channels. It's assumed that something is listening to each channel and doing something with the messages, for example writing them to a log file.

In production the value returned is always 0 (continue). In test the returned value may be 1 (stop). If a caller that would normally run indefinitely receives a stop return, it should stop. This is to allow unit testing of processes that would normally never terminate.

Jump to

Keyboard shortcuts

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