# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2020 Raritan Inc. All rights reserved.
#
# This is an auto-generated file.

#
# Section generated by IdlC from "PowerLogicConfig.idl"
#

import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.event

import raritan.rpc.powerlogic


# interface
class Config(Interface):
    idlType = "powerlogic.Config:1.0.1"

    NO_ERROR = 0

    ERR_INVALID_PARAMS = 1

    # structure
    class Settings(Structure):
        idlType = "powerlogic.Config_1_0_1.Settings:1.0.0"
        elements = ["name", "slaveAddr", "baud", "parity"]

        def __init__(self, name, slaveAddr, baud, parity):
            typecheck.is_string(name, AssertionError)
            typecheck.is_byte(slaveAddr, AssertionError)
            typecheck.is_int(baud, AssertionError)
            typecheck.is_byte(parity, AssertionError)

            self.name = name
            self.slaveAddr = slaveAddr
            self.baud = baud
            self.parity = parity

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                name = json['name'],
                slaveAddr = json['slaveAddr'],
                baud = json['baud'],
                parity = json['parity'],
            )
            return obj

        def encode(self):
            json = {}
            json['name'] = self.name
            json['slaveAddr'] = self.slaveAddr
            json['baud'] = self.baud
            json['parity'] = self.parity
            return json

    # value object
    class SettingsChangedEvent(raritan.rpc.event.UserEvent):
        idlType = "powerlogic.Config_1_0_1.SettingsChangedEvent:1.0.0"

        def __init__(self, oldSettings, newSettings, actUserName, actIpAddr, source):
            super(raritan.rpc.powerlogic.Config.SettingsChangedEvent, self).__init__(actUserName, actIpAddr, source)
            typecheck.is_struct(oldSettings, raritan.rpc.powerlogic.Config.Settings, AssertionError)
            typecheck.is_struct(newSettings, raritan.rpc.powerlogic.Config.Settings, AssertionError)

            self.oldSettings = oldSettings
            self.newSettings = newSettings

        def encode(self):
            json = super(raritan.rpc.powerlogic.Config.SettingsChangedEvent, self).encode()
            json['oldSettings'] = raritan.rpc.powerlogic.Config.Settings.encode(self.oldSettings)
            json['newSettings'] = raritan.rpc.powerlogic.Config.Settings.encode(self.newSettings)
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                oldSettings = raritan.rpc.powerlogic.Config.Settings.decode(json['oldSettings'], agent),
                newSettings = raritan.rpc.powerlogic.Config.Settings.decode(json['newSettings'], agent),
                # for event.UserEvent
                actUserName = json['actUserName'],
                actIpAddr = json['actIpAddr'],
                # for idl.Event
                source = Interface.decode(json['source'], agent),
            )
            return obj

        def listElements(self):
            elements = ["oldSettings", "newSettings"]
            elements = elements + super(raritan.rpc.powerlogic.Config.SettingsChangedEvent, self).listElements()
            return elements

    class _getSettings(Interface.Method):
        name = 'getSettings'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.powerlogic.Config.Settings.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.powerlogic.Config.Settings, DecodeException)
            return _ret_

    class _setSettings(Interface.Method):
        name = 'setSettings'

        @staticmethod
        def encode(settings):
            typecheck.is_struct(settings, raritan.rpc.powerlogic.Config.Settings, AssertionError)
            args = {}
            args['settings'] = raritan.rpc.powerlogic.Config.Settings.encode(settings)
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_
    def __init__(self, target, agent):
        super(Config, self).__init__(target, agent)
        self.getSettings = Config._getSettings(self)
        self.setSettings = Config._setSettings(self)

#
# Section generated by IdlC from "PowerLogicPowerMeter.idl"
#

import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.idl

import raritan.rpc.modbus

import raritan.rpc.powerlogic

import raritan.rpc.sensors


