bmw

package
v0.0.0-...-0c7050d Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthURI     = "https://customer.bmwgroup.com/gcdm/oauth"
	RedirectURI = "com.bmw.connected://oauth"
)
View Source
const (
	CocoApiURI = "https://cocoapi.bmwgroup.com"
)

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 BMW cars

func NewAPI

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

NewAPI creates a new vehicle

func (*API) Status

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

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

func (*API) Vehicles

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

Vehicles implements returns the /user/vehicles api

type Identity

type Identity struct {
	*request.Helper
}

func NewIdentity

func NewIdentity(log *util.Logger) *Identity

NewIdentity creates BMW identity

func (*Identity) Login

func (v *Identity) Login(user, password string) (oauth2.TokenSource, error)

func (*Identity) RefreshToken

func (v *Identity) RefreshToken(token *oauth2.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) 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

type Vehicle

type Vehicle struct {
	VIN            string
	Model          string
	AppVehicleType string
}

type VehicleStatus

type VehicleStatus struct {
	State struct {
		CurrentMileage        int64
		Range                 int64
		ElectricChargingState struct {
			ChargingLevelPercent int64
			Range                int64
			IsChargerConnected   bool
			ChargingStatus       string
			ChargingTarget       int64
		}
	}
}

Jump to

Keyboard shortcuts

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