server

package
v0.0.0-...-bd873f3 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnTypeUSB     = "usb"
	ConnTypeNetwork = "network"
)
View Source
const (
	DefaultGoProcMultiplier = 5
	DefaultGoProcDelay      = 30 // milliseconds

	LF = 1 << 0
	NL = 1 << 1

	VALID_KEY_CMD_LENGTH = 10
	KEY_PUSH_CMD         = "PUSH"
	KEY_HOLD_CMD         = "HOLD"

	KEY_MENU      SDSKeyType = "M"
	KEY_F         SDSKeyType = "F"
	KEY_1         SDSKeyType = "1"
	KEY_2         SDSKeyType = "2"
	KEY_3         SDSKeyType = "3"
	KEY_4         SDSKeyType = "4"
	KEY_5         SDSKeyType = "5"
	KEY_6         SDSKeyType = "6"
	KEY_7         SDSKeyType = "7"
	KEY_8         SDSKeyType = "8"
	KEY_9         SDSKeyType = "9"
	KEY_0         SDSKeyType = "0"
	KEY_DOT       SDSKeyType = "."
	KEY_ENTER     SDSKeyType = "E"
	KEY_ROT_RIGHT SDSKeyType = ">"
	KEY_ROT_LEFT  SDSKeyType = "<"
	KEY_ROT_PUSH  SDSKeyType = "^"
	KEY_VOL_PUSH  SDSKeyType = "V"
	KEY_SQL_PUSH  SDSKeyType = "Q"
	KEY_REPLAY    SDSKeyType = "Y"
	KEY_SYSTEM    SDSKeyType = "A"
	KEY_DEPT      SDSKeyType = "B"
	KEY_CHANNEL   SDSKeyType = "C"
	KEY_ZIP       SDSKeyType = "Z"
	KEY_SERV      SDSKeyType = "T"
	KEY_RANGE     SDSKeyType = "R"

	KEY_MODE_PRESS   SDSKeyModeType = "P" // Press (One Push)
	KEY_MODE_LONG    SDSKeyModeType = "L" // Long Press (Press and Hold a few seconds)
	KEY_MODE_HOLD    SDSKeyModeType = "H" // Hold (Press and Hold until Release receive)
	KEY_MODE_RELEASE SDSKeyModeType = "R" // Release (Cancel Hold state

	GltXmlUnknown GltXmlType = -1
	GltXmlFL      GltXmlType = iota
	GltXmlSYS
	GltXmlDEPT
	GltXmlSITE
	GltXmlCFREQ
	GltXmlTGID
	GltXmlSFREQ
	GltXmlAFREQ
	GltXmlATGID
	GltXmlFTO
	GltXmlCSBANK
	GltXmlUREC
	GltXmlIREC_FILE
	GltXmlUREC_FOLDER
	GltXmlUREC_FILE
	GltXmlTRN_DISCOV
	GltXmlCNV_DISCOV

	AstModeCurrentActivity ASTModeType = "CURRENT_ACTIVITY"
	AstModeLCNMonitor      ASTModeType = "LCN_MONITOR"
	AstActivityLog         ASTModeType = "ACTIVITY_LOG"
	AstLCNFinder           ASTModeType = "LCN_FINDER"

	AprModePause APRModeType = "PAUSE"
	AprModeRESME APRModeType = "RESUME"
)
View Source
const DateTimeFormat = "2006,1,2,15,4,5"

Variables

View Source
var ErrNoFile = fmt.Errorf("no file name was set, probably waiting for info")
View Source
var (
	// validKeys = loadValidKeys()
	TERMINATE = "quit\r"
)

Functions

func IsPrint

func IsPrint(s string) bool

func IsValidXMLMessage

func IsValidXMLMessage(msgType string, buffer []byte) bool

func ScanLinesWithCR

func ScanLinesWithCR(data []byte, atEOF bool) (advance int, token []byte, err error)

https://stackoverflow.com/a/52395088/486182

Types

type APRModeType

type APRModeType string

type ASTModeType

type ASTModeType string

type AudioFeedFile

type AudioFeedFile struct {
	Name           string
	Size           int64
	ExpectedBlocks int64
	Timestamp      *time.Time
	Data           []byte
	Finished       bool
	Metadata       *wavparse.Recording
}

func NewAudioFeedFile

func NewAudioFeedFile(pieces []string) (*AudioFeedFile, error)

func (*AudioFeedFile) ParseMetadata

