evcc-io/charger/smart-evse_decorators.go
2026-04-12 18:47:59 +02:00

116 lines
3.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 decorateSmartEVSE3(base *SmartEVSE3, meter func() (float64, error), meterEnergy func() (float64, error), phaseCurrents func() (float64, float64, float64, error), phaseSwitcher func(int) error, phaseGetter func() (int, error), identifier func() (string, error), statusReasoner func() (api.Reason, error)) api.Charger {
caps := make(map[reflect.Type]any)
if meter != nil {
caps[reflect.TypeFor[api.Meter]()] = &decorateSmartEVSE3MeterImpl{meter: meter}
}
if meterEnergy != nil {
caps[reflect.TypeFor[api.MeterEnergy]()] = &decorateSmartEVSE3MeterEnergyImpl{meterEnergy: meterEnergy}
}
if phaseCurrents != nil {
caps[reflect.TypeFor[api.PhaseCurrents]()] = &decorateSmartEVSE3PhaseCurrentsImpl{phaseCurrents: phaseCurrents}
}
if phaseSwitcher != nil {
caps[reflect.TypeFor[api.PhaseSwitcher]()] = &decorateSmartEVSE3PhaseSwitcherImpl{phaseSwitcher: phaseSwitcher}
}
if phaseGetter != nil {
caps[reflect.TypeFor[api.PhaseGetter]()] = &decorateSmartEVSE3PhaseGetterImpl{phaseGetter: phaseGetter}
}
if identifier != nil {
caps[reflect.TypeFor[api.Identifier]()] = &decorateSmartEVSE3IdentifierImpl{identifier: identifier}
}
if statusReasoner != nil {
caps[reflect.TypeFor[api.StatusReasoner]()] = &decorateSmartEVSE3StatusReasonerImpl{statusReasoner: statusReasoner}
}
if len(caps) == 0 {
return base
}
return &decorateSmartEVSE3Capable{SmartEVSE3: base, caps: caps}
}
type decorateSmartEVSE3Capable struct {
*SmartEVSE3
caps map[reflect.Type]any
}
func (d *decorateSmartEVSE3Capable) Capability(typ reflect.Type) (any, bool) {
c, ok := d.caps[typ]
if !ok && reflect.TypeOf(d).Implements(typ) {
return d, true
}
return c, ok
}
type decorateSmartEVSE3IdentifierImpl struct {
identifier func() (string, error)
}
func (impl *decorateSmartEVSE3IdentifierImpl) Identify() (string, error) {
return impl.identifier()
}
type decorateSmartEVSE3MeterImpl struct {
meter func() (float64, error)
}
func (impl *decorateSmartEVSE3MeterImpl) CurrentPower() (float64, error) {
return impl.meter()
}
type decorateSmartEVSE3MeterEnergyImpl struct {
meterEnergy func() (float64, error)
}
func (impl *decorateSmartEVSE3MeterEnergyImpl) TotalEnergy() (float64, error) {
return impl.meterEnergy()
}
type decorateSmartEVSE3PhaseCurrentsImpl struct {
phaseCurrents func() (float64, float64, float64, error)
}
func (impl *decorateSmartEVSE3PhaseCurrentsImpl) Currents() (float64, float64, float64, error) {
return impl.phaseCurrents()
}
type decorateSmartEVSE3PhaseGetterImpl struct {
phaseGetter func() (int, error)
}
func (impl *decorateSmartEVSE3PhaseGetterImpl) GetPhases() (int, error) {
return impl.phaseGetter()
}
type decorateSmartEVSE3PhaseSwitcherImpl struct {
phaseSwitcher func(int) error
}
func (impl *decorateSmartEVSE3PhaseSwitcherImpl) Phases1p3p(p0 int) error {
return impl.phaseSwitcher(p0)
}
type decorateSmartEVSE3StatusReasonerImpl struct {
statusReasoner func() (api.Reason, error)
}
func (impl *decorateSmartEVSE3StatusReasonerImpl) StatusReason() (api.Reason, error) {
return impl.statusReasoner()
}