dmr

package module
v0.0.0-...-344dc5b Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: MIT Imports: 11 Imported by: 0

README

go-dmr

Golang Digital Mobile Radio protocols.

Build Status

References

The DMR Air Interface protocol is specified in Electromagnetic compatibility and Radio spectrum Matters (ERM); Digital Mobile Radio (DMR) Systems; Part 1: DMR Air Interface (AI) protocol, ETSI TS 102 361-1.

The Brandmeister Homebrew protocol is specified in IPSC Protocol Specs for homebrew DMR repeater by Hans DL5DI, Jonathan Naylor (G4KLXG) and Torsten Schultze (DG1HT).

Warning

This implementation is not suitable for commercial use and is for educational purposes only.

Acknowledgements

The implementation is possible because of the invaluable help from the following persons. Thanks for your patience and providing me with sample data and links to test the protocols.

  • Rudy Hardeman (PD0ZRY)
  • Artem Prilutskiy (R3ABM)

Documentation

Overview

Package dmr implements various protocols for interfacing Digital Mobile Radio repeaters and base stations.

Index

Constants

View Source
const (
	PayloadBits                 = 98 + 10 + 48 + 10 + 98
	InfoHalfBits                = 98
	InfoBits                    = 2 * InfoHalfBits
	InfoSize                    = 12 // After BPTC(196, 96) decoding
	SlotTypeHalfBits            = 10
	SlotTypeBits                = 2 * SlotTypeHalfBits
	SignalBits                  = 48
	SyncOffsetBits              = InfoHalfBits + SlotTypeHalfBits
	SyncBits                    = SignalBits
	VoiceHalfBits               = 108
	VoiceBits                   = 2 * VoiceHalfBits
	EMBHalfBits                 = 8
	EMBBits                     = 2 * EMBHalfBits
	EMBSignallingLCFragmentBits = 32
)

Various sizes of information chunks.

View Source
const (
	B00000000 = iota
	B00000001
	B00000010
	B00000011
	B00000100
	B00000101
	B00000110
	B00000111
	B00001000
	B00001001
	B00001010
	B00001011
	B00001100
	B00001101
	B00001110
	B00001111
	B00010000
	B00010001
	B00010010
	B00010011
	B00010100
	B00010101
	B00010110
	B00010111
	B00011000
	B00011001
	B00011010
	B00011011
	B00011100
	B00011101
	B00011110
	B00011111
	B00100000
	B00100001
	B00100010
	B00100011
	B00100100
	B00100101
	B00100110
	B00100111
	B00101000
	B00101001
	B00101010
	B00101011
	B00101100
	B00101101
	B00101110
	B00101111
	B00110000
	B00110001
	B00110010
	B00110011
	B00110100
	B00110101
	B00110110
	B00110111
	B00111000
	B00111001
	B00111010
	B00111011
	B00111100
	B00111101
	B00111110
	B00111111
	B01000000
	B01000001
	B01000010
	B01000011
	B01000100
	B01000101
	B01000110
	B01000111
	B01001000
	B01001001
	B01001010
	B01001011
	B01001100
	B01001101
	B01001110
	B01001111
	B01010000
	B01010001
	B01010010
	B01010011
	B01010100
	B01010101
	B01010110
	B01010111
	B01011000
	B01011001
	B01011010
	B01011011
	B01011100
	B01011101
	B01011110
	B01011111
	B01100000
	B01100001
	B01100010
	B01100011
	B01100100
	B01100101
	B01100110
	B01100111
	B01101000
	B01101001
	B01101010
	B01101011
	B01101100
	B01101101
	B01101110
	B01101111
	B01110000
	B01110001
	B01110010
	B01110011
	B01110100
	B01110101
	B01110110
	B01110111
	B01111000
	B01111001
	B01111010
	B01111011
	B01111100
	B01111101
	B01111110
	B01111111
	B10000000
	B10000001
	B10000010
	B10000011
	B10000100
	B10000101
	B10000110
	B10000111
	B10001000
	B10001001
	B10001010
	B10001011
	B10001100
	B10001101
	B10001110
	B10001111
	B10010000
	B10010001
	B10010010
	B10010011
	B10010100
	B10010101
	B10010110
	B10010111
	B10011000
	B10011001
	B10011010
	B10011011
	B10011100
	B10011101
	B10011110
	B10011111
	B10100000
	B10100001
	B10100010
	B10100011
	B10100100
	B10100101
	B10100110
	B10100111
	B10101000
	B10101001
	B10101010
	B10101011
	B10101100
	B10101101
	B10101110
	B10101111
	B10110000
	B10110001
	B10110010
	B10110011
	B10110100
	B10110101
	B10110110
	B10110111
	B10111000
	B10111001
	B10111010
	B10111011
	B10111100
	B10111101
	B10111110
	B10111111
	B11000000
	B11000001
	B11000010
	B11000011
	B11000100
	B11000101
	B11000110
	B11000111
	B11001000
	B11001001
	B11001010
	B11001011
	B11001100
	B11001101
	B11001110
	B11001111
	B11010000
	B11010001
	B11010010
	B11010011
	B11010100
	B11010101
	B11010110
	B11010111
	B11011000
	B11011001
	B11011010
	B11011011
	B11011100
	B11011101
	B11011110
	B11011111
	B11100000
	B11100001
	B11100010
	B11100011
	B11100100
	B11100101
	B11100110
	B11100111
	B11101000
	B11101001
	B11101010
	B11101011
	B11101100
	B11101101
	B11101110
	B11101111
	B11110000
	B11110001
	B11110010
	B11110011
	B11110100
	B11110101
	B11110110
	B11110111
	B11111000
	B11111001
	B11111010
	B11111011
	B11111100
	B11111101
	B11111110
	B11111111
)

