Documentation
¶
Index ¶
- func BurstFromArray(data []byte) burst.Burst
- type Client
- type Command
- type DeregistrationRequestPacket
- type LinkType
- type MasterKeepAliveReplyPacket
- type MasterKeepAliveRequestPacket
- type MasterRegistrationReplyPacket
- type MasterRegistrationRequestPacket
- type Packet
- type PacketHandler
- type Peer
- type PeerKeepAliveReplyPacket
- type PeerKeepAliveRequestPacket
- type PeerListReplyPacket
- type PeerListRequestPacket
- type PeerRegistrationReplyPacket
- type PeerRegistrationRequestPacket
- type RTPData
- type RadioID
- type UnknownPacket
- type UserPacket
- type XnlPacket
- type XnlPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BurstFromArray ¶
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 (*Client) RegisterHandler ¶
func (c *Client) RegisterHandler(cmd Command, handlerFunc PacketHandler)
RegisterHandler registers a function to be called anytime a certain packet type is recieved
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 ¶
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 ¶
func (p DeregistrationRequestPacket) GetID() RadioID
GetID returns the RadioID for the packet
func (DeregistrationRequestPacket) ToArray ¶
func (p DeregistrationRequestPacket) ToArray() []byte
ToArray converts a packet to a byte array
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 ¶
func (p MasterKeepAliveReplyPacket) GetID() RadioID
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 ¶
func (p MasterKeepAliveRequestPacket) GetID() RadioID
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 ¶
func (p MasterRegistrationReplyPacket) GetID() RadioID
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 ¶
func (p MasterRegistrationRequestPacket) GetCommand() Command
GetCommand returns the command for the packet
func (MasterRegistrationRequestPacket) GetID ¶
func (p MasterRegistrationRequestPacket) GetID() RadioID
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 ¶
Packet is a data structure sent over UDP to a radio system
func CreatePacketFromArray ¶
CreatePacketFromArray creates a Mototrbo packet from an array
type PacketHandler ¶
PacketHandler is a function to handle a particular type of packet
type PeerKeepAliveReplyPacket ¶
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 ¶
func (p PeerKeepAliveReplyPacket) GetID() RadioID
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 ¶
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 ¶
func (p PeerKeepAliveRequestPacket) GetID() RadioID
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 ¶
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 ¶
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 ¶
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 ¶
func (p PeerRegistrationReplyPacket) GetID() RadioID
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 ¶
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 ¶
func (p PeerRegistrationRequestPacket) GetID() RadioID
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 ¶
RTPFromArray converts RTP Data from an array
type UnknownPacket ¶
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 ¶
XnlPacket an XNL data packet
func NewXNLXCMPPacketByArray ¶
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 ¶
GetCommand returns the command for the packet
Source Files
¶
- DeregistrationRequest.go
- MasterKeepAliveReply.go
- MasterKeepAliveRequest.go
- MasterRegistrationReply.go
- MasterRegistrationRequest.go
- PeerKeepAliveReply.go
- PeerKeepAliveRequest.go
- PeerListReply.go
- PeerListRequest.go
- PeerRegistrationReply.go
- PeerRegistrationRequest.go
- UserPacket.go
- XnlPacket.go
- client.go
- packet.go
- unknown.go