101 lines
2.8 KiB
Go
101 lines
2.8 KiB
Go
package meter
|
|
|
|
// Code generated by github.com/evcc-io/evcc/cmd/tools/decorate.go. DO NOT EDIT.
|
|
|
|
import (
|
|
"reflect"
|
|
|
|
"github.com/evcc-io/evcc/api"
|
|
)
|
|
|
|
func decorateLgEss(base *LgEss, meterEnergy func() (float64, error), batteryCapacity func() float64, battery func() (float64, error), batterySocLimiter func() (float64, float64), batteryPowerLimiter func() (float64, float64), batteryController func(api.BatteryMode) error) api.Meter {
|
|
caps := make(map[reflect.Type]any)
|
|
|
|
if meterEnergy != nil {
|
|
caps[reflect.TypeFor[api.MeterEnergy]()] = &decorateLgEssMeterEnergyImpl{meterEnergy: meterEnergy}
|
|
}
|
|
|
|
if batteryCapacity != nil {
|
|
caps[reflect.TypeFor[api.BatteryCapacity]()] = &decorateLgEssBatteryCapacityImpl{batteryCapacity: batteryCapacity}
|
|
}
|
|
|
|
if battery != nil {
|
|
caps[reflect.TypeFor[api.Battery]()] = &decorateLgEssBatteryImpl{battery: battery}
|
|
}
|
|
|
|
if batterySocLimiter != nil {
|
|
caps[reflect.TypeFor[api.BatterySocLimiter]()] = &decorateLgEssBatterySocLimiterImpl{batterySocLimiter: batterySocLimiter}
|
|
}
|
|
|
|
if batteryPowerLimiter != nil {
|
|
caps[reflect.TypeFor[api.BatteryPowerLimiter]()] = &decorateLgEssBatteryPowerLimiterImpl{batteryPowerLimiter: batteryPowerLimiter}
|
|
}
|
|
|
|
if batteryController != nil {
|
|
caps[reflect.TypeFor[api.BatteryController]()] = &decorateLgEssBatteryControllerImpl{batteryController: batteryController}
|
|
}
|
|
|
|
if len(caps) == 0 {
|
|
return base
|
|
}
|
|
|
|
return &decorateLgEssCapable{LgEss: base, caps: caps}
|
|
}
|
|
|
|
type decorateLgEssCapable struct {
|
|
*LgEss
|
|
caps map[reflect.Type]any
|
|
}
|
|
|
|
func (d *decorateLgEssCapable) Capability(typ reflect.Type) (any, bool) {
|
|
c, ok := d.caps[typ]
|
|
return c, ok
|
|
}
|
|
|
|
type decorateLgEssBatteryImpl struct {
|
|
battery func() (float64, error)
|
|
}
|
|
|
|
func (impl *decorateLgEssBatteryImpl) Soc() (float64, error) {
|
|
return impl.battery()
|
|
}
|
|
|
|
type decorateLgEssBatteryCapacityImpl struct {
|
|
batteryCapacity func() float64
|
|
}
|
|
|
|
func (impl *decorateLgEssBatteryCapacityImpl) Capacity() float64 {
|
|
return impl.batteryCapacity()
|
|
}
|
|
|
|
type decorateLgEssBatteryControllerImpl struct {
|
|
batteryController func(api.BatteryMode) error
|
|
}
|
|
|
|
func (impl *decorateLgEssBatteryControllerImpl) SetBatteryMode(p0 api.BatteryMode) error {
|
|
return impl.batteryController(p0)
|
|
}
|
|
|
|
type decorateLgEssBatteryPowerLimiterImpl struct {
|
|
batteryPowerLimiter func() (float64, float64)
|
|
}
|
|
|
|
func (impl *decorateLgEssBatteryPowerLimiterImpl) GetPowerLimits() (float64, float64) {
|
|
return impl.batteryPowerLimiter()
|
|
}
|
|
|
|
type decorateLgEssBatterySocLimiterImpl struct {
|
|
batterySocLimiter func() (float64, float64)
|
|
}
|
|
|
|
func (impl *decorateLgEssBatterySocLimiterImpl) GetSocLimits() (float64, float64) {
|
|
return impl.batterySocLimiter()
|
|
}
|
|
|
|
type decorateLgEssMeterEnergyImpl struct {
|
|
meterEnergy func() (float64, error)
|
|
}
|
|
|
|
func (impl *decorateLgEssMeterEnergyImpl) TotalEnergy() (float64, error) {
|
|
return impl.meterEnergy()
|
|
}
|