Because Go doesn't have binary literals ("We've found hex and octal to be sufficient")

View Source
const (
	OutboundActivationOpcode                   = B00111000
	UnitToUnitVoiceServiceRequestOpcode        = B00000100
	UnitToUnitVoiceServiceAnswerResponseOpcode = B00000101
	NegativeAcknowledgeResponseOpcode          = B00100100
	PreambleOpcode                             = B00111101
)

Control Block Opcode

View Source
const (
	PacketFormatUDT             uint8 = iota // 0b0000
	PacketFormatResponse                     // 0b0001
	PacketFormatUnconfirmedData              // 0b0010
	PacketFormatConfirmedData                // 0b0011

	PacketFormatShortDataDefined // 0b1101
	PacketFormatShortDataRaw     // 0b1110
	PacketFormatProprietaryData  // 0b1111
)

Data Header Packet Format

View Source
const (
	ServiceAccessPointUDT uint8 = iota // 0b0000

	ServiceAccessPointTCPIPHeaderCompression // 0b0010
	ServiceAccessPointUDPIPHeaderCompression // 0b0011
	ServiceAccessPointIPBasedPacketData      // 0b0100
	ServiceAccessPointARP                    // 0b0101

	ServiceAccessPointProprietaryData // 0b1001
	ServiceAccessPointShortData       // 0b1010
)

Service Access Point

View Source
const (
	ResponseTypeACK uint8 // Class 0b00, Type 0b001

	ResponseTypeIllegalFormat    // Class 0b01, Type 0b000
	ResponseTypePacketCRCFailed  // Class 0b01, Type 0b001
	ResponseTypeMemoryFull       // Class 0b01, Type 0b010
	ResponseTypeRecvFSVNOutOfSeq // Class 0b01, Type 0b011
	ResponseTypeUndeliverable    // Class 0b01, Type 0b100
	ResponseTypeRecvPktOutOfSeq  // Class 0b01, Type 0b101
	ResponseTypeDisallowed       // Class 0b01, Type 0b110

	ResponseTypeSelectiveACK // Class 0b10, Type 0b000
)

Response Data Header Response Type, encodes class and type

View Source
const (
	UDTFormatBinary uint8 = iota
	UDTFormatMSAddress
	UDTFormat4BitBCD
	UDTFormatISO_7BitChars
	UDTFormatISO_8BitChars
	UDTFormatNMEALocation
	UDTFormatIPAddress
	UDTFormat16BitUnicodeChars
	UDTFormatCustomCodeD1
	UDTFormatCustomCodeD2
)

UDP Response Header UDT Format

