saic

package
v0.0.0-...-1470ac1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatRunning = iota
	StatValid
	StatInvalid
)
View Source
const (
	Target40  = 1
	Target50  = 2
	Target60  = 3
	Target70  = 4
	Target80  = 5
	Target90  = 6
	Target100 = 7
)

Variables

View Source
var TargetSocVals = [...]int{0, 40, 50, 60, 70, 80, 90, 100}

Functions

This section is empty.

Types

type API

type API struct {
	*request.Helper

	Logger *util.Logger
	// contains filtered or unexported fields
}

API is an api.Vehicle implementation for SAIC cars

func NewAPI

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

NewAPI creates a new vehicle

func (*API) DoRequest

func (v *API) DoRequest(req *http.Request, result *requests.Answer) (string, error)

func (*API) Status

func (v *API) Status(vin string) (requests.ChargeStatus, error)

Status implements the /user/vehicles/<vin>/status api

func (*API) Wakeup

func (v *API) Wakeup(vin string) error

type ConcurrentRequest

type ConcurrentRequest struct {
	Status int
	Result requests.ChargeStatus
}

type Identity

type Identity struct {
	*request.Helper
	TokenSource oauth2.TokenSource
	User        string
	Password    string
	// contains filtered or unexported fields
}

func NewIdentity

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

NewIdentity creates SAIC identity

func (*Identity) Login

func (v *Identity) Login() error

func (*Identity) RefreshToken

func (v *Identity) RefreshToken(token *oauth2.Token) (*oauth2.Token, error)

func (*Identity) Token

func (v *Identity) Token() (*oauth2.Token, error)

type Provider

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

Provider implements the vehicle api

func NewProvider

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

NewProvider creates a vehicle api provider

func (*Provider) FinishTime

func (v *Provider) FinishTime() (time.Time, error)

FinishTime implements the api.VehicleFinishTimer interface

func (*Provider) GetLimitSoc

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

GetLimitSoc implements the api.SocLimiter interface

func (*Provider) Odometer

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

Odometer implements the api.VehicleOdometer 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

func (*Provider) WakeUp

func (v *Provider) WakeUp() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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