func (a *AudioFeedFile) ParseMetadata(file string) error

type Config

type Config struct {
	UDPAddress     *net.UDPAddr
	USBPath        string
	WebSocketPort  int
	RecordingsPath string
}

func (*Config) Serve

func (c *Config) Serve()

type DateTimeInfo

type DateTimeInfo struct {
	DaylightSavings bool
	Time            *time.Time
	RTCOK           bool
}

func NewDateTimeInfo

func NewDateTimeInfo(raw string) *DateTimeInfo

func (*DateTimeInfo) String

func (d *DateTimeInfo) String() string

type GltCSBank

type GltCSBank struct {
	XMLName xml.Name `xml:"GLT"`
	Text    string   `xml:",chardata"`
	CSBANK  []struct {
		Text  string `xml:",chardata"`
		Index string `xml:"Index,attr"`
		Name  string `xml:"Name,attr"`
		Lower string `xml:"Lower,attr"`
		Upper string `xml:"Upper,attr"`
		Mod   string `xml:"Mod,attr"`
		Step  string `xml:"Step,attr"`
	} `xml:"CS_BANK"`
	Footer struct {
		Text string `xml:",chardata"`
		No   string `xml:"No,attr"`
		EOT  string `xml:"EOT,attr"`
	} `xml:"Footer"`
}

type GltCnvDiscovery

type GltCnvDiscovery struct {
	XMLName   xml.Name `xml:"GLT"`
	Text      string   `xml:",chardata"`
	CNVDISCOV []struct {
		Text         string `xml:",chardata"`
		Name         string `xml:"Name,attr"`
		Lower        string `xml:"Lower,attr"`
		Upper        string `xml:"Upper,attr"`
		Mod          string `xml:"Mod,attr"`
		Step         string `xml:"Step,attr"`
		Delay        string `xml:"Delay,attr"`
		Logging      string `xml:"Logging,attr"`
		CompareDB    string `xml:"CompareDB,attr"`
		Duration     string `xml:"Duration,attr"`
		TimeOutTimer string `xml:"TimeOutTimer,attr"`
		AutoStore    string `xml:"AutoStore,attr"`
	} `xml:"CNV_DISCOV"`
	Footer struct {
		Text string `xml:",chardata"`
		No   string `xml:"No,attr"`
		EOT  string `xml:"EOT,attr"`
	} `xml:"Footer"`
}

GLT,CNV_DISCOV

type GltDeptInfo

type GltDeptInfo struct {
	XMLName xml.Name `xml:"GLT"`
	Text    string   `xml:",chardata"`
	DEPT    []struct {
		Text     string `xml:",chardata"`
		Index    string `xml:"Index,attr"`
		TGroupId string `xml:"TGroupId,attr"`
		Name     string `xml:"Name,attr"`
		Avoid    string `xml:"Avoid,attr"`
		QKey     string `xml:"Q_Key,attr"`
	} `xml:"DEPT"`
	Footer struct {
		Text string `xml:",chardata"`
		No   string `xml:"No,attr"`
		EOT  string `xml:"EOT,attr"`
	} `xml:"Footer"`
}

type GltFLInfo

type GltFLInfo struct {
	XMLName xml.Name `xml:"GLT"`
	Text    string   `xml:",chardata"`
	FL      []struct {
		Text    string `xml:",chardata"`
		Index   string `xml:"Index,attr"`
		Name    string `xml:"Name,attr"`
		Monitor string `xml:"Monitor,attr"`
		QKey    string `xml:"Q_Key,attr"`
		NTag    string `xml:"N_Tag,attr"`
	} `xml:"FL"`
	Footer struct {
		Text string `xml:",chardata"`
		No   string `xml:"No,attr"`
		EOT  string `xml:"EOT,attr"`
	} `xml:"Footer"`
}

type GltFto

type GltFto struct {
	XMLName xml.Name `xml:"GLT"`
	Text    string   `xml:",chardata"`
	FTO     []struct {
		Text  string `xml:",chardata"`
		Index string `xml:"Index,attr"`
		Freq  string `xml:"Freq,attr"`
		Mod   string `xml:"Mod,attr"`
		Name  string `xml:"Name,attr"`
		ToneA string `xml:"ToneA,attr"`
		ToneB string `xml:"ToneB,attr"`
	} `xml:"FTO"`
	Footer struct {
		Text string `xml:",chardata"`
		No   string `xml:"No,attr"`
		EOT  string `xml:"EOT,attr"`
	} `xml:"Footer"`
}

