53 lines
1.2 KiB
Go
53 lines
1.2 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 decorateOpenWB20(base *OpenWB20, phaseSwitcher func(int) error, identifier func() (string, error)) api.Charger {
|
|
caps := make(map[reflect.Type]any)
|
|
|
|
if phaseSwitcher != nil {
|
|
caps[reflect.TypeFor[api.PhaseSwitcher]()] = &decorateOpenWB20PhaseSwitcherImpl{phaseSwitcher: phaseSwitcher}
|
|
}
|
|
|
|
if identifier != nil {
|
|
caps[reflect.TypeFor[api.Identifier]()] = &decorateOpenWB20IdentifierImpl{identifier: identifier}
|
|
}
|
|
|
|
if len(caps) == 0 {
|
|
return base
|
|
}
|
|
|
|
return &decorateOpenWB20Capable{OpenWB20: base, caps: caps}
|
|
}
|
|
|
|
type decorateOpenWB20Capable struct {
|
|
*OpenWB20
|
|
caps map[reflect.Type]any
|
|
}
|
|
|
|
func (d *decorateOpenWB20Capable) Capability(typ reflect.Type) (any, bool) {
|
|
c, ok := d.caps[typ]
|
|
return c, ok
|
|
}
|
|
|
|
type decorateOpenWB20IdentifierImpl struct {
|
|
identifier func() (string, error)
|
|
}
|
|
|
|
func (impl *decorateOpenWB20IdentifierImpl) Identify() (string, error) {
|
|
return impl.identifier()
|
|
}
|
|
|
|
type decorateOpenWB20PhaseSwitcherImpl struct {
|
|
phaseSwitcher func(int) error
|
|
}
|
|
|
|
func (impl *decorateOpenWB20PhaseSwitcherImpl) Phases1p3p(p0 int) error {
|
|
return impl.phaseSwitcher(p0)
|
|
}
|