coordinator

package
v0.0.0-...-d8875bf Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	// GetVehicles returns the list of all vehicles
	GetVehicles() []api.Vehicle

	// Owner returns the loadpoint that currently owns the vehicle
	Owner(api.Vehicle) loadpoint.API

	// Acquire acquires the vehicle for the loadpoint and releases it at any other loadpoint
	Acquire(api.Vehicle)

	// Release releases a vehicle from a loadpoint
	Release(api.Vehicle)

	// IdentifyVehicleByStatus returns an available vehicle that is currently connected or charging
	IdentifyVehicleByStatus() api.Vehicle
}

API is the coordinator API

func NewAdapter

func NewAdapter(lp loadpoint.API, c *Coordinator) API

NewAdapter exposes the coordinator for a given loadpoint. Using an adapter simplifies the method signatures seen from the loadpoint.

func NewDummy

func NewDummy() API

NewDummy creates a dummy coordinator without vehicles

type Coordinator

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

Coordinator coordinates vehicle access between loadpoints

func New

func New(log *util.Logger, vehicles []api.Vehicle) *Coordinator

New creates a coordinator for a set of vehicles

func (*Coordinator) Add

func (c *Coordinator) Add(vehicle api.Vehicle)

Add adds a vehicle to the coordinator

func (*Coordinator) Delete

func (c *Coordinator) Delete(vehicle api.Vehicle)

Delete removes a vehicle from the coordinator

func (*Coordinator) GetVehicles

func (c *Coordinator) GetVehicles() []api.Vehicle

GetVehicles returns the list of all vehicles

func (*Coordinator) Owner

func (c *Coordinator) Owner(vehicle api.Vehicle) loadpoint.API

Owner returns the loadpoint that currently owns the vehicle

Jump to

Keyboard shortcuts

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