cfg

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Filename = "hellocontest.json"

Variables

View Source
var Default = Data{
	MyCall:              "DL0ABC",
	MyLocator:           "AA00zz",
	EnterTheirNumber:    true,
	EnterTheirXchange:   true,
	AllowMultiBand:      true,
	AllowMultiMode:      true,
	CabrilloQSOTemplate: "{{.QRG}} {{.Mode}} {{.Date}} {{.Time}} {{.MyCall}} {{.MyReport}} {{.MyNumber}} {{.MyXchange}} {{.TheirCall}} {{.TheirReport}} {{.TheirNumber}} {{.TheirXchange}}",
	HamlibAddress:       "localhost:4532",
	KeyerHost:           "localhost",
	KeyerPort:           6789,
	KeyerWPM:            20,
	KeyerSPMacros: []string{
		"{{.MyCall}}",
		"rr {{.MyReport}} {{.MyNumber}} {{.MyXchange}}",
		"tu gl",
		"nr {{.MyNumber}} {{.MyXchange}} {{.MyNumber}} {{.MyXchange}}",
	},
	KeyerRunMacros: []string{
		"cq {{.MyCall}} test",
		"{{.TheirCall}} {{.MyReport}} {{.MyNumber}} {{.MyXchange}}",
		"tu {{.MyCall}} test",
		"nr {{.MyNumber}} {{.MyXchange}} {{.MyNumber}} {{.MyXchange}}",
	},
	Score: Score{
		CountPerBand:            true,
		SameCountryPoints:       1,
		SameContinentPoints:     3,
		OtherPoints:             5,
		SpecificCountryPoints:   0,
		SpecificCountryPrefixes: []string{},
		Multis:                  []string{"CQ", "DXCC"},
		XchangeMultiPattern:     "",
	},
}

Functions

func AbsoluteFilename added in v0.3.0

func AbsoluteFilename() string

func Directory

func Directory() string

Directory returns the configuration directory. It panics if the directory could not be determined.

Types

type Data

type Data struct {
	MyCall              string   `json:"mycall"`
	MyLocator           string   `json:"locator"`
	EnterTheirNumber    bool     `json:"enter_their_number"`
	EnterTheirXchange   bool     `json:"enter_their_xchange"`
	AllowMultiBand      bool     `json:"allow_multi_band"`
	AllowMultiMode      bool     `json:"allow_multi_mode"`
	CabrilloQSOTemplate string   `json:"cabrillo_qso"`
	KeyerHost           string   `json:"keyer_host"`
	KeyerPort           int      `json:"keyer_port"`
	KeyerWPM            int      `json:"keyer_wpm"`
	KeyerSPMacros       []string `json:"keyer_sp_macros"`
	KeyerRunMacros      []string `json:"keyer_run_macros"`
	HamlibAddress       string   `json:"hamlib_address"`
	Score               Score    `json:"score"`
}

type LoadedConfiguration

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

func Load

func Load() (*LoadedConfiguration, error)

Load loads the configuration from the default location (see github.com/ftl/cfg/LoadJSON()).

func (*LoadedConfiguration) AllowMultiBand

func (c *LoadedConfiguration) AllowMultiBand() bool

func (*LoadedConfiguration) AllowMultiMode

func (c *LoadedConfiguration) AllowMultiMode() bool

func (*LoadedConfiguration) CabrilloQSOTemplate

func (c *LoadedConfiguration) CabrilloQSOTemplate() string

func (*LoadedConfiguration) CountPerBand added in v0.3.0

func (c *LoadedConfiguration) CountPerBand() bool

func (*LoadedConfiguration) EnterTheirNumber

func (c *LoadedConfiguration) EnterTheirNumber() bool

func (*LoadedConfiguration) EnterTheirXchange

func (c *LoadedConfiguration) EnterTheirXchange() bool

func (*LoadedConfiguration) HamlibAddress

func (c *LoadedConfiguration) HamlibAddress() string

func (*LoadedConfiguration) KeyerHost

func (c *LoadedConfiguration) KeyerHost() string

func (*LoadedConfiguration) KeyerPort

func (c *LoadedConfiguration) KeyerPort() int

func (*LoadedConfiguration) KeyerRunMacros

func (c *LoadedConfiguration) KeyerRunMacros() []string

func (*LoadedConfiguration) KeyerSPMacros

func (c *LoadedConfiguration) KeyerSPMacros() []string

func (*LoadedConfiguration) KeyerWPM