type GltSiteInfo

type GltSiteInfo struct {
	XMLName xml.Name `xml:"GLT"`
	Text    string   `xml:",chardata"`
	SITE    []struct {
		Text   string `xml:",chardata"`
		Index  string `xml:"Index,attr"`
		SiteId string `xml:"SiteId,attr"`
		Name   string `xml:"Name,attr"`
		Avoid  string `xml:"Avoid,attr"`
		QKey   string `xml:"Q_Key,attr"`
	} `xml:"SITE"`
	Footer struct {
		Text string `xml:",chardata"`
		No   string `xml:"No,attr"`
		EOT  string `xml:"EOT,attr"`
	} `xml:"Footer"`
}

type GltSysInfo

type GltSysInfo struct {
	XMLName xml.Name `xml:"GLT"`
	Text    string   `xml:",chardata"`
	SYS     []struct {
		Text    string `xml:",chardata"`
		Index   string `xml:"Index,attr"`
		TrunkId string `xml:"TrunkId,attr"`
		Name    string `xml:"Name,attr"`
		Avoid   string `xml:"Avoid,attr"`
		Type    string `xml:"Type,attr"`
		QKey    string `xml:"Q_Key,attr"`
		NTag    string `xml:"N_Tag,attr"`
	} `xml:"SYS"`
	Footer struct {
		Text string `xml:",chardata"`
		No   string `xml:"No,attr"`
		EOT  string `xml:"EOT,attr"`
	} `xml:"Footer"`
}

type GltTrnDiscovery

type GltTrnDiscovery struct {
	XMLName   xml.Name `xml:"GLT"`
	Text      string   `xml:",chardata"`
	TRNDISCOV []struct {
		Text         string `xml:",chardata"`
		Name         string `xml:"Name,attr"`
		Delay        string `xml:"Delay,attr"`
		Logging      string `xml:"Logging,attr"`
		Duration     string `xml:"Duration,attr"`
		CompareDB    string `xml:"CompareDB,attr"`
		SystemName   string `xml:"SystemName,attr"`
		SystemType   string `xml:"SystemType,attr"`
		SiteName     string `xml:"SiteName,attr"`
		TimeOutTimer string `xml:"TimeOutTimer,attr"`
		AutoStore    string `xml:"AutoStore,attr"`
	} `xml:"TRN_DISCOV"`
	Footer struct {
		Text string `xml:",chardata"`
		No   string `xml:"No,attr"`
		EOT  string `xml:"EOT,attr"`
	} `xml:"Footer"`
}

type GltUrecFolder

type GltUrecFolder struct {
	XMLName    xml.Name `xml:"GLT"`
	Text       string   `xml:",chardata"`
	URECFOLDER []struct {
		Text  string `xml:",chardata"`
		Index string `xml:"Index,attr"`
		Name  string `xml:"Name,attr"`
	} `xml:"UREC_FOLDER"`
	Footer struct {
		Text string `xml:",chardata"`
		No   string `xml:"No,attr"`
		EOT  string `xml:"EOT,attr"`
	} `xml:"Footer"`
}

type GltXmlType

type GltXmlType int

type KeyPress

type KeyPress struct {
	Key  string
	Mode string
}

func (*KeyPress) String

func (k *KeyPress) String() string

type LocationInfo

type LocationInfo struct {
	Latitude  float64
	Longitude float64
	Range     float64
}

func NewLocationInfo

func NewLocationInfo(raw string) *LocationInfo

func (*LocationInfo) String

func (l *LocationInfo) String() string

type Locker

type Locker struct {
	sync.Mutex
	// contains filtered or unexported fields
}
type MenuBack struct {
	ReturnLevel int
}
func (m *MenuBack) String() string
type MenuMode struct {
	ID    string
	Index string
}
func (m *MenuMode) String() string
type MenuSetValue struct {
	ItemIndex int
	Value     string
}
func (m *MenuSetValue) String() string
type Modal struct {
	PSI               bool // PSI Mode on/Off
	WSClientConnected bool
	ASTMode           ASTModeType
	APRMode           APRModeType
}

type MsgPacket

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

type MsiInfo

