Documentation ¶
Overview ¶
Package homebrew implements the Home Brew DMR IPSC protocol
Index ¶
- Variables
- func BuildData(p *dmr.Packet, repeaterID uint32) []byte
- func ParseData(data []byte) (*dmr.Packet, error)
- type AuthStatus
- type Config
- type ConfigFunc
- type Homebrew
- func (h *Homebrew) Active() bool
- func (h *Homebrew) Close() error
- func (h *Homebrew) GetPacketFunc() dmr.PacketFunc
- func (h *Homebrew) Link(peer *Peer) error
- func (h *Homebrew) ListenAndServe() error
- func (h *Homebrew) Send(p *dmr.Packet) error
- func (h *Homebrew) SetPacketFunc(f dmr.PacketFunc)
- func (h *Homebrew) Unlink(id uint32) error
- func (h *Homebrew) WritePacketToPeer(p *dmr.Packet, peer *Peer) error
- func (h *Homebrew) WriteToPeer(b []byte, peer *Peer) error
- func (h *Homebrew) WriteToPeerWithID(b []byte, id uint32) error
- type Peer
- type RepeaterConfiguration
Constants ¶
This section is empty.
Variables ¶
var ( DMRData = []byte("DMRD") MasterNAK = []byte("MSTNAK") MasterACK = []byte("MSTACK") RepeaterLogin = []byte("RPTL") RepeaterKey = []byte("RPTK") MasterPing = []byte("MSTPING") RepeaterPong = []byte("RPTPONG") MasterClosing = []byte("MSTCL") RepeaterClosing = []byte("RPTCL") )
Messages as documented by DL5DI, G4KLX and DG1HT, see "DMRplus IPSC Protocol for HB repeater (20150726).pdf".
var ( AuthTimeout = time.Second * 5 PingInterval = time.Second * 5 PingTimeout = time.Second * 15 SendInterval = time.Millisecond * 30 )
We ping the peers every minute
Functions ¶
Types ¶
type AuthStatus ¶
type AuthStatus uint8
const ( AuthNone AuthStatus = iota AuthBegin AuthDone AuthFailed )
func (*AuthStatus) String ¶
func (a *AuthStatus) String() string
type ConfigFunc ¶
type ConfigFunc func() *RepeaterConfiguration
ConfigFunc returns an actual RepeaterConfiguration instance when called. This is used by the DMR repeater to poll for current configuration, statistics and metrics.
type Homebrew ¶
type Homebrew struct { Config *RepeaterConfiguration Peer map[string]*Peer PeerID map[uint32]*Peer // contains filtered or unexported fields }
Homebrew is implements the Homebrew IPSC DMR Air Interface protocol
func New ¶
func New(config *RepeaterConfiguration, addr *net.UDPAddr) (*Homebrew, error)
New creates a new Homebrew repeater
func (*Homebrew) GetPacketFunc ¶
func (h *Homebrew) GetPacketFunc() dmr.PacketFunc
func (*Homebrew) ListenAndServe ¶
func (*Homebrew) SetPacketFunc ¶
func (h *Homebrew) SetPacketFunc(f dmr.PacketFunc)
func (*Homebrew) WritePacketToPeer ¶
type Peer ¶
type Peer struct { ID uint32 Addr *net.UDPAddr AuthKey []byte Status AuthStatus Nonce []byte Token []byte Incoming bool UnlinkOnAuthFailure bool PacketReceived dmr.PacketFunc Last struct { PacketSent time.Time PacketReceived time.Time PingSent time.Time PingReceived time.Time PongReceived time.Time } // contains filtered or unexported fields }
Peer is a remote repeater that also speaks the Homebrew protocol
func (*Peer) CheckRepeaterID ¶
func (*Peer) UpdateToken ¶
type RepeaterConfiguration ¶
type RepeaterConfiguration struct { Callsign string ID uint32 // Our RepeaterID RXFreq uint32 TXFreq uint32 TXPower uint8 ColorCode uint8 Latitude float32 Longitude float32 Height uint16 Location string Description string URL string SoftwareID string PackageID string }
RepeaterConfiguration holds information about the current repeater. It should be returned by a callback in the implementation, returning actual information about the current repeater status.
func (*RepeaterConfiguration) Bytes ¶
func (r *RepeaterConfiguration) Bytes() []byte
Bytes returns the configuration as bytes.
func (*RepeaterConfiguration) String ¶
func (r *RepeaterConfiguration) String() string
String returns the configuration as string.