config

package
v0.0.0-...-1ca3a53 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DebugFlag  bool
	TmpDir     string
	FreqOffset uint32
)

global debug flag and path to tmp dir and OSD freq offset

Functions

func CheckAdapters

func CheckAdapters(maxAdapters int) []int

CheckAdapters checks for the availability of DVB adapters and delete all adapter and service files If programmed happened to crash in a previous instance.

func CheckDependencies

func CheckDependencies() error

CheckDependencies checks if tsduck is installed. We need TSduck cmd line to run.

func KillRunningTSPProcesses

func KillRunningTSPProcesses() error

KillRunningTSPProcesses checks for and kills any running tsp processes

func SetupTempDir

func SetupTempDir()

func ValidateConfig

func ValidateConfig(config *Config) error

ValidateConfig validates the configuration using go-playground/validator

Types

type Config

type Config struct {
	Network     NetworkConfig `yaml:"network" validate:"required"`
	Dvbt_offset DvbtOffset    `yaml:"dvbt_offset" validate:"required"`
	DVB         []DVBConfig   `yaml:"dvb" validate:"required,dive"`
}

Config represents the configuration for the network and DVB-T and DVB-S

func ReadConfig

func ReadConfig(filename string) (*Config, error)

ReadConfig reads the configuration from a YAML file

type DVBConfig

type DVBConfig struct {
	Type       string `yaml:"type" validate:"required,oneof= 'AUTO-T' 'DVB-T' 'DVB-T2' 'DVB-S' 'DVB-S2' 'DVB-S-Turbo' 'AUTO-S' 'ATSC'"`
	Frequency  uint32 `yaml:"frequency" validate:"required,min=0"`
	Bandwidth  uint8  `yaml:"bandwidth,omitempty" validate:"min=0,max=8"`
	SymbolRate uint32 `yaml:"symbol_rate,omitempty" validate:"min=0"`
	IP         string `yaml:"ip" validate:"required,ip"`
	Port       int    `yaml:"port" validate:"required,min=1024,max=65535"`
}

DVBConfig represents the configuration for a single DVB type

type DvbtOffset

type DvbtOffset struct {
	FreqOffset uint32 `yaml:"freq_offset" validate:"required,min=600000000,max=700000000"`
}

type NetworkConfig

type NetworkConfig struct {
	StatsIP     string `yaml:"stats_ip" validate:"required,ip"`
	Port        int    `yaml:"port" validate:"required,min=1024,max=65535"`
	InterfaceIP string `yaml:"interface_ip" validate:"omitempty,ip"`
	WebIP       string `yaml:"web_ip" validate:"required,ip"`
}

NetworkConfig represents the network configuration

Jump to

Keyboard shortcuts

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