type MsiInfo struct {
	XMLName  xml.Name `xml:"MSI"`
	Text     string   `xml:",chardata"`
	Name     string   `xml:"Name,attr"`
	Index    string   `xml:"Index,attr"`
	MenuType string   `xml:"MenuType,attr"`
	Value    string   `xml:"Value,attr"`
	Selected string   `xml:"Selected,attr"`
	MenuItem []struct {
		Text  string `xml:",chardata"`
		Name  string `xml:"Name,attr"`
		Index string `xml:"Index,attr"`
	} `xml:"MenuItem"`
	Footer struct {
		Text string `xml:",chardata"`
		No   string `xml:"No,attr"`
		EOT  string `xml:"EOT,attr"`
	} `xml:"Footer"`
}

type SDSKeyModeType

type SDSKeyModeType string

type SDSKeyType

type SDSKeyType string

type ScannerConn

type ScannerConn struct {
	Type string
	// contains filtered or unexported fields
}

func NewUDPConn

func NewUDPConn(addr *net.UDPAddr) (*ScannerConn, error)

func NewUSBConn

func NewUSBConn(path string) (*ScannerConn, error)

func (ScannerConn) Close

func (c ScannerConn) Close() error

func (*ScannerConn) Open

func (c *ScannerConn) Open() error

func (ScannerConn) Read

func (c ScannerConn) Read(b []byte) (n int, err error)

func (ScannerConn) String

func (c ScannerConn) String() string

func (ScannerConn) Write

func (c ScannerConn) Write(b []byte) (n int, err error)

type ScannerCtrl

type ScannerCtrl struct {
	GoProcDelay      time.Duration
	GoProcMultiplier time.Duration
	// contains filtered or unexported fields
}

func CreateScannerCtrl

func CreateScannerCtrl() *ScannerCtrl

func (*ScannerCtrl) IsLocked

func (s *ScannerCtrl) IsLocked() bool

func (*ScannerCtrl) ReceiveFromRadioMsgChannel

func (s *ScannerCtrl) ReceiveFromRadioMsgChannel() (MsgPacket, bool)

func (*ScannerCtrl) SendToHostMsgChannel

func (s *ScannerCtrl) SendToHostMsgChannel(msg []byte) bool

func (*ScannerCtrl) SendToRadioMsgChannel

func (s *ScannerCtrl) SendToRadioMsgChannel(msg []byte) bool

type ScannerInfo

