mototrbo

package
v0.0.0-...-7f53359 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BurstFromArray

func BurstFromArray(data []byte) burst.Burst

BurstFromArray convers Burst Data from an array

Types

type Client

type Client struct {
	PacketsIn chan Packet
	// contains filtered or unexported fields
}

Client descripes a Mototrbo Network Client

func NewClient

func NewClient(address string) (*Client, error)

NewClient creates a new Client instance

func (*Client) Close

func (c *Client) Close()

Close ends the UDP connecton

func (*Client) RegisterHandler

func (c *Client) RegisterHandler(cmd Command, handlerFunc PacketHandler)

RegisterHandler registers a function to be called anytime a certain packet type is recieved

func (*Client) SendPacket

func (c *Client) SendPacket(pkt Packet, addr *net.UDPAddr)

SendPacket sends a MotoPacket to the radio

type Command

type Command byte

Command represents a command byte for the Mototrbo radios

const (
	// XnlXcmpPacket represents an XNL data packet
	XnlXcmpPacket Command = 0x70
	// GroupVoiceCall represents a group voice call
	GroupVoiceCall Command = 0x80
	// PrivateVoiceCall represents a private voice call
	PrivateVoiceCall Command = 0x81
	// GroupDataCall represents a group data call
	GroupDataCall Command = 0x83
	// PrivateDataCall represents a private data call
	PrivateDataCall Command = 0x84
	// RegistrationRequest represents a request to register with the master
	RegistrationRequest Command = 0x90
	// RegistrationReply represents a reply to registeration request
	RegistrationReply Command = 0x91
	// PeerListRequest represnets a request for the peer list
	PeerListRequest Command = 0x92
	// PeerListReply represnets a reply of the peer list
	PeerListReply Command = 0x93
	// PeerRegisterRequest represents a request to register with a peer
	PeerRegisterRequest Command = 0x94
	// PeerRegisterReply represents a reply to registeration request
	PeerRegisterReply Command = 0x95
	// MasterKeepAliveRequest ask the master to send a keep alive reply
	MasterKeepAliveRequest Command = 0x96
	// MasterKeepAliveReply a reply from the master to a keep alive request
	MasterKeepAliveReply Command = 0x97
	// PeerKeepAliveRequest ask the peer to send a keep alive reply
	PeerKeepAliveRequest Command = 0x98
	// PeerKeepAliveReply a reply from a peer to a keep alive request
	PeerKeepAliveReply Command = 0x99
	// DeregisterRequest a request to deregister from the master
	DeregisterRequest Command = 0x9A
)

type DeregistrationRequestPacket

type DeregistrationRequestPacket struct {
	Command Command
	ID      RadioID
}

DeregistrationRequestPacket a request to a master to deregister

func NewDeregistrationPacketByArray

func NewDeregistrationPacketByArray(data []byte) (DeregistrationRequestPacket, error)

NewDeregistrationPacketByArray create an deregistration packet from data array

func NewDeregistrationPacketByParam

func NewDeregistrationPacketByParam(id RadioID) DeregistrationRequestPacket

NewDeregistrationPacketByParam create deregistration packet from params

func (DeregistrationRequestPacket) GetCommand

func (p DeregistrationRequestPacket) GetCommand() Command

GetCommand returns the command for the packet

func (DeregistrationRequestPacket) GetID

GetID returns the RadioID for the packet

func (DeregistrationRequestPacket) ToArray

func (p DeregistrationRequestPacket) ToArray() []byte

ToArray converts a packet to a byte array

type LinkType

type LinkType byte

LinkType the type of link to the system

const (
	// IPSiteConnect the system is an IP Site Connect System
	IPSiteConnect LinkType = 0x04
	// CapacityPlus the system is a Capacity Plus System
	CapacityPlus LinkType = 0x08
)

type MasterKeepAliveReplyPacket

type MasterKeepAliveReplyPacket struct {
	Command  Command
	ID       RadioID
	Digital  bool
	CSBK     bool
	LinkType LinkType
}

MasterKeepAliveReplyPacket a request to a Master to register

func NewKeepAliveReplyPacketByArray

func NewKeepAliveReplyPacketByArray(data []byte) (MasterKeepAliveReplyPacket, error)

NewKeepAliveReplyPacketByArray create an registration packet from data array

func NewKeepAliveReplyPacketByParam

func NewKeepAliveReplyPacketByParam(id RadioID, digital bool, csbk bool, linkType LinkType) MasterKeepAliveReplyPacket

NewKeepAliveReplyPacketByParam create registration packet from params

func (MasterKeepAliveReplyPacket) GetCommand

func (p MasterKeepAliveReplyPacket) GetCommand() Command

GetCommand returns the command for the packet

func (MasterKeepAliveReplyPacket) GetID

