vatsimapi

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2022 License: CC0-1.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	VatsimAPIURL = "https://data.vatsim.net/v3/vatsim-data.json"

	ObjectTypeController pubsub.ObjectType = iota + 1
	ObjectTypePilot
)
View Source
const (
	FacilityATIS     = 1
	FacilityDelivery = 2
	FacilityGround   = 3
	FacilityTower    = 4
	FacilityApproach = 5
	FacilityRadar    = 6
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.1.0

type Config struct {
	URL  string                       `mapstructure:"url,omitempty"`
	Poll simwatchproviders.PollConfig `mapstructure:"poll"`
	Boot simwatchproviders.BootConfig `mapstructure:"boot,omitempty"`
}

type Controller

type Controller struct {
	Cid           int       `json:"cid"`
	Name          string    `json:"name"`
	Callsign      string    `json:"callsign"`
	Frequency     float64   `json:"frequency"`
	Facility      Facility  `json:"facility"`
	Rating        int       `json:"rating"`
	Server        string    `json:"server"`
	VisualRange   int       `json:"visual_range"`
	AtisCode      string    `json:"atis_code,omitempty"`
	TextAtis      string    `json:"text_atis"`
	LastUpdated   time.Time `json:"last_updated"`
	LogonTime     time.Time `json:"logon_time"`
	HumanReadable string    `json:"human_readable"`
}

func (Controller) NE

func (c Controller) NE(o Controller) bool

type Data

type Data struct {
	General     General       `json:"general"`
	Pilots      []VPilot      `json:"pilots"`
	Controllers []VController `json:"controllers"`
	ATIS        []VController `json:"atis"`
}

Data represents all the dynamic data with helper methods and index maps

type Facility

type Facility int

type FlightPlan

type FlightPlan struct {
	FlightRules string `json:"flight_rules"`
	Aircraft    string `json:"aircraft"`
	Departure   string `json:"departure"`
	Arrival     string `json:"arrival"`
	Alternate   string `json:"alternate"`
	CruiseTas   string `json:"cruise_tas"`
	Altitude    string `json:"altitude"`
	Deptime     string `json:"deptime"`
	EnrouteTime string `json:"enroute_time"`
	FuelTime    string `json:"fuel_time"`
	Remarks     string `json:"remarks"`
	Route       string `json:"route"`
}

FlightPlan is a VATSIM flight plan

type General

type General struct {
	Version          int    `json:"version"`
	Reload           int    `json:"reload"`
	Update           string `json:"update"`
	UpdateTimestamp  string `json:"update_timestamp"`
	ConnectedClients int    `json:"connected_clients"`
	UniqueUsers      int    `json:"unique_users"`
}

General is a VATSIM data header

type Pilot

type Pilot struct {
	Cid         int         `json:"cid"`
	Name        string      `json:"name"`
	Callsign    string      `json:"callsign"`
	Server      string      `json:"server"`
	PilotRating int         `json:"pilot_rating"`
	Latitude    float64     `json:"latitude"`
	Longitude   float64     `json:"longitude"`
	Altitude    int         `json:"altitude"`
	Groundspeed int         `json:"groundspeed"`
	Transponder string      `json:"transponder"`
	Heading     int         `json:"heading"`
	QnhIHg      float64     `json:"qnh_i_hg"`
	QnhMb       int         `json:"qnh_mb"`
	FlightPlan  *FlightPlan `json:"flight_plan"`
	LogonTime   time.Time   `json:"logon_time"`
	LastUpdated time.Time   `json:"last_updated"`
}

func (Pilot) NE

func (p Pilot) NE(o Pilot) bool

type Provider

type Provider struct {
	*pubsub.Provider
	// contains filtered or unexported fields
}

func New

func New(cfg *Config) *Provider

func (*Provider) Start

func (p *Provider) Start() error

func (*Provider) Stop

func (p *Provider) Stop()

type VController

type VController struct {
	Cid         int      `json:"cid"`
	Name        string   `json:"name"`
	Callsign    string   `json:"callsign"`
	Frequency   string   `json:"frequency"`
	Facility    int      `json:"facility"`
	Rating      int      `json:"rating"`
	Server      string   `json:"server"`
	VisualRange int      `json:"visual_range"`
	AtisCode    string   `json:"atis_code,omitempty"`
	TextAtis    []string `json:"text_atis"`
	LastUpdated string   `json:"last_updated"`
	LogonTime   string   `json:"logon_time"`
}

Controller is a VATSIM controller

type VPilot

type VPilot struct {
	Cid         int         `json:"cid"`
	Name        string      `json:"name"`
	Callsign    string      `json:"callsign"`
	Server      string      `json:"server"`
	PilotRating int         `json:"pilot_rating"`
	Latitude    float64     `json:"latitude"`
	Longitude   float64     `json:"longitude"`
	Altitude    int         `json:"altitude"`
	Groundspeed int         `json:"groundspeed"`
	Transponder string      `json:"transponder"`
	Heading     int         `json:"heading"`
	QnhIHg      float64     `json:"qnh_i_hg"`
	QnhMb       int         `json:"qnh_mb"`
	FlightPlan  *FlightPlan `json:"flight_plan"`
	LogonTime   string      `json:"logon_time"`
	LastUpdated string      `json:"last_updated"`
}

Pilot is a VATSIM pilot

Jump to

Keyboard shortcuts

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