fanet

package module
v0.0.0-...-6ed1fea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 11 Imported by: 0

README ยถ

go-fanet

PkgGoDev

Package fanet parses and generates FANET sentences.

License

MIT

Documentation ยถ

Overview ยถ

Package fanet generates and parses FANET sentences.

See https://github.com/3s1d/fanet-stm32. See https://github.com/3s1d/fanet-stm32/blob/master/fanet_module.pdf. See https://github.com/3s1d/fanet-stm32/blob/master/Src/fanet/radio/protocol.txt.

Index ยถ

Constants ยถ

This section is empty.

Variables ยถ

View Source
var AircraftTypes = map[int]string{
	0: "Other",
	1: "Paraglider",
	2: "Hangglider",
	3: "Balloon",
	4: "Glider",
	5: "Powered Aircraft",
	6: "Helicopter",
	7: "UAV",
}
View Source
var GroundTrackingTypes = map[int]string{
	0:  "Other",
	1:  "Walking",
	2:  "Vehicle",
	3:  "Bike",
	4:  "Boot",
	8:  "Need a ride",
	9:  "Landed well",
	12: "Need technical support",
	13: "Need medical help",
	14: "Distress call",
	15: "Distress call automatically",
}
View Source
var ManufacturerNames = map[int]string{
	0x00: "[reserved]",
	0x01: "Skytraxx",
	0x03: "BitBroker.eu",
	0x04: "AirWhere",
	0x05: "Windline",
	0x06: "Burnair.ch",
	0x07: "SoftRF",
	0x08: "GXAircom",
	0x09: "Airtribune",
	0x10: "alfapilot",
	0x0A: "FLARM",
	0x11: "FANET+",
	0x20: "XC Tracer",
	0xBA: "Burnair",
	0xCB: "CloudBuddy",
	0xE0: "OGN Tracker",
	0xE4: "4aviation",
	0xFA: "Various",
	0xFB: "Expressif",
	0xFC: "Unregistered",
	0xFD: "Unregistered",
	0xFE: "[Multicast]",
	0xFF: "[reserved]",
}

Functions ยถ

This section is empty.

Types ยถ

type Command ยถ

type Command interface {
	Sentence() string
}

func ParseCommand ยถ

func ParseCommand(data []byte) (Command, error)

ParseCommand parses a response from data.

func ParseCommandString ยถ

func ParseCommandString(s string) (Command, error)

ParseCommandString parses a response from s.

type DBGCommand ยถ

type DBGCommand struct {
	Zones    []string
	Severity string
}

A DBGCommand is a DBG command.

func (*DBGCommand) Sentence ยถ

func (c *DBGCommand) Sentence() string

type DBRResponse ยถ

type DBRResponse struct {
	Type      string
	Status    int
	StatusStr string
}

An DBRResponse is an DBR response.

func (*DBRResponse) Address ยถ

func (r *DBRResponse) Address() string

func (*DBRResponse) Err ยถ

func (r *DBRResponse) Err() error

type DGJCommand ยถ

type DGJCommand struct {
	Bootloader string
}

A DGJCommand is a DGJ command.

func (*DGJCommand) Sentence ยถ

func (c *DGJCommand) Sentence() string

type DGLCommand ยถ

type DGLCommand struct {
	Frequency int
	DBm       int
}

A DGLCommand is a DGL command.

func (*DGLCommand) Sentence ยถ

func (c *DGLCommand) Sentence() string

type DGPCommand ยถ

type DGPCommand struct {
	PowerMode bool
}

func (*DGPCommand) Sentence ยถ

func (c *DGPCommand) Sentence() string

type DGPResponse ยถ

type DGPResponse struct {
	PowerMode bool
}

func (*DGPResponse) Address ยถ

func (r *DGPResponse) Address() string

type DGRResponse ยถ

type DGRResponse struct {
	Type      string
	Status    int
	StatusStr string
}

