acars

package module
v0.0.0-...-8e89532 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2015 License: Zlib Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CpdlcRATypeR  = "R"  // C->P Expects "ROGER"
	CpdlcRATypeWU = "WU" // C->P Expects "WILCO"/"UNABLE"
	CpdlcRATypeAN = "AN" // C->P Expects "AFFIRM"/"NEGATIVE"
	CpdlcRATypeNE = "NE" // C->P Self-closing (Not-Enabled)
	CpdlcRATypeY  = "Y"  // P->C Expects Controller Response
	CpdlcRATypeN  = "N"  // P->C Self-closing (No response expected)
)
View Source
const (
	MsgTypeProgress = MsgType("progress")
	MsgTypeCPDLC    = MsgType("cpdlc")
	MsgTypeTelex    = MsgType("telex")
	MsgTypePing     = MsgType("ping")
	MsgTypePosReq   = MsgType("posreq")
	MsgTypePosition = MsgType("position")
	MsgTypeDataReq  = MsgType("datareq")
	MsgTypePoll     = MsgType("poll")
	MsgTypePeek     = MsgType("peek")
	MsgTypeAdsC     = MsgType("ads-c")
)

Variables

View Source
var (
	ErrMalformedAcarsMessage    = errors.New("Malformed ACARS message recieved")
	ErrInvalidMessageId         = errors.New("Message ID Invalid")
	ErrUnknownMessageFormat     = errors.New("Unknown Message Format")
	ErrUnsupportedMessageFormat = errors.New("Unsupported Message Format")
)

Functions

This section is empty.

Types

type AcarsError

type AcarsError struct {
	// contains filtered or unexported fields
}

this type of error is thrown by the acars service

func (*AcarsError) Error

func (err *AcarsError) Error() string

type CpdlcMessage

type CpdlcMessage struct {
	ID          int
	ReferenceID *int
	RAType      string
	Body        CpdlcString
}

func DecodeCpdlcMessage

func DecodeCpdlcMessage(msgIn string) (cpdlc *CpdlcMessage, err error)

DecodeCpdlcMessage translates a multipart CPDLC into a cpdlc message

func (*CpdlcMessage) Decode

func (cpdlc *CpdlcMessage) Decode(msgIn string) (err error)

func (*CpdlcMessage) WireString

func (cpdlc *CpdlcMessage) WireString() string

type CpdlcString

type CpdlcString string

A CpdlcString is an Hoppie's ACARS encoded CPDLC message with it's native encoding

func NewCpdlcString

func NewCpdlcString(strIn string) CpdlcString

NewCpdlcString encodes a platform neutral string into Hoppie's CPDLC format

func (CpdlcString) String

func (str CpdlcString) String() string

String returns the platform neutral encoding

type Message

type Message struct {
	From    string  // sending station ID
	Type    MsgType // message type
	Message string  // payload
}

Message represents a single subpayload from an ACARS server (as part of a peek or poll)

func ParseMessage

func ParseMessage(raw tclmanip.TclList) *Message

ParseMessage takes a raw message (as recieved from the server) and parses it into our internal Message format

func (*Message) Decode

func (msg *Message) Decode() (decodedMsg interface{}, err error)

Decode translates the Message (payload) into a useful form if able.

func (*Message) String

func (msg *Message) String() string

String provides a human interpretable version of the CPDLC message

type MsgType

type MsgType string

func (MsgType) String

func (mt MsgType) String() string

type PollResponse

type PollResponse struct {
	Status   string
	Messages []Message
}

type Request

type Request struct {
	Logon  string  `form:"logon"`
	From   string  `form:"from"`
	To     string  `form:"to"`
	Type   MsgType `form:"type"`
	Packet string  `form:"packet"`
}

func (*Request) ToValues

func (req *Request) ToValues() (val url.Values)

type Server

type Server struct {
	BaseUrl     string
	Logon       string
	StationName string
}

Server represents all of the necessary state to talk to Hoppie's ACARS

func New

func New(baseUrl, logon, stationName string) (srv *Server, err error)

New creates a new Server with which you can communicate with an ACARS server.

It will validate the URL provided in baseUrl. It currently does not validate the logon.

func (*Server) Do

func (srv *Server) Do(req *Request) (resp tclmanip.TclList, err error)

Do performs an ACARS operation.

req contains the fully populated ACARS request (logon, from, to, type, packet) resp contains the data sent back by the server encapsulated as a tclmanip.TclList. err contains the error if one was encountered during the request.

func (*Server) Peek

func (srv *Server) Peek() (messages []*Message, err error)

Peek performs an ACARS Peek (fetch without update)

messages contains the list of responses provided by the server

func (*Server) Ping

func (srv *Server) Ping(recipient string) (extraResp tclmanip.TclList, err error)

Ping performs an ACARS ping to the recipient specified.

extraResp contains the response after the "ok", if recieved.

func (*Server) Poll

func (srv *Server) Poll() (messages []*Message, err error)

Poll performs an ACARS Poll (fetch with update)

messages contains the list of responses provided by the server

type WireMsg

type WireMsg interface {
	// Convert the message to a format suitable for conveying over the wire
	WireString() string
	// Decode a message via this type
	Decode(protocolIn string) error
}

WireMsg is the interface to which all ACARS service encoded messages shall conform.

Jump to

Keyboard shortcuts

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