fiat

package
v0.0.0-...-da4a797 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiURI  = "https://channels.sdpr-01.fcagcv.com"
	ApiKey  = "3_mOx_J2dRgjXYCdyhchv3b5lhi54eBcdCTX4BI8MORqmZCoQWhA0mV2PTlptLGUQI"
	XApiKey = "qLYupk65UU1tw2Ih1cJhs4izijgRDbir2UFHA3Je"

	AuthURI     = "https://mfa.fcl-01.fcagcv.com"
	XAuthApiKey = "JWRYW7IYhW9v0RqDghQSx4UcRYRILNmc8zAuh5ys"
)
View Source
const (
	LoginURI = "https://loginmyuconnect.fiat.com"
	TokenURI = "https://authz.sdpr-01.fcagcv.com/v2/cognito/identity/token"

	Region = "eu-west-1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	*request.Helper
	// contains filtered or unexported fields
}

API is an api.Vehicle implementation for Fiat cars

func NewAPI

func NewAPI(log *util.Logger, identity *Identity) *API

func (*API) Action

func (v *API) Action(vin, pin, action, cmd string) (ActionResponse, error)

func (*API) Location

func (v *API) Location(vin string) (LocationResponse, error)

func (*API) Status

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

func (*API) Vehicles

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

type ActionResponse

type ActionResponse struct {
	Name, Message string

	// deep refresh
	Command          string
	CorrelationId    string
	ResponseStatus   string
	StatusTimestamp  TimeMillis
	AsyncRespTimeout int
}

type ErrorInfo

type ErrorInfo struct {
	ErrorCode    int
	ErrorMessage string
	ErrorDetails string
}

func (ErrorInfo) Error

func (e ErrorInfo) Error() error

type Identity

type Identity struct {
	*request.Helper
	// contains filtered or unexported fields
}

func NewIdentity

func NewIdentity(log *util.Logger, user, password string) *Identity

NewIdentity creates Fiat identity

func (*Identity) Login

func (v *Identity) Login() error

Login authenticates with username/password to get new aws credentials

func (*Identity) Sign

func (v *Identity) Sign(req *http.Request, body io.ReadSeeker) error

Sign signs an AWS request using identity's credentials

func (*Identity) UID

func (v *Identity) UID() string

UID returns the logged in users uid

type LocationResponse

type LocationResponse struct {
	TimeStamp        TimeMillis
	Longitude        float64
	Latitude         float64
	Altitude         float64
	Bearing          float64
	IsLocationApprox bool
}

type PinAuthResponse

type PinAuthResponse struct {
	Name, Message string
	Token         string
	Expiry        int64 // ms duration
}

type Provider

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

func NewProvider

func NewProvider(api *API, vin, pin string, expiry, 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.Vehicle interface

func (*Provider) Status

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

Status implements the api.ChargeState interface

type StatusResponse

type StatusResponse struct {
	VehicleInfo struct {
		Odometer struct {
			Odometer struct {
				Value int `json:",string"`
				Unit  string
			}
		}
		Timestamp TimeMillis
	}
	EvInfo *struct {
		Battery struct {
			ChargingLevel   string // LEVEL_2
			ChargingStatus  string // CHARGING
			DistanceToEmpty struct {
				Value int
				Unit  string
			}
			PlugInStatus        bool    // true
			StateOfCharge       float64 // 75
			TimeToFullyChargeL1 int     // 0
			TimeToFullyChargeL2 int     // 540
			TotalRange          int     // 17
		}
		Timestamp TimeMillis
	} `json:",omitempty"`
	Timestamp TimeMillis
}

type TimeMillis

type TimeMillis struct {
	time.Time
}

TimeMillis implements JSON unmarshal for Unix timestamps in milliseconds

func (*TimeMillis) UnmarshalJSON

func (ct *TimeMillis) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes unix timestamps in ms into time.Time

type Vehicle

type Vehicle struct {
	VIN string
}

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