View Source
const (
	DDFormatBinary uint8 = iota
	DDFormatBCD
	DDFormat7BitChar
	DDFormat8BitISO8859_1
	DDFormat8BitISO8859_2
	DDFormat8BitISO8859_3
	DDFormat8BitISO8859_4
	DDFormat8BitISO8859_5
	DDFormat8BitISO8859_6
	DDFormat8BitISO8859_7
	DDFormat8BitISO8859_8
	DDFormat8BitISO8859_9
	DDFormat8BitISO8859_10
	DDFormat8BitISO8859_11
	DDFormat8BitISO8859_13
	DDFormat8BitISO8859_14
	DDFormat8BitISO8859_15
	DDFormat8BitISO8859_16
	DDFormatUTF8
	DDFormatUTF16
	DDFormatUTF16BE
	DDFormatUTF16LE
	DDFormatUTF32
	DDFormatUTF32BE
	DDFormatUTF32LE
)

UDT Response Header DD Format

View Source
const (
	PrivacyIndicator              uint8 = iota // Privacy Indicator information in a standalone burst
	VoiceLC                                    // Indicates the beginning of voice transmission, carries addressing information
	TerminatorWithLC                           // Indicates the end of transmission, carries LC information
	CSBK                                       // Carries a control block
	MultiBlockControl                          // Header for multi-block control
	MultiBlockControlContinuation              // Follow-on blocks for multi-block control
	Data                                       // Carries addressing and numbering of packet data blocks
	Rate12Data                                 // Payload for rate 1/2 packet data
	Rate34Data                                 // Payload for rate 3⁄4 packet data
	Idle                                       // Fills channel when no info to transmit
	VoiceBurstA                                // Burst A marks the start of a superframe and always contains a voice SYNC pattern
	VoiceBurstB                                // Bursts B to F carry embedded signalling in place of the SYNC pattern
	VoiceBurstC                                // Bursts B to F carry embedded signalling in place of the SYNC pattern
	VoiceBurstD                                // Bursts B to F carry embedded signalling in place of the SYNC pattern
	VoiceBurstE                                // Bursts B to F carry embedded signalling in place of the SYNC pattern
	VoiceBurstF                                // Bursts B to F carry embedded signalling in place of the SYNC pattern
	IPSCSync
	UnknownSlotType
)

Data Type information element definitions, DMR Air Interface (AI) protocol, Table 6.1

View Source
const (
	CallTypePrivate uint8 = iota
	CallTypeGroup
)

Call Type

View Source
const (
	SyncPatternBSSourcedVoice uint8 = iota
	SyncPatternBSSourcedData
	SyncPatternMSSourcedVoice
	SyncPatternMSSourcedData
	SyncPatternMSSourcedRC
	SyncPatternDirectVoiceTS1
	SyncPatternDirectDataTS1
	SyncPatternDirectVoiceTS2
	SyncPatternDirectDataTS2
	SyncPatternUnknown
)

Table 9.2: SYNC Patterns

View Source
const (
	SingleFragment uint8 = iota
	FirstFragment
	LastFragment
	Continuation
)

EMB LCSS fragments.

View Source
const (
	// n_DFragMax, see DMR AI spec. page 163.
	MaxPacketFragmentSize = 1500
)

Variables

