Files
ham/protocol/protocol.go
maze 03047907f1
Some checks failed
Run tests / test (1.25) (push) Failing after 1m0s
Run tests / test (stable) (push) Failing after 1m0s
Added StatsReceiver interface
2026-03-17 08:35:33 +01:00

49 lines
1.1 KiB
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
Radio string `json:"radio"` // Radio name/ID
SNR float64 `json:"snr"` // Signal-to-noise Ratio
RSSI int `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 StatsReceiver interface {
// Stats returns a channel that receives stats updates.
Stats() <-chan map[string]any
}
type PacketTransmitter interface {
radio.Device
// SendRawPacket sends a raw (encoded) packet.
SendRawPacket(*Packet) error
}