# 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/cisco_energywise_agent/libcew_util/idl/EnergyWiseSettings.idl"
#

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

# structure
class EnergyWiseSettings(Structure):
    idlType = "cew.EnergyWiseSettings:1.0.0"
    elements = ["enabled", "domainName", "secret", "port", "pollingInterval"]

    def __init__(self, enabled, domainName, secret, port, pollingInterval):
        typecheck.is_bool(enabled, AssertionError)
        typecheck.is_string(domainName, AssertionError)
        typecheck.is_string(secret, AssertionError)
        typecheck.is_int(port, AssertionError)
        typecheck.is_int(pollingInterval, AssertionError)

        self.enabled = enabled
        self.domainName = domainName
        self.secret = secret
        self.port = port
        self.pollingInterval = pollingInterval

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            enabled=json["enabled"],
            domainName=json["domainName"],
            secret=json["secret"],
            port=json["port"],
            pollingInterval=json["pollingInterval"],
        )
        return obj

    def encode(self):
        json = {}
        json["enabled"] = self.enabled
        json["domainName"] = self.domainName
        json["secret"] = self.secret
        json["port"] = self.port
        json["pollingInterval"] = self.pollingInterval
        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/cisco_energywise_agent/libcew_mgr/idl/EnergyWiseManager.idl"
#

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


# interface
class EnergyWiseManager(Interface):
    idlType = "cew.EnergyWiseManager:1.0.0"

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

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