Documentation ¶
Overview ¶
Copyright (C) 2019 Graeme Sutherland, Nodestone Limited
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2019 Graeme Sutherland, Nodestone Limited ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2019 Graeme Sutherland, Nodestone Limited ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2019 Graeme Sutherland, Nodestone Limited ¶
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Index ¶
- Constants
- Variables
- func EncodePayload(verb MessageVerb, payload Payload) []byte
- func ProtocolVersionBytes() []byte
- func ProtocolVersionString() string
- func UDPConnection() *net.UDPConn
- func UDPRx(ctx context.Context, address *net.UDPAddr, messages chan RxMSG)
- func UDPTx(verb MessageVerb, payload Payload, resolvedAddress *net.UDPAddr)
- type BitEvent
- type Callsign
- type CarrierBitEvent
- type CarrierEventPayload
- type CarrierKeyType
- type ChannelIdType
- type KeyValuePayload
- type ListChannelsPayload
- type ListenConfirmPayload
- type ListenRequestPayload
- type MessageVerb
- type Payload
- type RelType
- type RxMSG
- type TimeSyncPayload
- type TimeSyncResponsePayload
- type UnlistenPayload
- type Version
- type VersionInfoPayload
Constants ¶
const CallsignSize = 16
const MaxBitEvents = (MaxMessageSizeInBytes - 22) / 5
slightly random
const MaxChannelsPerMessage int = (MaxMessageSizeInBytes - 1) / 2
List of Channels
const MaxMessageSizeInBytes = 200
conservative UDP payload in bytes
const MaxNsPerCarrierEvent = 2 ^ 32
Variables ¶
Functions ¶
func EncodePayload ¶
func EncodePayload(verb MessageVerb, payload Payload) []byte
func ProtocolVersionBytes ¶
func ProtocolVersionBytes() []byte
func ProtocolVersionString ¶
func ProtocolVersionString() string
func UDPConnection ¶
Types ¶
type Callsign ¶
type Callsign = [CallsignSize]byte
type CarrierBitEvent ¶
Offset allows for about 4 seconds of offset
type CarrierEventPayload ¶
type CarrierEventPayload struct { Channel ChannelIdType CarrierKey CarrierKeyType StartTimeStamp int64 BitEvents [MaxBitEvents]CarrierBitEvent SendTime int64 }
type CarrierKeyType ¶
type CarrierKeyType = uint16
type ChannelIdType ¶
type ChannelIdType = uint16
type KeyValuePayload ¶
type KeyValuePayload struct { Channel ChannelIdType CarrierKey CarrierKeyType Key [8]byte Value [16]byte }
type ListChannelsPayload ¶
type ListChannelsPayload struct {
Channels [MaxChannelsPerMessage]uint16
}
type ListenConfirmPayload ¶
type ListenConfirmPayload struct { Channel ChannelIdType CarrierKey CarrierKeyType }
type ListenRequestPayload ¶
type ListenRequestPayload struct { Channel ChannelIdType Callsign [16]byte }
type MessageVerb ¶
type MessageVerb = byte
const ( EnumerateChannels MessageVerb = 0x90 ListChannels MessageVerb = 0x91 TimeSync MessageVerb = 0x92 TimeSyncResponse MessageVerb = 0x93 ListenRequest MessageVerb = 0x94 ListenConfirm MessageVerb = 0x95 Unlisten MessageVerb = 0x96 KeyValue MessageVerb = 0x81 CarrierEvent MessageVerb = 0x82 VersionInfo MessageVerb = 0x97 )
func DecodePacket ¶
func DecodePacket(lineBuffer []byte) (MessageVerb, interface{})
type RxMSG ¶
type RxMSG struct { Verb MessageVerb Payload Payload SrcAddress net.UDPAddr RxTime int64 }
type TimeSyncResponsePayload ¶
type UnlistenPayload ¶
type UnlistenPayload struct { Channel ChannelIdType CarrierKey CarrierKeyType }