53 lines
1.4 KiB
Go
53 lines
1.4 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 decorateTasmota(base *Tasmota, phaseVoltages func() (float64, float64, float64, error), phaseCurrents func() (float64, float64, float64, error)) api.Charger {
|
|
caps := make(map[reflect.Type]any)
|
|
|
|
if phaseVoltages != nil {
|
|
caps[reflect.TypeFor[api.PhaseVoltages]()] = &decorateTasmotaPhaseVoltagesImpl{phaseVoltages: phaseVoltages}
|
|
}
|
|
|
|
if phaseCurrents != nil {
|
|
caps[reflect.TypeFor[api.PhaseCurrents]()] = &decorateTasmotaPhaseCurrentsImpl{phaseCurrents: phaseCurrents}
|
|
}
|
|
|
|
if len(caps) == 0 {
|
|
return base
|
|
}
|
|
|
|
return &decorateTasmotaCapable{Tasmota: base, caps: caps}
|
|
}
|
|
|
|
type decorateTasmotaCapable struct {
|
|
*Tasmota
|
|
caps map[reflect.Type]any
|
|
}
|
|
|
|
func (d *decorateTasmotaCapable) Capability(typ reflect.Type) (any, bool) {
|
|
c, ok := d.caps[typ]
|
|
return c, ok
|
|
}
|
|
|
|
type decorateTasmotaPhaseCurrentsImpl struct {
|
|
phaseCurrents func() (float64, float64, float64, error)
|
|
}
|
|
|
|
func (impl *decorateTasmotaPhaseCurrentsImpl) Currents() (float64, float64, float64, error) {
|
|
return impl.phaseCurrents()
|
|
}
|
|
|
|
type decorateTasmotaPhaseVoltagesImpl struct {
|
|
phaseVoltages func() (float64, float64, float64, error)
|
|
}
|
|
|
|
func (impl *decorateTasmotaPhaseVoltagesImpl) Voltages() (float64, float64, float64, error) {
|
|
return impl.phaseVoltages()
|
|
}
|