profile

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package profile describes supported radios and interfaces as data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Problems

func Problems(userDir string) []error

Problems describes the files in userDir that All left out, one error per file.

Types

type Profile

type Profile struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Rig  struct {
		Model      int    `json:"model"`       // hamlib model number
		Baud       int    `json:"baud"`        // CAT baud; 0 for none (dummy rig)
		DeviceGlob string `json:"device_glob"` // glob for the CAT serial device; "" for none
	} `json:"rig"`
	Packet struct {
		// How the radio is keyed for packet: "rig" (through rigctld, needs CAT), "rts" or "dtr" (a serial
		// modem-control line, as on a Digirig), "cm108" (a GPIO pin on a USB sound chip) or "none" (VOX).
		PTT string `json:"ptt"`
	} `json:"packet"`
	USBIDs []string `json:"usb_ids"` // vendor:product of the radio's USB serial chip, used to recognise it
	Audio  struct {
		CardHints []string `json:"card_hints"` // ALSA card ids to look for, in order
		Null      bool     `json:"null"`       // no sound card (testing)
	} `json:"audio"`
	Notes string `json:"notes"`
}

Profile is one radio/interface combination.

func All

func All(userDir string) ([]Profile, error)

All returns the built-in profiles plus those in userDir (a user file wins on an id clash). A user file that cannot be read or is not a valid profile is left out rather than failing everything: every service start reads the profiles, so one broken file must not stop radios that have nothing to do with it. Problems reports such files.

func Detect

func Detect(profiles []Profile, glob func(string) ([]string, error)) []Profile

Detect returns the profiles whose CAT device is present right now. glob is filepath.Glob in normal use. Profiles without a device pattern (the dummy radio) never match.

func Find

func Find(userDir, id string) (Profile, error)

Find returns the profile with the given id.

func Guess

func Guess(profiles []Profile, vid, pid string) []Profile

Guess returns the profiles whose usb_ids include vid:pid. Many radios share one serial chip, so more than one profile can match; the caller should offer them rather than choose.

func (Profile) HasCAT

func (p Profile) HasCAT() bool

HasCAT reports whether the radio can be controlled over CAT (it has a hamlib model). An interface that only keys the radio and carries audio, such as a Digirig, has no CAT.

func (Profile) PacketPTT

func (p Profile) PacketPTT() string

PacketPTT is how the radio is keyed for packet, defaulting to rigctld for a radio with CAT and to VOX (no keying line) for one without.

Jump to

Keyboard shortcuts

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