GetID returns the RadioID for the packet

func (MasterKeepAliveReplyPacket) ToArray

func (p MasterKeepAliveReplyPacket) ToArray() []byte

ToArray converts a packet to a byte array

type MasterKeepAliveRequestPacket

type MasterKeepAliveRequestPacket struct {
	Command  Command
	ID       RadioID
	Digital  bool
	CSBK     bool
	LinkType LinkType
}

MasterKeepAliveRequestPacket a request to a Master to register

func NewMasterKeepAliveRequestPacketByArray

func NewMasterKeepAliveRequestPacketByArray(data []byte) (MasterKeepAliveRequestPacket, error)

NewMasterKeepAliveRequestPacketByArray create an registration packet from data array

func NewMasterKeepAliveRequestPacketByParam

func NewMasterKeepAliveRequestPacketByParam(id RadioID, digital bool, csbk bool, linkType LinkType) MasterKeepAliveRequestPacket

NewMasterKeepAliveRequestPacketByParam create registration packet from params

func (MasterKeepAliveRequestPacket) GetCommand

func (p MasterKeepAliveRequestPacket) GetCommand() Command

GetCommand returns the command for the packet

func (MasterKeepAliveRequestPacket) GetID

GetID returns the RadioID for the packet

func (MasterKeepAliveRequestPacket) ToArray

func (p MasterKeepAliveRequestPacket) ToArray() []byte

ToArray converts a packet to a byte array

type MasterRegistrationReplyPacket

type MasterRegistrationReplyPacket struct {
	Command  Command
	ID       RadioID
	Digital  bool
	CSBK     bool
	LinkType LinkType
}

MasterRegistrationReplyPacket a request to a Master to register

func NewRegistrationReplyPacketByArray

func NewRegistrationReplyPacketByArray(data []byte) (MasterRegistrationReplyPacket, error)

NewRegistrationReplyPacketByArray create an registration packet from data array

func NewRegistrationReplyPacketByParam

func NewRegistrationReplyPacketByParam(id RadioID, digital bool, csbk bool, linkType LinkType) MasterRegistrationReplyPacket

NewRegistrationReplyPacketByParam create registration packet from params

func (MasterRegistrationReplyPacket) GetCommand

func (p MasterRegistrationReplyPacket) GetCommand() Command

GetCommand returns the command for the packet

func (MasterRegistrationReplyPacket) GetID

GetID returns the RadioID for the packet

func (MasterRegistrationReplyPacket) ToArray

func (p MasterRegistrationReplyPacket) ToArray() []byte

ToArray converts a packet to a byte array

type MasterRegistrationRequestPacket

type MasterRegistrationRequestPacket struct {
	Command  Command
	ID       RadioID
	Digital  bool
	CSBK     bool
	LinkType LinkType
}

MasterRegistrationRequestPacket a request to a Master to register

func NewRegistrationPacketByArray

func NewRegistrationPacketByArray(data []byte) (MasterRegistrationRequestPacket, error)

NewRegistrationPacketByArray create an registration packet from data array

func NewRegistrationPacketByParam

func NewRegistrationPacketByParam(id RadioID, digital bool, csbk bool, linkType LinkType) MasterRegistrationRequestPacket

NewRegistrationPacketByParam create registration packet from params

func (MasterRegistrationRequestPacket) GetCommand

GetCommand returns the command for the packet

func (MasterRegistrationRequestPacket) GetID

GetID returns the RadioID for the packet

func (MasterRegistrationRequestPacket) ToArray

func (p MasterRegistrationRequestPacket) ToArray() []byte

ToArray converts a packet to a byte array

type Packet

type Packet interface {
	GetCommand() Command
	GetID() RadioID
	ToArray() []byte
}

Packet is a data structure sent over UDP to a radio system

func CreatePacketFromArray

func CreatePacketFromArray(array []byte) (Packet, error)

CreatePacketFromArray creates a Mototrbo packet from an array

type PacketHandler

type PacketHandler func(Packet, net.Addr) bool

PacketHandler is a function to handle a particular type of packet

type Peer

type Peer struct {
	ID      RadioID
	Address string
	Port    uint16
	Mode    byte
}

Peer is a peer radio

type PeerKeepAliveReplyPacket

type PeerKeepAliveReplyPacket struct {
	Command Command
	ID      RadioID
	Digital bool
	CSBK    bool
}

PeerKeepAliveReplyPacket a request to a Master to register

func NewPeerKeepAliveReplyPacketByArray

func NewPeerKeepAliveReplyPacketByArray(data []byte) (PeerKeepAliveReplyPacket, error)

NewPeerKeepAliveReplyPacketByArray create an registration packet from data array

func NewPeerKeepAliveReplyPacketByParam

