41 lines
904 B
Go
41 lines
904 B
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 decorateOpenEVSE(base *OpenEVSE, phaseSwitcher func(int) error) api.Charger {
|
|
caps := make(map[reflect.Type]any)
|
|
|
|
if phaseSwitcher != nil {
|
|
caps[reflect.TypeFor[api.PhaseSwitcher]()] = &decorateOpenEVSEPhaseSwitcherImpl{phaseSwitcher: phaseSwitcher}
|
|
}
|
|
|
|
if len(caps) == 0 {
|
|
return base
|
|
}
|
|
|
|
return &decorateOpenEVSECapable{OpenEVSE: base, caps: caps}
|
|
}
|
|
|
|
type decorateOpenEVSECapable struct {
|
|
*OpenEVSE
|
|
caps map[reflect.Type]any
|
|
}
|
|
|
|
func (d *decorateOpenEVSECapable) Capability(typ reflect.Type) (any, bool) {
|
|
c, ok := d.caps[typ]
|
|
return c, ok
|
|
}
|
|
|
|
type decorateOpenEVSEPhaseSwitcherImpl struct {
|
|
phaseSwitcher func(int) error
|
|
}
|
|
|
|
func (impl *decorateOpenEVSEPhaseSwitcherImpl) Phases1p3p(p0 int) error {
|
|
return impl.phaseSwitcher(p0)
|
|
}
|