bmw

package
v0.0.0-...-3371691 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RedirectURI = "com.bmw.connected://oauth"
)

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, region 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 Authenticate

type Authenticate struct {
	ClientID, State string
}

type Identity

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

func NewIdentity

func NewIdentity(log *util.Logger, region string) *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 Region

type Region struct {
	AuthURI, CocoApiURI string
	Token
	Authenticate
}

type Token

type Token struct {
	Authorization string
}

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