65 lines
1.5 KiB
Go
65 lines
1.5 KiB
Go
package charger
|
|
|
|
// Code generated by github.com/evcc-io/evcc/cmd/tools/decorate.go. DO NOT EDIT.
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
"github.com/evcc-io/evcc/api"
|
|
)
|
|
|
|
func decorateVestel(base *Vestel, phaseSwitcher func(int) error, phaseGetter func() (int, error), identifier func() (string, error)) api.Charger {
|
|
caps := make(map[reflect.Type]any)
|
|
|
|
if phaseSwitcher != nil {
|
|
caps[reflect.TypeFor[api.PhaseSwitcher]()] = &decorateVestelPhaseSwitcherImpl{phaseSwitcher: phaseSwitcher}
|
|
}
|
|
|
|
if phaseGetter != nil {
|
|
caps[reflect.TypeFor[api.PhaseGetter]()] = &decorateVestelPhaseGetterImpl{phaseGetter: phaseGetter}
|
|
}
|
|
|
|
if identifier != nil {
|
|
caps[reflect.TypeFor[api.Identifier]()] = &decorateVestelIdentifierImpl{identifier: identifier}
|
|
}
|
|
|
|
if len(caps) == 0 {
|
|
return base
|
|
}
|
|
|
|
return &decorateVestelCapable{Vestel: base, caps: caps}
|
|
}
|
|
|
|
type decorateVestelCapable struct {
|
|
*Vestel
|
|
caps map[reflect.Type]any
|
|
}
|
|
|
|
func (d *decorateVestelCapable) Capability(typ reflect.Type) (any, bool) {
|
|
c, ok := d.caps[typ]
|
|
return c, ok
|
|
}
|
|
|
|
type decorateVestelIdentifierImpl struct {
|
|
identifier func() (string, error)
|
|
}
|
|
|
|
func (impl *decorateVestelIdentifierImpl) Identify() (string, error) {
|
|
return impl.identifier()
|
|
}
|
|
|
|
type decorateVestelPhaseGetterImpl struct {
|
|
phaseGetter func() (int, error)
|
|
}
|
|
|
|
func (impl *decorateVestelPhaseGetterImpl) GetPhases() (int, error) {
|
|
return impl.phaseGetter()
|
|
}
|
|
|
|
type decorateVestelPhaseSwitcherImpl struct {
|
|
phaseSwitcher func(int) error
|
|
}
|
|
|
|
func (impl *decorateVestelPhaseSwitcherImpl) Phases1p3p(p0 int) error {
|
|
return impl.phaseSwitcher(p0)
|
|
}
|