homebrew

package
v0.0.0-...-b5243b2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package homebrew implements the DL5DI Homebrew protocol compatible with BrandMeister

https://wiki.brandmeister.network/images/5/54/DMRplus_IPSC_Protocol_for_HB_repeater.pdf

Index

Constants

View Source
const (
	DefaultPort              = 62030
	DefaultKeepAliveInterval = time.Second * 5
	DefaultTimeout           = time.Second * 15
	DefaultFirebaseTokenID   = 393838907279
	DefaultFirebaseToken     = "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1"
)

Defaults

View Source
const (
	SignDMRData           = "DMRD"
	SignRepeaterConfig    = "RPTC"
	SignRepeaterLogin     = "RPTL"
	SignRepeaterKey       = "RPTK"
	SignRepeaterPong      = "RPTPONG"
	SignRepeaterClose     = "RPTCL"
	SignRepeaterRSSI      = "RPTRSSI"
	SignRepeaterInterrupt = "RPTINTR"
	SignRepeaterIdle      = "RPTIDLE"
	SignRepeaterWake      = "RPTWAKE"
	SignMaster            = "MST"
	SignMasterACK         = "MSTACK"
	SignMasterNAK         = "MSTNAK"
	SignMasterPing        = "MSTPING"
	SignMasterClose       = "MSTCL"
)

Message types

Variables

View Source
var (
	ErrInvalidCallsign       = errors.New("homebrew: invalid callsign")
	ErrInvalidColorCode      = errors.New("homebrew: invalid color code")
	ErrInvalidLatitude       = errors.New("homebrew: invalid latitude")
	ErrInvalidLongitude      = errors.New("homebrew: invalid longitude")
	ErrInvalidSlot           = errors.New("homebrew: invalid slot")
	ErrMasterRefusedLogin    = errors.New("homebrew: master refused login")
	ErrMasterRefusedPassword = errors.New("homebrew: master refused password")
	ErrMasterClose           = errors.New("homebrew: master sent close")
	ErrMasterShortNonce      = errors.New("homebrew: master sent short nonce")
)

Errors

View Source
var Debug bool

Debug enables debug messages

Functions

This section is empty.

Types

type Client

type Client struct {
	KeepAlive time.Duration
	Timeout   time.Duration

	// Configuration of the repeater
	Configuration *Configuration

	// Description of the client
	Description string

	// URL of the client
	URL string
	// contains filtered or unexported fields
}

Client implementing the Homebrew protocol

func NewClient

func NewClient(cfg *Configuration, addr, password string) (*Client, error)

NewClient sets up a Homebrew protocol client with defaults configured.

func (*Client) Close

func (c *Client) Close() error

Close the client socket and stop the receiver loop after it has been started by ListenAndServe.

func (*Client) ListenAndServe

func (c *Client) ListenAndServe(f chan<- *DMRData) error

ListenAndServe starts the packet receiver and decoder

func (*Client) SendDMR

func (c *Client) SendDMR(dmrData *DMRData) error

SendDMR sends a DMRData packet

func (*Client) SendIdle

func (c *Client) SendIdle(tokenID uint64, token string) error

SendIdle sends a Firebase idle message

func (*Client) SendInterrupt

func (c *Client) SendInterrupt(slot uint8) error

SendInterrupt sends a call interrupt to a time slot (0 = DMO, 1 = ts1, 2 = ts2)

func (*Client) SendRSSI

func (c *Client) SendRSSI(slot uint8, dBm float32) error

SendRSSI sends an RSSI report for a time slot (0 = DMO, 1 = ts1, 2 = ts2)

func (*Client) SendWake

func (c *Client) SendWake(tokenID uint64, token string) error

SendWake sends a Firebase wake message

type Configuration

type Configuration struct {
	// Callsign of the repeater
	Callsign string

	// ID DMR-ID of the repeater
	ID uint32

	// RXFreq frequency in Hz
	RXFreq int

	// TXFreq frequency in Hz
	TXFreq int

	// TXPower in dBm, decimal [0,99]
	TXPower uint8

	// ColorCode [1,15]
	ColorCode uint8

	// Latitude with north as positive [-90,+90]
	Latitude float64

	// Longitude with east as positive [-180+,180]
	Longitude float64

	// Height above ground in meters
	Height uint16

	// Location description
	Location string

	// Description (optional) about the repeater
	Description string

	// URL (optional) for the repeater or group
	URL string

	// SoftwareID with version (no HTML, no ads, no spam)
	SoftwareID string

	// PackageID with version and platform (no HTML, no ads, no spam)
	PackageID string
}

Configuration for the Homebrew repeater

func (*Configuration) Check

func (c *Configuration) Check() error

Check if the supplied Configuration is sane

type DMRData

type DMRData struct {
	// Signature (always DMRD)
	Signature [4]byte

	// Sequence of data frame
	Sequence uint8

	// Source ID
	Source dmr.ID

	// Target ID
	Target dmr.ID

	// Repeater ID
	Repeater uint32

	// Options flags
	Options Options

	// Stream ID
	Stream uint32

	// Data is the raw DMR data
	Data [33]byte
}

DMRData is a DMR data frame with metadata from the LC

type Options

type Options uint8

Options flags

func (Options) DataType

func (o Options) DataType() uint8

DataType raw DMR data type for data calls, voice frame number for voice calls

func (Options) FrameType

func (o Options) FrameType() uint8

FrameType (0x00 = voice, 0x01 = voice sync, 0x02 = data)

func (Options) Protect

func (o Options) Protect() bool

Protect flag (false = group call, true = private call)

func (Options) Slot

func (o Options) Slot() uint8

Slot number (0 = ts1, 1 = ts2)

Jump to

Keyboard shortcuts

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