vw

package
v0.0.0-...-cba36cc Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionCharge      = "batterycharge"
	ActionChargeStart = "start"
	ActionChargeStop  = "stop"
)
View Source
const (
	Brand   = "VW"
	Country = "DE"

	// Authorization ClientID
	AuthClientID = "38761134-34d0-41f3-9a73-c4be88d7d337"
)
View Source
const DefaultBaseURI = "https://msg.volkswagen.de/fs-car"

DefaultBaseURI is the VW api base URI

View Source
const RegionAPI = "https://mal-1a.prd.ece.vwg-connect.com/api"

RegionAPI is the VW api used for determining the home region

View Source
const ServiceOdometer = "0x0101010002"
View Source
const StatusService = "statusreport_v1"

Variables

View Source
var AuthParams = url.Values{
	"response_type": {"code id_token token"},
	"client_id":     {"9496332b-ea03-4091-a224-8c746b885068@apps_vw-dilab_com"},
	"redirect_uri":  {"carnet://identity-kit/login"},
	"scope":         {"openid profile mbb"},
}

Authorization parameters

View Source
var TRSParams = url.Values{
	"brand": {"vw"},
}

TokenRefreshService parameters

Functions

This section is empty.

Types

type API

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

API is the VW api client

func NewAPI

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

NewAPI creates a new api client

func (*API) Action

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

Action implements vehicle actions

func (*API) Any

func (v *API) Any(base, vin string) (interface{}, error)

Any implements any api response

func (*API) Charger

func (v *API) Charger(vin string) (ChargerResponse, error)

Charger implements the /charger response

func (*API) Climater

func (v *API) Climater(vin string) (ClimaterResponse, error)

Climater implements the /climater response

func (*API) HomeRegion

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

HomeRegion updates the home region for the given vehicle

func (*API) Position

func (v *API) Position(vin string) (PositionResponse, error)

Position implements the /position response

func (*API) RolesRights

func (v *API) RolesRights(vin string) (RolesRights, error)

RolesRights implements the /rolesrights/operationlist response

func (*API) ServiceURI

func (v *API) ServiceURI(vin, service string, rr RolesRights) (uri string)

ServiceURI renders the service URI for the given vin and service

func (*API) Status

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

Status implements the /status response

func (*API) Vehicles

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

Vehicles implements the /vehicles response

type ChargerResponse

type ChargerResponse struct {
	Charger struct {
		Status struct {
			BatteryStatusData struct {
				StateOfCharge         TimedInt
				RemainingChargingTime TimedInt
			}
			ChargingStatusData struct {
				ChargingState            TimedString // off, charging
				ChargingMode             TimedString // invalid, AC
				ChargingReason           TimedString // invalid, immediate
				ExternalPowerSupplyState TimedString // unavailable, available
				EnergyFlow               TimedString // on, off
			}
			PlugStatusData struct {
				PlugState TimedString // connected
			}
			CruisingRangeStatusData struct {
				EngineTypeFirstEngine  TimedString // typeIsElectric, petrolGasoline
				EngineTypeSecondEngine TimedString // typeIsElectric, petrolGasoline
				PrimaryEngineRange     TimedInt
				SecondaryEngineRange   TimedInt
				HybridRange            TimedInt
			}
		}
	}
	Error *Error // optional error
}

ChargerResponse is the /bs/batterycharge/v1/%s/%s/vehicles/%s/charger api

type ClimaterResponse

type ClimaterResponse struct {
	Climater struct {
		Settings struct {
			TargetTemperature TimedTemperature
			HeaterSource      TimedString
		}
		Status struct {
			ClimatisationStatusData struct {
				ClimatisationState         TimedString
				ClimatisationReason        TimedString
				RemainingClimatisationTime TimedInt
			}
			TemperatureStatusData struct {
				OutdoorTemperature TimedTemperature
			}
			VehicleParkingClockStatusData struct {
				VehicleParkingClock TimedString
			}
		}
	}
	Error *Error // optional error
}

ClimaterResponse is the /bs/climatisation/v1/%s/%s/vehicles/%s/climater api

type Error

type Error struct {
	ErrorCode, Description string
}

func (*Error) Error

func (e *Error) Error() error

type FieldDefinition

