Documentation
¶
Overview ¶
Package aprs works with APRS string and byte packets. It can upload those packets via APRS-IS or transmit them via TNC KISS.
Index ¶
- Variables
- func DecToDMS(l float64, hems [2]string) (float64, float64, string)
- func GenPass(call string) (pass uint16)
- func RecvIS(ctx context.Context, dial string, user Addr, pass int, filters ...string) <-chan Frame
- type Addr
- type Frame
- func (f Frame) Bytes() []byte
- func (f *Frame) FromBytes(frame []byte) error
- func (f *Frame) FromString(frame string) (err error)
- func (f Frame) SendHTTP(dial string, pass int) (err error)
- func (f Frame) SendIS(dial string, pass int) error
- func (f Frame) SendKISS(dial string) (err error)
- func (f Frame) SendTCP(dial string, pass int) (err error)
- func (f Frame) SendUDP(dial string, pass int) (err error)
- func (f Frame) String() (frame string)
- type Path
- type Wx
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrCallNotVerified = errors.New("Callsign not verified") ErrFrameBadControl = errors.New("Frame Control Field not UI-frame") ErrFrameBadProto = errors.New("Frame Protocol ID not no layer 3 protocol") ErrFrameIncomplete = errors.New("Frame incomplete") ErrFrameInvalid = errors.New("Frame is invalid") ErrFrameNoLast = errors.New("Frame incomplete or last path not set") ErrFrameShort = errors.New("Frame too short (16-bytes minimum)") ErrProtoScheme = errors.New("Protocol scheme is unknown") )
Errors.
var SwName = "Go"
SwName is the default software name.
var SwVers = "3"
SwVers is the default software version.
Functions ¶
func DecToDMS ¶
decToDMS takes a float latitude or longitude and converts it to degrees, minutes (second as decimal), and a hemisphere string.
Types ¶
type Addr ¶
Addr represents an APRS callsign, SSID, and associated metadata.
func (*Addr) FromString ¶
FromString sets the address from a string.
type Frame ¶
Frame represents a complete APRS frame.
func (Frame) Bytes ¶
Bytes returns the Frame in AX.25 byte format. This is suitable for sending to a TNC.
func (*Frame) FromString ¶
FromString sets the Frame from a TNC2 formatted string.
This strictly enforces the AX.25 specification and will return errors if callsigns are greater than 6 characters or SSID's are not numeric values between 0 and 15.
func (Frame) SendHTTP ¶
SendHTTP sends a Frame to the specified APRS-IS host over the HTTP protocol. This scheme is the least efficient and requires a verified connection (real callsign and passcode) but is reliable and provides acknowledgement of receipt.
func (Frame) SendIS ¶
SendIS sends a Frame to the specified APRS-IS dial string. The dial string should be in the form scheme://host:port with scheme being http, tcp, or udp. This is most commonly used for CWOP.
func (Frame) SendKISS ¶
SendKISS sends a Frame to the specified network TNC device using the KISS protocol for transmission over RF.
func (Frame) SendTCP ¶
SendTCP sends a Frame to the specified APRS-IS host over the TCP protocol. This scheme is the oldest, most compatible, and allows unverified connections.
func (Frame) SendUDP ¶
SendUDP sends a Frame to the specified APRS-IS host over the UDP protocol. This scheme is the most efficient but requires a verified connection (real callsign and passcode) and has no acknowledgement of receipt.
func (Frame) String ¶
String returns the Frame as a TNC2 formatted string. This is suitable for sending to APRS-IS servers.
Example (Hello) ¶
f := Frame{}
f.Src.FromString("N0CALL-13")
f.Dst.FromString("APZ001")
f.Path.FromString("WIDE1-1,WIDE2-1")
f.Text = "Hello world"
fmt.Println(f)
Output: N0CALL-13>APZ001,WIDE1-1,WIDE2-1:Hello world
Example (Wx) ¶
f := Frame{}
f.FromBytes(ax25Wx1)
fmt.Println(f)
Output: KG4HIE>APK102,W4LBT-9,WIDE1,KD4PBS-3*,WIDE2:=3438.51N/07941.15W_120/001g004t073r p P000h b KU2k
Example (Wx2) ¶
f := Frame{}
f.FromBytes(ax25Wx2)
fmt.Println(f)
Output: N4MTT-2>APX209,KD4PBS-3*,WIDE2-2:@270055z3548.41N/07846.35W_360/000g000t066r000P000p000h63b10183XU2k
type Path ¶
type Path []Addr
Path represents the APRS digipath.
func (*Path) FromString ¶
FromString sets the Path from a string of comma separated addresses.
type Wx ¶
type Wx struct {
Lat float64
Lon float64
Type string
Timestamp time.Time
Altimeter float64
Humidity int
RainLastHour float64
RainLast24Hours float64
RainToday float64
SolarRad int
Temp int
WindDir int
WindGust int
WindSpeed int
}
Wx represents a weather station observation.
func (Wx) String ¶
String returns an APRS packet for the provided measurements.
Example ¶
w := testWx fmt.Println(w) SwName = "GoTst" SwVers = "9" fmt.Println(w)
Output: @052035z3542.00N/07842.00W_.../...g...t...r...p...P...h..b.....Go3-Stn @052035z3542.00N/07842.00W_.../...g...t...r...p...P...h..b.....GoTst9-Stn
Example (Altimeter) ¶
w := testWx w.Altimeter = 29.87 fmt.Println(w)
Output: @052035z3542.00N/07842.00W_.../...g...t...r...p...P...h..b10115GoTst9-Stn
Example (Humidity) ¶
w := testWx w.Humidity = 61 fmt.Println(w) w.Humidity = 100 fmt.Println(w)
Output: @052035z3542.00N/07842.00W_.../...g...t...r...p...P...h61b.....GoTst9-Stn @052035z3542.00N/07842.00W_.../...g...t...r...p...P...h00b.....GoTst9-Stn
Example (Luminosity) ¶
w := testWx w.SolarRad = 864 fmt.Println(w) w.SolarRad = 1864 fmt.Println(w)
Output: @052035z3542.00N/07842.00W_.../...g...t...r...p...P...h..b.....L864GoTst9-Stn @052035z3542.00N/07842.00W_.../...g...t...r...p...P...h..b.....l864GoTst9-Stn
Example (Rain) ¶
w := testWx w.RainLastHour = 0.0 w.RainLast24Hours = 0.0 w.RainToday = 0.0 fmt.Println(w) w.RainLastHour = 0.54 w.RainLast24Hours = 0.23 w.RainToday = 0.21 fmt.Println(w)
Output: @052035z3542.00N/07842.00W_.../...g...t...r000p000P000h..b.....GoTst9-Stn @052035z3542.00N/07842.00W_.../...g...t...r054p023P021h..b.....GoTst9-Stn
Example (Temp) ¶
w := testWx w.Temp = -20 fmt.Println(w) w.Temp = 0 fmt.Println(w) w.Temp = 72 fmt.Println(w)
Output: @052035z3542.00N/07842.00W_.../...g...t-20r...p...P...h..b.....GoTst9-Stn @052035z3542.00N/07842.00W_.../...g...t000r...p...P...h..b.....GoTst9-Stn @052035z3542.00N/07842.00W_.../...g...t072r...p...P...h..b.....GoTst9-Stn
Example (Wind) ¶
w := testWx w.WindDir = 0 w.WindSpeed = 0 w.WindGust = 0 fmt.Println(w) w.WindDir = 180 w.WindSpeed = 8 w.WindGust = 16 fmt.Println(w)
Output: @052035z3542.00N/07842.00W_000/000g000t...r...p...P...h..b.....GoTst9-Stn @052035z3542.00N/07842.00W_180/008g016t...r...p...P...h..b.....GoTst9-Stn