43 lines
964 B
Go
43 lines
964 B
Go
package protocol
|
|
|
|
import (
|
|
"time"
|
|
|
|
"git.maze.io/go/ham/radio"
|
|
)
|
|
|
|
// Protocol standard names (as used in this package).
|
|
const (
|
|
ADSB = "adsb"
|
|
APRS = "aprs"
|
|
APRS_IS = "aprsis"
|
|
AX25 = "ax25"
|
|
LoRa = "lora"
|
|
MeshCore = "meshcore"
|
|
Meshtastic = "meshtastic"
|
|
)
|
|
|
|
// Packet represents a raw packet.
|
|
type Packet struct {
|
|
Time time.Time `json:"time,omitempty"` // Receive time stamp
|
|
Protocol string `json:"protocol"` // Protocol name
|
|
SNR float64 `json:"snr"` // Signal-to-noise Ratio
|
|
RSSI int8 `json:"rssi"` // Received Signal Strength Indicator
|
|
Raw []byte `json:"raw"` // Raw packet
|
|
}
|
|
|
|
// Receiver of packets.
|
|
type PacketReceiver interface {
|
|
radio.Device
|
|
|
|
// RawPackets starts receiving raw packets.
|
|
RawPackets() <-chan *Packet
|
|
}
|
|
|
|
type PacketTransmitter interface {
|
|
radio.Device
|
|
|
|
// SendRawPacket sends a raw (encoded) packet.
|
|
SendRawPacket(*Packet) error
|
|
}
|