More protocols
This commit is contained in:
30
protocol/packet.go
Normal file
30
protocol/packet.go
Normal file
@@ -0,0 +1,30 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user