View Source
var (
	Version    = "0.2.1"                                            // Version number
	SoftwareID = fmt.Sprintf("%s go-dmr %s", Version, runtime.GOOS) // Software identifier
	PackageID  = fmt.Sprintf("%s/%s", SoftwareID, runtime.GOARCH)   // Package identifier
)
View Source
var CallTypeName = map[uint8]string{
	CallTypePrivate: "private",
	CallTypeGroup:   "group",
}
View Source
var DDFormatName = map[uint8]string{
	DDFormatBinary:         "binary",
	DDFormatBCD:            "BCD",
	DDFormat7BitChar:       "7-bit characters",
	DDFormat8BitISO8859_1:  "8-bit ISO 8859-1",
	DDFormat8BitISO8859_2:  "8-bit ISO 8859-2",
	DDFormat8BitISO8859_3:  "8-bit ISO 8859-3",
	DDFormat8BitISO8859_4:  "8-bit ISO 8859-4",
	DDFormat8BitISO8859_5:  "8-bit ISO 8859-5",
	DDFormat8BitISO8859_6:  "8-bit ISO 8859-6",
	DDFormat8BitISO8859_7:  "8-bit ISO 8859-7",
	DDFormat8BitISO8859_8:  "8-bit ISO 8859-8",
	DDFormat8BitISO8859_9:  "8-bit ISO 8859-9",
	DDFormat8BitISO8859_10: "8-bit ISO 8859-10",
	DDFormat8BitISO8859_11: "8-bit ISO 8859-11",
	DDFormat8BitISO8859_13: "8-bit ISO 8859-13",
	DDFormat8BitISO8859_14: "8-bit ISO 8859-14",
	DDFormat8BitISO8859_15: "8-bit ISO 8859-15",
	DDFormat8BitISO8859_16: "8-bit ISO 8859-16",
	DDFormatUTF8:           "UTF-8",
	DDFormatUTF16:          "UTF-16",
	DDFormatUTF16BE:        "UTF-16 big endian",
	DDFormatUTF16LE:        "UTF-16 little endian",
	DDFormatUTF32:          "UTF-32",
	DDFormatUTF32BE:        "UTF-32 big endian",
	DDFormatUTF32LE:        "UTF-32 little endian",
}
View Source
var DataTypeName = map[uint8]string{
	PrivacyIndicator:              "privacy indicator",
	VoiceLC:                       "voice LC",
	TerminatorWithLC:              "terminator with LC",
	CSBK:                          "control block",
	MultiBlockControl:             "multi-block control",
	MultiBlockControlContinuation: "multi-block control follow-on",
	Data:                          "data",
	Rate12Data:                    "rate ½ packet data",
	Rate34Data:                    "rate ¾ packet data",
	Idle:                          "idle",
	VoiceBurstA:                   "voice (burst A)",
	VoiceBurstB:                   "voice (burst B)",
	VoiceBurstC:                   "voice (burst C)",
	VoiceBurstD:                   "voice (burst D)",
	VoiceBurstE:                   "voice (burst E)",
	VoiceBurstF:                   "voice (burst F)",
	IPSCSync:                      "IPSC sync",
	UnknownSlotType:               "uknown",
}
View Source
var LCSSName = map[uint8]string{
	SingleFragment: "single fragment",
	FirstFragment:  "first fragment",
	LastFragment:   "last fragment",
	Continuation:   "continuation",
}

LCSSName is a map of LCSS fragment type to string.

View Source
var ManufacturerName = map[uint8]string{
	0x00: "Reserved",
	0x01: "Reserved",
	0x02: "Reserved",
	0x03: "Reserved",
	0x04: "Flyde Micro Ltd.",
	0x05: "PROD-EL SPA",
	0x06: "Trident Datacom DBA Trident Micro Systems",
	0x07: "RADIODATA GmbH",
	0x08: "HYT science tech",
	0x09: "ASELSAN Elektronik Sanayi ve Ticaret A.S.",
	0x0a: "Kirisun Communications Co. Ltd",
	0x0b: "DMR Association Ltd.",
	0x10: "Motorola Ltd.",
	0x13: "EMC S.p.A. (Electronic Marketing Company)",
	0x1c: "EMC S.p.A. (Electronic Marketing Company)",
	0x20: "JVCKENWOOD Corporation",
	0x33: "Radio Activity Srl",
	0x3c: "Radio Activity Srl",
	0x58: "Tait Electronics Ltd",
	0x68: "HYT science tech",
	0x77: "Vertex Standard",
}

http://www.etsi.org/images/files/DMRcodes/dmrs-mfid.xls

