bmw

package
v0.0.0-...-aad484d Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHARGE_START = "start-charging"
	CHARGE_STOP  = "stop-charging"
	DOOR_LOCK    = "door-lock"
	LIGHT_FLASH  = "light-flash"

	REMOTE_SERVICE_BASE_URL   = "eadrax-vrccs/v3/presentation/remote-commands"
	VEHICLE_CHARGING_BASE_URL = "eadrax-crccs/v1/vehicles"
)
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) Action

func (v *API) Action(vin, action string) (Event, error)

Action implements the /remote-commands/<vin>/<service> api

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() ([]Vehicle, error)

Vehicles implements returns the /user/vehicles api

type Authenticate

type Authenticate struct {
	ClientID, State string
}

type Event

type Event struct {
	EventID      string
	CreationTime time.Time
}

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, hcaptcha 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) ChargeEnable

func (v *Provider) ChargeEnable(enable bool) error

ChargeEnable implements the api.ChargeController 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

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 {
	StatusCode int
	Message    string
	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