type FieldDefinition struct {
	ID               string // "0x0101010001",
	TsCarSentUtc     string // "2021-09-05T07:54:20Z",
	TsCarSent        string // "2021-09-05T07:54:19",
	TsCarCaptured    string // "2021-09-05T07:54:19",
	TsTssReceivedUtc string // "2021-09-05T07:54:23Z",
	MilCarCaptured   int    // 25009,
	MilCarSent       int    // 25009,
	Value            string // "echo"
}

type HomeRegion

type HomeRegion struct {
	HomeRegion struct {
		BaseURI struct {
			SystemID string
			Content  string // api url
		}
	}
	Error *Error // optional error
}

HomeRegion is the home region API response

type PositionResponse

type PositionResponse struct {
	FindCarResponse struct {
		Position struct {
			TimestampCarSent     string // "2021-12-12T16:42:44"
			TimestampTssReceived time.Time
			CarCoordinate        struct {
				Latitude  int64
				Longitude int64
			}
			TimestampCarSentUTC  time.Time
			TimestampCarCaptured string // "2021-12-12T16:42:44"
		}
		ParkingTimeUTC time.Time
	}
	Error *Error // optional error
}

PositionResponse is the /bs/cf/v1/%s/%s/vehicles/%s/position api

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) Climater

func (v *Provider) Climater() (bool, error)

Climater implements the api.VehicleClimater interface

func (*Provider) Diagnose

func (v *Provider) Diagnose()

Diagnose implements the api.Diagnosis interface

func (*Provider) FinishTime

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

FinishTime implements the api.VehicleFinishTimer interface

func (*Provider) Odometer

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

Odometer implements the api.VehicleOdometer interface

func (*Provider) Position

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

Position implements the api.VehiclePosition interface

func (*Provider) Range

func (v *Provider) Range() (rng int64, err error)

Range implements the api.VehicleRange interface

func (*Provider) Soc

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

Soc implements the api.Vehicle interface

func (*Provider) StartCharge

func (v *Provider) StartCharge() error

StartCharge implements the api.VehicleChargeController interface

func (*Provider) Status

func (v *Provider) Status() (api.ChargeStatus, error)

Status implements the api.ChargeState interface

func (*Provider) StopCharge

func (v *Provider) StopCharge() error

StopCharge implements the api.VehicleChargeController interface

type RolesRights

type RolesRights struct {
	OperationList struct {
		VIN, UserId, Role, Status string
		ServiceInfo               []ServiceInfo
	}
}

RolesRights is the /rolesrights/operationlist response

func (RolesRights) ServiceByID

func (rr RolesRights) ServiceByID(id string) *ServiceInfo

type ServiceDefinition

type ServiceDefinition struct {
	ID    string
	Field []FieldDefinition
}

func (*ServiceDefinition) FieldByID

func (s *ServiceDefinition) FieldByID(id string) *FieldDefinition

type ServiceInfo

type ServiceInfo struct {
	ServiceId     string
	ServiceType   string
	ServiceStatus struct {
		Status string
	}
	LicenseRequired            bool
	CumulatedLicense           map[string]interface{}
	PrimaryUserRequired        bool
	TermsAndConditionsRequired bool
	ServiceEol                 string
	RolesAndRightsRequired     bool
	InvocationUrl              struct {
		Content string
	}
	Operation []map[string]interface{}
}

ServiceInfo is the rolesrights service information

type StatusResponse

type StatusResponse struct {
	StoredVehicleDataResponse struct {
		VIN         string
		VehicleData struct {
			Data []ServiceDefinition
		}
	}
	Error *Error
}

func (*StatusResponse) ServiceByID

func (s *StatusResponse) ServiceByID(id string) *ServiceDefinition

type TimedInt

type TimedInt struct {
	Content   int
	Timestamp string
}

TimedInt is an int value with timestamp

type TimedString

type TimedString struct {
	Content   string
	Timestamp string
}

TimedString is a string value with timestamp

type TimedTemperature

type TimedTemperature struct {
	Content   float64
	Timestamp string
}

TimedTemperature is the api temperature with timestamp

func (*TimedTemperature) UnmarshalJSON

func (t *TimedTemperature) UnmarshalJSON(data []byte) error

type VehiclesResponse

type VehiclesResponse struct {
	UserVehicles struct {
		Vehicle []string
	}
	Error *Error // optional error
}

VehiclesResponse is the /usermanagement/users/v1/%s/%s/vehicles api

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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