View Source
var ResponseTypeName = map[uint8]string{
	ResponseTypeACK:              "ACK",
	ResponseTypeIllegalFormat:    "illegal format",
	ResponseTypePacketCRCFailed:  "packet CRC failed",
	ResponseTypeMemoryFull:       "memory full",
	ResponseTypeRecvFSVNOutOfSeq: "recv FSN out of sequence",
	ResponseTypeUndeliverable:    "undeliverable",
	ResponseTypeRecvPktOutOfSeq:  "recv PKT our of sequence",
	ResponseTypeDisallowed:       "disallowed",
	ResponseTypeSelectiveACK:     "selective ACK",
}
View Source
var ServiceAccessPointName = map[uint8]string{
	ServiceAccessPointUDT:                    "UDT",
	ServiceAccessPointTCPIPHeaderCompression: "TCP/IP header compression",
	ServiceAccessPointUDPIPHeaderCompression: "UDP/IP header compression",
	ServiceAccessPointIPBasedPacketData:      "IP based packet data",
	ServiceAccessPointARP:                    "ARP",
	ServiceAccessPointProprietaryData:        "proprietary data",
	ServiceAccessPointShortData:              "short data",
}
View Source
var (
	SyncPatternName = map[uint8]string{
		SyncPatternBSSourcedVoice: "bs sourced voice",
		SyncPatternBSSourcedData:  "bs sourced data",
		SyncPatternMSSourcedVoice: "ms sourced voice",
		SyncPatternMSSourcedData:  "ms sourced data",
		SyncPatternMSSourcedRC:    "ms sourced rc",
		SyncPatternDirectVoiceTS1: "direct voice ts1",
		SyncPatternDirectDataTS1:  "direct data ts1",
		SyncPatternDirectVoiceTS2: "direct voice ts2",
		SyncPatternDirectDataTS2:  "direct data ts2",
		SyncPatternUnknown:        "unknown",
	}
)
View Source
var UDTFormatName = map[uint8]string{
	UDTFormatBinary:            "binary",
	UDTFormatMSAddress:         "MS address",
	UDTFormat4BitBCD:           "4-bit BCD",
	UDTFormatISO_7BitChars:     "ISO 7-bit characters",
	UDTFormatISO_8BitChars:     "ISO 8-bit characters",
	UDTFormatNMEALocation:      "NMEA location",
	UDTFormatIPAddress:         "IP address",
	UDTFormat16BitUnicodeChars: "16-bit Unicode characters",
	UDTFormatCustomCodeD1:      "custom code D1",
	UDTFormatCustomCodeD2:      "custom code D2",
}

Functions

func BitsToBytes

func BitsToBytes(bits []byte) []byte

BitsToBytes converts a byte slice of bits to a byte slice.

func BuildMessageData

func BuildMessageData(msg string, ddFormat uint8, nullTerminated bool) ([]byte, error)

func BytesToBits

func BytesToBits(data []byte) []byte

BytesToBits converts a byte slice to a byte slice representing the individual data bits.

func ParseEMBBitsFromSync

func ParseEMBBitsFromSync(sync []byte) ([]byte, error)

ParseEMBBitsFromSync extracts the embedded signalling bits from the SYNC bits.

func ParseEmbeddedSignallingLCFromSyncBits

func ParseEmbeddedSignallingLCFromSyncBits(sync []byte) ([]byte, error)

ParseEmbeddedSignallingLCFromSyncBits extracts the embedded signalling LC from the SYNC bits.

func ParseMessageData

func ParseMessageData(data []byte, ddFormat uint8, nullTerminated bool) (string, error)

func SyncPattern

func SyncPattern(bits []byte) uint8

Types

type ConfirmedData

type ConfirmedData struct {
	PadOctetCount          uint8
	FullMessage            bool
	BlocksToFollow         uint8
	Resync                 bool
	SendSequenceNumber     uint8
	FragmentSequenceNumber uint8
}

func (ConfirmedData) String

func (d ConfirmedData) String() string

func (ConfirmedData) Write

func (d ConfirmedData) Write(data []byte) error

type ControlBlock

type ControlBlock struct {
	CRC          uint16
	Last         bool
	Opcode       uint8
	SrcID, DstID uint32
	Data         ControlBlockData
}

func ParseControlBlock

func ParseControlBlock(data []byte) (*ControlBlock, error)

func (*ControlBlock) Bytes

func (cb *ControlBlock) Bytes() ([]byte, error)

func (*ControlBlock) String

func (cb *ControlBlock) String() string

type ControlBlockData

type ControlBlockData interface {
	String() string
	Write([]byte) error
	Parse([]byte) error
}

type DataBlock

type DataBlock struct {
	Serial uint8
	CRC    uint16
	OK     bool
	Data   []byte
	Length uint8
}

func ParseDataBlock

func ParseDataBlock(data []byte, dataType uint8, confirmed bool) (*DataBlock, error)

func (*DataBlock) Bytes

func (db *DataBlock) Bytes(dataType uint8, confirmed bool) []byte

type DataFragment

type DataFragment struct {
	Data   []byte
	Stored int
	Needed int
	CRC    uint32
}

func CombineDataBlocks

func CombineDataBlocks(blocks []*DataBlock) (*DataFragment, error)

func (*DataFragment) DataBlocks

func (df *DataFragment) DataBlocks(dataType uint8, confirm bool) ([]*DataBlock, error)

type DataHeader

