coordinator

package
v0.0.0-...-aa513c4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 4 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, filtered by availability
	GetVehicles(availableOnly bool) []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(availableOnly bool) []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