smart

package
v0.0.0-...-7eabc78 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ApiURI = "https://oneapp.microservice.smart.mercedes-benz.com/seqc/v0"

Variables

View Source
var OAuth2Config = &oauth2.Config{
	ClientID:    "70d89501-938c-4bec-82d0-6abb550b0825",
	RedirectURL: "https://oneapp.microservice.smart.mercedes-benz.com",
	Endpoint: oauth2.Endpoint{
		AuthURL:  mb.OAuthURI + "/as/authorization.oauth2",
		TokenURL: mb.OAuthURI + "/as/token.oauth2",
	},
	Scopes: []string{"openid", "profile", "email", "phone", "ciam-uid", "offline_access"},
}

Functions

This section is empty.

Types

type API

type API struct {
	*request.Helper
}

func NewAPI

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

func (*API) Refresh

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

func (*API) Status

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

func (*API) Vehicles

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

type BoolValue

type BoolValue struct {
	Status int
	Value  bool
	Ts     TimeSecs
}

type FloatValue

type FloatValue struct {
	Status int
	Value  float64
	Ts     TimeSecs
}

type IntValue

type IntValue struct {
	Status int
	Value  int
	Ts     TimeSecs
}

type Provider

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

func NewProvider

func NewProvider(log *util.Logger, api *API, vin string, expiry, cache time.Duration) *Provider

func (*Provider) Odometer

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

Odometer implements the Provider.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)

Range implements the api.VehicleRange interface

type StatusResponse

type StatusResponse struct {
	PreCond struct {
		Data struct {
			ChargingPower  FloatValue
			ChargingActive BoolValue
			ChargingStatus IntValue
		} `json:"data"`
	}
	Status struct {
		Data struct {
			Odo           FloatValue
			RangeElectric FloatValue
			Soc           FloatValue
		} `json:"data"`
	}
	Images           []string
	Error            string
	ErrorDescription string `json:"error_description"`
}

type TimeSecs

type TimeSecs struct {
	time.Time
}

TimeSecs implements JSON unmarshal for Unix timestamps in seconds

func (*TimeSecs) UnmarshalJSON

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

UnmarshalJSON decodes unix timestamps in ms into time.Time

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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