type DataHeader struct {
	PacketFormat       uint8
	DstIsGroup         bool
	ResponseRequested  bool
	HeaderCompression  bool
	ServiceAccessPoint uint8
	DstID              uint32
	SrcID              uint32
	CRC                uint16
	Data               DataHeaderData
}

func ParseDataHeader

func ParseDataHeader(data []byte, proprietary bool) (*DataHeader, error)

func (*DataHeader) Bytes

func (h *DataHeader) Bytes() ([]byte, error)

func (DataHeader) String

func (h DataHeader) String() string

type DataHeaderData

type DataHeaderData interface {
	String() string
	Write([]byte) error
}

type EMB

type EMB struct {
	ColorCode uint8
	LCSS      uint8
}

EMB contains embedded signalling.

func ParseEMB

func ParseEMB(bits []byte) (*EMB, error)

ParseEMB parses embedded signalling

func (*EMB) String

func (emb *EMB) String() string

type EmbeddedSignallingLC

type EmbeddedSignallingLC struct {
	Bits     []byte
	Checksum []byte
}

EmbeddedSignallingLC contains the embedded signalling LC and checksum.

func DeinterleaveEmbeddedSignallingLC

func DeinterleaveEmbeddedSignallingLC(bits []byte) (*EmbeddedSignallingLC, error)

DeinterleaveEmbeddedSignallingLC deinterleaves the embedded signalling LC bits.

func (*EmbeddedSignallingLC) Check

func (eslc *EmbeddedSignallingLC) Check() bool

Check verifies the checksum in the embedded signalling LC.

func (*EmbeddedSignallingLC) Interleave

func (eslc *EmbeddedSignallingLC) Interleave() []byte

Interleave packs the embedded signalling LC to interleaved bits.

type NegativeAcknowledgeResponse

type NegativeAcknowledgeResponse struct {
	SourceType  bool
	ServiceType uint8
	Reason      uint8
}

func (*NegativeAcknowledgeResponse) Parse

func (d *NegativeAcknowledgeResponse) Parse(data []byte) error

func (*NegativeAcknowledgeResponse) String

func (d *NegativeAcknowledgeResponse) String() string

func (*NegativeAcknowledgeResponse) Write

func (d *NegativeAcknowledgeResponse) Write(data []byte) error

type OutboundActivation

type OutboundActivation struct{}

func (*OutboundActivation) Parse

func (d *OutboundActivation) Parse(data []byte) error

func (*OutboundActivation) String

func (d *OutboundActivation) String() string

func (*OutboundActivation) Write

func (d *OutboundActivation) Write(data []byte) error

type Packet

type Packet struct {
	// 0 for slot 1, 1 for slot 2
	Timeslot uint8

	// Starts at zero for each incoming transmission, wraps back to zero when 256 is reached
	Sequence uint8

	// Source and destination DMR ID
	SrcID uint32
	DstID uint32

	// 3 bytes registered DMR-ID for public repeaters, 4 bytes for private repeaters
	RepeaterID uint32

	// Random or incremented number which stays the same from PTT-press to PTT-release which identifies a stream
	StreamID uint32

	// Data Type or Slot type
	DataType uint8

	// 0 for group call, 1 for unit to unit
	CallType uint8

	// The on-air DMR data with possible FEC fixes to the AMBE data and/or Slot Type and/or EMB, etc
	Data []byte // 34 bytes
	Bits []byte // 264 bits
}

Packet represents a frame transported by the Air Interface

func (*Packet) EMBBits

func (p *Packet) EMBBits() []byte

EMBBits returns the frame EMB bits from the SYNC bits

func (*Packet) InfoBits

func (p *Packet) InfoBits() []byte

InfoBits returns the frame Info bits

func (*Packet) SetData

func (p *Packet) SetData(data []byte)

func (*Packet) SlotType

func (p *Packet) SlotType() []byte

SlotType returns the frame Slot Type parsed from the Slot Type bits

func (*Packet) SlotTypeBits

func (p *Packet) SlotTypeBits() []byte

SlotTypeBits returns the SloT Type bits

func (*Packet) SyncBits

func (p *Packet) SyncBits() []byte

SyncBits returns the frame SYNC bits

func (*Packet) VoiceBits

func (p *Packet) VoiceBits() []byte

VoiceBits returns the bits containing voice data

type PacketFunc

