# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/jsonrpcd/src/modelrpc/idl/Cascade.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.pdumodel


# interface
class Cascade(Interface):
    idlType = "pdumodel.Cascade:1.0.0"

    # structure
    class Info(Structure):
        idlType = "pdumodel.Cascade.Info:1.0.0"
        elements = ["pduIds"]

        def __init__(self, pduIds):
            for x0 in pduIds:
                typecheck.is_int(x0, AssertionError)

            self.pduIds = pduIds

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                pduIds=[x0 for x0 in json["pduIds"]],
            )
            return obj

        def encode(self):
            json = {}
            json["pduIds"] = [x0 for x0 in self.pduIds]
            return json

    def getInfo(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInfo", args)
        _ret_ = raritan.rpc.pdumodel.Cascade.Info.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Cascade.Info, DecodeException)
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/jsonrpcd/src/modelrpc/idl/Inlets.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.pdumodel


# interface
class Inlets(Interface):
    idlType = "pdumodel.Inlets:1.0.0"

    # structure
    class Info(Structure):
        idlType = "pdumodel.Inlets.Info:1.0.0"
        elements = ["numberOfInlets"]

        def __init__(self, numberOfInlets):
            typecheck.is_int(numberOfInlets, AssertionError)

            self.numberOfInlets = numberOfInlets

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                numberOfInlets=json["numberOfInlets"],
            )
            return obj

        def encode(self):
            json = {}
            json["numberOfInlets"] = self.numberOfInlets
            return json

    def getInfo(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInfo", args)
        _ret_ = raritan.rpc.pdumodel.Inlets.Info.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Inlets.Info, DecodeException)
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/jsonrpcd/src/modelrpc/idl/Outlets.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.pdumodel


# interface
class Outlets(Interface):
    idlType = "pdumodel.Outlets:1.0.0"

    # structure
    class Info(Structure):
        idlType = "pdumodel.Outlets.Info:1.0.0"
        elements = ["numberOfOutlets"]

        def __init__(self, numberOfOutlets):
            typecheck.is_int(numberOfOutlets, AssertionError)

            self.numberOfOutlets = numberOfOutlets

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                numberOfOutlets=json["numberOfOutlets"],
            )
            return obj

        def encode(self):
            json = {}
            json["numberOfOutlets"] = self.numberOfOutlets
            return json

    def getInfo(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInfo", args)
        _ret_ = raritan.rpc.pdumodel.Outlets.Info.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Outlets.Info, DecodeException)
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/jsonrpcd/src/modelrpc/idl/OverCurrentProtectors.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.pdumodel


# interface
class OverCurrentProtectors(Interface):
    idlType = "pdumodel.OverCurrentProtectors:1.0.0"

    # structure
    class Info(Structure):
        idlType = "pdumodel.OverCurrentProtectors.Info:1.0.0"
        elements = ["numberOfOCPs"]

        def __init__(self, numberOfOCPs):
            typecheck.is_int(numberOfOCPs, AssertionError)

            self.numberOfOCPs = numberOfOCPs

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                numberOfOCPs=json["numberOfOCPs"],
            )
            return obj

        def encode(self):
            json = {}
            json["numberOfOCPs"] = self.numberOfOCPs
            return json

    def getInfo(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInfo", args)
        _ret_ = raritan.rpc.pdumodel.OverCurrentProtectors.Info.decode(
            rsp["_ret_"], agent
        )
        typecheck.is_struct(
            _ret_, raritan.rpc.pdumodel.OverCurrentProtectors.Info, DecodeException
        )
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/Nameplate.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.pdumodel


# structure
class Rating(Structure):
    idlType = "pdumodel.Rating:1.0.0"
    elements = ["current", "minVoltage", "maxVoltage"]

    def __init__(self, current, minVoltage, maxVoltage):
        typecheck.is_int(current, AssertionError)
        typecheck.is_int(minVoltage, AssertionError)
        typecheck.is_int(maxVoltage, AssertionError)

        self.current = current
        self.minVoltage = minVoltage
        self.maxVoltage = maxVoltage

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            current=json["current"],
            minVoltage=json["minVoltage"],
            maxVoltage=json["maxVoltage"],
        )
        return obj

    def encode(self):
        json = {}
        json["current"] = self.current
        json["minVoltage"] = self.minVoltage
        json["maxVoltage"] = self.maxVoltage
        return json


# structure
class Nameplate(Structure):
    idlType = "pdumodel.Nameplate:1.0.0"
    elements = [
        "manufacturer",
        "model",
        "partNumber",
        "serialNumber",
        "rating",
        "imageFileURL",
    ]

    def __init__(
        self, manufacturer, model, partNumber, serialNumber, rating, imageFileURL
    ):
        typecheck.is_string(manufacturer, AssertionError)
        typecheck.is_string(model, AssertionError)
        typecheck.is_string(partNumber, AssertionError)
        typecheck.is_string(serialNumber, AssertionError)
        typecheck.is_struct(
            rating, raritan.rpc.pdumodel.Nameplate.Rating, AssertionError
        )
        typecheck.is_string(imageFileURL, AssertionError)

        self.manufacturer = manufacturer
        self.model = model
        self.partNumber = partNumber
        self.serialNumber = serialNumber
        self.rating = rating
        self.imageFileURL = imageFileURL

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            manufacturer=json["manufacturer"],
            model=json["model"],
            partNumber=json["partNumber"],
            serialNumber=json["serialNumber"],
            rating=raritan.rpc.pdumodel.Nameplate.Rating.decode(json["rating"], agent),
            imageFileURL=json["imageFileURL"],
        )
        return obj

    def encode(self):
        json = {}
        json["manufacturer"] = self.manufacturer
        json["model"] = self.model
        json["partNumber"] = self.partNumber
        json["serialNumber"] = self.serialNumber
        json["rating"] = raritan.rpc.pdumodel.Nameplate.Rating.encode(self.rating)
        json["imageFileURL"] = self.imageFileURL
        return json

    # structure
    class Rating(Structure):
        idlType = "pdumodel.Nameplate.Rating:1.0.0"
        elements = ["voltage", "current", "frequency", "power"]

        def __init__(self, voltage, current, frequency, power):
            typecheck.is_string(voltage, AssertionError)
            typecheck.is_string(current, AssertionError)
            typecheck.is_string(frequency, AssertionError)
            typecheck.is_string(power, AssertionError)

            self.voltage = voltage
            self.current = current
            self.frequency = frequency
            self.power = power

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                voltage=json["voltage"],
                current=json["current"],
                frequency=json["frequency"],
                power=json["power"],
            )
            return obj

        def encode(self):
            json = {}
            json["voltage"] = self.voltage
            json["current"] = self.current
            json["frequency"] = self.frequency
            json["power"] = self.power
            return json


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/Controller.idl"
#

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

import raritan.rpc.pdumodel


# structure
class CtrlStatistic(Structure):
    idlType = "pdumodel.CtrlStatistic:1.0.0"
    elements = [
        "masterCSumErrCnt",
        "slaveCSumErrCnt",
        "timeoutCnt",
        "resetCnt",
        "emResetCnt",
    ]

    def __init__(
        self, masterCSumErrCnt, slaveCSumErrCnt, timeoutCnt, resetCnt, emResetCnt
    ):
        typecheck.is_int(masterCSumErrCnt, AssertionError)
        typecheck.is_int(slaveCSumErrCnt, AssertionError)
        typecheck.is_int(timeoutCnt, AssertionError)
        typecheck.is_int(resetCnt, AssertionError)
        typecheck.is_int(emResetCnt, AssertionError)

        self.masterCSumErrCnt = masterCSumErrCnt
        self.slaveCSumErrCnt = slaveCSumErrCnt
        self.timeoutCnt = timeoutCnt
        self.resetCnt = resetCnt
        self.emResetCnt = emResetCnt

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            masterCSumErrCnt=json["masterCSumErrCnt"],
            slaveCSumErrCnt=json["slaveCSumErrCnt"],
            timeoutCnt=json["timeoutCnt"],
            resetCnt=json["resetCnt"],
            emResetCnt=json["emResetCnt"],
        )
        return obj

    def encode(self):
        json = {}
        json["masterCSumErrCnt"] = self.masterCSumErrCnt
        json["slaveCSumErrCnt"] = self.slaveCSumErrCnt
        json["timeoutCnt"] = self.timeoutCnt
        json["resetCnt"] = self.resetCnt
        json["emResetCnt"] = self.emResetCnt
        return json