func NewPeerKeepAliveReplyPacketByParam(id RadioID, digital bool, csbk bool, linkType LinkType) PeerKeepAliveReplyPacket

NewPeerKeepAliveReplyPacketByParam create registration packet from params

func (PeerKeepAliveReplyPacket) GetCommand

func (p PeerKeepAliveReplyPacket) GetCommand() Command

GetCommand returns the command for the packet

func (PeerKeepAliveReplyPacket) GetID

GetID returns the RadioID for the packet

func (PeerKeepAliveReplyPacket) ToArray

func (p PeerKeepAliveReplyPacket) ToArray() []byte

ToArray converts a packet to a byte array

type PeerKeepAliveRequestPacket

type PeerKeepAliveRequestPacket struct {
	Command Command
	ID      RadioID
	Digital bool
	CSBK    bool
}

PeerKeepAliveRequestPacket a request to a Master to register

func NewPeerKeepAliveRequestPacketByArray

func NewPeerKeepAliveRequestPacketByArray(data []byte) (PeerKeepAliveRequestPacket, error)

NewPeerKeepAliveRequestPacketByArray create an registration packet from data array

func NewPeerKeepAliveRequestPacketByParam

func NewPeerKeepAliveRequestPacketByParam(id RadioID, digital bool, csbk bool, linkType LinkType) PeerKeepAliveRequestPacket

NewPeerKeepAliveRequestPacketByParam create registration packet from params

func (PeerKeepAliveRequestPacket) GetCommand

func (p PeerKeepAliveRequestPacket) GetCommand() Command

GetCommand returns the command for the packet

func (PeerKeepAliveRequestPacket) GetID

GetID returns the RadioID for the packet

func (PeerKeepAliveRequestPacket) ToArray

func (p PeerKeepAliveRequestPacket) ToArray() []byte

ToArray converts a packet to a byte array

type PeerListReplyPacket

type PeerListReplyPacket struct {
	Command Command
	ID      RadioID
	Peers   []Peer
}

PeerListReplyPacket a request to a master for a list of peers

func NewPeerListReplyPacketByArray

func NewPeerListReplyPacketByArray(data []byte) (PeerListReplyPacket, error)

NewPeerListReplyPacketByArray create an registration packet from data array

func NewPeerListReplyPacketByParam

func NewPeerListReplyPacketByParam(id RadioID, peers []Peer) PeerListReplyPacket

NewPeerListReplyPacketByParam create peer list request packet by params

func (PeerListReplyPacket) GetCommand

func (p PeerListReplyPacket) GetCommand() Command

GetCommand returns the command for the packet

func (PeerListReplyPacket) GetID

func (p PeerListReplyPacket) GetID() RadioID

GetID returns the RadioID for the packet

func (PeerListReplyPacket) ToArray

func (p PeerListReplyPacket) ToArray() []byte

ToArray converts a packet to a byte array

type PeerListRequestPacket

type PeerListRequestPacket struct {
	Command Command
	ID      RadioID
}

PeerListRequestPacket a request to a master for a list of peers

func NewPeerListRequestPacketByArray

func NewPeerListRequestPacketByArray(data []byte) (PeerListRequestPacket, error)

NewPeerListRequestPacketByArray create an registration packet from data array

func NewPeerListRequestPacketByParam

func NewPeerListRequestPacketByParam(id RadioID) PeerListRequestPacket

NewPeerListRequestPacketByParam create peer list request packet by params

func (PeerListRequestPacket) GetCommand

func (p PeerListRequestPacket) GetCommand() Command

GetCommand returns the command for the packet

func (PeerListRequestPacket) GetID

func (p PeerListRequestPacket) GetID() RadioID

GetID returns the RadioID for the packet

func (PeerListRequestPacket) ToArray

func (p PeerListRequestPacket) ToArray() []byte

ToArray converts a packet to a byte array

type PeerRegistrationReplyPacket

type PeerRegistrationReplyPacket struct {
	Command  Command
	ID       RadioID
	LinkType LinkType
}

PeerRegistrationReplyPacket a reply to a peer registeration

func NewPeerRegistrationReplyPacketByArray

func NewPeerRegistrationReplyPacketByArray(data []byte) (PeerRegistrationReplyPacket, error)

NewPeerRegistrationReplyPacketByArray create an registration packet from data array

func NewPeerRegistrationReplyPacketByParam

func NewPeerRegistrationReplyPacketByParam(id RadioID, linkType LinkType) PeerRegistrationReplyPacket

NewPeerRegistrationReplyPacketByParam create registration packet from params

func (PeerRegistrationReplyPacket) GetCommand

func (p PeerRegistrationReplyPacket) GetCommand() Command

GetCommand returns the command for the packet

func (PeerRegistrationReplyPacket) GetID

