inreach

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FieldID is the DeLorme internal ID for the event
	FieldID = "Id"
	// FieldTimeUTC is the US-formatted version of the event timestamp as UTC.
	FieldTimeUTC = "Time UTC"
	// FieldTime is the US-formatted version of the event timestamp in the preferred
	// timezone of the account owner.
	FieldTime = "Time"
	// FieldName is the First and last name of the user assigned to the device that
	// sent the message.
	FieldName = "Name"
	// FieldMapDisplayName is the Map Display Name for this user. This field is editable
	// by the user in their Account or Settings page.
	FieldMapDisplayName = "Map Display Name"
	// FieldDeviceType is the hardware type of the device in use. Recent types are:
	// DeLorme D1, InReach Zigbee, InReach Bluetooth, inReach SE, and inReach 2.5.
	// The D1 is known as model 1.0, the Zigbee and Bluetooth are model 1.5,
	// and most 2.5 devices are the Explorer model.
	FieldDeviceType = "Device Type"
	// FieldIMEI is the IMEI of the device sending the message.
	FieldIMEI = "IMEI"
	// FieldIncidentID is the emergency incident, if any.
	FieldIncidentID = "Incident Id"
	// FieldLatitude is the latitude in degrees WGS84, where negative is south of the equator.
	FieldLatitude = "Latitude"
	// FieldLongitude is the longitude in degrees WGS84, where negative is west of the Prime Meridian.
	FieldLongitude = "Longitude"
	// FieldElevation is the meters from Mean Sea Level.
	FieldElevation = "Elevation"
	// FieldVelocity is the ground speed of the device. Value is always in kilometers per hour.
	FieldVelocity = "Velocity"
	// FieldCourse is the approximate direction of travel of the device, always in true degrees.
	// Value is accurate to one of sixteen compass points only.
	FieldCourse = "Course"
	// FieldValidGPSFix is True if the device’s GPS unit has a fix. This is not a measure of
	// quality of the GPS fix. However, it is unlikely that any point will be provided without
	// a valid GPS fix.
	FieldValidGPS = "Valid GPS Fix"
	// FieldInEmergency is true if the device is in SOS state.
	FieldInEmergency = "In Emergency"
	// FieldText is the message text, if any, in Unicode.
	FieldText = "Text"
	// FieldEvent is the event log type. See `Events` table below.
	FieldEvent = "Event"
)
View Source
const (
	DateFormat = "2006-01-02T00:00z"
)

Variables

This section is empty.

Functions

func Events

func Events() map[int]string

Events IDs and descriptions from InReach

Types

type APIOption

type APIOption func(url.Values) error

APIOption for configuring API requests

func WithDateRange

func WithDateRange(before, after time.Time) APIOption

WithDateRange sets the date range for events

type Client

type Client struct {
	Feed *FeedService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(opts ...Option) (*Client, error)

NewClient creates a new client and applies all provided Options

type Data

type Data struct {
	Text  string `xml:",chardata"`
	Name  string `xml:"name,attr"`
	Value string `xml:"value"`
}

type Document

type Document struct {
	Text   string  `xml:",chardata"`
	Name   string  `xml:"name"`
	Folder *Folder `xml:"Folder"`
}

type ExtendedData

type ExtendedData struct {
	Text string  `xml:",chardata"`
	Data []*Data `xml:"Data"`
}

type Fault

type Fault struct {
	Code    int    `xml:"status_code"`
	Message string `xml:"msg"`
}

func (*Fault) Error

func (f *Fault) Error() string

type FeedService

type FeedService service

FeedService returns a feed of tracking points

func (*FeedService) Feed

func (s *FeedService) Feed(ctx context.Context, user string, opts ...APIOption) (*KML, error)

Feed returns the feed for the user in the (optionally) specified time range

type Folder

type Folder struct {
	Text      string       `xml:",chardata"`
	Name      string       `xml:"name"`
	Placemark []*Placemark `xml:"Placemark"`
}

type KML

type KML struct {
	XMLName  xml.Name  `xml:"kml"`
	Text     string    `xml:",chardata"`
	XSD      string    `xml:"xsd,attr"`
	XSI      string    `xml:"xsi,attr"`
	XMLNS    string    `xml:"xmlns,attr"`
	Document *Document `xml:"Document"`
}

func (*KML) GeoJSON

func (k *KML) GeoJSON() (*geojson.FeatureCollection, error)

type LineString

type LineString struct {
	Text        string `xml:",chardata"`
	Tessellate  string `xml:"tessellate"`
	Coordinates string `xml:"coordinates"`
}

type Option

type Option func(*Client) error

Option provides a configuration mechanism for a Client

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL specifies the base url

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets the underlying http client.

func WithHTTPTracing

func WithHTTPTracing(debug bool) Option

WithHTTPTracing enables tracing http calls.

func WithTransport

func WithTransport(t http.RoundTripper) Option

WithTransport sets the underlying http client transport.

type Placemark

type Placemark struct {
	Text         string        `xml:",chardata"`
	Name         string        `xml:"name"`
	Visibility   string        `xml:"visibility"`
	Description  string        `xml:"description"`
	TimeStamp    *TimeStamp    `xml:"TimeStamp"`
	StyleURL     string        `xml:"styleUrl"`
	ExtendedData *ExtendedData `xml:"ExtendedData"`
	Point        *Point        `xml:"Point"`
	LineString   *LineString   `xml:"LineString"`
}

type Point

type Point struct {
	Text         string `xml:",chardata"`
	Extrude      string `xml:"extrude"`
	AltitudeMode string `xml:"altitudeMode"`
	Coordinates  string `xml:"coordinates"`
}

type TimeStamp

type TimeStamp struct {
	Text string `xml:",chardata"`
	When string `xml:"when"`
}

Jump to

Keyboard shortcuts

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