type ScannerInfo struct {
	XMLName     xml.Name `xml:"ScannerInfo"`
	Text        string   `xml:",chardata"`
	Mode        string   `xml:"Mode,attr"`
	VScreen     string   `xml:"V_Screen,attr"`
	MonitorList struct {
		Text      string `xml:",chardata"`
		Name      string `xml:"Name,attr"`
		Index     string `xml:"Index,attr"`
		ListType  string `xml:"ListType,attr"`
		QKey      string `xml:"Q_Key,attr"`
		NTag      string `xml:"N_Tag,attr"`
		DBCounter string `xml:"DB_Counter,attr"`
	} `xml:"MonitorList"`
	System struct {
		Text       string `xml:",chardata"`
		Name       string `xml:"Name,attr"`
		Index      string `xml:"Index,attr"`
		Avoid      string `xml:"Avoid,attr"`
		SystemType string `xml:"SystemType,attr"`
		QKey       string `xml:"Q_Key,attr"`
		NTag       string `xml:"N_Tag,attr"`
		Hold       string `xml:"Hold,attr"`
	} `xml:"System"`
	Department struct {
		Text  string `xml:",chardata"`
		Name  string `xml:"Name,attr"`
		Index string `xml:"Index,attr"`
		Avoid string `xml:"Avoid,attr"`
		QKey  string `xml:"Q_Key,attr"`
		Hold  string `xml:"Hold,attr"`
	} `xml:"Department"`
	TGID struct {
		Text    string `xml:",chardata"`
		Name    string `xml:"Name,attr"`
		Index   string `xml:"Index,attr"`
		Avoid   string `xml:"Avoid,attr"`
		TGID    string `xml:"TGID,attr"`
		SetSlot string `xml:"SetSlot,attr"`
		RecSlot string `xml:"RecSlot,attr"`
		NTag    string `xml:"N_Tag,attr"`
		Hold    string `xml:"Hold,attr"`
		SvcType string `xml:"SvcType,attr"`
		PCh     string `xml:"P_Ch,attr"`
		LVL     string `xml:"LVL,attr"`
	} `xml:"TGID"`
	UnitID struct {
		Text string `xml:",chardata"`
		Name string `xml:"Name,attr"`
		UID  string `xml:"U_Id,attr"`
	} `xml:"UnitID"`
	Site struct {
		Text  string `xml:",chardata"`
		Name  string `xml:"Name,attr"`
		Index string `xml:"Index,attr"`
		Avoid string `xml:"Avoid,attr"`
		QKey  string `xml:"Q_Key,attr"`
		Hold  string `xml:"Hold,attr"`
		Mod   string `xml:"Mod,attr"`
	} `xml:"Site"`
	SiteFrequency struct {
		Text string `xml:",chardata"`
		Freq string `xml:"Freq,attr"`
		IFX  string `xml:"IFX,attr"`
		SAS  string `xml:"SAS,attr"`
		SAD  string `xml:"SAD,attr"`
	} `xml:"SiteFrequency"`
	DualWatch struct {
		Text string `xml:",chardata"`
		PRI  string `xml:"PRI,attr"`
		CC   string `xml:"CC,attr"`
		WX   string `xml:"WX,attr"`
	} `xml:"DualWatch"`
	TrunkingDiscovery struct {
		Text       string `xml:",chardata"`
		SystemName string `xml:"SystemName,attr"`
		SiteName   string `xml:"SiteName,attr"`
		TGID       string `xml:"TGID,attr"`
		TgidName   string `xml:"TgidName,attr"`
		SAD        string `xml:"SAD,attr"`
		RecSlot    string `xml:"RecSlot,attr"`
		PastTime   string `xml:"PastTime,attr"`
		HitCount   string `xml:"HitCount,attr"`
		UID        string `xml:"U_Id,attr"`
	} `xml:"TrunkingDiscovery"`
	Property struct {
		Text      string `xml:",chardata"`
		F         string `xml:"F,attr"`
		VOL       string `xml:"VOL,attr"`
		SQL       string `xml:"SQL,attr"`
		Sig       string `xml:"Sig,attr"`
		Att       string `xml:"Att,attr"`
		Rec       string `xml:"Rec,attr"`
		KeyLock   string `xml:"KeyLock,attr"`
		P25Status string `xml:"P25Status,attr"`
		Mute      string `xml:"Mute,attr"`
		Backlight string `xml:"Backlight,attr"`
		ALed      string `xml:"A_Led,attr"`
		Dir       string `xml:"Dir,attr"`
		Rssi      string `xml:"Rssi,attr"`
	} `xml:"Property"`
	ViewDescription struct {
		Text      string `xml:",chardata"`
		PlainText []struct {
			Chardata string `xml:",chardata"`
			AttrText string `xml:"Text,attr"`
		} `xml:"PlainText"`
		PopupScreen struct {
			Chardata string `xml:",chardata"`
			AttrText string `xml:"Text,attr"`
			Button   struct {
				Chardata string `xml:",chardata"`
				AttrText string `xml:"Text,attr"`
				KeyCode  string `xml:"KeyCode,attr"`
			} `xml:"Button"`
		} `xml:"PopupScreen"`
	} `xml:"ViewDescription"`
}

type ScannerStatus

type ScannerStatus struct {
	// Best guesses based on
	// https://github.com/suidroot/pyUniden/blob/e7705be191474ffada8af12bf1f09c0d4a65057d/pyuniden/main.py#L84-L122
	// http://www.servicedocs.com/ARTIKELEN/7200250170003.pdf
	// http://www.netfiles.ru/share/linked/f1/BCD396T_Protocol.pdf
	Line1          string
	Line2          string
	Line3          string
	Line4          string
	Line5          string
	Line6          string
	Line7          string
	Line8          string
	Line9          string
	Line10         string
	Line11         string
	Line12         string
	Line13         string
	Line14         string
	Line15         string
	Line16         string
	Line17         string
	Line18         string
	Line19         string
	Line20         string
	Frequency      float64
	Squelch        bool
	Mute           bool
	WeatherAlerts  bool
	CCLed          bool
	AlertLED       bool
	BacklightLevel int
	SignalLevel    int
}

func NewScannerStatus

func NewScannerStatus(raw string) *ScannerStatus

func (*ScannerStatus) Command

func (s *ScannerStatus) Command() string

type UserRecordStatus

type UserRecordStatus struct {
	Recording    bool
	ErrorCode    *int
	ErrorMessage *string
}

func NewUserRecordStatus

func NewUserRecordStatus(raw string) *UserRecordStatus

func (*UserRecordStatus) String

func (u *UserRecordStatus) String() string

Jump to

Keyboard shortcuts

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