types

package module
v0.0.76 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 2 Imported by: 4

README

Station Manager: types package

This package contains the Go types used across the various modules and applications which comprise the Station Manager application suite.

It is a core module that defines the data structures and types that are shared and, by design, **does not/cannot depend on any other Station Manager package; only Go system modules (e.g. "time") are allowed. It is essential that this module HAS NO DEPENDENCIES from Station Manager to ensure that it can be used in anywhere without causing cyclic dependency errors.

Candidates for inclusion in this module are:

  1. Go data structures and types that are shared across modules/packages
  2. Constants that are used across modules/packages
  3. Interfaces that are implemented by multiple modules/packages

Documentation

Index

Constants

View Source
const (
	PostgresDriverName = "postgres"
	SqliteDriverName   = "sqlite"
)
View Source
const (
	ConfigServiceName        = "configservice"
	DatabaseServiceName      = "databaseservice"
	SqliteServiceName        = "sqliteservice"
	LoggingServiceName       = "loggingservice"
	CatServiceName           = "catservice"
	HamNutLookupServiceName  = "hamnutlookupservice"
	QrzLookupServiceName     = "qrzlookupservice"
	QrzForwardingServiceName = "qrzforwardingservice"
	EmailServiceName         = "emailservice"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ADIFBand

type ADIFBand string

type ADIFDate

type ADIFDate struct {
	time.Time
}

type ADIFFreq

type ADIFFreq float64

type ADIFTime

type ADIFTime struct {
	time.Time
}

type ApiKey added in v0.0.18

type ApiKey struct {
	ID        int64  `json:"id"`
	LogbookID int64  `json:"logbook_id"`
	KeyName   string `json:"key_name"`
	KeyHash   string `json:"key_hash"`
	KeyPrefix string `json:"key_prefix"`
}

type AppConfig

type AppConfig struct {
	DatastoreConfig      DatastoreConfig   `json:"datastore_config"`
	LoggingConfig        LoggingConfig     `json:"logging_config"`
	RequiredConfigs      RequiredConfigs   `json:"required_configs"`
	ServerConfig         *ServerConfig     `json:"server_config,omitempty"`
	RigConfigs           []RigConfig       `json:"rig_configs,omitempty"`
	LookupServiceConfigs []LookupConfig    `json:"lookup_service_configs,omitempty"`
	ForwardingConfigs    []ForwarderConfig `json:"forwarding_configs,omitempty"`
	EmailConfigs         EmailConfig       `json:"email_configs,omitempty"`
	LoggingStation       LoggingStation    `json:"logging_station"`
}

type CatCommand added in v0.0.21

type CatCommand struct {
	Name string
	Cmd  string
}

type CatConfig added in v0.0.21

type CatConfig struct {
	Enabled bool
	// ListenerRateLimiterIntervalMS controls how frequently the CAT listener will
	// poll the serial port for new data. The unit is milliseconds.
	//
	// Default is 10ms.
	ListenerRateLimiterIntervalMS time.Duration
	// ListenerReadTimeoutMS controls how long each CAT listener cycle will wait for
	// a framed response line from the serial client. This should typically be less
	// than or equal to ListenerRateLimiterInterval so that each tick's read can
	// complete or time out before the next tick occurs. The unit is milliseconds.
	//
	// If left as zero, callers may choose a sensible default or fall back to the
	// underlying SerialConfig.ReadTimeoutMS.
	//
	// Default is 8ms.
	ListenerReadTimeoutMS time.Duration

	// SendChannelSize is the size of the channel used to send CAT commands to the serial port.
	//
	// Default is 10.
	SendChannelSize int

	// ProcessingChannelSize is the size of the channel used to receive a raw response line from the serial port.
	// It then processes the response line into a CAT status value that can be consumed by the frontend.
	//
	// Default is 10
	ProcessingChannelSize int
}

type CatState added in v0.0.21

type CatState struct {
	Prefix  string // The CAT command prefix.
	Markers []Marker
	Data    string
}

type CatStatus added in v0.0.21

type CatStatus map[string]string

CatStatus is a map of CAT status values keyed by state tag. These are related to CAT commands; a particular command when issued will return a status value linked to that command. The status value is a string that represents the status of the CAT command in a format usable by the frontend.

See the cat.StatusChannel in the cat/service.go file for more details.

type ContactHistory added in v0.0.41

type ContactHistory struct {
	ID      int64  `json:"id"`
	Band    string `json:"band"`
	Freq    string `json:"freq" boil:"freq"`
	Mode    string `json:"mode"`
	QsoDate string `json:"qso_date" boil:"qso_date"`
	TimeOn  string `json:"time_on"`
	Name    string `json:"name"`
	Country string `json:"country"`
	Call    string `json:"call"`
	RstSent string `json:"rst_sent"`
	RstRcvd string `json:"rst_rcvd"`
	Notes   string `json:"notes"`
}

type ContactedStation added in v0.0.6

type ContactedStation struct {
	// ID is the primary key of the ContactedStation table. This is only used when updating the contacted station details.
	// Notice the JSON tag for this struct is "csid" so that it does not clash with the "id" field of the QSO struct.
	// See the models.ts file for more details.
	CSID         int64  `json:"csid"`
	Address      string `json:"address"`
	Age          string `json:"age"`
	Altitude     string `json:"altitude"`
	Call         string `json:"call,omitempty"`
	Cont         string `json:"cont"` // the contacted station's Continent
	ContactedOp  string `json:"contacted_op"`
	Country      string `json:"country,omitempty"`
	CQZ          string `json:"cqz"`
	DXCC         string `json:"dxcc"`
	Email        string `json:"email"`
	EqCall       string `json:"eq_call"` // the contacted station's owner's callsign (if different from call)
	Gridsquare   string `json:"gridsquare"`
	Iota         string `json:"iota"`
	IotaIslandId string `json:"iota_island_id"`
	ITUZ         string `json:"ituz"`
	Lat          string `json:"lat"`
	Lon          string `json:"lon"`
	Name         string `json:"name"`
	QTH          string `json:"qth"`
	// These belong to a QSO, not necessarily a ContactedStation
	//Rig          string `json:"rig"`
	Sig     string `json:"sig"`      // the name of the contacted station's special activity or interest group
	SigInfo string `json:"sig_info"` // information associated with the contacted station's activity or interest group
	Web     string `json:"web"`
	WwffRef string `json:"wwff_ref"`
}

ContactedStation represents details of the station contacted during a QSO and is compatible with the ADI format. Some fields are marked as 'omitempty'. This is for the importer tool, which marshalls the additional data using json.Marshal. Fields that are not set will be omitted from the JSON output, and this will not trigger the duplicate check at the database level.

type ContactedStationAdditionalData added in v0.0.74

type ContactedStationAdditionalData struct {
	Address      string `json:"address,omitempty"`
	Age          string `json:"age,omitempty"`
	Altitude     string `json:"altitude,omitempty"`
	Cont         string `json:"cont,omitempty"`
	ContactedOp  string `json:"contacted_op,omitempty"`
	CQZ          string `json:"cqz,omitempty"`
	DXCC         string `json:"dxcc,omitempty"`
	Email        string `json:"email,omitempty"`
	EqCall       string `json:"eq_call,omitempty"`
	Gridsquare   string `json:"gridsquare,omitempty"`
	Iota         string `json:"iota,omitempty"`
	IotaIslandId string `json:"iota_island_id,omitempty"`
	ITUZ         string `json:"ituz,omitempty"`
	Lat          string `json:"lat,omitempty"`
	Lon          string `json:"lon,omitempty"`
	QTH          string `json:"qth,omitempty"`
	Rig          string `json:"rig,omitempty"`
	Sig          string `json:"sig,omitempty"`
	SigInfo      string `json:"sig_info,omitempty"`
	Web          string `json:"web,omitempty"`
	WwffRef      string `json:"wwff_ref,omitempty"`
}

ContactedStationAdditionalData represents the fields stored in the additional_data JSON column of the contacted_station table. These are fields not stored in dedicated columns (id, name, call, country).

type Country added in v0.0.6

type Country struct {
	ID                int64
	Name              string `json:"name" hamnut:"countryName"`
	Prefix            string `json:"prefix" hamnut:"prefix"`
	Ccode             string `json:"ccode" hamnut:"countryCode"`
	Continent         string `json:"continent" hamnut:"continent"`
	CQZone            string `json:"cq_zone" hamnut:"cqZone"`
	ITUZone           string `json:"itu_zone" hamnut:"ituZone"`
	DXCCPrefix        string `json:"dxcc_prefix" hamnut:"primaryDXCCPrefix"`
	TimeOffset        string `json:"time_offset" hamnut:"timeOffset"`
	ShortPathDistance string `json:"short_path_distance"`
	LongPathDistance  string `json:"long_path_distance"`
	ShortPathBearing  string `json:"short_path_bearing"`
	LongPathBearing   string `json:"long_path_bearing"`
	IsNewEntity       bool   `json:"is_new_entity"` // Indicates if this QSO is with a new country for the logging station
	LocalTime         string `json:"local_time"`
}

type DatastoreConfig

type DatastoreConfig struct {
	Driver                    string            `json:"driver" validate:"oneof=postgres sqlite"`
	Path                      string            `json:"path" validate:"required_if=Driver sqlite,omitempty"`    // Used for sqlite only
	Options                   map[string]string `json:"options" validate:"required_if=Driver sqlite,omitempty"` // Used for sqlite only
	Host                      string            `json:"host,omitempty" validate:"required_if=Driver postgres,omitempty,hostname|ip"`
	Port                      int               `json:"port,omitempty" validate:"required_if=Driver postgres,omitempty,min=1,max=65535"`
	User                      string            `json:"user,omitempty" validate:"required_if=Driver postgres,omitempty,min=1,max=63,alphanum|contains=_|contains=-"`
	Password                  string            `json:"pass,omitempty" validate:"required_if=Driver postgres,omitempty,min=1"`
	Database                  string            `json:"database,omitempty" validate:"required_if=Driver postgres,omitempty,min=1,max=63,alphanum|contains=_|contains=-"`
	SSLMode                   string            `json:"ssl_mode,omitempty" validate:"required_if=Driver postgres,omitempty,oneof=disable require verify-ca verify-full"`
	MaxOpenConns              int               `json:"max_open_conns" validate:"min=1"` // For Postgres, minimum is 5 (enforced in database validation)
	MaxIdleConns              int               `json:"max_idle_conns" validate:"min=1"`
	ConnMaxLifetime           int               `json:"conn_max_lifetime" validate:"min=0"`           // Number of minutes
	ConnMaxIdleTime           int               `json:"conn_max_idle_time" validate:"min=0"`          // Number of minutes
	ContextTimeout            int               `json:"context_timeout" validate:"min=5"`             // Seconds
	TransactionContextTimeout int               `json:"transaction_context_timeout" validate:"min=5"` // Seconds
	Debug                     bool              // Enable SQLBoiler query logging
	Params                    map[string]string `json:"params,omitempty" validate:"omitempty"`
}

type EmailConfig added in v0.0.55

type EmailConfig struct {
	Name     string `json:"name"`
	Enabled  bool   `json:"enabled"`
	Username string `json:"username"`
	Password string `json:"password"`
	Host     string `json:"host"`
	Port     int    `json:"port"`
	From     string `json:"from" validate:"required,email"`
	To       string `json:"to" validate:"required,email"`
	Subject  string `json:"subject"`
	Body     string `json:"body"`
	// SMTP operational knobs
	SmtpDialTimeoutSec int `json:"smtp_dial_timeout_sec,omitempty"`
	SmtpRetryCount     int `json:"smtp_retry_count,omitempty"`
	SmtpRetryDelaySec  int `json:"smtp_retry_delay_sec,omitempty"`
}

type ForwarderConfig added in v0.0.49

type ForwarderConfig struct {
	Name           string        `json:"name"`
	Enabled        bool          `json:"enabled"`
	URL            string        `json:"url"`
	APIKey         string        `json:"apikey,omitempty"`
	Username       string        `json:"username,omitempty"`
	Password       string        `json:"password,omitempty"`
	UserAgent      string        `json:"useragent"`
	HttpTimeoutSec time.Duration `json:"timeout_sec"`
}

type Logbook added in v0.0.7

type Logbook struct {
	ID          int64  `json:"id"`
	UserID      int64  `json:"user_id,omitempty"` // FK to users.id - only for postgres
	Name        string `json:"name"`              // Unique name (to the user) for the logbook
	Callsign    string `json:"callsign"`          // The callsign associated with the logbook
	APIKey      string `json:"api_key,omitempty"`
	Description string `json:"description,omitempty"`
}

type LogbookList added in v0.0.7

type LogbookList []Logbook

type LoggingConfig added in v0.0.2

type LoggingConfig struct {
	Level                  string `json:"level" validate:"oneof=trace debug info warn error fatal panic"`
	SkipFrameCount         int    `json:"skip_frame_count" validate:"min=0"`
	WithTimestamp          bool   `json:"with_timestamp"`
	ConsoleLogging         bool   `json:"console_logging"`
	FileLogging            bool   `json:"file_logging"`
	RelLogFileDir          string `json:"rel_log_file_dir" validate:"required"`
	LogFileMaxBackups      int    `json:"log_file_max_backups" validate:"min=0"`
	LogFileMaxAgeDays      int    `json:"log_file_max_age_days" validate:"min=0"`
	LogFileMaxSizeMB       int    `json:"log_file_max_size_mb" validate:"omitempty,min=1"`
	ShutdownTimeoutMS      int    `json:"shutdown_timeout_ms" validate:"omitempty,min=10,max=10000"` // Timeout for graceful shutdown (10ms-10s, 0=use default)
	ShutdownTimeoutWarning bool   `json:"shutdown_timeout_warning"`                                  // Log warning if the shutdown timeout is exceeded

	// Optional polish fields
	ConsoleNoColor    bool   `json:"console_no_color"`
	ConsoleTimeFormat string `json:"console_time_format"`
	LogFileCompress   bool   `json:"log_file_compress"`
}

type LoggingStation added in v0.0.6

type LoggingStation struct {
	AntennaAzimuth  string `json:"ant_az"` // the bearing from the logging station to the contacted station
	MyAltitude      string `json:"my_altitude"`
	MyAntenna       string `json:"my_antenna"`
	MyCity          string `json:"my_city"`
	MyCountry       string `json:"my_country"`
	MyCqZone        string `json:"my_cq_zone"`
	MyDXCC          string `json:"my_dxcc"`
	MyGridsquare    string `json:"my_gridsquare"`
	MyIota          string `json:"my_iota"`
	MyIotaIslandID  string `json:"my_iota_island_id"`
	MyITUZone       string `json:"my_itu_zone"`
	MyLat           string `json:"my_lat"`
	MyLon           string `json:"my_lon"`
	MyMorseKeyInfo  string `json:"my_morse_key_info"`
	MyMorseKeyType  string `json:"my_morse_key_type"`
	MyName          string `json:"my_name"`
	MyPostalCode    string `json:"my_postal_code"`
	MyRig           string `json:"my_rig"`
	MySig           string `json:"my_sig"`
	MySigInfo       string `json:"my_sig_info"`
	MyStreet        string `json:"my_street"`
	MyWwffRef       string `json:"my_wwff_ref"`
	Operator        string `json:"operator"` // the logging operator's callsign if STATION_CALLSIGN is absent, OPERATOR shall be treated as both the logging station's callsign and the logging operator's callsign
	OwnerCallsign   string `json:"owner_callsign"`
	StationCallsign string `json:"station_callsign" validate:"required,min=3,max=30"`
}

LoggingStation represents the details of the station logging the QSO, including location, equipment, and operator info. It is compatible with the ADI format.

type LookupConfig added in v0.0.34

type LookupConfig struct {
	Name           string        `json:"name"`
	Enabled        bool          `json:"enabled"`
	URL            string        `json:"url"`
	Username       string        `json:"username,omitempty"`
	Password       string        `json:"password,omitempty"`
	UserAgent      string        `json:"useragent"`
	HttpTimeoutSec time.Duration `json:"timeout_sec"` // Seconds
	ViewUrl        string        `json:"view_url,omitempty"`
}

type Marker added in v0.0.21

type Marker struct {
	Tag           string
	Index         int
	Length        int
	ValueMappings []ValueMapping
}

type PostRequest added in v0.0.17

type PostRequest struct {
	Callsign string `json:"callsign"` // The callsign associated with the user account *NOT THE LOGBOOK CALLSIGN*. The logbook callsign is associated with Key.
	Key      string `json:"key"`      // Logbook's API Key, or if registering, the Bootstrap Key
	// For RegisterLogbookAction, a Logbook must be provided.
	Logbook *Logbook `json:"logbook,omitempty"`
	// For InsertQsoAction, Qso must be provided.
	Qso *Qso `json:"qso,omitempty"`
}

type Qsl added in v0.0.25

type Qsl struct {
	QslMsg       string `json:"qslmsg"`
	QslMsgRcvd   string `json:"qslmsg_rcvd"`
	QslRDate     string `json:"qslrdate"`
	QslSDate     string `json:"qslsdate"`
	QslRcvd      string `json:"qsl_rcvd"`
	QslRcvdVia   string `json:"qsl_rcvd_via"`
	QslRcvdNotes string `json:"qsl_rcvd_notes"`
	QslSent      string `json:"qsl_sent"`
	QslSendVia   string `json:"qsl_sent_via"`
	QslVia       string `json:"qsl_via"`
}

type Qso added in v0.0.6

type Qso struct {
	ID int64 `json:"id"`

	// LogbookID represents the foreign key to the logbook associated with a QSO entry.
	// Every QSO entry MUST have a logbook associated with it.
	LogbookID int64 `json:"logbook_id" validate:"required"`

	// SessionID represents the foreign key to the session associated with a QSO entry.
	// Every QSO entry MUST have a session associated with it.
	SessionID int64 `json:"session_id" validate:"required"`

	SmQsoUploadDate     string `json:"sm_qso_upload_date"`
	SmQsoUploadStatus   string `json:"sm_qso_upload_status"`
	SmFwrdByEmailDate   string `json:"sm_fwrd_by_email_date"`
	SmFwrdByEmailStatus string `json:"sm_fwrd_by_email_status"`

	QrzComUploadDate   string `json:"qrzcom_qso_upload_date"`
	QrzComUploadStatus string `json:"qrzcom_qso_upload_status"`
	/*
		All the below fields are compatible with the ADI format and are populated by the adapter.
		The only exception to this is the [xx]ID/ID fields, which are required by database functions.
	*/
	QsoDetails
	ContactedStation
	LoggingStation
	Qsl

	CountryDetails Country          `json:"country_details" adapter:"ignore"` // More detailed information about the contacted station's country
	ContactHistory []ContactHistory `json:"contact_history" adapter:"ignore"`
}

type QsoAdditionalData added in v0.0.74

type QsoAdditionalData struct {
	// Upload status fields
	SmQsoUploadDate     string `json:"sm_qso_upload_date,omitempty"`
	SmQsoUploadStatus   string `json:"sm_qso_upload_status,omitempty"`
	SmFwrdByEmailDate   string `json:"sm_fwrd_by_email_date,omitempty"`
	SmFwrdByEmailStatus string `json:"sm_fwrd_by_email_status,omitempty"`
	QrzComUploadDate    string `json:"qrzcom_qso_upload_date,omitempty"`
	QrzComUploadStatus  string `json:"qrzcom_qso_upload_status,omitempty"`

	// QsoDetails fields (excluding those in dedicated columns: band, mode, freq, qso_date, time_on, time_off, rst_sent, rst_rcvd)
	AIndex      string `json:"a_index,omitempty"`
	AntPath     string `json:"ant_path,omitempty"`
	BandRx      string `json:"band_rx,omitempty"`
	Comment     string `json:"comment,omitempty"`
	ContestId   string `json:"contest_id,omitempty"`
	Distance    string `json:"distance,omitempty"`
	FreqRx      string `json:"freq_rx,omitempty"`
	Submode     string `json:"submode,omitempty"`
	Notes       string `json:"notes,omitempty"`
	QsoDateOff  string `json:"qso_date_off,omitempty"`
	QsoRandom   string `json:"qso_random,omitempty"`
	QsoComplete string `json:"qso_complete,omitempty"`
	RxPwr       string `json:"rx_pwr,omitempty"`
	SRX         string `json:"srx,omitempty"`
	STX         string `json:"stx,omitempty"`
	TxPwr       string `json:"tx_pwr,omitempty"`
	Rig         string `json:"rig,omitempty"`

	// ContactedStation fields (excluding those in dedicated columns: call, country)
	Address      string `json:"address,omitempty"`
	Age          string `json:"age,omitempty"`
	Altitude     string `json:"altitude,omitempty"`
	Cont         string `json:"cont,omitempty"`
	ContactedOp  string `json:"contacted_op,omitempty"`
	CQZ          string `json:"cqz,omitempty"`
	DXCC         string `json:"dxcc,omitempty"`
	Email        string `json:"email,omitempty"`
	EqCall       string `json:"eq_call,omitempty"`
	Gridsquare   string `json:"gridsquare,omitempty"`
	Iota         string `json:"iota,omitempty"`
	IotaIslandId string `json:"iota_island_id,omitempty"`
	ITUZ         string `json:"ituz,omitempty"`
	Lat          string `json:"lat,omitempty"`
	Lon          string `json:"lon,omitempty"`
	Name         string `json:"name,omitempty"`
	QTH          string `json:"qth,omitempty"`
	Sig          string `json:"sig,omitempty"`
	SigInfo      string `json:"sig_info,omitempty"`
	Web          string `json:"web,omitempty"`
	WwffRef      string `json:"wwff_ref,omitempty"`

	// LoggingStation fields
	AntennaAzimuth  string `json:"ant_az,omitempty"`
	MyAltitude      string `json:"my_altitude,omitempty"`
	MyAntenna       string `json:"my_antenna,omitempty"`
	MyCity          string `json:"my_city,omitempty"`
	MyCountry       string `json:"my_country,omitempty"`
	MyCqZone        string `json:"my_cq_zone,omitempty"`
	MyDXCC          string `json:"my_dxcc,omitempty"`
	MyGridsquare    string `json:"my_gridsquare,omitempty"`
	MyIota          string `json:"my_iota,omitempty"`
	MyIotaIslandID  string `json:"my_iota_island_id,omitempty"`
	MyITUZone       string `json:"my_itu_zone,omitempty"`
	MyLat           string `json:"my_lat,omitempty"`
	MyLon           string `json:"my_lon,omitempty"`
	MyMorseKeyInfo  string `json:"my_morse_key_info,omitempty"`
	MyMorseKeyType  string `json:"my_morse_key_type,omitempty"`
	MyName          string `json:"my_name,omitempty"`
	MyPostalCode    string `json:"my_postal_code,omitempty"`
	MyRig           string `json:"my_rig,omitempty"`
	MySig           string `json:"my_sig,omitempty"`
	MySigInfo       string `json:"my_sig_info,omitempty"`
	MyStreet        string `json:"my_street,omitempty"`
	MyWwffRef       string `json:"my_wwff_ref,omitempty"`
	Operator        string `json:"operator,omitempty"`
	OwnerCallsign   string `json:"owner_callsign,omitempty"`
	StationCallsign string `json:"station_callsign,omitempty"`
}

QsoAdditionalData represents the fields stored in the additional_data JSON column of the QSO table. These are fields that are not stored in dedicated database columns but are part of the full QSO record. All fields use omitempty to minimize storage and avoid triggering duplicate checks at the database level.

type QsoDetails added in v0.0.6

type QsoDetails struct {
	AIndex      string `json:"a_index"`
	AntPath     string `json:"ant_path"` // ADIF, section II.B.1 - currently, we only use S and L
	Band        string `json:"band,omitempty" validate:"band"`
	BandRx      string `json:"band_rx"` //in a split frequency QSO, the logging station's receiving band
	Comment     string `json:"comment"`
	ContestId   string `json:"contest_id"`
	Distance    string `json:"distance"` // km
	Freq        string `json:"freq,omitempty"`
	FreqRx      string `json:"freq_rx"`
	Mode        string `json:"mode,omitempty" validate:"mode"`
	Submode     string `json:"submode"`
	Notes       string `json:"notes"` // information of interest to the logging station's operator
	QsoDate     string `json:"qso_date,omitempty"`
	QsoDateOff  string `json:"qso_date_off"`
	QsoRandom   string `json:"qso_random"`
	QsoComplete string `json:"qso_complete"`
	RstRcvd     string `json:"rst_rcvd,omitempty"`
	RstSent     string `json:"rst_sent,omitempty"`
	RxPwr       string `json:"rx_pwr"` // the contacted station's transmitter power in Watts with a value greater than or equal to 0
	SRX         string `json:"srx"`    // contest QSO received serial number with a value greater than or equal to 0
	STX         string `json:"stx"`    // contest QSO transmitted serial number with a value greater than or equal to 0
	TimeOff     string `json:"time_off,omitempty"`
	TimeOn      string `json:"time_on,omitempty"`
	TxPwr       string `json:"tx_pwr"` // the logging station's power in Watts with a value greater than or equal to 0
	Rig         string `json:"rig"`
}

QsoDetails represents the details of a QSO and is compatible with the ADI format. Some fields are marked as 'omitempty'. This is for the importer tool, which marshalls the additional data using json.Marshal. Fields that are not set will be omitted from the JSON output, and this will not trigger the duplicate check at the database level.

type QsoSlice added in v0.0.25

type QsoSlice []Qso

type QsoUpload added in v0.0.63

type QsoUpload struct {
	ID            int64     `json:"id" boil:"id,bind"`
	ModifiedAt    time.Time `json:"modified_at" boil:"modified_at,bind"`
	QsoID         int64     `json:"qso_id" boil:"qso_id,bind"`
	Service       string    `json:"service" boil:"service,bind"`
	Action        string    `json:"action" boil:"action,bind"`
	Status        string    `json:"status" boil:"status,bind"`
	Attempts      int64     `json:"attempts" boil:"attempts,bind"`
	LastAttemptAt int64     `json:"last_attempt_at" boil:"last_attempt_at,bind"`
	LastError     string    `json:"last_error" boil:"last_error,bind"`
	Qso           Qso
}

type RequestAction added in v0.0.17

type RequestAction string
const (
	// RegisterLogbookAction registers a new logbook with the server.
	RegisterLogbookAction RequestAction = "register_logbook"
	InsertQsoAction                     = "insert_qso"
)

func (RequestAction) String added in v0.0.17

func (s RequestAction) String() string

type RequiredConfigs added in v0.0.4

type RequiredConfigs struct {
	DefaultLogbookID   int64  `json:"default_logbook_id"`
	DefaultRigID       int64  `json:"default_rig_id"`
	DefaultFreq        string `json:"default_freq"`
	DefaultMode        string `json:"default_mode"`
	DefaultIsRandomQso bool   `json:"default_is_random_qso"`
	PowerMultiplier    int    `json:"power_multiplier"`
	DefaultTxPower     int    `json:"default_tx_power"`
	UsePowerMultiplier bool   `json:"use_power_multiplier"`
	// The default TO email address.
	DefaultFwdEmail string `json:"default_fwd_email"`

	// QsoForwardingIntervalSeconds determines the interval at which QSO forwarding occurs, defined as a duration in
	// seconds. The forwarding process checks for queued QSOs at the interval defined by this setting.
	QsoForwardingPollIntervalSeconds time.Duration `json:"qso_forwarding_poll_interval_seconds"`
	QsoForwardingWorkerCount         int           `json:"qso_forwarding_worker_count"`

	// QsoForwardingQueueSize defines the maximum number of QSOs that can be stored in the forwarding queue awaiting processing.
	QsoForwardingQueueSize int `json:"qso_forwarding_queue_size"`

	// The maximum number of QSOs to retrieve from the database for forwarding.
	// This the SQL select LIMIT clause.
	QsoForwardingRowLimit int `json:"qso_forwarding_row_limit"`
	// This is related to forwarding. Writes to the SQLite database are serialized to prevent concurrent write conflicts.
	// and busy signal.
	DatabaseWriteQueueSize int `json:"database_write_queue_size"`

	PagingationPageSize int `json:"pagingation_page_size"`
}

type RigConfig added in v0.0.21

type RigConfig struct {
	ID           int64        `koanf:"id"`
	Name         string       `koanf:"name"`
	Model        string       `koanf:"model"`
	Terminator   string       `koanf:"terminator"` // Terminator defines the character used to signal the end of a command.
	CatCommands  []CatCommand `koanf:"commands"`
	CatStates    []CatState   `koanf:"states"`
	SerialConfig SerialConfig `koanf:"serial_port"`
	CatConfig    CatConfig    `koanf:"cat"`
}

type SerialConfig added in v0.0.21

type SerialConfig struct {
	PortName string
	BaudRate int
	DataBits int
	Parity   serial.Parity
	StopBits serial.StopBits

	// The serial drivers' read timeout. The unit is milliseconds.
	//
	// Default is 200ms.
	ReadTimeoutMS  time.Duration
	WriteTimeoutMS time.Duration // Milliseconds
	RTS            bool
	DTR            bool
	LineDelimiter  byte // If not provided, the default is '\r'.
}

type ServerConfig added in v0.0.19

type ServerConfig struct {
	Name         string `json:"name"` // AppName for goFiber
	Host         string `json:"host" validate:"required,hostname"`
	Port         int    `json:"port" validate:"required,min=3000,max=65535"`
	TLSEnabled   bool   `json:"tls_enabled"`
	TLSCertFile  string `json:"tls_cert_file" validate:"required_if=TLSEnabled true"`
	TLSKeyFile   string `json:"tls_key_file" validate:"required_if=TLSEnabled true"`
	ReadTimeout  int    `json:"read_timeout" validate:"required"`  // Seconds
	WriteTimeout int    `json:"write_timeout" validate:"required"` // Seconds
	IdleTimeout  int    `json:"idle_timeout" validate:"required"`  // Seconds
	BodyLimit    int    `json:"body_limit" validate:"required"`
}

type StateValues added in v0.0.21

type StateValues map[string]map[string]string

StateValues is a map of state values keyed by state tag. These are related to CAT commands; a particular command when issued will return a state value linked to that command. The state value is a string that represents the state of the CAT command in user-readable format.

See the cat.StateValues() method in the cat/service.go file for more details.

type UiConfig added in v0.0.26

type UiConfig struct {
	DefaultRigID int64   `json:"default_rig_id"`
	Logbook      Logbook `json:"logbook"`
	RigName      string  `json:"rig_name"`
	// DefaultFreq is in khz. This is used when the CAT system is unavailable.
	DefaultFreq string `json:"default_freq"`
	// DefaultMode is the CAT mode when the CAT system is unavailable.
	DefaultMode        string `json:"default_mode"`
	OwnersCallsign     string `json:"owners_callsign"`
	DefaultIsRandomQso bool   `json:"default_is_random_qso"`
	UsePowerMultiplier bool   `json:"use_power_multiplier"`
	PowerMultiplier    int    `json:"power_multiplier"`
	DefaultTxPower     int    `json:"default_tx_power"`
	DefaultFwdEmail    string `json:"default_fwd_email"`
	OwnerCallsign      string `json:"owner_callsign"`

	PaginationPageSize int `json:"pagination_page_size"`
}

type User added in v0.0.13

type User struct {
	ID             int64  `json:"id"`
	Callsign       string `json:"callsign" validate:"min=3,max=30,alphanum"`
	PassHash       string `json:"pass_hash" validate:"required"`
	Issuer         string `json:"issuer,omitempty"`
	Subject        string `json:"subject,omitempty"`
	Email          string `json:"email,required"`
	EmailConfirmed bool   `json:"email_confirmed"`
}

type ValueMapping added in v0.0.21

type ValueMapping struct {
	Key   string
	Value string
}

Jump to

Keyboard shortcuts

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