# interface
class Controller(Interface):
    idlType = "pdumodel.Controller:3.0.0"

    # enumeration
    class Status(Enumeration):
        idlType = "pdumodel.Controller.Status:1.0.0"
        values = [
            "OK",
            "COMMUNICATION_UNSTABLE",
            "COMMUNICATION_FAILURE",
            "UNKNOWN",
            "INCOMPATIBLE",
        ]

    Status.OK = Status(0)
    Status.COMMUNICATION_UNSTABLE = Status(1)
    Status.COMMUNICATION_FAILURE = Status(2)
    Status.UNKNOWN = Status(3)
    Status.INCOMPATIBLE = Status(4)

    # enumeration
    class Type(Enumeration):
        idlType = "pdumodel.Controller.Type:1.0.0"
        values = ["OUTLET_CTRL", "INLET_CTRL", "METER_CTRL"]

    Type.OUTLET_CTRL = Type(0)
    Type.INLET_CTRL = Type(1)
    Type.METER_CTRL = Type(2)

    # structure
    class MetaData(Structure):
        idlType = "pdumodel.Controller.MetaData:1.0.0"
        elements = [
            "type",
            "address",
            "magic",
            "versionAvailable",
            "fwAppVersion",
            "fwBootVersion",
            "hwVersion",
            "serial",
            "haveResetCnt",
            "haveEmResetCnt",
        ]

        def __init__(
            self,
            type,
            address,
            magic,
            versionAvailable,
            fwAppVersion,
            fwBootVersion,
            hwVersion,
            serial,
            haveResetCnt,
            haveEmResetCnt,
        ):
            typecheck.is_enum(
                type, raritan.rpc.pdumodel.Controller.Type, AssertionError
            )
            typecheck.is_string(address, AssertionError)
            typecheck.is_int(magic, AssertionError)
            typecheck.is_bool(versionAvailable, AssertionError)
            typecheck.is_int(fwAppVersion, AssertionError)
            typecheck.is_int(fwBootVersion, AssertionError)
            typecheck.is_int(hwVersion, AssertionError)
            typecheck.is_string(serial, AssertionError)
            typecheck.is_bool(haveResetCnt, AssertionError)
            typecheck.is_bool(haveEmResetCnt, AssertionError)

            self.type = type
            self.address = address
            self.magic = magic
            self.versionAvailable = versionAvailable
            self.fwAppVersion = fwAppVersion
            self.fwBootVersion = fwBootVersion
            self.hwVersion = hwVersion
            self.serial = serial
            self.haveResetCnt = haveResetCnt
            self.haveEmResetCnt = haveEmResetCnt

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                type=raritan.rpc.pdumodel.Controller.Type.decode(json["type"]),
                address=json["address"],
                magic=json["magic"],
                versionAvailable=json["versionAvailable"],
                fwAppVersion=json["fwAppVersion"],
                fwBootVersion=json["fwBootVersion"],
                hwVersion=json["hwVersion"],
                serial=json["serial"],
                haveResetCnt=json["haveResetCnt"],
                haveEmResetCnt=json["haveEmResetCnt"],
            )
            return obj

        def encode(self):
            json = {}
            json["type"] = raritan.rpc.pdumodel.Controller.Type.encode(self.type)
            json["address"] = self.address
            json["magic"] = self.magic
            json["versionAvailable"] = self.versionAvailable
            json["fwAppVersion"] = self.fwAppVersion
            json["fwBootVersion"] = self.fwBootVersion
            json["hwVersion"] = self.hwVersion
            json["serial"] = self.serial
            json["haveResetCnt"] = self.haveResetCnt
            json["haveEmResetCnt"] = self.haveEmResetCnt
            return json

    # value object
    class StatusChangedEvent(raritan.rpc.idl.Event):
        idlType = "pdumodel.Controller.StatusChangedEvent:1.0.0"

        def __init__(self, oldStatus, newStatus, source):
            super(raritan.rpc.pdumodel.Controller.StatusChangedEvent, self).__init__(
                source
            )
            typecheck.is_enum(
                oldStatus, raritan.rpc.pdumodel.Controller.Status, AssertionError
            )
            typecheck.is_enum(
                newStatus, raritan.rpc.pdumodel.Controller.Status, AssertionError
            )

            self.oldStatus = oldStatus
            self.newStatus = newStatus

        def encode(self):
            json = super(
                raritan.rpc.pdumodel.Controller.StatusChangedEvent, self
            ).encode()
            json["oldStatus"] = raritan.rpc.pdumodel.Controller.Status.encode(
                self.oldStatus
            )
            json["newStatus"] = raritan.rpc.pdumodel.Controller.Status.encode(
                self.newStatus
            )
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                oldStatus=raritan.rpc.pdumodel.Controller.Status.decode(
                    json["oldStatus"]
                ),
                newStatus=raritan.rpc.pdumodel.Controller.Status.decode(
                    json["newStatus"]
                ),
                # for idl.Event
                source=Interface.decode(json["source"], agent),
            )
            return obj

        def listElements(self):
            elements = ["oldStatus", "newStatus"]
            elements = (
                elements
                + super(
                    raritan.rpc.pdumodel.Controller.StatusChangedEvent, self
                ).listElements()
            )
            return elements

    # value object
    class MetaDataChangedEvent(raritan.rpc.idl.Event):
        idlType = "pdumodel.Controller.MetaDataChangedEvent:1.0.0"

        def __init__(self, oldMetaData, newMetaData, source):
            super(raritan.rpc.pdumodel.Controller.MetaDataChangedEvent, self).__init__(
                source
            )
            typecheck.is_struct(
                oldMetaData, raritan.rpc.pdumodel.Controller.MetaData, AssertionError
            )
            typecheck.is_struct(
                newMetaData, raritan.rpc.pdumodel.Controller.MetaData, AssertionError
            )

            self.oldMetaData = oldMetaData
            self.newMetaData = newMetaData

        def encode(self):
            json = super(
                raritan.rpc.pdumodel.Controller.MetaDataChangedEvent, self
            ).encode()
            json["oldMetaData"] = raritan.rpc.pdumodel.Controller.MetaData.encode(
                self.oldMetaData
            )
            json["newMetaData"] = raritan.rpc.pdumodel.Controller.MetaData.encode(
                self.newMetaData
            )
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                oldMetaData=raritan.rpc.pdumodel.Controller.MetaData.decode(
                    json["oldMetaData"], agent
                ),
                newMetaData=raritan.rpc.pdumodel.Controller.MetaData.decode(
                    json["newMetaData"], agent
                ),
                # for idl.Event
                source=Interface.decode(json["source"], agent),
            )
            return obj

        def listElements(self):
            elements = ["oldMetaData", "newMetaData"]
            elements = (
                elements
                + super(
                    raritan.rpc.pdumodel.Controller.MetaDataChangedEvent, self
                ).listElements()
            )
            return elements

    def getCommunicationStatus(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getCommunicationStatus", args)
        _ret_ = raritan.rpc.pdumodel.Controller.Status.decode(rsp["_ret_"])
        typecheck.is_enum(
            _ret_, raritan.rpc.pdumodel.Controller.Status, DecodeException
        )
        return _ret_

    def getStatistics(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getStatistics", args)
        _ret_ = raritan.rpc.pdumodel.CtrlStatistic.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.CtrlStatistic, DecodeException)
        return _ret_

    def getMetaData(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getMetaData", args)
        _ret_ = raritan.rpc.pdumodel.Controller.MetaData.decode(rsp["_ret_"], agent)
        typecheck.is_struct(
            _ret_, raritan.rpc.pdumodel.Controller.MetaData, DecodeException
        )
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/EDevice.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.pdumodel


# interface
class EDevice(Interface):
    idlType = "pdumodel.EDevice:1.0.0"

    def getParents(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getParents", args)
        _ret_ = [Interface.decode(x0, agent) for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_interface(x0, raritan.rpc.pdumodel.EDevice, DecodeException)
        return _ret_

    def getChildren(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getChildren", args)
        _ret_ = [Interface.decode(x0, agent) for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_interface(x0, raritan.rpc.pdumodel.EDevice, DecodeException)
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/Pole.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.pdumodel

import raritan.rpc.sensors


# enumeration
class PowerLine(Enumeration):
    idlType = "pdumodel.PowerLine:1.0.0"
    values = ["L1", "L2", "L3", "NEUTRAL"]


PowerLine.L1 = PowerLine(0)
PowerLine.L2 = PowerLine(1)
PowerLine.L3 = PowerLine(2)
PowerLine.NEUTRAL = PowerLine(3)

# structure
class Pole(Structure):
    idlType = "pdumodel.Pole:2.0.0"
    elements = [
        "label",
        "line",
        "nodeId",
        "voltage",
        "voltageLN",
        "current",
        "peakCurrent",
        "activePower",
        "apparentPower",
        "powerFactor",
        "activeEnergy",
        "apparentEnergy",
    ]

    def __init__(
        self,
        label,
        line,
        nodeId,
        voltage,
        voltageLN,
        current,
        peakCurrent,
        activePower,
        apparentPower,
        powerFactor,
        activeEnergy,
        apparentEnergy,
    ):
        typecheck.is_string(label, AssertionError)
        typecheck.is_enum(line, raritan.rpc.pdumodel.PowerLine, AssertionError)
        typecheck.is_int(nodeId, AssertionError)
        typecheck.is_interface(
            voltage, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            voltageLN, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            current, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            peakCurrent, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            activePower, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            apparentPower, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            powerFactor, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            activeEnergy, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            apparentEnergy, raritan.rpc.sensors.NumericSensor, AssertionError
        )

        self.label = label
        self.line = line
        self.nodeId = nodeId
        self.voltage = voltage
        self.voltageLN = voltageLN
        self.current = current
        self.peakCurrent = peakCurrent
        self.activePower = activePower
        self.apparentPower = apparentPower
        self.powerFactor = powerFactor
        self.activeEnergy = activeEnergy
        self.apparentEnergy = apparentEnergy

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            label=json["label"],
            line=raritan.rpc.pdumodel.PowerLine.decode(json["line"]),
            nodeId=json["nodeId"],
            voltage=Interface.decode(json["voltage"], agent),
            voltageLN=Interface.decode(json["voltageLN"], agent),
            current=Interface.decode(json["current"], agent),
            peakCurrent=Interface.decode(json["peakCurrent"], agent),
            activePower=Interface.decode(json["activePower"], agent),
            apparentPower=Interface.decode(json["apparentPower"], agent),
            powerFactor=Interface.decode(json["powerFactor"], agent),
            activeEnergy=Interface.decode(json["activeEnergy"], agent),
            apparentEnergy=Interface.decode(json["apparentEnergy"], agent),
        )
        return obj

    def encode(self):
        json = {}
        json["label"] = self.label
        json["line"] = raritan.rpc.pdumodel.PowerLine.encode(self.line)
        json["nodeId"] = self.nodeId
        json["voltage"] = Interface.encode(self.voltage)
        json["voltageLN"] = Interface.encode(self.voltageLN)
        json["current"] = Interface.encode(self.current)
        json["peakCurrent"] = Interface.encode(self.peakCurrent)
        json["activePower"] = Interface.encode(self.activePower)
        json["apparentPower"] = Interface.encode(self.apparentPower)
        json["powerFactor"] = Interface.encode(self.powerFactor)
        json["activeEnergy"] = Interface.encode(self.activeEnergy)
        json["apparentEnergy"] = Interface.encode(self.apparentEnergy)
        return json


# structure
class DoublePole(Structure):
    idlType = "pdumodel.DoublePole:2.0.0"
    elements = [
        "label",
        "line",
        "inNodeId",
        "outNodeId",
        "voltage",
        "voltageLN",
        "current",
        "peakCurrent",
        "activePower",
        "apparentPower",
        "powerFactor",
        "activeEnergy",
        "apparentEnergy",
    ]

    def __init__(
        self,
        label,
        line,
        inNodeId,
        outNodeId,
        voltage,
        voltageLN,
        current,
        peakCurrent,
        activePower,
        apparentPower,
        powerFactor,
        activeEnergy,
        apparentEnergy,
    ):
        typecheck.is_string(label, AssertionError)
        typecheck.is_enum(line, raritan.rpc.pdumodel.PowerLine, AssertionError)
        typecheck.is_int(inNodeId, AssertionError)
        typecheck.is_int(outNodeId, AssertionError)
        typecheck.is_interface(
            voltage, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            voltageLN, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            current, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            peakCurrent, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            activePower, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            apparentPower, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            powerFactor, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            activeEnergy, raritan.rpc.sensors.NumericSensor, AssertionError
        )
        typecheck.is_interface(
            apparentEnergy, raritan.rpc.sensors.NumericSensor, AssertionError
        )

        self.label = label
        self.line = line
        self.inNodeId = inNodeId
        self.outNodeId = outNodeId
        self.voltage = voltage
        self.voltageLN = voltageLN
        self.current = current
        self.peakCurrent = peakCurrent
        self.activePower = activePower
        self.apparentPower = apparentPower
        self.powerFactor = powerFactor
        self.activeEnergy = activeEnergy
        self.apparentEnergy = apparentEnergy

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            label=json["label"],
            line=raritan.rpc.pdumodel.PowerLine.decode(json["line"]),
            inNodeId=json["inNodeId"],
            outNodeId=json["outNodeId"],
            voltage=Interface.decode(json["voltage"], agent),
            voltageLN=Interface.decode(json["voltageLN"], agent),
            current=Interface.decode(json["current"], agent),
            peakCurrent=Interface.decode(json["peakCurrent"], agent),
            activePower=Interface.decode(json["activePower"], agent),
            apparentPower=Interface.decode(json["apparentPower"], agent),
            powerFactor=Interface.decode(json["powerFactor"], agent),
            activeEnergy=Interface.decode(json["activeEnergy"], agent),
            apparentEnergy=Interface.decode(json["apparentEnergy"], agent),
        )
        return obj

    def encode(self):
        json = {}
        json["label"] = self.label
        json["line"] = raritan.rpc.pdumodel.PowerLine.encode(self.line)
        json["inNodeId"] = self.inNodeId
        json["outNodeId"] = self.outNodeId
        json["voltage"] = Interface.encode(self.voltage)
        json["voltageLN"] = Interface.encode(self.voltageLN)
        json["current"] = Interface.encode(self.current)
        json["peakCurrent"] = Interface.encode(self.peakCurrent)
        json["activePower"] = Interface.encode(self.activePower)
        json["apparentPower"] = Interface.encode(self.apparentPower)
        json["powerFactor"] = Interface.encode(self.powerFactor)
        json["activeEnergy"] = Interface.encode(self.activeEnergy)
        json["apparentEnergy"] = Interface.encode(self.apparentEnergy)
        return json


# structure
class ThrowPole(Structure):
    idlType = "pdumodel.ThrowPole:1.0.0"
    elements = ["label", "line", "inNodeIds", "outNodeId"]

    def __init__(self, label, line, inNodeIds, outNodeId):
        typecheck.is_string(label, AssertionError)
        typecheck.is_enum(line, raritan.rpc.pdumodel.PowerLine, AssertionError)
        for x0 in inNodeIds:
            typecheck.is_int(x0, AssertionError)
        typecheck.is_int(outNodeId, AssertionError)

        self.label = label
        self.line = line
        self.inNodeIds = inNodeIds
        self.outNodeId = outNodeId

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            label=json["label"],
            line=raritan.rpc.pdumodel.PowerLine.decode(json["line"]),
            inNodeIds=[x0 for x0 in json["inNodeIds"]],
            outNodeId=json["outNodeId"],
        )
        return obj

    def encode(self):
        json = {}
        json["label"] = self.label
        json["line"] = raritan.rpc.pdumodel.PowerLine.encode(self.line)
        json["inNodeIds"] = [x0 for x0 in self.inNodeIds]
        json["outNodeId"] = self.outNodeId
        return json


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/ResidualCurrentStateSensor.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.sensors


# interface
class ResidualCurrentStateSensor(raritan.rpc.sensors.StateSensor):
    idlType = "pdumodel.ResidualCurrentStateSensor:2.0.0"

    STATE_NORMAL = 0

    STATE_WARNING = 1

    STATE_CRITICAL = 2

    STATE_SELFTEST = 3

    STATE_FAILURE = 4

    def startSelfTest(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "startSelfTest", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/Inlet.idl"
#

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

import raritan.rpc.pdumodel

import raritan.rpc.sensors


# interface
class Inlet(EDevice):
    idlType = "pdumodel.Inlet:1.2.6"

    # structure
    class MetaData(Structure):
        idlType = "pdumodel.Inlet.MetaData:1.0.0"
        elements = ["label", "plugType", "namePlate", "rating"]

        def __init__(self, label, plugType, namePlate, rating):
            typecheck.is_string(label, AssertionError)
            typecheck.is_string(plugType, AssertionError)
            typecheck.is_struct(
                namePlate, raritan.rpc.pdumodel.Nameplate, AssertionError
            )
            typecheck.is_struct(rating, raritan.rpc.pdumodel.Rating, AssertionError)

            self.label = label
            self.plugType = plugType
            self.namePlate = namePlate
            self.rating = rating

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                label=json["label"],
                plugType=json["plugType"],
                namePlate=raritan.rpc.pdumodel.Nameplate.decode(
                    json["namePlate"], agent
                ),
                rating=raritan.rpc.pdumodel.Rating.decode(json["rating"], agent),
            )
            return obj

        def encode(self):
            json = {}
            json["label"] = self.label
            json["plugType"] = self.plugType
            json["namePlate"] = raritan.rpc.pdumodel.Nameplate.encode(self.namePlate)
            json["rating"] = raritan.rpc.pdumodel.Rating.encode(self.rating)
            return json

    # structure
    class Sensors(Structure):
        idlType = "pdumodel.Inlet.Sensors:1.0.0"
        elements = [
            "voltage",
            "current",
            "peakCurrent",
            "residualCurrent",
            "activePower",
            "apparentPower",
            "powerFactor",
            "activeEnergy",
            "apparentEnergy",
            "unbalancedCurrent",
            "lineFrequency",
            "phaseAngle",
            "powerQuality",
            "surgeProtectorStatus",
            "residualCurrentStatus",
        ]

        def __init__(
            self,
            voltage,
            current,
            peakCurrent,
            residualCurrent,
            activePower,
            apparentPower,
            powerFactor,
            activeEnergy,
            apparentEnergy,
            unbalancedCurrent,
            lineFrequency,
            phaseAngle,
            powerQuality,
            surgeProtectorStatus,
            residualCurrentStatus,
        ):
            typecheck.is_interface(
                voltage, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                current, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                peakCurrent, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                residualCurrent, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                activePower, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                apparentPower, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                powerFactor, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                activeEnergy, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                apparentEnergy, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                unbalancedCurrent, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                lineFrequency, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                phaseAngle, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                powerQuality, raritan.rpc.sensors.StateSensor, AssertionError
            )
            typecheck.is_interface(
                surgeProtectorStatus, raritan.rpc.sensors.StateSensor, AssertionError
            )
            typecheck.is_interface(
                residualCurrentStatus,
                raritan.rpc.pdumodel.ResidualCurrentStateSensor,
                AssertionError,
            )

            self.voltage = voltage
            self.current = current
            self.peakCurrent = peakCurrent
            self.residualCurrent = residualCurrent
            self.activePower = activePower
            self.apparentPower = apparentPower
            self.powerFactor = powerFactor
            self.activeEnergy = activeEnergy
            self.apparentEnergy = apparentEnergy
            self.unbalancedCurrent = unbalancedCurrent
            self.lineFrequency = lineFrequency
            self.phaseAngle = phaseAngle
            self.powerQuality = powerQuality
            self.surgeProtectorStatus = surgeProtectorStatus
            self.residualCurrentStatus = residualCurrentStatus

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                voltage=Interface.decode(json["voltage"], agent),
                current=Interface.decode(json["current"], agent),
                peakCurrent=Interface.decode(json["peakCurrent"], agent),
                residualCurrent=Interface.decode(json["residualCurrent"], agent),
                activePower=Interface.decode(json["activePower"], agent),
                apparentPower=Interface.decode(json["apparentPower"], agent),
                powerFactor=Interface.decode(json["powerFactor"], agent),
                activeEnergy=Interface.decode(json["activeEnergy"], agent),
                apparentEnergy=Interface.decode(json["apparentEnergy"], agent),
                unbalancedCurrent=Interface.decode(json["unbalancedCurrent"], agent),
                lineFrequency=Interface.decode(json["lineFrequency"], agent),
                phaseAngle=Interface.decode(json["phaseAngle"], agent),
                powerQuality=Interface.decode(json["powerQuality"], agent),
                surgeProtectorStatus=Interface.decode(
                    json["surgeProtectorStatus"], agent
                ),
                residualCurrentStatus=Interface.decode(
                    json["residualCurrentStatus"], agent
                ),
            )
            return obj

        def encode(self):
            json = {}
            json["voltage"] = Interface.encode(self.voltage)
            json["current"] = Interface.encode(self.current)
            json["peakCurrent"] = Interface.encode(self.peakCurrent)
            json["residualCurrent"] = Interface.encode(self.residualCurrent)
            json["activePower"] = Interface.encode(self.activePower)
            json["apparentPower"] = Interface.encode(self.apparentPower)
            json["powerFactor"] = Interface.encode(self.powerFactor)
            json["activeEnergy"] = Interface.encode(self.activeEnergy)
            json["apparentEnergy"] = Interface.encode(self.apparentEnergy)
            json["unbalancedCurrent"] = Interface.encode(self.unbalancedCurrent)
            json["lineFrequency"] = Interface.encode(self.lineFrequency)
            json["phaseAngle"] = Interface.encode(self.phaseAngle)
            json["powerQuality"] = Interface.encode(self.powerQuality)
            json["surgeProtectorStatus"] = Interface.encode(self.surgeProtectorStatus)
            json["residualCurrentStatus"] = Interface.encode(self.residualCurrentStatus)
            return json

    # structure
    class Settings(Structure):
        idlType = "pdumodel.Inlet.Settings:1.0.0"
        elements = ["name"]

        def __init__(self, name):
            typecheck.is_string(name, AssertionError)

            self.name = name

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                name=json["name"],
            )
            return obj

        def encode(self):
            json = {}
            json["name"] = self.name
            return json

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

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

            self.oldSettings = oldSettings
            self.newSettings = newSettings

        def encode(self):
            json = super(raritan.rpc.pdumodel.Inlet.SettingsChangedEvent, self).encode()
            json["oldSettings"] = raritan.rpc.pdumodel.Inlet.Settings.encode(
                self.oldSettings
            )
            json["newSettings"] = raritan.rpc.pdumodel.Inlet.Settings.encode(
                self.newSettings
            )
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                oldSettings=raritan.rpc.pdumodel.Inlet.Settings.decode(
                    json["oldSettings"], agent
                ),
                newSettings=raritan.rpc.pdumodel.Inlet.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.pdumodel.Inlet.SettingsChangedEvent, self
                ).listElements()
            )
            return elements

    # value object
    class EnableStateChangedEvent(raritan.rpc.event.UserEvent):
        idlType = "pdumodel.Inlet.EnableStateChangedEvent:1.0.0"

        def __init__(self, enabled, actUserName, actIpAddr, source):
            super(raritan.rpc.pdumodel.Inlet.EnableStateChangedEvent, self).__init__(
                actUserName, actIpAddr, source
            )
            typecheck.is_bool(enabled, AssertionError)

            self.enabled = enabled

        def encode(self):
            json = super(
                raritan.rpc.pdumodel.Inlet.EnableStateChangedEvent, self
            ).encode()
            json["enabled"] = self.enabled
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                enabled=json["enabled"],
                # for event.UserEvent
                actUserName=json["actUserName"],
                actIpAddr=json["actIpAddr"],
                # for idl.Event
                source=Interface.decode(json["source"], agent),
            )
            return obj

        def listElements(self):
            elements = ["enabled"]
            elements = (
                elements
                + super(
                    raritan.rpc.pdumodel.Inlet.EnableStateChangedEvent, self
                ).listElements()
            )
            return elements

    def getMetaData(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getMetaData", args)
        _ret_ = raritan.rpc.pdumodel.Inlet.MetaData.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Inlet.MetaData, DecodeException)
        return _ret_

    def getSensors(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getSensors", args)
        _ret_ = raritan.rpc.pdumodel.Inlet.Sensors.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Inlet.Sensors, DecodeException)
        return _ret_

    def getPoles(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getPoles", args)
        _ret_ = [raritan.rpc.pdumodel.Pole.decode(x0, agent) for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_struct(x0, raritan.rpc.pdumodel.Pole, DecodeException)
        return _ret_

    def getSettings(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getSettings", args)
        _ret_ = raritan.rpc.pdumodel.Inlet.Settings.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Inlet.Settings, DecodeException)
        return _ret_

    def setSettings(self, settings):
        agent = self.agent
        typecheck.is_struct(
            settings, raritan.rpc.pdumodel.Inlet.Settings, AssertionError
        )
        args = {}
        args["settings"] = raritan.rpc.pdumodel.Inlet.Settings.encode(settings)
        rsp = agent.json_rpc(self.target, "setSettings", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def setEnabled(self, enabled):
        agent = self.agent
        typecheck.is_bool(enabled, AssertionError)
        args = {}
        args["enabled"] = enabled
        rsp = agent.json_rpc(self.target, "setEnabled", args)

    def isEnabled(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "isEnabled", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_bool(_ret_, DecodeException)
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/OverCurrentProtector.idl"
#

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

import raritan.rpc.pdumodel

import raritan.rpc.sensors


# structure
class CircuitBreakerStatistic(Structure):
    idlType = "pdumodel.CircuitBreakerStatistic:1.0.0"
    elements = ["tripCnt"]

    def __init__(self, tripCnt):
        typecheck.is_int(tripCnt, AssertionError)

        self.tripCnt = tripCnt

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            tripCnt=json["tripCnt"],
        )
        return obj

    def encode(self):
        json = {}
        json["tripCnt"] = self.tripCnt
        return json


# interface
class OverCurrentProtector(EDevice):
    idlType = "pdumodel.OverCurrentProtector:2.1.2"

    # enumeration
    class Type(Enumeration):
        idlType = "pdumodel.OverCurrentProtector.Type:1.0.0"
        values = [
            "BREAKER_1POLE",
            "BREAKER_2POLE",
            "BREAKER_3POLE",
            "FUSE",
            "FUSE_PAIR",
            "RCBO_2POLE",
            "RCBO_3POLE",
            "RCBO_4POLE",
        ]

    Type.BREAKER_1POLE = Type(0)
    Type.BREAKER_2POLE = Type(1)
    Type.BREAKER_3POLE = Type(2)
    Type.FUSE = Type(3)
    Type.FUSE_PAIR = Type(4)
    Type.RCBO_2POLE = Type(5)
    Type.RCBO_3POLE = Type(6)
    Type.RCBO_4POLE = Type(7)

    # structure
    class MetaData(Structure):
        idlType = "pdumodel.OverCurrentProtector.MetaData:1.0.0"
        elements = ["label", "namePlate", "rating", "type", "maxTripCnt"]

        def __init__(self, label, namePlate, rating, type, maxTripCnt):
            typecheck.is_string(label, AssertionError)
            typecheck.is_struct(
                namePlate, raritan.rpc.pdumodel.Nameplate, AssertionError
            )
            typecheck.is_struct(rating, raritan.rpc.pdumodel.Rating, AssertionError)
            typecheck.is_enum(
                type, raritan.rpc.pdumodel.OverCurrentProtector.Type, AssertionError
            )
            typecheck.is_int(maxTripCnt, AssertionError)

            self.label = label
            self.namePlate = namePlate
            self.rating = rating
            self.type = type
            self.maxTripCnt = maxTripCnt

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                label=json["label"],
                namePlate=raritan.rpc.pdumodel.Nameplate.decode(
                    json["namePlate"], agent
                ),
                rating=raritan.rpc.pdumodel.Rating.decode(json["rating"], agent),
                type=raritan.rpc.pdumodel.OverCurrentProtector.Type.decode(
                    json["type"]
                ),
                maxTripCnt=json["maxTripCnt"],
            )
            return obj

        def encode(self):
            json = {}
            json["label"] = self.label
            json["namePlate"] = raritan.rpc.pdumodel.Nameplate.encode(self.namePlate)
            json["rating"] = raritan.rpc.pdumodel.Rating.encode(self.rating)
            json["type"] = raritan.rpc.pdumodel.OverCurrentProtector.Type.encode(
                self.type
            )
            json["maxTripCnt"] = self.maxTripCnt
            return json

    # structure
    class Sensors(Structure):
        idlType = "pdumodel.OverCurrentProtector.Sensors:1.0.0"
        elements = ["trip", "current", "peakCurrent"]

        def __init__(self, trip, current, peakCurrent):
            typecheck.is_interface(
                trip, raritan.rpc.sensors.StateSensor, AssertionError
            )
            typecheck.is_interface(
                current, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                peakCurrent, raritan.rpc.sensors.NumericSensor, AssertionError
            )

            self.trip = trip
            self.current = current
            self.peakCurrent = peakCurrent

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                trip=Interface.decode(json["trip"], agent),
                current=Interface.decode(json["current"], agent),
                peakCurrent=Interface.decode(json["peakCurrent"], agent),
            )
            return obj

        def encode(self):
            json = {}
            json["trip"] = Interface.encode(self.trip)
            json["current"] = Interface.encode(self.current)
            json["peakCurrent"] = Interface.encode(self.peakCurrent)
            return json

    # structure
    class Settings(Structure):
        idlType = "pdumodel.OverCurrentProtector.Settings:1.0.0"
        elements = ["name"]

        def __init__(self, name):
            typecheck.is_string(name, AssertionError)

            self.name = name

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                name=json["name"],
            )
            return obj

        def encode(self):
            json = {}
            json["name"] = self.name
            return json

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

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

            self.oldSettings = oldSettings
            self.newSettings = newSettings

        def encode(self):
            json = super(
                raritan.rpc.pdumodel.OverCurrentProtector.SettingsChangedEvent, self
            ).encode()
            json[
                "oldSettings"
            ] = raritan.rpc.pdumodel.OverCurrentProtector.Settings.encode(
                self.oldSettings
            )
            json[
                "newSettings"
            ] = raritan.rpc.pdumodel.OverCurrentProtector.Settings.encode(
                self.newSettings
            )
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                oldSettings=raritan.rpc.pdumodel.OverCurrentProtector.Settings.decode(
                    json["oldSettings"], agent
                ),
                newSettings=raritan.rpc.pdumodel.OverCurrentProtector.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.pdumodel.OverCurrentProtector.SettingsChangedEvent, self
                ).listElements()
            )
            return elements

    def getMetaData(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getMetaData", args)
        _ret_ = raritan.rpc.pdumodel.OverCurrentProtector.MetaData.decode(
            rsp["_ret_"], agent
        )
        typecheck.is_struct(
            _ret_, raritan.rpc.pdumodel.OverCurrentProtector.MetaData, DecodeException
        )
        return _ret_

    def getSensors(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getSensors", args)
        _ret_ = raritan.rpc.pdumodel.OverCurrentProtector.Sensors.decode(
            rsp["_ret_"], agent
        )
        typecheck.is_struct(
            _ret_, raritan.rpc.pdumodel.OverCurrentProtector.Sensors, DecodeException
        )
        return _ret_

    def getPoles(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getPoles", args)
        _ret_ = [
            raritan.rpc.pdumodel.DoublePole.decode(x0, agent) for x0 in rsp["_ret_"]
        ]
        for x0 in _ret_:
            typecheck.is_struct(x0, raritan.rpc.pdumodel.DoublePole, DecodeException)
        return _ret_

    def getInlet(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInlet", args)
        _ret_ = Interface.decode(rsp["_ret_"], agent)
        typecheck.is_interface(_ret_, raritan.rpc.pdumodel.Inlet, DecodeException)
        return _ret_

    def getOCP(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getOCP", args)
        _ret_ = Interface.decode(rsp["_ret_"], agent)
        typecheck.is_interface(
            _ret_, raritan.rpc.pdumodel.OverCurrentProtector, DecodeException
        )
        return _ret_

    def getSettings(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getSettings", args)
        _ret_ = raritan.rpc.pdumodel.OverCurrentProtector.Settings.decode(
            rsp["_ret_"], agent
        )
        typecheck.is_struct(
            _ret_, raritan.rpc.pdumodel.OverCurrentProtector.Settings, DecodeException
        )
        return _ret_

    def setSettings(self, settings):
        agent = self.agent
        typecheck.is_struct(
            settings, raritan.rpc.pdumodel.OverCurrentProtector.Settings, AssertionError
        )
        args = {}
        args["settings"] = raritan.rpc.pdumodel.OverCurrentProtector.Settings.encode(
            settings
        )
        rsp = agent.json_rpc(self.target, "setSettings", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/Outlet.idl"
#

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

import raritan.rpc.idl

import raritan.rpc.pdumodel

import raritan.rpc.sensors


# structure
class OutletStatistic(Structure):
    idlType = "pdumodel.OutletStatistic:1.0.0"
    elements = ["relayCycleCnt", "relayFailCnt"]

    def __init__(self, relayCycleCnt, relayFailCnt):
        typecheck.is_int(relayCycleCnt, AssertionError)
        typecheck.is_int(relayFailCnt, AssertionError)

        self.relayCycleCnt = relayCycleCnt
        self.relayFailCnt = relayFailCnt

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            relayCycleCnt=json["relayCycleCnt"],
            relayFailCnt=json["relayFailCnt"],
        )
        return obj

    def encode(self):
        json = {}
        json["relayCycleCnt"] = self.relayCycleCnt
        json["relayFailCnt"] = self.relayFailCnt
        return json


# interface
class Outlet(EDevice):
    idlType = "pdumodel.Outlet:1.5.6"

    ERR_OUTLET_NOT_SWITCHABLE = 1

    ERR_LOAD_SHEDDING_ACTIVE = 2

    ERR_OUTLET_DISABLED = 3

    ERR_OUTLET_NOT_OFF = 4

    ERR_INVALID_PARAM = 1

    # structure
    class MetaData(Structure):
        idlType = "pdumodel.Outlet.MetaData:1.0.0"
        elements = [
            "label",
            "receptacleType",
            "namePlate",
            "rating",
            "isSwitchable",
            "isLatching",
            "maxRelayCycleCnt",
        ]

        def __init__(
            self,
            label,
            receptacleType,
            namePlate,
            rating,
            isSwitchable,
            isLatching,
            maxRelayCycleCnt,
        ):
            typecheck.is_string(label, AssertionError)
            typecheck.is_string(receptacleType, AssertionError)
            typecheck.is_struct(
                namePlate, raritan.rpc.pdumodel.Nameplate, AssertionError
            )
            typecheck.is_struct(rating, raritan.rpc.pdumodel.Rating, AssertionError)
            typecheck.is_bool(isSwitchable, AssertionError)
            typecheck.is_bool(isLatching, AssertionError)
            typecheck.is_int(maxRelayCycleCnt, AssertionError)

            self.label = label
            self.receptacleType = receptacleType
            self.namePlate = namePlate
            self.rating = rating
            self.isSwitchable = isSwitchable
            self.isLatching = isLatching
            self.maxRelayCycleCnt = maxRelayCycleCnt

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                label=json["label"],
                receptacleType=json["receptacleType"],
                namePlate=raritan.rpc.pdumodel.Nameplate.decode(
                    json["namePlate"], agent
                ),
                rating=raritan.rpc.pdumodel.Rating.decode(json["rating"], agent),
                isSwitchable=json["isSwitchable"],
                isLatching=json["isLatching"],
                maxRelayCycleCnt=json["maxRelayCycleCnt"],
            )
            return obj

        def encode(self):
            json = {}
            json["label"] = self.label
            json["receptacleType"] = self.receptacleType
            json["namePlate"] = raritan.rpc.pdumodel.Nameplate.encode(self.namePlate)
            json["rating"] = raritan.rpc.pdumodel.Rating.encode(self.rating)
            json["isSwitchable"] = self.isSwitchable
            json["isLatching"] = self.isLatching
            json["maxRelayCycleCnt"] = self.maxRelayCycleCnt
            return json

    # enumeration
    class PowerState(Enumeration):
        idlType = "pdumodel.Outlet.PowerState:1.0.0"
        values = ["PS_OFF", "PS_ON"]

    PowerState.PS_OFF = PowerState(0)
    PowerState.PS_ON = PowerState(1)

    # structure
    class LedState(Structure):
        idlType = "pdumodel.Outlet.LedState:1.0.0"
        elements = ["red", "green", "blinking"]

        def __init__(self, red, green, blinking):
            typecheck.is_bool(red, AssertionError)
            typecheck.is_bool(green, AssertionError)
            typecheck.is_bool(blinking, AssertionError)

            self.red = red
            self.green = green
            self.blinking = blinking

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                red=json["red"],
                green=json["green"],
                blinking=json["blinking"],
            )
            return obj

        def encode(self):
            json = {}
            json["red"] = self.red
            json["green"] = self.green
            json["blinking"] = self.blinking
            return json

    # structure
    class State(Structure):
        idlType = "pdumodel.Outlet.State:1.0.0"
        elements = [
            "available",
            "powerState",
            "switchOnInProgress",
            "cycleInProgress",
            "ledState",
            "lastPowerStateChange",
        ]

        def __init__(
            self,
            available,
            powerState,
            switchOnInProgress,
            cycleInProgress,
            ledState,
            lastPowerStateChange,
        ):
            typecheck.is_bool(available, AssertionError)
            typecheck.is_enum(
                powerState, raritan.rpc.pdumodel.Outlet.PowerState, AssertionError
            )
            typecheck.is_bool(switchOnInProgress, AssertionError)
            typecheck.is_bool(cycleInProgress, AssertionError)
            typecheck.is_struct(
                ledState, raritan.rpc.pdumodel.Outlet.LedState, AssertionError
            )
            typecheck.is_time(lastPowerStateChange, AssertionError)

            self.available = available
            self.powerState = powerState
            self.switchOnInProgress = switchOnInProgress
            self.cycleInProgress = cycleInProgress
            self.ledState = ledState
            self.lastPowerStateChange = lastPowerStateChange

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                available=json["available"],
                powerState=raritan.rpc.pdumodel.Outlet.PowerState.decode(
                    json["powerState"]
                ),
                switchOnInProgress=json["switchOnInProgress"],
                cycleInProgress=json["cycleInProgress"],
                ledState=raritan.rpc.pdumodel.Outlet.LedState.decode(
                    json["ledState"], agent
                ),
                lastPowerStateChange=raritan.rpc.Time.decode(
                    json["lastPowerStateChange"]
                ),
            )
            return obj

        def encode(self):
            json = {}
            json["available"] = self.available
            json["powerState"] = raritan.rpc.pdumodel.Outlet.PowerState.encode(
                self.powerState
            )
            json["switchOnInProgress"] = self.switchOnInProgress
            json["cycleInProgress"] = self.cycleInProgress
            json["ledState"] = raritan.rpc.pdumodel.Outlet.LedState.encode(
                self.ledState
            )
            json["lastPowerStateChange"] = raritan.rpc.Time.encode(
                self.lastPowerStateChange
            )
            return json

    # enumeration
    class StartupState(Enumeration):
        idlType = "pdumodel.Outlet.StartupState:1.0.0"
        values = ["SS_ON", "SS_OFF", "SS_LASTKNOWN", "SS_PDUDEF"]

    StartupState.SS_ON = StartupState(0)
    StartupState.SS_OFF = StartupState(1)
    StartupState.SS_LASTKNOWN = StartupState(2)
    StartupState.SS_PDUDEF = StartupState(3)

    # structure
    class Settings(Structure):
        idlType = "pdumodel.Outlet.Settings:1.0.0"
        elements = [
            "name",
            "startupState",
            "usePduCycleDelay",
            "cycleDelay",
            "nonCritical",
            "sequenceDelay",
        ]

        def __init__(
            self,
            name,
            startupState,
            usePduCycleDelay,
            cycleDelay,
            nonCritical,
            sequenceDelay,
        ):
            typecheck.is_string(name, AssertionError)
            typecheck.is_enum(
                startupState, raritan.rpc.pdumodel.Outlet.StartupState, AssertionError
            )
            typecheck.is_bool(usePduCycleDelay, AssertionError)
            typecheck.is_int(cycleDelay, AssertionError)
            typecheck.is_bool(nonCritical, AssertionError)
            typecheck.is_int(sequenceDelay, AssertionError)

            self.name = name
            self.startupState = startupState
            self.usePduCycleDelay = usePduCycleDelay
            self.cycleDelay = cycleDelay
            self.nonCritical = nonCritical
            self.sequenceDelay = sequenceDelay

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                name=json["name"],
                startupState=raritan.rpc.pdumodel.Outlet.StartupState.decode(
                    json["startupState"]
                ),
                usePduCycleDelay=json["usePduCycleDelay"],
                cycleDelay=json["cycleDelay"],
                nonCritical=json["nonCritical"],
                sequenceDelay=json["sequenceDelay"],
            )
            return obj

        def encode(self):
            json = {}
            json["name"] = self.name
            json["startupState"] = raritan.rpc.pdumodel.Outlet.StartupState.encode(
                self.startupState
            )
            json["usePduCycleDelay"] = self.usePduCycleDelay
            json["cycleDelay"] = self.cycleDelay
            json["nonCritical"] = self.nonCritical
            json["sequenceDelay"] = self.sequenceDelay
            return json

    # structure
    class Sensors(Structure):
        idlType = "pdumodel.Outlet.Sensors:1.0.0"
        elements = [
            "voltage",
            "current",
            "peakCurrent",
            "maximumCurrent",
            "unbalancedCurrent",
            "activePower",
            "apparentPower",
            "powerFactor",
            "activeEnergy",
            "apparentEnergy",
            "phaseAngle",
            "lineFrequency",
            "outletState",
        ]

        def __init__(
            self,
            voltage,
            current,
            peakCurrent,
            maximumCurrent,
            unbalancedCurrent,
            activePower,
            apparentPower,
            powerFactor,
            activeEnergy,
            apparentEnergy,
            phaseAngle,
            lineFrequency,
            outletState,
        ):
            typecheck.is_interface(
                voltage, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                current, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                peakCurrent, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                maximumCurrent, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                unbalancedCurrent, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                activePower, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                apparentPower, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                powerFactor, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                activeEnergy, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                apparentEnergy, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                phaseAngle, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                lineFrequency, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                outletState, raritan.rpc.sensors.StateSensor, AssertionError
            )

            self.voltage = voltage
            self.current = current
            self.peakCurrent = peakCurrent
            self.maximumCurrent = maximumCurrent
            self.unbalancedCurrent = unbalancedCurrent
            self.activePower = activePower
            self.apparentPower = apparentPower
            self.powerFactor = powerFactor
            self.activeEnergy = activeEnergy
            self.apparentEnergy = apparentEnergy
            self.phaseAngle = phaseAngle
            self.lineFrequency = lineFrequency
            self.outletState = outletState

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                voltage=Interface.decode(json["voltage"], agent),
                current=Interface.decode(json["current"], agent),
                peakCurrent=Interface.decode(json["peakCurrent"], agent),
                maximumCurrent=Interface.decode(json["maximumCurrent"], agent),
                unbalancedCurrent=Interface.decode(json["unbalancedCurrent"], agent),
                activePower=Interface.decode(json["activePower"], agent),
                apparentPower=Interface.decode(json["apparentPower"], agent),
                powerFactor=Interface.decode(json["powerFactor"], agent),
                activeEnergy=Interface.decode(json["activeEnergy"], agent),
                apparentEnergy=Interface.decode(json["apparentEnergy"], agent),
                phaseAngle=Interface.decode(json["phaseAngle"], agent),
                lineFrequency=Interface.decode(json["lineFrequency"], agent),
                outletState=Interface.decode(json["outletState"], agent),
            )
            return obj

        def encode(self):
            json = {}
            json["voltage"] = Interface.encode(self.voltage)
            json["current"] = Interface.encode(self.current)
            json["peakCurrent"] = Interface.encode(self.peakCurrent)
            json["maximumCurrent"] = Interface.encode(self.maximumCurrent)
            json["unbalancedCurrent"] = Interface.encode(self.unbalancedCurrent)
            json["activePower"] = Interface.encode(self.activePower)
            json["apparentPower"] = Interface.encode(self.apparentPower)
            json["powerFactor"] = Interface.encode(self.powerFactor)
            json["activeEnergy"] = Interface.encode(self.activeEnergy)
            json["apparentEnergy"] = Interface.encode(self.apparentEnergy)
            json["phaseAngle"] = Interface.encode(self.phaseAngle)
            json["lineFrequency"] = Interface.encode(self.lineFrequency)
            json["outletState"] = Interface.encode(self.outletState)
            return json

    # value object
    class PowerControlEvent(raritan.rpc.event.UserEvent):
        idlType = "pdumodel.Outlet.PowerControlEvent:1.0.0"

        def __init__(self, state, cycle, actUserName, actIpAddr, source):
            super(raritan.rpc.pdumodel.Outlet.PowerControlEvent, self).__init__(
                actUserName, actIpAddr, source
            )
            typecheck.is_enum(
                state, raritan.rpc.pdumodel.Outlet.PowerState, AssertionError
            )
            typecheck.is_bool(cycle, AssertionError)

            self.state = state
            self.cycle = cycle

        def encode(self):
            json = super(raritan.rpc.pdumodel.Outlet.PowerControlEvent, self).encode()
            json["state"] = raritan.rpc.pdumodel.Outlet.PowerState.encode(self.state)
            json["cycle"] = self.cycle
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                state=raritan.rpc.pdumodel.Outlet.PowerState.decode(json["state"]),
                cycle=json["cycle"],
                # for event.UserEvent
                actUserName=json["actUserName"],
                actIpAddr=json["actIpAddr"],
                # for idl.Event
                source=Interface.decode(json["source"], agent),
            )
            return obj

        def listElements(self):
            elements = ["state", "cycle"]
            elements = (
                elements
                + super(
                    raritan.rpc.pdumodel.Outlet.PowerControlEvent, self
                ).listElements()
            )
            return elements

    # value object
    class StateChangedEvent(raritan.rpc.idl.Event):
        idlType = "pdumodel.Outlet.StateChangedEvent:1.0.0"

        def __init__(self, oldState, newState, source):
            super(raritan.rpc.pdumodel.Outlet.StateChangedEvent, self).__init__(source)
            typecheck.is_struct(
                oldState, raritan.rpc.pdumodel.Outlet.State, AssertionError
            )
            typecheck.is_struct(
                newState, raritan.rpc.pdumodel.Outlet.State, AssertionError
            )

            self.oldState = oldState
            self.newState = newState

        def encode(self):
            json = super(raritan.rpc.pdumodel.Outlet.StateChangedEvent, self).encode()
            json["oldState"] = raritan.rpc.pdumodel.Outlet.State.encode(self.oldState)
            json["newState"] = raritan.rpc.pdumodel.Outlet.State.encode(self.newState)
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                oldState=raritan.rpc.pdumodel.Outlet.State.decode(
                    json["oldState"], agent
                ),
                newState=raritan.rpc.pdumodel.Outlet.State.decode(
                    json["newState"], agent
                ),
                # for idl.Event
                source=Interface.decode(json["source"], agent),
            )
            return obj

        def listElements(self):
            elements = ["oldState", "newState"]
            elements = (
                elements
                + super(
                    raritan.rpc.pdumodel.Outlet.StateChangedEvent, self
                ).listElements()
            )
            return elements

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

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

            self.oldSettings = oldSettings
            self.newSettings = newSettings

        def encode(self):
            json = super(
                raritan.rpc.pdumodel.Outlet.SettingsChangedEvent, self
            ).encode()
            json["oldSettings"] = raritan.rpc.pdumodel.Outlet.Settings.encode(
                self.oldSettings
            )
            json["newSettings"] = raritan.rpc.pdumodel.Outlet.Settings.encode(
                self.newSettings
            )
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                oldSettings=raritan.rpc.pdumodel.Outlet.Settings.decode(
                    json["oldSettings"], agent
                ),
                newSettings=raritan.rpc.pdumodel.Outlet.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.pdumodel.Outlet.SettingsChangedEvent, self
                ).listElements()
            )
            return elements

    def getMetaData(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getMetaData", args)
        _ret_ = raritan.rpc.pdumodel.Outlet.MetaData.decode(rsp["_ret_"], agent)
        typecheck.is_struct(
            _ret_, raritan.rpc.pdumodel.Outlet.MetaData, DecodeException
        )
        return _ret_

    def getSensors(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getSensors", args)
        _ret_ = raritan.rpc.pdumodel.Outlet.Sensors.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Outlet.Sensors, DecodeException)
        return _ret_

    def getState(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getState", args)
        _ret_ = raritan.rpc.pdumodel.Outlet.State.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Outlet.State, DecodeException)
        return _ret_

    def setPowerState(self, pstate):
        agent = self.agent
        typecheck.is_enum(
            pstate, raritan.rpc.pdumodel.Outlet.PowerState, AssertionError
        )
        args = {}
        args["pstate"] = raritan.rpc.pdumodel.Outlet.PowerState.encode(pstate)
        rsp = agent.json_rpc(self.target, "setPowerState", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def cyclePowerState(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "cyclePowerState", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getSettings(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getSettings", args)
        _ret_ = raritan.rpc.pdumodel.Outlet.Settings.decode(rsp["_ret_"], agent)
        typecheck.is_struct(
            _ret_, raritan.rpc.pdumodel.Outlet.Settings, DecodeException
        )
        return _ret_

    def setSettings(self, settings):
        agent = self.agent
        typecheck.is_struct(
            settings, raritan.rpc.pdumodel.Outlet.Settings, AssertionError
        )
        args = {}
        args["settings"] = raritan.rpc.pdumodel.Outlet.Settings.encode(settings)
        rsp = agent.json_rpc(self.target, "setSettings", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getIOP(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getIOP", args)
        i = Interface.decode(rsp["i"], agent)
        o = Interface.decode(rsp["o"], agent)
        p = [raritan.rpc.pdumodel.Pole.decode(x0, agent) for x0 in rsp["p"]]
        typecheck.is_interface(i, raritan.rpc.pdumodel.Inlet, DecodeException)
        typecheck.is_interface(
            o, raritan.rpc.pdumodel.OverCurrentProtector, DecodeException
        )
        for x0 in p:
            typecheck.is_struct(x0, raritan.rpc.pdumodel.Pole, DecodeException)
        return (i, o, p)

    def getController(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getController", args)
        _ret_ = Interface.decode(rsp["_ret_"], agent)
        typecheck.is_interface(_ret_, raritan.rpc.pdumodel.Controller, DecodeException)
        return _ret_

    def unstick(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "unstick", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/TransferSwitch.idl"
#

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

import raritan.rpc.pdumodel

import raritan.rpc.sensors


# interface
class TransferSwitch(EDevice):
    idlType = "pdumodel.TransferSwitch:3.1.1"

    ERR_INVALID_PARAM = 1

    ERR_SWITCH_PREVENTED = 2

    ERR_SWITCH_FAILED = 3

    # enumeration
    class Type(Enumeration):
        idlType = "pdumodel.TransferSwitch.Type:1.0.0"
        values = ["STS", "ATS", "HTS"]

    Type.STS = Type(0)
    Type.ATS = Type(1)
    Type.HTS = Type(2)

    # enumeration
    class TransferReason(Enumeration):
        idlType = "pdumodel.TransferSwitch.TransferReason:1.0.0"
        values = [
            "REASON_UNKNOWN",
            "REASON_STARTUP",
            "REASON_MANUAL_TRANSFER",
            "REASON_AUTO_RETRANSFER",
            "REASON_POWER_FAILURE",
            "REASON_POWER_QUALITY",
            "REASON_OVERLOAD",
            "REASON_OVERHEAT",
            "REASON_INTERNAL_FAILURE",
        ]

    TransferReason.REASON_UNKNOWN = TransferReason(0)
    TransferReason.REASON_STARTUP = TransferReason(1)
    TransferReason.REASON_MANUAL_TRANSFER = TransferReason(2)
    TransferReason.REASON_AUTO_RETRANSFER = TransferReason(3)
    TransferReason.REASON_POWER_FAILURE = TransferReason(4)
    TransferReason.REASON_POWER_QUALITY = TransferReason(5)
    TransferReason.REASON_OVERLOAD = TransferReason(6)
    TransferReason.REASON_OVERHEAT = TransferReason(7)
    TransferReason.REASON_INTERNAL_FAILURE = TransferReason(8)

    # structure
    class MetaData(Structure):
        idlType = "pdumodel.TransferSwitch.MetaData:1.0.0"
        elements = ["label", "namePlate", "rating", "type", "sourceCount"]

        def __init__(self, label, namePlate, rating, type, sourceCount):
            typecheck.is_string(label, AssertionError)
            typecheck.is_struct(
                namePlate, raritan.rpc.pdumodel.Nameplate, AssertionError
            )
            typecheck.is_struct(rating, raritan.rpc.pdumodel.Rating, AssertionError)
            typecheck.is_enum(
                type, raritan.rpc.pdumodel.TransferSwitch.Type, AssertionError
            )
            typecheck.is_int(sourceCount, AssertionError)

            self.label = label
            self.namePlate = namePlate
            self.rating = rating
            self.type = type
            self.sourceCount = sourceCount

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                label=json["label"],
                namePlate=raritan.rpc.pdumodel.Nameplate.decode(
                    json["namePlate"], agent
                ),
                rating=raritan.rpc.pdumodel.Rating.decode(json["rating"], agent),
                type=raritan.rpc.pdumodel.TransferSwitch.Type.decode(json["type"]),
                sourceCount=json["sourceCount"],
            )
            return obj

        def encode(self):
            json = {}
            json["label"] = self.label
            json["namePlate"] = raritan.rpc.pdumodel.Nameplate.encode(self.namePlate)
            json["rating"] = raritan.rpc.pdumodel.Rating.encode(self.rating)
            json["type"] = raritan.rpc.pdumodel.TransferSwitch.Type.encode(self.type)
            json["sourceCount"] = self.sourceCount
            return json

    OPERATIONAL_STATE_OFF = 0

    OPERATIONAL_STATE_NORMAL = 1

    OPERATIONAL_STATE_STANDBY = 2

    SWITCH_FAULT_I1_SHORT = 1

    SWITCH_FAULT_I1_OPEN = 2

    SWITCH_FAULT_I2_SHORT = 4

    SWITCH_FAULT_I2_OPEN = 8

    # structure
    class Sensors(Structure):
        idlType = "pdumodel.TransferSwitch.Sensors:1.0.0"
        elements = [
            "selectedSource",
            "operationalState",
            "sourceVoltagePhaseSyncAngle",
            "overloadAlarm",
            "phaseSyncAlarm",
            "switchFault",
        ]

        def __init__(
            self,
            selectedSource,
            operationalState,
            sourceVoltagePhaseSyncAngle,
            overloadAlarm,
            phaseSyncAlarm,
            switchFault,
        ):
            typecheck.is_interface(
                selectedSource, raritan.rpc.sensors.StateSensor, AssertionError
            )
            typecheck.is_interface(
                operationalState, raritan.rpc.sensors.StateSensor, AssertionError
            )
            typecheck.is_interface(
                sourceVoltagePhaseSyncAngle,
                raritan.rpc.sensors.NumericSensor,
                AssertionError,
            )
            typecheck.is_interface(
                overloadAlarm, raritan.rpc.sensors.StateSensor, AssertionError
            )
            typecheck.is_interface(
                phaseSyncAlarm, raritan.rpc.sensors.StateSensor, AssertionError
            )
            typecheck.is_interface(
                switchFault, raritan.rpc.sensors.StateSensor, AssertionError
            )

            self.selectedSource = selectedSource
            self.operationalState = operationalState
            self.sourceVoltagePhaseSyncAngle = sourceVoltagePhaseSyncAngle
            self.overloadAlarm = overloadAlarm
            self.phaseSyncAlarm = phaseSyncAlarm
            self.switchFault = switchFault

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                selectedSource=Interface.decode(json["selectedSource"], agent),
                operationalState=Interface.decode(json["operationalState"], agent),
                sourceVoltagePhaseSyncAngle=Interface.decode(
                    json["sourceVoltagePhaseSyncAngle"], agent
                ),
                overloadAlarm=Interface.decode(json["overloadAlarm"], agent),
                phaseSyncAlarm=Interface.decode(json["phaseSyncAlarm"], agent),
                switchFault=Interface.decode(json["switchFault"], agent),
            )
            return obj

        def encode(self):
            json = {}
            json["selectedSource"] = Interface.encode(self.selectedSource)
            json["operationalState"] = Interface.encode(self.operationalState)
            json["sourceVoltagePhaseSyncAngle"] = Interface.encode(
                self.sourceVoltagePhaseSyncAngle
            )
            json["overloadAlarm"] = Interface.encode(self.overloadAlarm)
            json["phaseSyncAlarm"] = Interface.encode(self.phaseSyncAlarm)
            json["switchFault"] = Interface.encode(self.switchFault)
            return json

    # structure
    class Settings(Structure):
        idlType = "pdumodel.TransferSwitch.Settings:1.0.0"
        elements = [
            "name",
            "preferredSource",
            "autoRetransfer",
            "noAutoRetransferIfPhaseFault",
            "autoRetransferWaitTime",
            "manualTransferEnabled",
        ]

        def __init__(
            self,
            name,
            preferredSource,
            autoRetransfer,
            noAutoRetransferIfPhaseFault,
            autoRetransferWaitTime,
            manualTransferEnabled,
        ):
            typecheck.is_string(name, AssertionError)
            typecheck.is_int(preferredSource, AssertionError)
            typecheck.is_bool(autoRetransfer, AssertionError)
            typecheck.is_bool(noAutoRetransferIfPhaseFault, AssertionError)
            typecheck.is_int(autoRetransferWaitTime, AssertionError)
            typecheck.is_bool(manualTransferEnabled, AssertionError)

            self.name = name
            self.preferredSource = preferredSource
            self.autoRetransfer = autoRetransfer
            self.noAutoRetransferIfPhaseFault = noAutoRetransferIfPhaseFault
            self.autoRetransferWaitTime = autoRetransferWaitTime
            self.manualTransferEnabled = manualTransferEnabled

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                name=json["name"],
                preferredSource=json["preferredSource"],
                autoRetransfer=json["autoRetransfer"],
                noAutoRetransferIfPhaseFault=json["noAutoRetransferIfPhaseFault"],
                autoRetransferWaitTime=json["autoRetransferWaitTime"],
                manualTransferEnabled=json["manualTransferEnabled"],
            )
            return obj

        def encode(self):
            json = {}
            json["name"] = self.name
            json["preferredSource"] = self.preferredSource
            json["autoRetransfer"] = self.autoRetransfer
            json["noAutoRetransferIfPhaseFault"] = self.noAutoRetransferIfPhaseFault
            json["autoRetransferWaitTime"] = self.autoRetransferWaitTime
            json["manualTransferEnabled"] = self.manualTransferEnabled
            return json

    # structure
    class Statistics(Structure):
        idlType = "pdumodel.TransferSwitch.Statistics:1.0.0"
        elements = [
            "transferCount",
            "powerFailDetectTime",
            "relayOpenTime",
            "totalTransferTime",
        ]

        def __init__(
            self, transferCount, powerFailDetectTime, relayOpenTime, totalTransferTime
        ):
            typecheck.is_int(transferCount, AssertionError)
            typecheck.is_int(powerFailDetectTime, AssertionError)
            typecheck.is_int(relayOpenTime, AssertionError)
            typecheck.is_int(totalTransferTime, AssertionError)

            self.transferCount = transferCount
            self.powerFailDetectTime = powerFailDetectTime
            self.relayOpenTime = relayOpenTime
            self.totalTransferTime = totalTransferTime

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                transferCount=json["transferCount"],
                powerFailDetectTime=json["powerFailDetectTime"],
                relayOpenTime=json["relayOpenTime"],
                totalTransferTime=json["totalTransferTime"],
            )
            return obj

        def encode(self):
            json = {}
            json["transferCount"] = self.transferCount
            json["powerFailDetectTime"] = self.powerFailDetectTime
            json["relayOpenTime"] = self.relayOpenTime
            json["totalTransferTime"] = self.totalTransferTime
            return json

    # structure
    class WaveformSample(Structure):
        idlType = "pdumodel.TransferSwitch.WaveformSample:1.0.0"
        elements = ["voltage", "current"]

        def __init__(self, voltage, current):
            typecheck.is_double(voltage, AssertionError)
            typecheck.is_double(current, AssertionError)

            self.voltage = voltage
            self.current = current

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                voltage=json["voltage"],
                current=json["current"],
            )
            return obj

        def encode(self):
            json = {}
            json["voltage"] = self.voltage
            json["current"] = self.current
            return json

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

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

            self.oldSettings = oldSettings
            self.newSettings = newSettings

        def encode(self):
            json = super(
                raritan.rpc.pdumodel.TransferSwitch.SettingsChangedEvent, self
            ).encode()
            json["oldSettings"] = raritan.rpc.pdumodel.TransferSwitch.Settings.encode(
                self.oldSettings
            )
            json["newSettings"] = raritan.rpc.pdumodel.TransferSwitch.Settings.encode(
                self.newSettings
            )
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                oldSettings=raritan.rpc.pdumodel.TransferSwitch.Settings.decode(
                    json["oldSettings"], agent
                ),
                newSettings=raritan.rpc.pdumodel.TransferSwitch.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.pdumodel.TransferSwitch.SettingsChangedEvent, self
                ).listElements()
            )
            return elements

    def getMetaData(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getMetaData", args)
        _ret_ = raritan.rpc.pdumodel.TransferSwitch.MetaData.decode(rsp["_ret_"], agent)
        typecheck.is_struct(
            _ret_, raritan.rpc.pdumodel.TransferSwitch.MetaData, DecodeException
        )
        return _ret_

    def getSensors(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getSensors", args)
        _ret_ = raritan.rpc.pdumodel.TransferSwitch.Sensors.decode(rsp["_ret_"], agent)
        typecheck.is_struct(
            _ret_, raritan.rpc.pdumodel.TransferSwitch.Sensors, DecodeException
        )
        return _ret_

    def getPoles(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getPoles", args)
        _ret_ = [
            raritan.rpc.pdumodel.ThrowPole.decode(x0, agent) for x0 in rsp["_ret_"]
        ]
        for x0 in _ret_:
            typecheck.is_struct(x0, raritan.rpc.pdumodel.ThrowPole, DecodeException)
        return _ret_

    def getSettings(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getSettings", args)
        _ret_ = raritan.rpc.pdumodel.TransferSwitch.Settings.decode(rsp["_ret_"], agent)
        typecheck.is_struct(
            _ret_, raritan.rpc.pdumodel.TransferSwitch.Settings, DecodeException
        )
        return _ret_

    def setSettings(self, settings):
        agent = self.agent
        typecheck.is_struct(
            settings, raritan.rpc.pdumodel.TransferSwitch.Settings, AssertionError
        )
        args = {}
        args["settings"] = raritan.rpc.pdumodel.TransferSwitch.Settings.encode(settings)
        rsp = agent.json_rpc(self.target, "setSettings", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getStatistics(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getStatistics", args)
        _ret_ = raritan.rpc.pdumodel.TransferSwitch.Statistics.decode(
            rsp["_ret_"], agent
        )
        typecheck.is_struct(
            _ret_, raritan.rpc.pdumodel.TransferSwitch.Statistics, DecodeException
        )
        return _ret_

    def transferToSource(self, source, faultOverride):
        agent = self.agent
        typecheck.is_int(source, AssertionError)
        typecheck.is_bool(faultOverride, AssertionError)
        args = {}
        args["source"] = source
        args["faultOverride"] = faultOverride
        rsp = agent.json_rpc(self.target, "transferToSource", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getLastTransferReason(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getLastTransferReason", args)
        _ret_ = raritan.rpc.pdumodel.TransferSwitch.TransferReason.decode(rsp["_ret_"])
        typecheck.is_enum(
            _ret_, raritan.rpc.pdumodel.TransferSwitch.TransferReason, DecodeException
        )
        return _ret_

    def getLastTransferWaveform(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getLastTransferWaveform", args)
        _ret_ = [
            raritan.rpc.pdumodel.TransferSwitch.WaveformSample.decode(x0, agent)
            for x0 in rsp["_ret_"]
        ]
        for x0 in _ret_:
            typecheck.is_struct(
                x0, raritan.rpc.pdumodel.TransferSwitch.WaveformSample, DecodeException
            )
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/Pdu.idl"
#

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

import raritan.rpc.hmi

import raritan.rpc.idl

import raritan.rpc.pdumodel

import raritan.rpc.peripheral

import raritan.rpc.portsmodel

import raritan.rpc.sensors


# interface
class Pdu(Interface):
    idlType = "pdumodel.Pdu:3.0.0"

    ERR_INVALID_PARAM = 1

    # structure
    class MetaData(Structure):
        idlType = "pdumodel.Pdu.MetaData:1.0.0"
        elements = [
            "nameplate",
            "ctrlBoardSerial",
            "hwRevision",
            "fwRevision",
            "macAddress",
            "hasSwitchableOutlets",
            "hasMeteredOutlets",
            "hasLatchingOutletRelays",
            "isInlineMeter",
        ]

        def __init__(
            self,
            nameplate,
            ctrlBoardSerial,
            hwRevision,
            fwRevision,
            macAddress,
            hasSwitchableOutlets,
            hasMeteredOutlets,
            hasLatchingOutletRelays,
            isInlineMeter,
        ):
            typecheck.is_struct(
                nameplate, raritan.rpc.pdumodel.Nameplate, AssertionError
            )
            typecheck.is_string(ctrlBoardSerial, AssertionError)
            typecheck.is_string(hwRevision, AssertionError)
            typecheck.is_string(fwRevision, AssertionError)
            typecheck.is_string(macAddress, AssertionError)
            typecheck.is_bool(hasSwitchableOutlets, AssertionError)
            typecheck.is_bool(hasMeteredOutlets, AssertionError)
            typecheck.is_bool(hasLatchingOutletRelays, AssertionError)
            typecheck.is_bool(isInlineMeter, AssertionError)

            self.nameplate = nameplate
            self.ctrlBoardSerial = ctrlBoardSerial
            self.hwRevision = hwRevision
            self.fwRevision = fwRevision
            self.macAddress = macAddress
            self.hasSwitchableOutlets = hasSwitchableOutlets
            self.hasMeteredOutlets = hasMeteredOutlets
            self.hasLatchingOutletRelays = hasLatchingOutletRelays
            self.isInlineMeter = isInlineMeter

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                nameplate=raritan.rpc.pdumodel.Nameplate.decode(
                    json["nameplate"], agent
                ),
                ctrlBoardSerial=json["ctrlBoardSerial"],
                hwRevision=json["hwRevision"],
                fwRevision=json["fwRevision"],
                macAddress=json["macAddress"],
                hasSwitchableOutlets=json["hasSwitchableOutlets"],
                hasMeteredOutlets=json["hasMeteredOutlets"],
                hasLatchingOutletRelays=json["hasLatchingOutletRelays"],
                isInlineMeter=json["isInlineMeter"],
            )
            return obj

        def encode(self):
            json = {}
            json["nameplate"] = raritan.rpc.pdumodel.Nameplate.encode(self.nameplate)
            json["ctrlBoardSerial"] = self.ctrlBoardSerial
            json["hwRevision"] = self.hwRevision
            json["fwRevision"] = self.fwRevision
            json["macAddress"] = self.macAddress
            json["hasSwitchableOutlets"] = self.hasSwitchableOutlets
            json["hasMeteredOutlets"] = self.hasMeteredOutlets
            json["hasLatchingOutletRelays"] = self.hasLatchingOutletRelays
            json["isInlineMeter"] = self.isInlineMeter
            return json

    # structure
    class Sensors(Structure):
        idlType = "pdumodel.Pdu.Sensors:1.0.0"
        elements = ["powerSupplyStatus", "activePower", "activeEnergy"]

        def __init__(self, powerSupplyStatus, activePower, activeEnergy):
            for x0 in powerSupplyStatus:
                typecheck.is_interface(
                    x0, raritan.rpc.sensors.StateSensor, AssertionError
                )
            typecheck.is_interface(
                activePower, raritan.rpc.sensors.NumericSensor, AssertionError
            )
            typecheck.is_interface(
                activeEnergy, raritan.rpc.sensors.NumericSensor, AssertionError
            )

            self.powerSupplyStatus = powerSupplyStatus
            self.activePower = activePower
            self.activeEnergy = activeEnergy

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                powerSupplyStatus=[
                    Interface.decode(x0, agent) for x0 in json["powerSupplyStatus"]
                ],
                activePower=Interface.decode(json["activePower"], agent),
                activeEnergy=Interface.decode(json["activeEnergy"], agent),
            )
            return obj

        def encode(self):
            json = {}
            json["powerSupplyStatus"] = [
                Interface.encode(x0) for x0 in self.powerSupplyStatus
            ]
            json["activePower"] = Interface.encode(self.activePower)
            json["activeEnergy"] = Interface.encode(self.activeEnergy)
            return json

    # structure
    class Statistic(Structure):
        idlType = "pdumodel.Pdu.Statistic:1.0.0"
        elements = ["cbStats", "ctrlStats", "outletStats", "peripheralStats"]

        def __init__(self, cbStats, ctrlStats, outletStats, peripheralStats):
            for x0 in cbStats:
                typecheck.is_struct(
                    x0, raritan.rpc.pdumodel.CircuitBreakerStatistic, AssertionError
                )
            for x0 in ctrlStats:
                typecheck.is_struct(
                    x0, raritan.rpc.pdumodel.CtrlStatistic, AssertionError
                )
            for x0 in outletStats:
                typecheck.is_struct(
                    x0, raritan.rpc.pdumodel.OutletStatistic, AssertionError
                )
            typecheck.is_struct(
                peripheralStats,
                raritan.rpc.peripheral.DeviceManager.Statistics,
                AssertionError,
            )

            self.cbStats = cbStats
            self.ctrlStats = ctrlStats
            self.outletStats = outletStats
            self.peripheralStats = peripheralStats

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                cbStats=[
                    raritan.rpc.pdumodel.CircuitBreakerStatistic.decode(x0, agent)
                    for x0 in json["cbStats"]
                ],
                ctrlStats=[
                    raritan.rpc.pdumodel.CtrlStatistic.decode(x0, agent)
                    for x0 in json["ctrlStats"]
                ],
                outletStats=[
                    raritan.rpc.pdumodel.OutletStatistic.decode(x0, agent)
                    for x0 in json["outletStats"]
                ],
                peripheralStats=raritan.rpc.peripheral.DeviceManager.Statistics.decode(
                    json["peripheralStats"], agent
                ),
            )
            return obj

        def encode(self):
            json = {}
            json["cbStats"] = [
                raritan.rpc.pdumodel.CircuitBreakerStatistic.encode(x0)
                for x0 in self.cbStats
            ]
            json["ctrlStats"] = [
                raritan.rpc.pdumodel.CtrlStatistic.encode(x0) for x0 in self.ctrlStats
            ]
            json["outletStats"] = [
                raritan.rpc.pdumodel.OutletStatistic.encode(x0)
                for x0 in self.outletStats
            ]
            json[
                "peripheralStats"
            ] = raritan.rpc.peripheral.DeviceManager.Statistics.encode(
                self.peripheralStats
            )
            return json

    # enumeration
    class StartupState(Enumeration):
        idlType = "pdumodel.Pdu.StartupState:1.0.0"
        values = ["SS_ON", "SS_OFF", "SS_LASTKNOWN"]

    StartupState.SS_ON = StartupState(0)
    StartupState.SS_OFF = StartupState(1)
    StartupState.SS_LASTKNOWN = StartupState(2)

    # structure
    class Settings(Structure):
        idlType = "pdumodel.Pdu.Settings:1.0.0"
        elements = [
            "name",
            "startupState",
            "cycleDelay",
            "inRushGuardDelay",
            "outletPowerStateSequence",
            "powerOnDelay",
            "latchingRelays",
        ]

        def __init__(
            self,
            name,
            startupState,
            cycleDelay,
            inRushGuardDelay,
            outletPowerStateSequence,
            powerOnDelay,
            latchingRelays,
        ):
            typecheck.is_string(name, AssertionError)
            typecheck.is_enum(
                startupState, raritan.rpc.pdumodel.Pdu.StartupState, AssertionError
            )
            typecheck.is_int(cycleDelay, AssertionError)
            typecheck.is_int(inRushGuardDelay, AssertionError)
            for x0 in outletPowerStateSequence:
                typecheck.is_int(x0, AssertionError)
            typecheck.is_int(powerOnDelay, AssertionError)
            typecheck.is_bool(latchingRelays, AssertionError)

            self.name = name
            self.startupState = startupState
            self.cycleDelay = cycleDelay
            self.inRushGuardDelay = inRushGuardDelay
            self.outletPowerStateSequence = outletPowerStateSequence
            self.powerOnDelay = powerOnDelay
            self.latchingRelays = latchingRelays

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                name=json["name"],
                startupState=raritan.rpc.pdumodel.Pdu.StartupState.decode(
                    json["startupState"]
                ),
                cycleDelay=json["cycleDelay"],
                inRushGuardDelay=json["inRushGuardDelay"],
                outletPowerStateSequence=[
                    x0 for x0 in json["outletPowerStateSequence"]
                ],
                powerOnDelay=json["powerOnDelay"],
                latchingRelays=json["latchingRelays"],
            )
            return obj

        def encode(self):
            json = {}
            json["name"] = self.name
            json["startupState"] = raritan.rpc.pdumodel.Pdu.StartupState.encode(
                self.startupState
            )
            json["cycleDelay"] = self.cycleDelay
            json["inRushGuardDelay"] = self.inRushGuardDelay
            json["outletPowerStateSequence"] = [
                x0 for x0 in self.outletPowerStateSequence
            ]
            json["powerOnDelay"] = self.powerOnDelay
            json["latchingRelays"] = self.latchingRelays
            return json

    # structure
    class OutletSequenceState(Structure):
        idlType = "pdumodel.Pdu.OutletSequenceState:1.0.0"
        elements = [
            "sequenceRunning",
            "nextOutletToSwitch",
            "timeUntilNextSwitch",
            "outletsRemaining",
        ]

        def __init__(
            self,
            sequenceRunning,
            nextOutletToSwitch,
            timeUntilNextSwitch,
            outletsRemaining,
        ):
            typecheck.is_bool(sequenceRunning, AssertionError)
            typecheck.is_int(nextOutletToSwitch, AssertionError)
            typecheck.is_int(timeUntilNextSwitch, AssertionError)
            typecheck.is_int(outletsRemaining, AssertionError)

            self.sequenceRunning = sequenceRunning
            self.nextOutletToSwitch = nextOutletToSwitch
            self.timeUntilNextSwitch = timeUntilNextSwitch
            self.outletsRemaining = outletsRemaining

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                sequenceRunning=json["sequenceRunning"],
                nextOutletToSwitch=json["nextOutletToSwitch"],
                timeUntilNextSwitch=json["timeUntilNextSwitch"],
                outletsRemaining=json["outletsRemaining"],
            )
            return obj

        def encode(self):
            json = {}
            json["sequenceRunning"] = self.sequenceRunning
            json["nextOutletToSwitch"] = self.nextOutletToSwitch
            json["timeUntilNextSwitch"] = self.timeUntilNextSwitch
            json["outletsRemaining"] = self.outletsRemaining
            return json

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

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

            self.oldSettings = oldSettings
            self.newSettings = newSettings

        def encode(self):
            json = super(raritan.rpc.pdumodel.Pdu.SettingsChangedEvent, self).encode()
            json["oldSettings"] = raritan.rpc.pdumodel.Pdu.Settings.encode(
                self.oldSettings
            )
            json["newSettings"] = raritan.rpc.pdumodel.Pdu.Settings.encode(
                self.newSettings
            )
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                oldSettings=raritan.rpc.pdumodel.Pdu.Settings.decode(
                    json["oldSettings"], agent
                ),
                newSettings=raritan.rpc.pdumodel.Pdu.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.pdumodel.Pdu.SettingsChangedEvent, self
                ).listElements()
            )
            return elements

    # value object
    class LoadSheddingModeChangedEvent(raritan.rpc.event.UserEvent):
        idlType = "pdumodel.Pdu.LoadSheddingModeChangedEvent:1.0.0"

        def __init__(self, enabled, actUserName, actIpAddr, source):
            super(raritan.rpc.pdumodel.Pdu.LoadSheddingModeChangedEvent, self).__init__(
                actUserName, actIpAddr, source
            )
            typecheck.is_bool(enabled, AssertionError)

            self.enabled = enabled

        def encode(self):
            json = super(
                raritan.rpc.pdumodel.Pdu.LoadSheddingModeChangedEvent, self
            ).encode()
            json["enabled"] = self.enabled
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                enabled=json["enabled"],
                # for event.UserEvent
                actUserName=json["actUserName"],
                actIpAddr=json["actIpAddr"],
                # for idl.Event
                source=Interface.decode(json["source"], agent),
            )
            return obj

        def listElements(self):
            elements = ["enabled"]
            elements = (
                elements
                + super(
                    raritan.rpc.pdumodel.Pdu.LoadSheddingModeChangedEvent, self
                ).listElements()
            )
            return elements

    # value object
    class OutletSequenceStateChangedEvent(raritan.rpc.idl.Event):
        idlType = "pdumodel.Pdu.OutletSequenceStateChangedEvent:1.0.0"

        def __init__(self, newState, source):
            super(
                raritan.rpc.pdumodel.Pdu.OutletSequenceStateChangedEvent, self
            ).__init__(source)
            typecheck.is_struct(
                newState, raritan.rpc.pdumodel.Pdu.OutletSequenceState, AssertionError
            )

            self.newState = newState

        def encode(self):
            json = super(
                raritan.rpc.pdumodel.Pdu.OutletSequenceStateChangedEvent, self
            ).encode()
            json["newState"] = raritan.rpc.pdumodel.Pdu.OutletSequenceState.encode(
                self.newState
            )
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                newState=raritan.rpc.pdumodel.Pdu.OutletSequenceState.decode(
                    json["newState"], agent
                ),
                # for idl.Event
                source=Interface.decode(json["source"], agent),
            )
            return obj

        def listElements(self):
            elements = ["newState"]
            elements = (
                elements
                + super(
                    raritan.rpc.pdumodel.Pdu.OutletSequenceStateChangedEvent, self
                ).listElements()
            )
            return elements

    def getNameplate(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getNameplate", args)
        _ret_ = raritan.rpc.pdumodel.Nameplate.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Nameplate, DecodeException)
        return _ret_

    def getMetaData(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getMetaData", args)
        _ret_ = raritan.rpc.pdumodel.Pdu.MetaData.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Pdu.MetaData, DecodeException)
        return _ret_

    def getSensors(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getSensors", args)
        _ret_ = raritan.rpc.pdumodel.Pdu.Sensors.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Pdu.Sensors, DecodeException)
        return _ret_

    def getSensorLogger(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getSensorLogger", args)
        _ret_ = Interface.decode(rsp["_ret_"], agent)
        typecheck.is_interface(_ret_, raritan.rpc.sensors.Logger, DecodeException)
        return _ret_

    def getControllers(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getControllers", args)
        _ret_ = [Interface.decode(x0, agent) for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_interface(x0, raritan.rpc.pdumodel.Controller, DecodeException)
        return _ret_

    def getOutlets(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getOutlets", args)
        _ret_ = [Interface.decode(x0, agent) for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_interface(x0, raritan.rpc.pdumodel.Outlet, DecodeException)
        return _ret_

    def getOverCurrentProtectors(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getOverCurrentProtectors", args)
        _ret_ = [Interface.decode(x0, agent) for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_interface(
                x0, raritan.rpc.pdumodel.OverCurrentProtector, DecodeException
            )
        return _ret_

    def getInlets(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInlets", args)
        _ret_ = [Interface.decode(x0, agent) for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_interface(x0, raritan.rpc.pdumodel.Inlet, DecodeException)
        return _ret_

    def getTransferSwitches(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getTransferSwitches", args)
        _ret_ = [Interface.decode(x0, agent) for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_interface(
                x0, raritan.rpc.pdumodel.TransferSwitch, DecodeException
            )
        return _ret_

    def getPeripheralDeviceManager(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getPeripheralDeviceManager", args)
        _ret_ = Interface.decode(rsp["_ret_"], agent)
        typecheck.is_interface(
            _ret_, raritan.rpc.peripheral.DeviceManager, DecodeException
        )
        return _ret_

    def getBeeper(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getBeeper", args)
        _ret_ = Interface.decode(rsp["_ret_"], agent)
        typecheck.is_interface(_ret_, raritan.rpc.hmi.InternalBeeper, DecodeException)
        return _ret_

    def getSettings(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getSettings", args)
        _ret_ = raritan.rpc.pdumodel.Pdu.Settings.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Pdu.Settings, DecodeException)
        return _ret_

    def isLoadSheddingActive(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "isLoadSheddingActive", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_bool(_ret_, DecodeException)
        return _ret_

    def setSettings(self, settings):
        agent = self.agent
        typecheck.is_struct(settings, raritan.rpc.pdumodel.Pdu.Settings, AssertionError)
        args = {}
        args["settings"] = raritan.rpc.pdumodel.Pdu.Settings.encode(settings)
        rsp = agent.json_rpc(self.target, "setSettings", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def setLoadSheddingActive(self, active):
        agent = self.agent
        typecheck.is_bool(active, AssertionError)
        args = {}
        args["active"] = active
        rsp = agent.json_rpc(self.target, "setLoadSheddingActive", args)

    def getFeaturePorts(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getFeaturePorts", args)
        _ret_ = [Interface.decode(x0, agent) for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_interface(x0, raritan.rpc.portsmodel.Port, DecodeException)
        return _ret_

    def enterRS485ConfigModeAndAssignCtrlBoardAddress(self, addr):
        agent = self.agent
        typecheck.is_int(addr, AssertionError)
        args = {}
        args["addr"] = addr
        rsp = agent.json_rpc(
            self.target, "enterRS485ConfigModeAndAssignCtrlBoardAddress", args
        )
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def enterRS485ConfigModeAndAssignSCBoardAddress(self, deviceId, addr):
        agent = self.agent
        typecheck.is_int(deviceId, AssertionError)
        typecheck.is_int(addr, AssertionError)
        args = {}
        args["deviceId"] = deviceId
        args["addr"] = addr
        rsp = agent.json_rpc(
            self.target, "enterRS485ConfigModeAndAssignSCBoardAddress", args
        )
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def leaveRS485ConfigMode(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "leaveRS485ConfigMode", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def setAllOutletPowerStates(self, pstate):
        agent = self.agent
        typecheck.is_enum(
            pstate, raritan.rpc.pdumodel.Outlet.PowerState, AssertionError
        )
        args = {}
        args["pstate"] = raritan.rpc.pdumodel.Outlet.PowerState.encode(pstate)
        rsp = agent.json_rpc(self.target, "setAllOutletPowerStates", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def setMultipleOutletPowerStates(self, outletNumbers, state, respectSequence):
        agent = self.agent
        for x0 in outletNumbers:
            typecheck.is_int(x0, AssertionError)
        typecheck.is_enum(state, raritan.rpc.pdumodel.Outlet.PowerState, AssertionError)
        typecheck.is_bool(respectSequence, AssertionError)
        args = {}
        args["outletNumbers"] = [x0 for x0 in outletNumbers]
        args["state"] = raritan.rpc.pdumodel.Outlet.PowerState.encode(state)
        args["respectSequence"] = respectSequence
        rsp = agent.json_rpc(self.target, "setMultipleOutletPowerStates", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def cycleAllOutletPowerStates(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "cycleAllOutletPowerStates", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def cycleMultipleOutletPowerStates(self, outletNumbers, respectSequence):
        agent = self.agent
        for x0 in outletNumbers:
            typecheck.is_int(x0, AssertionError)
        typecheck.is_bool(respectSequence, AssertionError)
        args = {}
        args["outletNumbers"] = [x0 for x0 in outletNumbers]
        args["respectSequence"] = respectSequence
        rsp = agent.json_rpc(self.target, "cycleMultipleOutletPowerStates", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getStatistic(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getStatistic", args)
        _ret_ = raritan.rpc.pdumodel.Pdu.Statistic.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Pdu.Statistic, DecodeException)
        return _ret_

    def getOutletSequenceState(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getOutletSequenceState", args)
        _ret_ = raritan.rpc.pdumodel.Pdu.OutletSequenceState.decode(rsp["_ret_"], agent)
        typecheck.is_struct(
            _ret_, raritan.rpc.pdumodel.Pdu.OutletSequenceState, DecodeException
        )
        return _ret_

    def cancelOutletSequence(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "cancelOutletSequence", args)


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/Ade.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.pdumodel


# interface
class Ade(Interface):
    idlType = "pdumodel.Ade:1.0.0"

    # structure
    class MetaData(Structure):
        idlType = "pdumodel.Ade.MetaData:1.0.0"
        elements = [
            "adeType",
            "channels",
            "currentDivider",
            "voltageDivider",
            "energyDivider",
        ]

        def __init__(
            self, adeType, channels, currentDivider, voltageDivider, energyDivider
        ):
            typecheck.is_string(adeType, AssertionError)
            typecheck.is_int(channels, AssertionError)
            typecheck.is_double(currentDivider, AssertionError)
            typecheck.is_double(voltageDivider, AssertionError)
            typecheck.is_double(energyDivider, AssertionError)

            self.adeType = adeType
            self.channels = channels
            self.currentDivider = currentDivider
            self.voltageDivider = voltageDivider
            self.energyDivider = energyDivider

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                adeType=json["adeType"],
                channels=json["channels"],
                currentDivider=json["currentDivider"],
                voltageDivider=json["voltageDivider"],
                energyDivider=json["energyDivider"],
            )
            return obj

        def encode(self):
            json = {}
            json["adeType"] = self.adeType
            json["channels"] = self.channels
            json["currentDivider"] = self.currentDivider
            json["voltageDivider"] = self.voltageDivider
            json["energyDivider"] = self.energyDivider
            return json

    # structure
    class Sample(Structure):
        idlType = "pdumodel.Ade.Sample:1.0.0"
        elements = ["vrms", "irms", "watt", "va", "wh", "vah"]

        def __init__(self, vrms, irms, watt, va, wh, vah):
            typecheck.is_long(vrms, AssertionError)
            typecheck.is_long(irms, AssertionError)
            typecheck.is_long(watt, AssertionError)
            typecheck.is_long(va, AssertionError)
            typecheck.is_long(wh, AssertionError)
            typecheck.is_long(vah, AssertionError)

            self.vrms = vrms
            self.irms = irms
            self.watt = watt
            self.va = va
            self.wh = wh
            self.vah = vah

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                vrms=int(json["vrms"]),
                irms=int(json["irms"]),
                watt=int(json["watt"]),
                va=int(json["va"]),
                wh=int(json["wh"]),
                vah=int(json["vah"]),
            )
            return obj

        def encode(self):
            json = {}
            json["vrms"] = self.vrms
            json["irms"] = self.irms
            json["watt"] = self.watt
            json["va"] = self.va
            json["wh"] = self.wh
            json["vah"] = self.vah
            return json

    def getMetaData(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getMetaData", args)
        _ret_ = raritan.rpc.pdumodel.Ade.MetaData.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Ade.MetaData, DecodeException)
        return _ret_

    def getLatestSample(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getLatestSample", args)
        _ret_ = [
            raritan.rpc.pdumodel.Ade.Sample.decode(x0, agent) for x0 in rsp["_ret_"]
        ]
        for x0 in _ret_:
            typecheck.is_struct(x0, raritan.rpc.pdumodel.Ade.Sample, DecodeException)
        return _ret_

    def getCalibrationData(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getCalibrationData", args)
        _ret_ = dict([(elem["key"], int(elem["value"])) for elem in rsp["_ret_"]])
        return _ret_

    def setCalibrationData(self, regs):
        agent = self.agent
        args = {}
        args["regs"] = [dict(key=k, value=v) for k, v in regs.items()]
        rsp = agent.json_rpc(self.target, "setCalibrationData", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/Unit.idl"
#

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

import raritan.rpc.pdumodel


# interface
class Unit(Interface):
    idlType = "pdumodel.Unit:2.0.1"

    ERR_INVALID_PARAM = 1

    # enumeration
    class Orientation(Enumeration):
        idlType = "pdumodel.Unit.Orientation:1.0.0"
        values = ["NORMAL", "FLIPPED"]

    Orientation.NORMAL = Orientation(0)
    Orientation.FLIPPED = Orientation(1)

    # structure
    class MetaData(Structure):
        idlType = "pdumodel.Unit.MetaData:1.0.0"
        elements = ["hasOrientationSensor", "supportedDisplayOrientations"]

        def __init__(self, hasOrientationSensor, supportedDisplayOrientations):
            typecheck.is_bool(hasOrientationSensor, AssertionError)
            for x0 in supportedDisplayOrientations:
                typecheck.is_enum(
                    x0, raritan.rpc.pdumodel.Unit.Orientation, AssertionError
                )

            self.hasOrientationSensor = hasOrientationSensor
            self.supportedDisplayOrientations = supportedDisplayOrientations

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                hasOrientationSensor=json["hasOrientationSensor"],
                supportedDisplayOrientations=[
                    raritan.rpc.pdumodel.Unit.Orientation.decode(x0)
                    for x0 in json["supportedDisplayOrientations"]
                ],
            )
            return obj

        def encode(self):
            json = {}
            json["hasOrientationSensor"] = self.hasOrientationSensor
            json["supportedDisplayOrientations"] = [
                raritan.rpc.pdumodel.Unit.Orientation.encode(x0)
                for x0 in self.supportedDisplayOrientations
            ]
            return json

    # structure
    class Settings(Structure):
        idlType = "pdumodel.Unit.Settings:1.0.0"
        elements = ["buzzerMuted", "autoDisplayOrientation", "displayOrientation"]

        def __init__(self, buzzerMuted, autoDisplayOrientation, displayOrientation):
            typecheck.is_bool(buzzerMuted, AssertionError)
            typecheck.is_bool(autoDisplayOrientation, AssertionError)
            typecheck.is_enum(
                displayOrientation,
                raritan.rpc.pdumodel.Unit.Orientation,
                AssertionError,
            )

            self.buzzerMuted = buzzerMuted
            self.autoDisplayOrientation = autoDisplayOrientation
            self.displayOrientation = displayOrientation

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                buzzerMuted=json["buzzerMuted"],
                autoDisplayOrientation=json["autoDisplayOrientation"],
                displayOrientation=raritan.rpc.pdumodel.Unit.Orientation.decode(
                    json["displayOrientation"]
                ),
            )
            return obj

        def encode(self):
            json = {}
            json["buzzerMuted"] = self.buzzerMuted
            json["autoDisplayOrientation"] = self.autoDisplayOrientation
            json["displayOrientation"] = raritan.rpc.pdumodel.Unit.Orientation.encode(
                self.displayOrientation
            )
            return json

    # value object
    class IdentificationStartedEvent(raritan.rpc.event.UserEvent):
        idlType = "pdumodel.Unit.IdentificationStartedEvent:1.0.0"

        def __init__(self, duration, actUserName, actIpAddr, source):
            super(raritan.rpc.pdumodel.Unit.IdentificationStartedEvent, self).__init__(
                actUserName, actIpAddr, source
            )
            typecheck.is_int(duration, AssertionError)

            self.duration = duration

        def encode(self):
            json = super(
                raritan.rpc.pdumodel.Unit.IdentificationStartedEvent, self
            ).encode()
            json["duration"] = self.duration
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                duration=json["duration"],
                # for event.UserEvent
                actUserName=json["actUserName"],
                actIpAddr=json["actIpAddr"],
                # for idl.Event
                source=Interface.decode(json["source"], agent),
            )
            return obj

        def listElements(self):
            elements = ["duration"]
            elements = (
                elements
                + super(
                    raritan.rpc.pdumodel.Unit.IdentificationStartedEvent, self
                ).listElements()
            )
            return elements

    def getMetaData(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getMetaData", args)
        _ret_ = raritan.rpc.pdumodel.Unit.MetaData.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Unit.MetaData, DecodeException)
        return _ret_

    def getSettings(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getSettings", args)
        _ret_ = raritan.rpc.pdumodel.Unit.Settings.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.pdumodel.Unit.Settings, DecodeException)
        return _ret_

    def setSettings(self, settings):
        agent = self.agent
        typecheck.is_struct(
            settings, raritan.rpc.pdumodel.Unit.Settings, AssertionError
        )
        args = {}
        args["settings"] = raritan.rpc.pdumodel.Unit.Settings.encode(settings)
        rsp = agent.json_rpc(self.target, "setSettings", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def identify(self, seconds):
        agent = self.agent
        typecheck.is_int(seconds, AssertionError)
        args = {}
        args["seconds"] = seconds
        rsp = agent.json_rpc(self.target, "identify", args)

    def muteBuzzer(self, mute):
        agent = self.agent
        typecheck.is_bool(mute, AssertionError)
        args = {}
        args["mute"] = mute
        rsp = agent.json_rpc(self.target, "muteBuzzer", args)

    def getDisplayOrientation(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getDisplayOrientation", args)
        _ret_ = raritan.rpc.pdumodel.Unit.Orientation.decode(rsp["_ret_"])
        typecheck.is_enum(_ret_, raritan.rpc.pdumodel.Unit.Orientation, DecodeException)
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/PowerQualitySensor.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.sensors


# interface
class PowerQualitySensor(raritan.rpc.sensors.StateSensor):
    idlType = "pdumodel.PowerQualitySensor:2.0.0"

    STATE_NORMAL = 0

    STATE_WARNING = 1

    STATE_CRITICAL = 2


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/MemoryMapController.idl"
#

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

# interface
class MemoryMapController(Controller):
    idlType = "pdumodel.MemoryMapController:3.0.0"

    def readMemory(self, address, size):
        agent = self.agent
        typecheck.is_int(address, AssertionError)
        typecheck.is_int(size, AssertionError)
        args = {}
        args["address"] = address
        args["size"] = size
        rsp = agent.json_rpc(self.target, "readMemory", args)
        _ret_ = rsp["_ret_"]
        memory = [x0 for x0 in rsp["memory"]]
        typecheck.is_int(_ret_, DecodeException)
        for x0 in memory:
            typecheck.is_byte(x0, DecodeException)
        return (_ret_, memory)

    def writeMemory(self, address, memory):
        agent = self.agent
        typecheck.is_int(address, AssertionError)
        for x0 in memory:
            typecheck.is_byte(x0, AssertionError)
        args = {}
        args["address"] = address
        args["memory"] = [x0 for x0 in memory]
        rsp = agent.json_rpc(self.target, "writeMemory", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_


# Do NOT edit this file!
# It was generated by IdlC class idl.json.python.ProxyAsnVisitor.

#
# Section generated from "/home/nb/builds/MEGA/px2-3.0.0-3.0.9-branch-20140613-none-release-none-pdu-raritan/fwcomponents/mkdist/tmp/px2_final/libidl_client/topofw/pdu/idl/Bcm.idl"
#

import raritan.rpc
from raritan.rpc import (
    Interface,
    Structure,
    ValueObject,
    Enumeration,
    typecheck,
    DecodeException,
)
import raritan.rpc.pdumodel


# interface
class Bcm(Interface):
    idlType = "pdumodel.Bcm:1.0.0"

    # enumeration
    class LineConfig(Enumeration):
        idlType = "pdumodel.Bcm.LineConfig:1.0.0"
        values = ["UNCONNECTED", "L1_N", "L2_N", "L3_N"]

    LineConfig.UNCONNECTED = LineConfig(0)
    LineConfig.L1_N = LineConfig(1)
    LineConfig.L2_N = LineConfig(2)
    LineConfig.L3_N = LineConfig(3)

    # enumeration
    class TransformerType(Enumeration):
        idlType = "pdumodel.Bcm.TransformerType:1.0.0"
        values = ["VOLTAGE", "TURNSRATIO"]

    TransformerType.VOLTAGE = TransformerType(0)
    TransformerType.TURNSRATIO = TransformerType(1)

    # structure
    class PhaseConfig(Structure):
        idlType = "pdumodel.Bcm.PhaseConfig:1.0.0"
        elements = [
            "lineConfig",
            "ctType",
            "fsCurrent",
            "fsVoltage",
            "turnsRatio",
            "burdenResistor",
        ]

        def __init__(
            self, lineConfig, ctType, fsCurrent, fsVoltage, turnsRatio, burdenResistor
        ):
            typecheck.is_enum(
                lineConfig, raritan.rpc.pdumodel.Bcm.LineConfig, AssertionError
            )
            typecheck.is_enum(
                ctType, raritan.rpc.pdumodel.Bcm.TransformerType, AssertionError
            )
            typecheck.is_int(fsCurrent, AssertionError)
            typecheck.is_int(fsVoltage, AssertionError)
            typecheck.is_int(turnsRatio, AssertionError)
            typecheck.is_int(burdenResistor, AssertionError)

            self.lineConfig = lineConfig
            self.ctType = ctType
            self.fsCurrent = fsCurrent
            self.fsVoltage = fsVoltage
            self.turnsRatio = turnsRatio
            self.burdenResistor = burdenResistor

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                lineConfig=raritan.rpc.pdumodel.Bcm.LineConfig.decode(
                    json["lineConfig"]
                ),
                ctType=raritan.rpc.pdumodel.Bcm.TransformerType.decode(json["ctType"]),
                fsCurrent=json["fsCurrent"],
                fsVoltage=json["fsVoltage"],
                turnsRatio=json["turnsRatio"],
                burdenResistor=json["burdenResistor"],
            )
            return obj

        def encode(self):
            json = {}
            json["lineConfig"] = raritan.rpc.pdumodel.Bcm.LineConfig.encode(
                self.lineConfig
            )
            json["ctType"] = raritan.rpc.pdumodel.Bcm.TransformerType.encode(
                self.ctType
            )
            json["fsCurrent"] = self.fsCurrent
            json["fsVoltage"] = self.fsVoltage
            json["turnsRatio"] = self.turnsRatio
            json["burdenResistor"] = self.burdenResistor
            return json

    # structure
    class ChannelConfig(Structure):
        idlType = "pdumodel.Bcm.ChannelConfig:1.0.0"
        elements = ["channel", "label", "is3Phase", "lineA", "lineB", "lineC"]

        def __init__(self, channel, label, is3Phase, lineA, lineB, lineC):
            typecheck.is_int(channel, AssertionError)
            typecheck.is_string(label, AssertionError)
            typecheck.is_bool(is3Phase, AssertionError)
            typecheck.is_struct(
                lineA, raritan.rpc.pdumodel.Bcm.PhaseConfig, AssertionError
            )
            typecheck.is_struct(
                lineB, raritan.rpc.pdumodel.Bcm.PhaseConfig, AssertionError
            )
            typecheck.is_struct(
                lineC, raritan.rpc.pdumodel.Bcm.PhaseConfig, AssertionError
            )

            self.channel = channel
            self.label = label
            self.is3Phase = is3Phase
            self.lineA = lineA
            self.lineB = lineB
            self.lineC = lineC

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                channel=json["channel"],
                label=json["label"],
                is3Phase=json["is3Phase"],
                lineA=raritan.rpc.pdumodel.Bcm.PhaseConfig.decode(json["lineA"], agent),
                lineB=raritan.rpc.pdumodel.Bcm.PhaseConfig.decode(json["lineB"], agent),
                lineC=raritan.rpc.pdumodel.Bcm.PhaseConfig.decode(json["lineC"], agent),
            )
            return obj

        def encode(self):
            json = {}
            json["channel"] = self.channel
            json["label"] = self.label
            json["is3Phase"] = self.is3Phase
            json["lineA"] = raritan.rpc.pdumodel.Bcm.PhaseConfig.encode(self.lineA)
            json["lineB"] = raritan.rpc.pdumodel.Bcm.PhaseConfig.encode(self.lineB)
            json["lineC"] = raritan.rpc.pdumodel.Bcm.PhaseConfig.encode(self.lineC)
            return json

    def getChannelCount(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getChannelCount", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getChannelConfigs(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getChannelConfigs", args)
        _ret_ = [
            raritan.rpc.pdumodel.Bcm.ChannelConfig.decode(x0, agent)
            for x0 in rsp["_ret_"]
        ]
        for x0 in _ret_:
            typecheck.is_struct(
                x0, raritan.rpc.pdumodel.Bcm.ChannelConfig, DecodeException
            )
        return _ret_

    def setChannelConfig(self, channel, config):
        agent = self.agent
        typecheck.is_int(channel, AssertionError)
        typecheck.is_struct(
            config, raritan.rpc.pdumodel.Bcm.ChannelConfig, AssertionError
        )
        args = {}
        args["channel"] = channel
        args["config"] = raritan.rpc.pdumodel.Bcm.ChannelConfig.encode(config)
        rsp = agent.json_rpc(self.target, "setChannelConfig", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_