type PacketFunc func(Repeater, *Packet) error

PacketFunc is a callback function that handles DMR packets

type Preamble

type Preamble struct {
	DataFollows bool
	DstIsGroup  bool
	Blocks      uint8
}

func (*Preamble) Parse

func (d *Preamble) Parse(data []byte) error

func (*Preamble) String

func (d *Preamble) String() string

func (*Preamble) Write

func (d *Preamble) Write(data []byte) error

type ProprietaryData

type ProprietaryData struct {
	ManufacturerID uint8
}

func (ProprietaryData) String

func (d ProprietaryData) String() string

func (ProprietaryData) Write

func (d ProprietaryData) Write(data []byte) error

type Repeater

type Repeater interface {
	Active() bool
	Close() error
	ListenAndServe() error
	Send(*Packet) error

	GetPacketFunc() PacketFunc
	SetPacketFunc(PacketFunc)
}

Repeater implements a repeater station.

type ResponseData

type ResponseData struct {
	BlocksToFollow uint8
	ClassType      uint8 // See ResponseType map above
	Status         uint8
}

func (ResponseData) String

func (d ResponseData) String() string

func (ResponseData) Write

func (d ResponseData) Write(data []byte) error

type ShortDataDefinedData

type ShortDataDefinedData struct {
	AppendedBlocks uint8
	DDFormat       uint8
	Resync         bool
	FullMessage    bool
	BitPadding     uint8
}

func (ShortDataDefinedData) String

func (d ShortDataDefinedData) String() string

func (ShortDataDefinedData) Write

func (d ShortDataDefinedData) Write(data []byte) error

type ShortDataRawData

type ShortDataRawData struct {
	AppendedBlocks uint8
	SrcPort        uint8
	DstPort        uint8
	Resync         bool
	FullMessage    bool
	BitPadding     uint8
}

func (ShortDataRawData) String

func (d ShortDataRawData) String() string

func (ShortDataRawData) Write

func (d ShortDataRawData) Write(data []byte) error

type UDTData

type UDTData struct {
	Format            uint8
	PadNibble         uint8
	AppendedBlocks    uint8
	SupplementaryFlag bool
	Opcode            uint8
}

func (UDTData) String

func (d UDTData) String() string

func (UDTData) Write

func (d UDTData) Write(data []byte) error

type UnconfirmedData

type UnconfirmedData struct {
	PadOctetCount          uint8
	FullMessage            bool
	BlocksToFollow         uint8
	FragmentSequenceNumber uint8
}

func (UnconfirmedData) String

func (d UnconfirmedData) String() string

func (UnconfirmedData) Write

func (d UnconfirmedData) Write(data []byte) error

type UnitToUnitVoiceServiceAnswerResponse

type UnitToUnitVoiceServiceAnswerResponse struct {
	Options  uint8
	Response uint8
}

func (*UnitToUnitVoiceServiceAnswerResponse) Parse

func (*UnitToUnitVoiceServiceAnswerResponse) String

func (*UnitToUnitVoiceServiceAnswerResponse) Write

type UnitToUnitVoiceServiceRequest

type UnitToUnitVoiceServiceRequest struct {
	Options uint8
}

func (*UnitToUnitVoiceServiceRequest) Parse

func (d *UnitToUnitVoiceServiceRequest) Parse(data []byte) error

func (*UnitToUnitVoiceServiceRequest) String

func (*UnitToUnitVoiceServiceRequest) Write

func (d *UnitToUnitVoiceServiceRequest) Write(data []byte) error

Directories

Path Synopsis
crc
crc16
Package crc16 implements the 16-bit cyclic redundancy check, or CRC-16, checksum.
Package crc16 implements the 16-bit cyclic redundancy check, or CRC-16, checksum.
quadres_16_7
Package quadres_16_7 implements the quadratic residue (16, 7, 6) parity check.
Package quadres_16_7 implements the quadratic residue (16, 7, 6) parity check.
Package homebrew implements the Home Brew DMR IPSC protocol
Package homebrew implements the Home Brew DMR IPSC protocol
Package ipsc implements the Motorola IP Site Connect protocol.
Package ipsc implements the Motorola IP Site Connect protocol.
lc
Package vbptc implements the Variable length BPTC for embedded signalling
Package vbptc implements the Variable length BPTC for embedded signalling

Jump to

Keyboard shortcuts

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