31 lines
660 B
Go
31 lines
660 B
Go
package protocol
|
|
|
|
// Packet represents a raw packet.
|
|
type Packet struct {
|
|
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
|
|
}
|
|
|
|
type Device interface {
|
|
// Close the device.
|
|
Close() error
|
|
}
|
|
|
|
// Receiver of packets.
|
|
type Receiver interface {
|
|
Device
|
|
|
|
// RawPackets starts receiving raw packets.
|
|
RawPackets() <-chan *Packet
|
|
}
|
|
|
|
// Transmitter of packets.
|
|
type Transmitter interface {
|
|
Device
|
|
|
|
// SendRawPacket sends a raw (encoded) packet.
|
|
SendRawPacket(*Packet) error
|
|
}
|