GetID returns the RadioID for the packet

func (PeerRegistrationReplyPacket) ToArray

func (p PeerRegistrationReplyPacket) ToArray() []byte

ToArray converts a packet to a byte array

type PeerRegistrationRequestPacket

type PeerRegistrationRequestPacket struct {
	Command  Command
	ID       RadioID
	LinkType LinkType
}

PeerRegistrationRequestPacket a request to a peer to register

func NewPeerRegistrationPacketByArray

func NewPeerRegistrationPacketByArray(data []byte) (PeerRegistrationRequestPacket, error)

NewPeerRegistrationPacketByArray create an registration packet from data array

func NewPeerRegistrationPacketByParam

func NewPeerRegistrationPacketByParam(id RadioID, linkType LinkType) PeerRegistrationRequestPacket

NewPeerRegistrationPacketByParam create registration packet from params

func (PeerRegistrationRequestPacket) GetCommand

func (p PeerRegistrationRequestPacket) GetCommand() Command

GetCommand returns the command for the packet

func (PeerRegistrationRequestPacket) GetID

GetID returns the RadioID for the packet

func (PeerRegistrationRequestPacket) ToArray

func (p PeerRegistrationRequestPacket) ToArray() []byte

ToArray converts a packet to a byte array

type RTPData

type RTPData struct {
	Version        byte
	Padding        bool
	Extension      bool
	CSRCCount      byte
	Marker         bool
	PayloadType    byte
	SequenceNumber uint16
	Timestamp      uint32
	SSRCID         uint32
}

RTPData represents the Real Time Protocol data sent by the radio

func RTPFromArray

func RTPFromArray(data []byte) RTPData

RTPFromArray converts RTP Data from an array

type RadioID

type RadioID uint32

RadioID represents a radio ID

type UnknownPacket

type UnknownPacket struct {
	Command Command
	ID      RadioID
	Payload []byte
}

UnknownPacket a Mototrbo packet of unknown type

func NewUnknownPacket

func NewUnknownPacket(array []byte) (UnknownPacket, error)

NewUnknownPacket create an unknown packet from a byte array

func (UnknownPacket) GetCommand

func (p UnknownPacket) GetCommand() Command

GetCommand returns the command for the packet

func (UnknownPacket) GetID

func (p UnknownPacket) GetID() RadioID

GetID returns the RadioID for the packet

func (UnknownPacket) ToArray

func (p UnknownPacket) ToArray() []byte

ToArray converts a packet to a byte array

type UserPacket

type UserPacket struct {
	Command     Command
	ID          RadioID
	Source      RadioID
	Destination RadioID
	Encrypted   bool //0x80
	End         bool //0x40
	TimeSlot    byte //0x20
	PhoneCall   bool //0x10
	RTP         RTPData
	Payload     burst.Burst
}

UserPacket a request to a Master to register

func NewUserPacketByArray

func NewUserPacketByArray(data []byte) (UserPacket, error)

NewUserPacketByArray create an user packet from data array

func NewUserPacketByParam

func NewUserPacketByParam(cmd Command, id RadioID, src RadioID, dest RadioID, encrypted bool, end bool, timeslot byte, phoneCall bool, rtp RTPData, payload burst.Burst) UserPacket

NewUserPacketByParam create user packet from params

func (UserPacket) GetCommand

func (p UserPacket) GetCommand() Command

GetCommand returns the command for the packet

func (UserPacket) GetID

func (p UserPacket) GetID() RadioID

GetID returns the RadioID for the packet

func (UserPacket) ToArray

func (p UserPacket) ToArray() []byte

ToArray converts a packet to a byte array

type XnlPacket

type XnlPacket struct {
	Command Command
	ID      RadioID
	Payload []byte
}

XnlPacket an XNL data packet

func NewXNLXCMPPacketByArray

func NewXNLXCMPPacketByArray(data []byte) (XnlPacket, error)

NewXNLXCMPPacketByArray create an XNL/XCMP from data array

func NewXNLXCMPPacketByParam

func NewXNLXCMPPacketByParam(id RadioID, payload XnlPayload) XnlPacket

NewXNLXCMPPacketByParam create an XNL/XCMP from params and payload

func (XnlPacket) GetCommand

func (p XnlPacket) GetCommand() Command

GetCommand returns the command for the packet

func (XnlPacket) GetID

func (p XnlPacket) GetID() RadioID

GetID returns the RadioID for the packet

func (XnlPacket) ToArray

func (p XnlPacket) ToArray() []byte

ToArray converts a packet to a byte array

type XnlPayload

type XnlPayload interface {
	ToArray() []byte
}

XnlPayload an Xnl Packet Payload

Directories

Path Synopsis
xnl

Jump to

Keyboard shortcuts

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