ipsc

package
v0.0.0-...-e993038 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package ipsc implements the Motorola IP Site Connect protocol.

Index

Constants

View Source
const (
	FlagPeerOperational = 0x40
	MaskPeerMode        = 0x30
	FlagPeerModeAnalog  = 0x10
	FlagPeerModeDigital = 0x20
	MaskIPSCTS1         = 0x0c
	MaskIPSCTS2         = 0x03
	FlagIPSCTS1On       = 0x08
	FlagIPSCTS1Off      = 0x04
	FlagIPSCTS2On       = 0x02
	FlagIPSCTS2Off      = 0x01
)

Linking status

Byte 1 - BIT FLAGS:

	xx.. .... = Peer Operational (01 only known valid value)
	..xx .... = Peer MODE: 00 - No Radio, 01 - Analog, 10 - Digital
	.... xx.. = IPSC Slot 1: 10 on, 01 off
	.... ..xx = IPSC Slot 2: 10 on, 01 off
View Source
const (
	FlagCSBKMessage            = 0x80
	FlagRepeaterCallMonitoring = 0x40
	FlagConsoleApplication     = 0x20
)

Service flags

Byte 1 - 0x00  	= Unknown
Byte 2 - 0x00	= Unknown
Byte 3 - BIT FLAGS:

	x... .... = CSBK Message
	.x.. .... = Repeater Call Monitoring
	..x. .... = 3rd Party "Console" Application
	...x xxxx = Unknown - default to 0
View Source
const (
	FlagXNLStatus           = 0x80
	FlagXNLMaster           = 0x40
	FlagXNLSlave            = 0x20
	FlagPacketAuthenticated = 0x10
	FlagDataCall            = 0x08
	FlagVoiceCall           = 0x04
	FlagMasterPeer          = 0x01
)

Byte 4 = BIT FLAGS:

x... .... = XNL Connected (1=true)
.x.. .... = XNL Master Device
..x. .... = XNL Slave Device
...x .... = Set if packets are authenticated
.... x... = Set if data calls are supported
.... .x.. = Set if voice calls are supported
.... ..x. = Unknown - default to 0
.... ...x = Set if master
View Source
const (
	// IPSC Version Information
	Version14  byte = 0x00
	Version15  byte = 0x00
	Version15A byte = 0x00
	Version16  byte = 0x01
	Version17  byte = 0x02
	Version18  byte = 0x02
	Version19  byte = 0x03
	Version22  byte = 0x04

	// Known IPSC Message Types
	CallConfirmation          byte = 0x05 // Confirmation FROM the recipient of a confirmed call.
	TextMessageAck            byte = 0x54 // Doesn't seem to mean success, though. This code is sent success or failure
	CallMonStatus             byte = 0x61 //  |
	CallMonRepeat             byte = 0x62 //  | Exact meaning unknown
	CallMonNACK               byte = 0x63 //  |
	XCMPXNLControl            byte = 0x70 // XCMP/XNL control message
	GroupVoice                byte = 0x80
	PVTVoice                  byte = 0x81
	GroupData                 byte = 0x83
	PVTData                   byte = 0x84
	RPTWakeUp                 byte = 0x85 // Similar to OTA DMR "wake up"
	UnknownCollision          byte = 0x86 // Seen when two dmrlinks try to transmit at once
	MasterRegistrationRequest byte = 0x90 // FROM peer TO master
	MasterRegistrationReply   byte = 0x91 // FROM master TO peer
	PeerListRequest           byte = 0x92 // From peer TO master
	PeerListReply             byte = 0x93 // From master TO peer
	PeerRegistrationRequest   byte = 0x94 // Peer registration request
	PeerRegistrationReply     byte = 0x95 // Peer registration reply
	MasterAliveRequest        byte = 0x96 // FROM peer TO master
	MasterAliveReply          byte = 0x97 // FROM master TO peer
	PeerAliveRequest          byte = 0x98 // Peer keep alive request
	PeerAliveReply            byte = 0x99 // Peer keep alive reply
	DeregistrationRequest     byte = 0x9a // Request de-registration from system
	DeregistrationReply       byte = 0x9b // De-registration reply

	// Link Type Values
	LinkTypeIPSC byte = 0x04
)
View Source
const (
	VoiceLCHeader    uint16 = 0x1111
	TerminatorWithLC uint16 = 0x2222
	CSBK             uint16 = 0x3333
	DataHeader       uint16 = 0x4444
	Rate12Data       uint16 = 0x5555
	Rate34Data       uint16 = 0x6666
	VoiceDataA       uint16 = 0xbbbb
	VoiceDataB       uint16 = 0xcccc
	VoiceDataC       uint16 = 0x7777
	VoiceDataD       uint16 = 0x8888
	VoiceDataE       uint16 = 0x9999
	VoiceDataF       uint16 = 0xaaaa
	IPSCSync         uint16 = 0xeeee
	UnknownSlotType  uint16 = 0x0000
)
View Source
const (
	CallTypePrivate uint8 = iota
	CallTypeGroup
)