func (c *LoadedConfiguration) KeyerWPM() int

func (*LoadedConfiguration) Multis added in v0.3.0

func (c *LoadedConfiguration) Multis() []string

func (*LoadedConfiguration) MyCall

func (*LoadedConfiguration) MyLocator

func (c *LoadedConfiguration) MyLocator() locator.Locator

func (*LoadedConfiguration) OtherPoints added in v0.3.0

func (c *LoadedConfiguration) OtherPoints() int

func (*LoadedConfiguration) SameContinentPoints added in v0.3.0

func (c *LoadedConfiguration) SameContinentPoints() int

func (*LoadedConfiguration) SameCountryPoints added in v0.3.0

func (c *LoadedConfiguration) SameCountryPoints() int

func (*LoadedConfiguration) SpecificCountryPoints added in v0.3.0

func (c *LoadedConfiguration) SpecificCountryPoints() int

func (*LoadedConfiguration) SpecificCountryPrefixes added in v0.3.0

func (c *LoadedConfiguration) SpecificCountryPrefixes() []string

func (*LoadedConfiguration) XchangeMultiPattern added in v0.3.0

func (c *LoadedConfiguration) XchangeMultiPattern() string

type Score added in v0.3.0

type Score struct {
	CountPerBand bool `json:"count_per_band"`

	SameCountryPoints   int `json:"same_country_points"`
	SameContinentPoints int `json:"same_continent_points"`
	OtherPoints         int `json:"other_points"`

	SpecificCountryPoints   int      `json:"specific_country_points"`
	SpecificCountryPrefixes []string `json:"specific_country_prefixes"`

	Multis              []string `json:"multis"`
	XchangeMultiPattern string   `json:"xchange_multi_pattern"`
}

type StaticConfiguration

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

func Static

func Static(myCall callsign.Callsign, myLocator locator.Locator) *StaticConfiguration

Static creates a static configuration instance with the given data.

func (*StaticConfiguration) AllowMultiBand

func (c *StaticConfiguration) AllowMultiBand() bool

func (*StaticConfiguration) AllowMultiMode

func (c *StaticConfiguration) AllowMultiMode() bool

func (*StaticConfiguration) CabrilloQSOTemplate

func (c *StaticConfiguration) CabrilloQSOTemplate() string

func (*StaticConfiguration) CountPerBand added in v0.3.0

func (c *StaticConfiguration) CountPerBand() bool

func (*StaticConfiguration) EnterTheirNumber

func (c *StaticConfiguration) EnterTheirNumber() bool

func (*StaticConfiguration) EnterTheirXchange

func (c *StaticConfiguration) EnterTheirXchange() bool

func (*StaticConfiguration) HamlibAddress

func (c *StaticConfiguration) HamlibAddress() string

func (*StaticConfiguration) KeyerHost

func (c *StaticConfiguration) KeyerHost() string

func (*StaticConfiguration) KeyerPort

func (c *StaticConfiguration) KeyerPort() int

func (*StaticConfiguration) KeyerRunMacros

func (c *StaticConfiguration) KeyerRunMacros() []string

func (*StaticConfiguration) KeyerSPMacros

func (c *StaticConfiguration) KeyerSPMacros() []string

func (*StaticConfiguration) KeyerWPM

func (c *StaticConfiguration) KeyerWPM() int

func (*StaticConfiguration) Multis added in v0.3.0

func (c *StaticConfiguration) Multis() []string

func (*StaticConfiguration) MyCall

func (*StaticConfiguration) MyLocator

func (c *StaticConfiguration) MyLocator() locator.Locator

func (*StaticConfiguration) OtherPoints added in v0.3.0

func (c *StaticConfiguration) OtherPoints() int

func (*StaticConfiguration) SameContinentPoints added in v0.3.0

func (c *StaticConfiguration) SameContinentPoints() int

func (*StaticConfiguration) SameCountryPoints added in v0.3.0

func (c *StaticConfiguration) SameCountryPoints() int

func (*StaticConfiguration) SpecificCountryPoints added in v0.3.0

func (c *StaticConfiguration) SpecificCountryPoints() int

func (*StaticConfiguration) SpecificCountryPrefixes added in v0.3.0

func (c *StaticConfiguration) SpecificCountryPrefixes() []string

func (*StaticConfiguration) XchangeMultiPattern added in v0.3.0

func (c *StaticConfiguration) XchangeMultiPattern() string

Jump to

Keyboard shortcuts

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