# interface
class PowerMeter(raritan.rpc.modbus.Device):
    idlType = "powerlogic.PowerMeter:1.2.5"

    # structure
    class MinMaxReading(Structure):
        idlType = "powerlogic.PowerMeter_1_2_5.MinMaxReading:1.0.0"
        elements = ["min", "max", "reading"]

        def __init__(self, min, max, reading):
            typecheck.is_interface(min, raritan.rpc.sensors.NumericSensor, AssertionError)
            typecheck.is_interface(max, raritan.rpc.sensors.NumericSensor, AssertionError)
            typecheck.is_interface(reading, raritan.rpc.sensors.NumericSensor, AssertionError)

            self.min = min
            self.max = max
            self.reading = reading

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                min = Interface.decode(json['min'], agent),
                max = Interface.decode(json['max'], agent),
                reading = Interface.decode(json['reading'], agent),
            )
            return obj

        def encode(self):
            json = {}
            json['min'] = Interface.encode(self.min)
            json['max'] = Interface.encode(self.max)
            json['reading'] = Interface.encode(self.reading)
            return json

    # structure
    class L2N_N_Avg(Structure):
        idlType = "powerlogic.PowerMeter_1_2_5.L2N_N_Avg:1.0.0"
        elements = ["l1", "l2", "l3", "n", "average"]

        def __init__(self, l1, l2, l3, n, average):
            typecheck.is_struct(l1, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_struct(l2, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_struct(l3, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_interface(n, raritan.rpc.sensors.NumericSensor, AssertionError)
            typecheck.is_interface(average, raritan.rpc.sensors.NumericSensor, AssertionError)

            self.l1 = l1
            self.l2 = l2
            self.l3 = l3
            self.n = n
            self.average = average

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                l1 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l1'], agent),
                l2 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l2'], agent),
                l3 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l3'], agent),
                n = Interface.decode(json['n'], agent),
                average = Interface.decode(json['average'], agent),
            )
            return obj

        def encode(self):
            json = {}
            json['l1'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l1)
            json['l2'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l2)
            json['l3'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l3)
            json['n'] = Interface.encode(self.n)
            json['average'] = Interface.encode(self.average)
            return json

    # structure
    class L2L_Avg(Structure):
        idlType = "powerlogic.PowerMeter_1_2_5.L2L_Avg:1.0.0"
        elements = ["l1l2", "l2l3", "l3l1", "average"]

        def __init__(self, l1l2, l2l3, l3l1, average):
            typecheck.is_struct(l1l2, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_struct(l2l3, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_struct(l3l1, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_interface(average, raritan.rpc.sensors.NumericSensor, AssertionError)

            self.l1l2 = l1l2
            self.l2l3 = l2l3
            self.l3l1 = l3l1
            self.average = average

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                l1l2 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l1l2'], agent),
                l2l3 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l2l3'], agent),
                l3l1 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l3l1'], agent),
                average = Interface.decode(json['average'], agent),
            )
            return obj

        def encode(self):
            json = {}
            json['l1l2'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l1l2)
            json['l2l3'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l2l3)
            json['l3l1'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l3l1)
            json['average'] = Interface.encode(self.average)
            return json

    # structure
    class L2N_Avg(Structure):
        idlType = "powerlogic.PowerMeter_1_2_5.L2N_Avg:1.0.0"
        elements = ["l1", "l2", "l3", "average"]

        def __init__(self, l1, l2, l3, average):
            typecheck.is_struct(l1, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_struct(l2, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_struct(l3, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_interface(average, raritan.rpc.sensors.NumericSensor, AssertionError)

            self.l1 = l1
            self.l2 = l2
            self.l3 = l3
            self.average = average

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                l1 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l1'], agent),
                l2 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l2'], agent),
                l3 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l3'], agent),
                average = Interface.decode(json['average'], agent),
            )
            return obj

        def encode(self):
            json = {}
            json['l1'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l1)
            json['l2'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l2)
            json['l3'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l3)
            json['average'] = Interface.encode(self.average)
            return json

    # structure
    class L2N(Structure):
        idlType = "powerlogic.PowerMeter_1_2_5.L2N:1.0.0"
        elements = ["l1", "l2", "l3"]

        def __init__(self, l1, l2, l3):
            typecheck.is_struct(l1, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_struct(l2, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_struct(l3, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)

            self.l1 = l1
            self.l2 = l2
            self.l3 = l3

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                l1 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l1'], agent),
                l2 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l2'], agent),
                l3 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l3'], agent),
            )
            return obj

        def encode(self):
            json = {}
            json['l1'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l1)
            json['l2'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l2)
            json['l3'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l3)
            return json

    # structure
    class L2L(Structure):
        idlType = "powerlogic.PowerMeter_1_2_5.L2L:1.0.0"
        elements = ["l1l2", "l2l3", "l3l1"]

        def __init__(self, l1l2, l2l3, l3l1):
            typecheck.is_struct(l1l2, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_struct(l2l3, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_struct(l3l1, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)

            self.l1l2 = l1l2
            self.l2l3 = l2l3
            self.l3l1 = l3l1

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                l1l2 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l1l2'], agent),
                l2l3 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l2l3'], agent),
                l3l1 = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['l3l1'], agent),
            )
            return obj

        def encode(self):
            json = {}
            json['l1l2'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l1l2)
            json['l2l3'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l2l3)
            json['l3l1'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.l3l1)
            return json

    # structure
    class L2N_plain_total(Structure):
        idlType = "powerlogic.PowerMeter_1_2_5.L2N_plain_total:1.0.0"
        elements = ["l1", "l2", "l3", "total"]

        def __init__(self, l1, l2, l3, total):
            typecheck.is_interface(l1, raritan.rpc.sensors.NumericSensor, AssertionError)
            typecheck.is_interface(l2, raritan.rpc.sensors.NumericSensor, AssertionError)
            typecheck.is_interface(l3, raritan.rpc.sensors.NumericSensor, AssertionError)
            typecheck.is_struct(total, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)

            self.l1 = l1
            self.l2 = l2
            self.l3 = l3
            self.total = total

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                l1 = Interface.decode(json['l1'], agent),
                l2 = Interface.decode(json['l2'], agent),
                l3 = Interface.decode(json['l3'], agent),
                total = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['total'], agent),
            )
            return obj

        def encode(self):
            json = {}
            json['l1'] = Interface.encode(self.l1)
            json['l2'] = Interface.encode(self.l2)
            json['l3'] = Interface.encode(self.l3)
            json['total'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.total)
            return json

    # structure
    class Sensors(Structure):
        idlType = "powerlogic.PowerMeter_1_2_5.Sensors:1.0.0"
        elements = ["current", "voltageL2L", "voltageL2N", "frequency", "activePower", "reactivePower", "apparentPower", "powerFactor", "activeEnergy", "reactiveEnergy", "apparentEnergy", "thdCurrent", "thdVoltageL2L", "thdVoltageL2N"]

        def __init__(self, current, voltageL2L, voltageL2N, frequency, activePower, reactivePower, apparentPower, powerFactor, activeEnergy, reactiveEnergy, apparentEnergy, thdCurrent, thdVoltageL2L, thdVoltageL2N):
            typecheck.is_struct(current, raritan.rpc.powerlogic.PowerMeter.L2N_N_Avg, AssertionError)
            typecheck.is_struct(voltageL2L, raritan.rpc.powerlogic.PowerMeter.L2L_Avg, AssertionError)
            typecheck.is_struct(voltageL2N, raritan.rpc.powerlogic.PowerMeter.L2N_Avg, AssertionError)
            typecheck.is_interface(frequency, raritan.rpc.sensors.NumericSensor, AssertionError)
            typecheck.is_struct(activePower, raritan.rpc.powerlogic.PowerMeter.L2N_plain_total, AssertionError)
            typecheck.is_struct(reactivePower, raritan.rpc.powerlogic.PowerMeter.L2N_plain_total, AssertionError)
            typecheck.is_struct(apparentPower, raritan.rpc.powerlogic.PowerMeter.L2N_plain_total, AssertionError)
            typecheck.is_struct(powerFactor, raritan.rpc.powerlogic.PowerMeter.MinMaxReading, AssertionError)
            typecheck.is_interface(activeEnergy, raritan.rpc.sensors.NumericSensor, AssertionError)
            typecheck.is_interface(reactiveEnergy, raritan.rpc.sensors.NumericSensor, AssertionError)
            typecheck.is_interface(apparentEnergy, raritan.rpc.sensors.NumericSensor, AssertionError)
            typecheck.is_struct(thdCurrent, raritan.rpc.powerlogic.PowerMeter.L2N, AssertionError)
            typecheck.is_struct(thdVoltageL2L, raritan.rpc.powerlogic.PowerMeter.L2L, AssertionError)
            typecheck.is_struct(thdVoltageL2N, raritan.rpc.powerlogic.PowerMeter.L2N, AssertionError)

            self.current = current
            self.voltageL2L = voltageL2L
            self.voltageL2N = voltageL2N
            self.frequency = frequency
            self.activePower = activePower
            self.reactivePower = reactivePower
            self.apparentPower = apparentPower
            self.powerFactor = powerFactor
            self.activeEnergy = activeEnergy
            self.reactiveEnergy = reactiveEnergy
            self.apparentEnergy = apparentEnergy
            self.thdCurrent = thdCurrent
            self.thdVoltageL2L = thdVoltageL2L
            self.thdVoltageL2N = thdVoltageL2N

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                current = raritan.rpc.powerlogic.PowerMeter.L2N_N_Avg.decode(json['current'], agent),
                voltageL2L = raritan.rpc.powerlogic.PowerMeter.L2L_Avg.decode(json['voltageL2L'], agent),
                voltageL2N = raritan.rpc.powerlogic.PowerMeter.L2N_Avg.decode(json['voltageL2N'], agent),
                frequency = Interface.decode(json['frequency'], agent),
                activePower = raritan.rpc.powerlogic.PowerMeter.L2N_plain_total.decode(json['activePower'], agent),
                reactivePower = raritan.rpc.powerlogic.PowerMeter.L2N_plain_total.decode(json['reactivePower'], agent),
                apparentPower = raritan.rpc.powerlogic.PowerMeter.L2N_plain_total.decode(json['apparentPower'], agent),
                powerFactor = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.decode(json['powerFactor'], agent),
                activeEnergy = Interface.decode(json['activeEnergy'], agent),
                reactiveEnergy = Interface.decode(json['reactiveEnergy'], agent),
                apparentEnergy = Interface.decode(json['apparentEnergy'], agent),
                thdCurrent = raritan.rpc.powerlogic.PowerMeter.L2N.decode(json['thdCurrent'], agent),
                thdVoltageL2L = raritan.rpc.powerlogic.PowerMeter.L2L.decode(json['thdVoltageL2L'], agent),
                thdVoltageL2N = raritan.rpc.powerlogic.PowerMeter.L2N.decode(json['thdVoltageL2N'], agent),
            )
            return obj

        def encode(self):
            json = {}
            json['current'] = raritan.rpc.powerlogic.PowerMeter.L2N_N_Avg.encode(self.current)
            json['voltageL2L'] = raritan.rpc.powerlogic.PowerMeter.L2L_Avg.encode(self.voltageL2L)
            json['voltageL2N'] = raritan.rpc.powerlogic.PowerMeter.L2N_Avg.encode(self.voltageL2N)
            json['frequency'] = Interface.encode(self.frequency)
            json['activePower'] = raritan.rpc.powerlogic.PowerMeter.L2N_plain_total.encode(self.activePower)
            json['reactivePower'] = raritan.rpc.powerlogic.PowerMeter.L2N_plain_total.encode(self.reactivePower)
            json['apparentPower'] = raritan.rpc.powerlogic.PowerMeter.L2N_plain_total.encode(self.apparentPower)
            json['powerFactor'] = raritan.rpc.powerlogic.PowerMeter.MinMaxReading.encode(self.powerFactor)
            json['activeEnergy'] = Interface.encode(self.activeEnergy)
            json['reactiveEnergy'] = Interface.encode(self.reactiveEnergy)
            json['apparentEnergy'] = Interface.encode(self.apparentEnergy)
            json['thdCurrent'] = raritan.rpc.powerlogic.PowerMeter.L2N.encode(self.thdCurrent)
            json['thdVoltageL2L'] = raritan.rpc.powerlogic.PowerMeter.L2L.encode(self.thdVoltageL2L)
            json['thdVoltageL2N'] = raritan.rpc.powerlogic.PowerMeter.L2N.encode(self.thdVoltageL2N)
            return json

    # structure
    class Setup(Structure):
        idlType = "powerlogic.PowerMeter_1_2_5.Setup:1.0.0"
        elements = ["systemType", "displayMode"]

        def __init__(self, systemType, displayMode):
            typecheck.is_int(systemType, AssertionError)
            typecheck.is_int(displayMode, AssertionError)

            self.systemType = systemType
            self.displayMode = displayMode

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                systemType = json['systemType'],
                displayMode = json['displayMode'],
            )
            return obj

        def encode(self):
            json = {}
            json['systemType'] = self.systemType
            json['displayMode'] = self.displayMode
            return json

    # structure
    class ErrorStatus(Structure):
        idlType = "powerlogic.PowerMeter_1_2_5.ErrorStatus:1.0.0"
        elements = ["vL1saturation", "vL2saturation", "vL3saturation", "cL1saturation", "cL2saturation", "cL3saturation", "freqInvalid"]

        def __init__(self, vL1saturation, vL2saturation, vL3saturation, cL1saturation, cL2saturation, cL3saturation, freqInvalid):
            typecheck.is_bool(vL1saturation, AssertionError)
            typecheck.is_bool(vL2saturation, AssertionError)
            typecheck.is_bool(vL3saturation, AssertionError)
            typecheck.is_bool(cL1saturation, AssertionError)
            typecheck.is_bool(cL2saturation, AssertionError)
            typecheck.is_bool(cL3saturation, AssertionError)
            typecheck.is_bool(freqInvalid, AssertionError)

            self.vL1saturation = vL1saturation
            self.vL2saturation = vL2saturation
            self.vL3saturation = vL3saturation
            self.cL1saturation = cL1saturation
            self.cL2saturation = cL2saturation
            self.cL3saturation = cL3saturation
            self.freqInvalid = freqInvalid

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                vL1saturation = json['vL1saturation'],
                vL2saturation = json['vL2saturation'],
                vL3saturation = json['vL3saturation'],
                cL1saturation = json['cL1saturation'],
                cL2saturation = json['cL2saturation'],
                cL3saturation = json['cL3saturation'],
                freqInvalid = json['freqInvalid'],
            )
            return obj

        def encode(self):
            json = {}
            json['vL1saturation'] = self.vL1saturation
            json['vL2saturation'] = self.vL2saturation
            json['vL3saturation'] = self.vL3saturation
            json['cL1saturation'] = self.cL1saturation
            json['cL2saturation'] = self.cL2saturation
            json['cL3saturation'] = self.cL3saturation
            json['freqInvalid'] = self.freqInvalid
            return json

    # value object
    class SetupChangedEvent(raritan.rpc.idl.Event):
        idlType = "powerlogic.PowerMeter_1_2_5.SetupChangedEvent:1.0.0"

        def __init__(self, oldSetup, newSetup, source):
            super(raritan.rpc.powerlogic.PowerMeter.SetupChangedEvent, self).__init__(source)
            typecheck.is_struct(oldSetup, raritan.rpc.powerlogic.PowerMeter.Setup, AssertionError)
            typecheck.is_struct(newSetup, raritan.rpc.powerlogic.PowerMeter.Setup, AssertionError)

            self.oldSetup = oldSetup
            self.newSetup = newSetup

        def encode(self):
            json = super(raritan.rpc.powerlogic.PowerMeter.SetupChangedEvent, self).encode()
            json['oldSetup'] = raritan.rpc.powerlogic.PowerMeter.Setup.encode(self.oldSetup)
            json['newSetup'] = raritan.rpc.powerlogic.PowerMeter.Setup.encode(self.newSetup)
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                oldSetup = raritan.rpc.powerlogic.PowerMeter.Setup.decode(json['oldSetup'], agent),
                newSetup = raritan.rpc.powerlogic.PowerMeter.Setup.decode(json['newSetup'], agent),
                # for idl.Event
                source = Interface.decode(json['source'], agent),
            )
            return obj

        def listElements(self):
            elements = ["oldSetup", "newSetup"]
            elements = elements + super(raritan.rpc.powerlogic.PowerMeter.SetupChangedEvent, self).listElements()
            return elements

    # value object
    class ErrorStatusChangedEvent(raritan.rpc.idl.Event):
        idlType = "powerlogic.PowerMeter_1_2_5.ErrorStatusChangedEvent:1.0.0"

        def __init__(self, oldStatus, newStatus, source):
            super(raritan.rpc.powerlogic.PowerMeter.ErrorStatusChangedEvent, self).__init__(source)
            typecheck.is_struct(oldStatus, raritan.rpc.powerlogic.PowerMeter.ErrorStatus, AssertionError)
            typecheck.is_struct(newStatus, raritan.rpc.powerlogic.PowerMeter.ErrorStatus, AssertionError)

            self.oldStatus = oldStatus
            self.newStatus = newStatus

        def encode(self):
            json = super(raritan.rpc.powerlogic.PowerMeter.ErrorStatusChangedEvent, self).encode()
            json['oldStatus'] = raritan.rpc.powerlogic.PowerMeter.ErrorStatus.encode(self.oldStatus)
            json['newStatus'] = raritan.rpc.powerlogic.PowerMeter.ErrorStatus.encode(self.newStatus)
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                oldStatus = raritan.rpc.powerlogic.PowerMeter.ErrorStatus.decode(json['oldStatus'], agent),
                newStatus = raritan.rpc.powerlogic.PowerMeter.ErrorStatus.decode(json['newStatus'], agent),
                # for idl.Event
                source = Interface.decode(json['source'], agent),
            )
            return obj

        def listElements(self):
            elements = ["oldStatus", "newStatus"]
            elements = elements + super(raritan.rpc.powerlogic.PowerMeter.ErrorStatusChangedEvent, self).listElements()
            return elements

    class _getSensors(Interface.Method):
        name = 'getSensors'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.powerlogic.PowerMeter.Sensors.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.powerlogic.PowerMeter.Sensors, DecodeException)
            return _ret_

    class _getSetup(Interface.Method):
        name = 'getSetup'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.powerlogic.PowerMeter.Setup.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.powerlogic.PowerMeter.Setup, DecodeException)
            return _ret_

    class _getErrorStatus(Interface.Method):
        name = 'getErrorStatus'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.powerlogic.PowerMeter.ErrorStatus.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.powerlogic.PowerMeter.ErrorStatus, DecodeException)
            return _ret_

    class _resetAllMinMaxValues(Interface.Method):
        name = 'resetAllMinMaxValues'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            return None

    class _clearAllEnergyAccumulators(Interface.Method):
        name = 'clearAllEnergyAccumulators'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            return None
    def __init__(self, target, agent):
        super(PowerMeter, self).__init__(target, agent)
        self.getSensors = PowerMeter._getSensors(self)
        self.getSetup = PowerMeter._getSetup(self)
        self.getErrorStatus = PowerMeter._getErrorStatus(self)
        self.resetAllMinMaxValues = PowerMeter._resetAllMinMaxValues(self)
        self.clearAllEnergyAccumulators = PowerMeter._clearAllEnergyAccumulators(self)
