bluelink

package
v0.0.0-...-722e3e0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VehiclesURL     = "/api/v1/spa/vehicles"
	StatusURL       = "/api/v1/spa/vehicles/%s/status"
	StatusLatestURL = "/api/v1/spa/vehicles/%s/status/latest"
)
View Source
const (
	DeviceIdURL        = "/api/v1/spa/notifications/register"
	IntegrationInfoURL = "/api/v1/user/integrationinfo"
	SilentSigninURL    = "/api/v1/user/silentsignin"
	LanguageURL        = "/api/v1/user/language"
	LoginURL           = "/api/v1/user/signin"
	TokenURL           = "/api/v1/user/oauth2/token"
)

Variables

View Source
var ErrAuthFail = errors.New("authorization failed")

ErrAuthFail indicates authorization failure

Functions

This section is empty.

Types

type API

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

API implements the Kia/Hyundai bluelink api. Based on https://github.com/Hacksore/bluelinky.

func NewAPI

func NewAPI(log *util.Logger, identity *Identity, cache time.Duration) *API

New creates a new BlueLink API

func (*API) Status

func (v *API) Status(vid string) (StatusData, error)

func (*API) Vehicles

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

type Config

type Config struct {
	URI               string
	BrandAuthUrl      string // v2
	BasicToken        string
	CCSPServiceID     string
	CCSPApplicationID string
}

Config is the bluelink API configuration

type DrivingDistance

type DrivingDistance struct {
	RangeByFuel struct {
		EvModeRange struct {
			Value int
		}
	}
}

type Identity

type Identity struct {
	*request.Helper

	oauth2.TokenSource
	// contains filtered or unexported fields
}

Identity implements the Kia/Hyundai bluelink identity. Based on https://github.com/Hacksore/bluelinky.

func NewIdentity

func NewIdentity(log *util.Logger, config Config) (*Identity, error)

NewIdentity creates BlueLink Identity

func (*Identity) Login

func (v *Identity) Login(user, password string) (err error)

func (*Identity) RefreshToken

func (v *Identity) RefreshToken(token *oauth2.Token) (*oauth2.Token, error)

RefreshToken implements oauth.TokenRefresher

func (*Identity) Request

func (v *Identity) Request(method, path string) (*http.Request, error)

Request creates authenticated request

type Provider

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

Provider implements the Kia/Hyundai bluelink api. Based on https://github.com/Hacksore/bluelinky.

func NewProvider

func NewProvider(api *API, vid string, cache time.Duration) *Provider

New creates a new BlueLink API

func (*Provider) FinishTime

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

FinishTime implements the api.VehicleFinishTimer 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.Battery interface

type Stamps

type Stamps map[string][]string

Stamps collects stamps for a single brand

func (Stamps) New

func (s Stamps) New(id string) string

New creates a new stamp

type StatusData

type StatusData struct {
	Time     string
	EvStatus struct {
		BatteryStatus float64
		RemainTime2   struct {
			Atc struct {
				Value, Unit int
			}
		}
		DrvDistance []DrivingDistance
	}
	Vehicles []Vehicle
}

func (*StatusData) Updated

func (d *StatusData) Updated() (time.Time, error)

type StatusLatestResponse

type StatusLatestResponse struct {
	RetCode string
	ResCode string
	ResMsg  struct {
		VehicleStatusInfo struct {
			VehicleStatus StatusData
		}
	}
}

type StatusResponse

type StatusResponse struct {
	RetCode string
	ResCode string
	ResMsg  StatusData
}

type Vehicle

type Vehicle struct {
	VIN, VehicleName, VehicleID string
}

type VehiclesResponse

type VehiclesResponse struct {
	RetCode string
	ResMsg  struct {
		Vehicles []Vehicle
	}
}

Jump to

Keyboard shortcuts

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