connect

package
v0.0.0-...-f470ccd Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ApiURI = "https://api.mps.ford.com/api/fordconnect"
View Source
const (
	ApplicationID = "AFDC085B-377A-4351-B23E-5E1D35FB3700"
)
View Source
const StatusSuccess = "SUCCESS"

Variables

This section is empty.

Functions

func NewIdentity

func NewIdentity(log *util.Logger, id, secret string, token *oauth2.Token) oauth2.TokenSource

NewIdentity creates FordConnect token source

func Oauth2Config

func Oauth2Config(id, secret string) *oauth2.Config

Types

type API

type API struct {
	*request.Helper
}

API is the Ford api client

func NewAPI

func NewAPI(log *util.Logger, ts oauth2.TokenSource) *API

NewAPI creates a new api client

func (*API) Status

func (v *API) Status(vin string) (Vehicle, error)

func (*API) VIN

func (v *API) VIN(id string) (string, error)

VIN returns the vehicle's vIN

func (*API) Vehicles

func (v *API) Vehicles() ([]Vehicle, error)

Vehicles returns the list of user vehicles

type InformationResponse

type InformationResponse struct {
	Status  string
	Vehicle Vehicle
}

type Provider

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

func NewProvider

func NewProvider(api *API, vin string, cache time.Duration) *Provider

func (*Provider) Odometer

func (v *Provider) Odometer() (float64, error)

Odometer implements the api.VehicleOdometer interface

func (*Provider) Position

func (v *Provider) Position() (float64, float64, error)

Position implements the api.VehiclePosition interface

func (*Provider) Range

func (v *Provider) Range() (int64, error)

Range implements the api.VehicleRange interface

func (*Provider) Soc

func (v *Provider) Soc() (float64, error)

Soc implements the api.Battery interface

func (*Provider) Status

func (v *Provider) Status() (api.ChargeStatus, error)

Status implements the api.ChargeState interface

type TimedValue

type TimedValue struct {
	Value           float64
	DistanceToEmpty float64
	Timestamp       Timestamp // "05-24-2024 15:58:56"
}

type Timestamp

type Timestamp struct {
	time.Time
}

func (*Timestamp) UnmarshalJSON

func (ts *Timestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes Ford timestamps into time.Time

type Vehicle

type Vehicle struct {
	VehicleID                     string
	Make                          string
	ModelName                     string
	ModelYear                     string
	Color                         string
	NickName                      string
	LastUpdated                   string
	VehicleAuthorizationIndicator int
	ServiceCompatible             bool
	EngineType                    string
	VehicleDetails                VehicleDetails
	VehicleStatus                 VehicleStatus
	VehicleLocation               VehicleLocation
}

type VehicleDetails

type VehicleDetails struct {
	FuelLevel, BatteryChargeLevel TimedValue
	Mileage, Odometer             float64
}

type VehicleLocation

type VehicleLocation struct {
	Speed     float64   // 0,
	Direction string    // "SOUTHEAST",
	TimeStamp Timestamp // "05-24-2024 15:58:56",
	Longitude float64   `json:",string"`
	Latitude  float64   `json:",string"`
}

type VehicleStatus

type VehicleStatus struct {
	ChargingStatus struct {
		Value           string    // "NotReady",
		TimeStamp       Timestamp // "05-24-2024 15:58:56",
		ChargeStartTime Timestamp // "01-01-2010 00:00:00",
		ChargeEndTime   Timestamp // "05-24-2024 15:33:00"
	}
	PlugStatus struct {
		Value     bool      // false,
		TimeStamp Timestamp // "05-24-2024 15:58:56"
	}
}

type VehiclesResponse

type VehiclesResponse struct {
	Vehicles []Vehicle
}

Jump to

Keyboard shortcuts

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