Variables

View Source
var (
	TimeslotName = map[uint8]string{
		0x00: "TS1",
		0x01: "TS2",
	}
	FrameTypeName = map[uint8]string{
		0x00: "voice",
		0x01: "voice sync",
		0x02: "data sync",
		0x03: "unused",
	}
	SlotTypeName = map[uint16]string{
		0x0000: "unknown",
		0x1111: "voice LC header",
		0x2222: "terminator with LC",
		0x3333: "CSBK",
		0x4444: "data header",
		0x5555: "rate 1/2 data",
		0x6666: "rate 3/4 data",
		0x7777: "voice data C",
		0x8888: "voice data D",
		0x9999: "voice data E",
		0xaaaa: "voice data F",
		0xbbbb: "voice data A",
		0xcccc: "voice data B",
		0xeeee: "IPSC sync",
	}
	CallTypeName = map[uint8]string{
		0x00: "private",
		0x01: "group",
	}
)
View Source
var MasterRequired = map[byte]bool{
	PeerListReply:    true,
	MasterAliveReply: true,
}
View Source
var UserGenerated = map[byte]bool{
	GroupVoice: true,
	PVTVoice:   true,
	GroupData:  true,
	PVTData:    true,
}

Functions

func SwapPayloadBytes

func SwapPayloadBytes(payload []byte)

Types

type IPSC

type IPSC struct {
	Network *Network
	Dump    bool
	// contains filtered or unexported fields
}

func New

func New(network *Network) (*IPSC, error)

func (*IPSC) Run

func (c *IPSC) Run() error

type Mask

type Mask uint8
const (
	// Byte 1
	RTPVersionMask Mask = 0xc0
	RTPPadMask     Mask = 0x20
	RTPExtMask     Mask = 0x10
	RTPCSICMask    Mask = 0x0f
	// Byte 2
	RTPMRKRMask    Mask = 0x80
	RTPPayTypeMask Mask = 0xf7
)

RTP mask values

Bytes 1 and 2 of the RTP header are bit-fields, the rest are at least
one byte long, and do not need masked.

type Network

type Network struct {
	Disabled                   bool
	RadioID                    uint32
	AliveTimer                 time.Duration
	MaxMissed                  int
	IPSCMode                   string
	PeerOperDisabled           bool
	TS1LinkDisabled            bool
	TS2LinkDisabled            bool
	CSBKCall                   bool
	RepeaterCallMonitoring     bool `yaml:"rcm"`
	ConsoleApplicationDisabled bool
	XNLCall                    bool
	XNLMaster                  bool
	DataCall                   bool
	VoiceCall                  bool
	MasterPeer                 bool
	AuthKey                    string
	Master                     string
	MasterID                   uint32
	Listen                     string
}

type Packet

type Packet struct {
	Timeslot  uint8 // 0=ts1, 1=ts2
	FrameType uint8
	SlotType  uint16
	CallType  uint8 // 0=private, 1=group
	SrcID     uint32
	DstID     uint32
	Payload   []byte // 34 bytes
	Bits      []byte // 264 bits
	Sequence  uint8
}

func (*Packet) Dump

func (p *Packet) Dump() string

func (*Packet) InfoBits

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

func (*Packet) VoiceBits

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

Jump to

Keyboard shortcuts

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