A DGRResponse is a DGR response.

func (*DGRResponse) Address ยถ

func (r *DGRResponse) Address() string

func (*DGRResponse) Err ยถ

func (r *DGRResponse) Err() error

type DGVCommand ยถ

type DGVCommand struct{}

A DGVCommand is a DGV command.

func (DGVCommand) Sentence ยถ

func (DGVCommand) Sentence() string

type DGVResponse ยถ

type DGVResponse struct {
	BuildDateCode string
}

A DGVResponse is a DGV response.

func (*DGVResponse) Address ยถ

func (r *DGVResponse) Address() string

type FAOResponse ยถ

type FAOResponse struct {
	Source       int
	ID           ID
	IDType       int
	AircraftType int
	Latitude     float64
	Longitude    float64
	Altitude     float64
	GroundSpeed  float64
	ClimbRate    float64
	Track        float64
}

An FAOResponse is an FAO response.

func (*FAOResponse) Address ยถ

func (r *FAOResponse) Address() string

type FAPCommand ยถ

type FAPCommand struct {
	PowerMode bool
}

func (*FAPCommand) Sentence ยถ

func (c *FAPCommand) Sentence() string

type FARResponse ยถ

type FARResponse struct {
	Type      string
	Status    int
	StatusStr string
}

A FARResponse is a FAR response.

func (*FARResponse) Address ยถ

func (r *FARResponse) Address() string

func (*FARResponse) Err ยถ

func (r *FARResponse) Err() error

type FATCommand ยถ

type FATCommand struct {
	Delay time.Duration
}

A FATCommand is a FAT command.

func (*FATCommand) Sentence ยถ

func (c *FATCommand) Sentence() string

type FAXCommand ยถ

type FAXCommand struct{}

A FAXCommand is a FAX command.

func (FAXCommand) Sentence ยถ

func (FAXCommand) Sentence() string

type FAXResponse ยถ

type FAXResponse struct {
	Date time.Time
}

A FAXResponse is a FAX response.

func (*FAXResponse) Address ยถ

func (r *FAXResponse) Address() string

type FNACommand ยถ

type FNACommand struct{}

An FNACommand is an FNA command.

func (FNACommand) Sentence ยถ

func (FNACommand) Sentence() string

type FNAResponse ยถ

type FNAResponse struct {
	ID ID
}

An FNAResponse is an FNA response.

func (*FNAResponse) Address ยถ

func (r *FNAResponse) Address() string

type FNCCommand ยถ

type FNCCommand struct {
	AircraftType int
	LiveTracking bool
	GroundType   int
}

func (*FNCCommand) Sentence ยถ

func (c *FNCCommand) Sentence() string

type FNFAck ยถ

type FNFAck struct{}

An FNFAck is an FNF ack payload.

type FNFGroundTracking ยถ

type FNFGroundTracking struct {
	Latitude       float64
	Longitude      float64
	Type           int
	OnlineTracking bool
}

An FNFGroundTracking is an FNF ground tracking payload.

type FNFHardwareInfo ยถ

type FNFHardwareInfo struct {
	IsPingPongRequest bool
	HardwareSubtype   Optional[int]
	ReleaseVersion    Optional[bool]
	BuildDate         Optional[time.Time]
	ICAOAddress       Optional[[3]byte]
	Uptime            Optional[time.Duration]
	RSSI              Optional[int]
	FANETAddress      Optional[[3]byte]
}

An FNFHardwareInfo is an FNF hardware info payload.

type FNFMessage ยถ

type FNFMessage struct {
	SubType uint8
	Message string
}

An FNFMessage is an FNF message payload.

type FNFName ยถ

type FNFName struct {
	Name string
}

An FNFName is an FNF name payload.

func (*FNFName) FNFType ยถ

func (n *FNFName) FNFType() int

func (*FNFName) Payload ยถ

func (n *FNFName) Payload() ([]byte, error)

type FNFResponse ยถ

type FNFResponse struct {
	Source    ID
	Broadcast bool
	Signature Optional[int]
	Type      int
	Payload   []byte
}

An FNFResponse is an FNF response.

func (*FNFResponse) Address ยถ

func (r *FNFResponse) Address() string

func (*FNFResponse) ParsePayload ยถ

func (r *FNFResponse) ParsePayload() (any, error)

type FNFTracking ยถ

type FNFTracking struct {
	Latitude       float64
	Longitude      float64
	OnlineTracking bool
	Type           int
	Altitude       int
	SpeedKPH       float64
	Climb          float64
	Heading        float64
	TurnRate       Optional[float64]
	QNEOffset      Optional[int]
}

An FNFTracking is an FNF tracking payload.

type FNMCommand ยถ

type FNMCommand struct {
	Mode int
}

func (*FNMCommand) Sentence ยถ

func (c *FNMCommand) Sentence() string

type FNRResponse ยถ

type FNRResponse struct {
	Type        string
	Status      int
	StatusStr   string
	Destination ID
}

An FNRResponse is an FNR response.

func (*FNRResponse) Address ยถ

func (r *FNRResponse) Address() string

func (*FNRResponse) Err ยถ

func (r *FNRResponse) Err() error

type FNSCommand ยถ

type FNSCommand struct {
	Latitude        float64
	Longitude       float64
	Altitude        float64
	SpeedKPH        float64
	Climb           float64
	Heading         float64
	Time            time.Time
	GeoidSeparation Optional[float64]
	TurnRate        Optional[float64]
	QNEOffset       Optional[float64]
}

An FNSCommand is an FNS command.

func (*FNSCommand) Sentence ยถ

func (c *FNSCommand) Sentence() string

type FNTCommand ยถ

type FNTCommand struct {
	Type        int
	Destination ID
	Forward     bool
	AckRequired bool
	Payload     []byte
	Signature   Optional[int]
}

An FNTCommand is an FNT request.

func (*FNTCommand) Sentence ยถ

func (c *FNTCommand) Sentence() string

type FNZResponse ยถ

type FNZResponse struct {
	Zone     int
	ZoneName string
}

An FNZResponse is an FNZ response.

func (*FNZResponse) Address ยถ

func (r *FNZResponse) Address() string

type ID ยถ

type ID struct {
	Manufacturer int
	Device       int
}

func (ID) Int ยถ

func (id ID) Int() int

func (ID) IsZero ยถ

func (id ID) IsZero() bool

func (ID) MarshalText ยถ

func (id ID) MarshalText() ([]byte, error)

func (*ID) Set ยถ

func (id *ID) Set(s string) error

func (ID) String ยถ

func (id ID) String() string

func (ID) Type ยถ

func (ID) Type() string

type Optional ยถ

type Optional[T any] struct {
	Value T
	Valid bool
}

func NewOptional ยถ

func NewOptional[T any](value T) Optional[T]

func (Optional[T]) MarshalJSON ยถ

func (o Optional[T]) MarshalJSON() ([]byte, error)

func (*Optional[T]) UnmarshalJSON ยถ

func (o *Optional[T]) UnmarshalJSON(data []byte) error

type Response ยถ

type Response interface {
	Address() string
}

func ParseResponse ยถ

func ParseResponse(data []byte) (Response, error)

ParseResponse parses a response from data.

func ParseResponseString ยถ

func ParseResponseString(s string) (Response, error)

ParseResponseString parses a response from s.

type SyntaxError ยถ

type SyntaxError struct {
	Data []byte
	Pos  int
	Err  error
}

func (*SyntaxError) Error ยถ

func (e *SyntaxError) Error() string

func (*SyntaxError) Unwrap ยถ

func (e *SyntaxError) Unwrap() error

Directories ยถ

Path Synopsis
cmd
fanet2json command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL