# 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/webcam/idl/Webcam.idl"
#

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


# enumeration
class PixelFormat(Enumeration):
    idlType = "webcam.PixelFormat:1.0.0"
    values = ["MJPEG", "JPEG", "RGB", "YUV"]


PixelFormat.MJPEG = PixelFormat(0)
PixelFormat.JPEG = PixelFormat(1)
PixelFormat.RGB = PixelFormat(2)
PixelFormat.YUV = PixelFormat(3)

# enumeration
class PowerLineFrequency(Enumeration):
    idlType = "webcam.PowerLineFrequency:1.0.0"
    values = ["NOT_SUPPORTED", "HZ50", "HZ60", "DISABLED"]


PowerLineFrequency.NOT_SUPPORTED = PowerLineFrequency(0)
PowerLineFrequency.HZ50 = PowerLineFrequency(1)
PowerLineFrequency.HZ60 = PowerLineFrequency(2)
PowerLineFrequency.DISABLED = PowerLineFrequency(3)

# structure
class Format(Structure):
    idlType = "webcam.Format:2.0.0"
    elements = ["width", "height", "pixelFormat"]

    def __init__(self, width, height, pixelFormat):
        typecheck.is_int(width, AssertionError)
        typecheck.is_int(height, AssertionError)
        typecheck.is_enum(pixelFormat, raritan.rpc.webcam.PixelFormat, AssertionError)

        self.width = width
        self.height = height
        self.pixelFormat = pixelFormat

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            width=json["width"],
            height=json["height"],
            pixelFormat=raritan.rpc.webcam.PixelFormat.decode(json["pixelFormat"]),
        )
        return obj

    def encode(self):
        json = {}
        json["width"] = self.width
        json["height"] = self.height
        json["pixelFormat"] = raritan.rpc.webcam.PixelFormat.encode(self.pixelFormat)
        return json


# structure
class Controls(Structure):
    idlType = "webcam.Controls:1.0.0"
    elements = [
        "brightness",
        "contrast",
        "saturation",
        "gain",
        "gamma",
        "powerLineFrequency",
    ]

    def __init__(
        self, brightness, contrast, saturation, gain, gamma, powerLineFrequency
    ):
        typecheck.is_int(brightness, AssertionError)
        typecheck.is_int(contrast, AssertionError)
        typecheck.is_int(saturation, AssertionError)
        typecheck.is_int(gain, AssertionError)
        typecheck.is_int(gamma, AssertionError)
        typecheck.is_enum(
            powerLineFrequency, raritan.rpc.webcam.PowerLineFrequency, AssertionError
        )

        self.brightness = brightness
        self.contrast = contrast
        self.saturation = saturation
        self.gain = gain
        self.gamma = gamma
        self.powerLineFrequency = powerLineFrequency

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            brightness=json["brightness"],
            contrast=json["contrast"],
            saturation=json["saturation"],
            gain=json["gain"],
            gamma=json["gamma"],
            powerLineFrequency=raritan.rpc.webcam.PowerLineFrequency.decode(
                json["powerLineFrequency"]
            ),
        )
        return obj

    def encode(self):
        json = {}
        json["brightness"] = self.brightness
        json["contrast"] = self.contrast
        json["saturation"] = self.saturation
        json["gain"] = self.gain
        json["gamma"] = self.gamma
        json["powerLineFrequency"] = raritan.rpc.webcam.PowerLineFrequency.encode(
            self.powerLineFrequency
        )
        return json


# structure
class Location(Structure):
    idlType = "webcam.Location:1.0.0"
    elements = ["name", "x", "y", "z"]

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

        self.name = name
        self.x = x
        self.y = y
        self.z = z

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

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


# structure
class ImageMetaData(Structure):
    idlType = "webcam.ImageMetaData:1.0.0"
    elements = ["format", "timestamp", "location"]

    def __init__(self, format, timestamp, location):
        typecheck.is_struct(format, raritan.rpc.webcam.Format, AssertionError)
        typecheck.is_long(timestamp, AssertionError)
        typecheck.is_struct(location, raritan.rpc.webcam.Location, AssertionError)

        self.format = format
        self.timestamp = timestamp
        self.location = location

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            format=raritan.rpc.webcam.Format.decode(json["format"], agent),
            timestamp=int(json["timestamp"]),
            location=raritan.rpc.webcam.Location.decode(json["location"], agent),
        )
        return obj

    def encode(self):
        json = {}
        json["format"] = raritan.rpc.webcam.Format.encode(self.format)
        json["timestamp"] = self.timestamp
        json["location"] = raritan.rpc.webcam.Location.encode(self.location)
        return json


# structure
class Image(Structure):
    idlType = "webcam.Image:2.0.0"
    elements = ["meta", "data"]

    def __init__(self, meta, data):
        typecheck.is_struct(meta, raritan.rpc.webcam.ImageMetaData, AssertionError)
        typecheck.is_string(data, AssertionError)

        self.meta = meta
        self.data = data

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            meta=raritan.rpc.webcam.ImageMetaData.decode(json["meta"], agent),
            data=json["data"],
        )
        return obj

    def encode(self):
        json = {}
        json["meta"] = raritan.rpc.webcam.ImageMetaData.encode(self.meta)
        json["data"] = self.data
        return json


# structure
class Settings(Structure):
    idlType = "webcam.Settings:2.0.0"
    elements = ["format", "controls", "name", "location", "refreshInterval"]

    def __init__(self, format, controls, name, location, refreshInterval):
        typecheck.is_struct(format, raritan.rpc.webcam.Format, AssertionError)
        typecheck.is_struct(controls, raritan.rpc.webcam.Controls, AssertionError)
        typecheck.is_string(name, AssertionError)
        typecheck.is_struct(location, raritan.rpc.webcam.Location, AssertionError)
        typecheck.is_int(refreshInterval, AssertionError)

        self.format = format
        self.controls = controls
        self.name = name
        self.location = location
        self.refreshInterval = refreshInterval

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            format=raritan.rpc.webcam.Format.decode(json["format"], agent),
            controls=raritan.rpc.webcam.Controls.decode(json["controls"], agent),
            name=json["name"],
            location=raritan.rpc.webcam.Location.decode(json["location"], agent),
            refreshInterval=json["refreshInterval"],
        )
        return obj

    def encode(self):
        json = {}
        json["format"] = raritan.rpc.webcam.Format.encode(self.format)
        json["controls"] = raritan.rpc.webcam.Controls.encode(self.controls)
        json["name"] = self.name
        json["location"] = raritan.rpc.webcam.Location.encode(self.location)
        json["refreshInterval"] = self.refreshInterval
        return json


# structure
class Information(Structure):
    idlType = "webcam.Information:2.0.0"
    elements = ["id", "supportedFormats"]

    def __init__(self, id, supportedFormats):
        typecheck.is_string(id, AssertionError)
        for x0 in supportedFormats:
            typecheck.is_struct(x0, raritan.rpc.webcam.Format, AssertionError)

        self.id = id
        self.supportedFormats = supportedFormats

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            id=json["id"],
            supportedFormats=[
                raritan.rpc.webcam.Format.decode(x0, agent)
                for x0 in json["supportedFormats"]
            ],
        )
        return obj

    def encode(self):
        json = {}
        json["id"] = self.id
        json["supportedFormats"] = [
            raritan.rpc.webcam.Format.encode(x0) for x0 in self.supportedFormats
        ]
        return json


# interface
class Webcam(Interface):
    idlType = "webcam.Webcam:2.0.0"

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

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

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

    def setControls(self, controls):
        agent = self.agent
        typecheck.is_struct(controls, raritan.rpc.webcam.Controls, AssertionError)
        args = {}
        args["controls"] = raritan.rpc.webcam.Controls.encode(controls)
        rsp = agent.json_rpc(self.target, "setControls", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getControlDefaults(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getControlDefaults", args)
        _ret_ = raritan.rpc.webcam.Controls.decode(rsp["_ret_"], agent)
        typecheck.is_struct(_ret_, raritan.rpc.webcam.Controls, 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/webcam/idl/WebcamChannel.idl"
#

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


# interface
class Channel(Interface):
    idlType = "webcam.Channel:1.0.0"

    NO_ERROR = 0

    ERR_NOT_AVAILABLE = 2

    ERR_NO_SUCH_OBJECT = 3

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

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

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

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

    def captureImage(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "captureImage", args)
        _ret_ = rsp["_ret_"]
        image = raritan.rpc.webcam.Image.decode(rsp["image"], agent)
        typecheck.is_int(_ret_, DecodeException)
        typecheck.is_struct(image, raritan.rpc.webcam.Image, DecodeException)
        return (_ret_, image)

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


# 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/webcam/idl/WebcamManager.idl"
#

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

import raritan.rpc.webcam


# enumeration
class Priority(Enumeration):
    idlType = "webcam.Priority:1.0.0"
    values = ["VERY_LOW", "LOW", "NORMAL", "HIGH", "VERY_HIGH"]


Priority.VERY_LOW = Priority(0)
Priority.LOW = Priority(1)
Priority.NORMAL = Priority(2)
Priority.HIGH = Priority(3)
Priority.VERY_HIGH = Priority(4)

# value object
class WebcamEvent(raritan.rpc.idl.Event):
    idlType = "webcam.WebcamEvent:1.0.0"

    def __init__(self, webcam, source):
        super(raritan.rpc.webcam.WebcamEvent, self).__init__(source)
        typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)

        self.webcam = webcam

    def encode(self):
        json = super(raritan.rpc.webcam.WebcamEvent, self).encode()
        json["webcam"] = Interface.encode(self.webcam)
        return json

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

    def listElements(self):
        elements = ["webcam"]
        elements = elements + super(raritan.rpc.webcam.WebcamEvent, self).listElements()
        return elements


# value object
class WebcamAddedEvent(WebcamEvent):
    idlType = "webcam.WebcamAddedEvent:1.0.0"

    def __init__(self, webcam, source):
        super(raritan.rpc.webcam.WebcamAddedEvent, self).__init__(webcam, source)

    def encode(self):
        json = super(raritan.rpc.webcam.WebcamAddedEvent, self).encode()
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            # for webcam.WebcamEvent
            webcam=Interface.decode(json["webcam"], agent),
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = []
        elements = (
            elements + super(raritan.rpc.webcam.WebcamAddedEvent, self).listElements()
        )
        return elements


# value object
class WebcamRemovedEvent(WebcamEvent):
    idlType = "webcam.WebcamRemovedEvent:1.0.0"

    def __init__(self, webcam, source):
        super(raritan.rpc.webcam.WebcamRemovedEvent, self).__init__(webcam, source)

    def encode(self):
        json = super(raritan.rpc.webcam.WebcamRemovedEvent, self).encode()
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            # for webcam.WebcamEvent
            webcam=Interface.decode(json["webcam"], agent),
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = []
        elements = (
            elements + super(raritan.rpc.webcam.WebcamRemovedEvent, self).listElements()
        )
        return elements


# value object
class WebcamSettingsChangedEvent(WebcamEvent):
    idlType = "webcam.WebcamSettingsChangedEvent:1.0.0"

    def __init__(self, username, oldSettings, newSettings, webcam, source):
        super(raritan.rpc.webcam.WebcamSettingsChangedEvent, self).__init__(
            webcam, source
        )
        typecheck.is_string(username, AssertionError)
        typecheck.is_struct(oldSettings, raritan.rpc.webcam.Settings, AssertionError)
        typecheck.is_struct(newSettings, raritan.rpc.webcam.Settings, AssertionError)

        self.username = username
        self.oldSettings = oldSettings
        self.newSettings = newSettings

    def encode(self):
        json = super(raritan.rpc.webcam.WebcamSettingsChangedEvent, self).encode()
        json["username"] = self.username
        json["oldSettings"] = raritan.rpc.webcam.Settings.encode(self.oldSettings)
        json["newSettings"] = raritan.rpc.webcam.Settings.encode(self.newSettings)
        return json

    @classmethod
    def decode(cls, json, agent):
        obj = cls(
            username=json["username"],
            oldSettings=raritan.rpc.webcam.Settings.decode(json["oldSettings"], agent),
            newSettings=raritan.rpc.webcam.Settings.decode(json["newSettings"], agent),
            # for webcam.WebcamEvent
            webcam=Interface.decode(json["webcam"], agent),
            # for idl.Event
            source=Interface.decode(json["source"], agent),
        )
        return obj

    def listElements(self):
        elements = ["username", "oldSettings", "newSettings"]
        elements = (
            elements
            + super(raritan.rpc.webcam.WebcamSettingsChangedEvent, self).listElements()
        )
        return elements


# interface
class WebcamManager(Interface):
    idlType = "webcam.WebcamManager:2.0.0"

    NO_ERROR = 0

    ERR_INVALID_PARAM = 1

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

    def getChannel(self, webcam, clientType):
        agent = self.agent
        typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
        typecheck.is_string(clientType, AssertionError)
        args = {}
        args["webcam"] = Interface.encode(webcam)
        args["clientType"] = clientType
        rsp = agent.json_rpc(self.target, "getChannel", args)
        _ret_ = rsp["_ret_"]
        channel = Interface.decode(rsp["channel"], agent)
        typecheck.is_int(_ret_, DecodeException)
        typecheck.is_interface(channel, raritan.rpc.webcam.Channel, DecodeException)
        return (_ret_, channel)

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

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

    def getClientTypes(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getClientTypes", args)
        _ret_ = [x0 for x0 in rsp["_ret_"]]
        for x0 in _ret_:
            typecheck.is_string(x0, DecodeException)
        return _ret_

    def getClientTypePriorities(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getClientTypePriorities", args)
        _ret_ = dict(
            [
                (elem["key"], raritan.rpc.webcam.Priority.decode(elem["value"]))
                for elem in rsp["_ret_"]
            ]
        )
        return _ret_

    def setClientTypePriorities(self, priorities):
        agent = self.agent
        args = {}
        args["priorities"] = [
            dict(key=k, value=raritan.rpc.webcam.Priority.encode(v))
            for k, v in priorities.items()
        ]
        rsp = agent.json_rpc(self.target, "setClientTypePriorities", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getWebcamPriorities(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getWebcamPriorities", args)
        _ret_ = dict(
            [
                (elem["key"], raritan.rpc.webcam.Priority.decode(elem["value"]))
                for elem in rsp["_ret_"]
            ]
        )
        return _ret_

    def setWebcamPriorities(self, priorities):
        agent = self.agent
        args = {}
        args["priorities"] = [
            dict(key=k, value=raritan.rpc.webcam.Priority.encode(v))
            for k, v in priorities.items()
        ]
        rsp = agent.json_rpc(self.target, "setWebcamPriorities", 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/webcam/idl/StorageManager.idl"
#

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


# interface
class StorageManager(Interface):
    idlType = "webcam.StorageManager:1.0.1"

    NO_ERROR = 0

    ERR_INVALID_PARAM = 1

    ERR_INIT_IN_PROGRESS = 2

    ERR_ALREADY_RUNNING = 3

    ERR_TOO_LARGE = 4

    # enumeration
    class StorageType(Enumeration):
        idlType = "webcam.StorageManager.StorageType:1.0.0"
        values = ["LOCAL", "FTP", "CIFS", "NFS"]

    StorageType.LOCAL = StorageType(0)
    StorageType.FTP = StorageType(1)
    StorageType.CIFS = StorageType(2)
    StorageType.NFS = StorageType(3)

    # enumeration
    class Direction(Enumeration):
        idlType = "webcam.StorageManager.Direction:1.0.0"
        values = ["ASCENDING", "DESCENDING"]

    Direction.ASCENDING = Direction(0)
    Direction.DESCENDING = Direction(1)

    # enumeration
    class StorageStatus(Enumeration):
        idlType = "webcam.StorageManager.StorageStatus:1.0.0"
        values = ["INITIALIZING", "READY"]

    StorageStatus.INITIALIZING = StorageStatus(0)
    StorageStatus.READY = StorageStatus(1)

    # structure
    class WebcamStorageInfo(Structure):
        idlType = "webcam.StorageManager.WebcamStorageInfo:1.0.0"
        elements = ["webcam", "newestIndex", "oldestIndex", "count"]

        def __init__(self, webcam, newestIndex, oldestIndex, count):
            typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
            typecheck.is_long(newestIndex, AssertionError)
            typecheck.is_long(oldestIndex, AssertionError)
            typecheck.is_int(count, AssertionError)

            self.webcam = webcam
            self.newestIndex = newestIndex
            self.oldestIndex = oldestIndex
            self.count = count

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                webcam=Interface.decode(json["webcam"], agent),
                newestIndex=int(json["newestIndex"]),
                oldestIndex=int(json["oldestIndex"]),
                count=json["count"],
            )
            return obj

        def encode(self):
            json = {}
            json["webcam"] = Interface.encode(self.webcam)
            json["newestIndex"] = self.newestIndex
            json["oldestIndex"] = self.oldestIndex
            json["count"] = self.count
            return json

    # structure
    class StorageInformation(Structure):
        idlType = "webcam.StorageManager.StorageInformation:1.0.0"
        elements = ["status", "capacity", "used", "webcamStorageInfo"]

        def __init__(self, status, capacity, used, webcamStorageInfo):
            typecheck.is_enum(
                status, raritan.rpc.webcam.StorageManager.StorageStatus, AssertionError
            )
            typecheck.is_int(capacity, AssertionError)
            typecheck.is_int(used, AssertionError)
            for x0 in webcamStorageInfo:
                typecheck.is_struct(
                    x0,
                    raritan.rpc.webcam.StorageManager.WebcamStorageInfo,
                    AssertionError,
                )

            self.status = status
            self.capacity = capacity
            self.used = used
            self.webcamStorageInfo = webcamStorageInfo

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                status=raritan.rpc.webcam.StorageManager.StorageStatus.decode(
                    json["status"]
                ),
                capacity=json["capacity"],
                used=json["used"],
                webcamStorageInfo=[
                    raritan.rpc.webcam.StorageManager.WebcamStorageInfo.decode(
                        x0, agent
                    )
                    for x0 in json["webcamStorageInfo"]
                ],
            )
            return obj

        def encode(self):
            json = {}
            json["status"] = raritan.rpc.webcam.StorageManager.StorageStatus.encode(
                self.status
            )
            json["capacity"] = self.capacity
            json["used"] = self.used
            json["webcamStorageInfo"] = [
                raritan.rpc.webcam.StorageManager.WebcamStorageInfo.encode(x0)
                for x0 in self.webcamStorageInfo
            ]
            return json

    # structure
    class StorageSettings(Structure):
        idlType = "webcam.StorageManager.StorageSettings:1.0.0"
        elements = ["type", "capacity", "server", "username", "password"]

        def __init__(self, type, capacity, server, username, password):
            typecheck.is_enum(
                type, raritan.rpc.webcam.StorageManager.StorageType, AssertionError
            )
            typecheck.is_int(capacity, AssertionError)
            typecheck.is_string(server, AssertionError)
            typecheck.is_string(username, AssertionError)
            typecheck.is_string(password, AssertionError)

            self.type = type
            self.capacity = capacity
            self.server = server
            self.username = username
            self.password = password

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                type=raritan.rpc.webcam.StorageManager.StorageType.decode(json["type"]),
                capacity=json["capacity"],
                server=json["server"],
                username=json["username"],
                password=json["password"],
            )
            return obj

        def encode(self):
            json = {}
            json["type"] = raritan.rpc.webcam.StorageManager.StorageType.encode(
                self.type
            )
            json["capacity"] = self.capacity
            json["server"] = self.server
            json["username"] = self.username
            json["password"] = self.password
            return json

    # structure
    class StorageMetaData(Structure):
        idlType = "webcam.StorageManager.StorageMetaData:1.0.0"
        elements = ["index", "webcam"]

        def __init__(self, index, webcam):
            typecheck.is_long(index, AssertionError)
            typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)

            self.index = index
            self.webcam = webcam

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                index=int(json["index"]),
                webcam=Interface.decode(json["webcam"], agent),
            )
            return obj

        def encode(self):
            json = {}
            json["index"] = self.index
            json["webcam"] = Interface.encode(self.webcam)
            return json

    # structure
    class ImageStorageMetaData(Structure):
        idlType = "webcam.StorageManager.ImageStorageMetaData:1.0.0"
        elements = ["imageMeta", "fileSize", "storageMeta"]

        def __init__(self, imageMeta, fileSize, storageMeta):
            typecheck.is_struct(
                imageMeta, raritan.rpc.webcam.ImageMetaData, AssertionError
            )
            typecheck.is_int(fileSize, AssertionError)
            typecheck.is_struct(
                storageMeta,
                raritan.rpc.webcam.StorageManager.StorageMetaData,
                AssertionError,
            )

            self.imageMeta = imageMeta
            self.fileSize = fileSize
            self.storageMeta = storageMeta

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                imageMeta=raritan.rpc.webcam.ImageMetaData.decode(
                    json["imageMeta"], agent
                ),
                fileSize=json["fileSize"],
                storageMeta=raritan.rpc.webcam.StorageManager.StorageMetaData.decode(
                    json["storageMeta"], agent
                ),
            )
            return obj

        def encode(self):
            json = {}
            json["imageMeta"] = raritan.rpc.webcam.ImageMetaData.encode(self.imageMeta)
            json["fileSize"] = self.fileSize
            json[
                "storageMeta"
            ] = raritan.rpc.webcam.StorageManager.StorageMetaData.encode(
                self.storageMeta
            )
            return json

    # structure
    class StorageImage(Structure):
        idlType = "webcam.StorageManager.StorageImage:1.0.0"
        elements = ["image", "metaData"]

        def __init__(self, image, metaData):
            typecheck.is_struct(image, raritan.rpc.webcam.Image, AssertionError)
            typecheck.is_struct(
                metaData,
                raritan.rpc.webcam.StorageManager.StorageMetaData,
                AssertionError,
            )

            self.image = image
            self.metaData = metaData

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                image=raritan.rpc.webcam.Image.decode(json["image"], agent),
                metaData=raritan.rpc.webcam.StorageManager.StorageMetaData.decode(
                    json["metaData"], agent
                ),
            )
            return obj

        def encode(self):
            json = {}
            json["image"] = raritan.rpc.webcam.Image.encode(self.image)
            json["metaData"] = raritan.rpc.webcam.StorageManager.StorageMetaData.encode(
                self.metaData
            )
            return json

    # structure
    class Activity(Structure):
        idlType = "webcam.StorageManager.Activity:1.0.0"
        elements = ["webcam", "interval", "count", "done"]

        def __init__(self, webcam, interval, count, done):
            typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
            typecheck.is_int(interval, AssertionError)
            typecheck.is_int(count, AssertionError)
            typecheck.is_int(done, AssertionError)

            self.webcam = webcam
            self.interval = interval
            self.count = count
            self.done = done

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                webcam=Interface.decode(json["webcam"], agent),
                interval=json["interval"],
                count=json["count"],
                done=json["done"],
            )
            return obj

        def encode(self):
            json = {}
            json["webcam"] = Interface.encode(self.webcam)
            json["interval"] = self.interval
            json["count"] = self.count
            json["done"] = self.done
            return json

    def getSupportedStorageTypes(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getSupportedStorageTypes", args)
        _ret_ = [
            raritan.rpc.webcam.StorageManager.StorageType.decode(x0)
            for x0 in rsp["_ret_"]
        ]
        for x0 in _ret_:
            typecheck.is_enum(
                x0, raritan.rpc.webcam.StorageManager.StorageType, DecodeException
            )
        return _ret_

    def getInformation(self):
        agent = self.agent
        args = {}
        rsp = agent.json_rpc(self.target, "getInformation", args)
        _ret_ = raritan.rpc.webcam.StorageManager.StorageInformation.decode(
            rsp["_ret_"], agent
        )
        typecheck.is_struct(
            _ret_, raritan.rpc.webcam.StorageManager.StorageInformation, DecodeException
        )
        return _ret_

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

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

    def addImage(self, webcam, image):
        agent = self.agent
        typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
        typecheck.is_struct(image, raritan.rpc.webcam.Image, AssertionError)
        args = {}
        args["webcam"] = Interface.encode(webcam)
        args["image"] = raritan.rpc.webcam.Image.encode(image)
        rsp = agent.json_rpc(self.target, "addImage", args)
        _ret_ = rsp["_ret_"]
        index = int(rsp["index"])
        typecheck.is_int(_ret_, DecodeException)
        typecheck.is_long(index, DecodeException)
        return (_ret_, index)

    def removeImages(self, webcam, start, count, direction):
        agent = self.agent
        typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
        typecheck.is_long(start, AssertionError)
        typecheck.is_int(count, AssertionError)
        typecheck.is_enum(
            direction, raritan.rpc.webcam.StorageManager.Direction, AssertionError
        )
        args = {}
        args["webcam"] = Interface.encode(webcam)
        args["start"] = start
        args["count"] = count
        args["direction"] = raritan.rpc.webcam.StorageManager.Direction.encode(
            direction
        )
        rsp = agent.json_rpc(self.target, "removeImages", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def getMetaData(self, webcam, start, count, direction):
        agent = self.agent
        typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
        typecheck.is_long(start, AssertionError)
        typecheck.is_int(count, AssertionError)
        typecheck.is_enum(
            direction, raritan.rpc.webcam.StorageManager.Direction, AssertionError
        )
        args = {}
        args["webcam"] = Interface.encode(webcam)
        args["start"] = start
        args["count"] = count
        args["direction"] = raritan.rpc.webcam.StorageManager.Direction.encode(
            direction
        )
        rsp = agent.json_rpc(self.target, "getMetaData", args)
        _ret_ = rsp["_ret_"]
        meta = [
            raritan.rpc.webcam.StorageManager.ImageStorageMetaData.decode(x0, agent)
            for x0 in rsp["meta"]
        ]
        typecheck.is_int(_ret_, DecodeException)
        for x0 in meta:
            typecheck.is_struct(
                x0,
                raritan.rpc.webcam.StorageManager.ImageStorageMetaData,
                DecodeException,
            )
        return (_ret_, meta)

    def getImages(self, webcam, start, count, direction):
        agent = self.agent
        typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
        typecheck.is_long(start, AssertionError)
        typecheck.is_int(count, AssertionError)
        typecheck.is_enum(
            direction, raritan.rpc.webcam.StorageManager.Direction, AssertionError
        )
        args = {}
        args["webcam"] = Interface.encode(webcam)
        args["start"] = start
        args["count"] = count
        args["direction"] = raritan.rpc.webcam.StorageManager.Direction.encode(
            direction
        )
        rsp = agent.json_rpc(self.target, "getImages", args)
        _ret_ = rsp["_ret_"]
        image = [
            raritan.rpc.webcam.StorageManager.StorageImage.decode(x0, agent)
            for x0 in rsp["image"]
        ]
        typecheck.is_int(_ret_, DecodeException)
        for x0 in image:
            typecheck.is_struct(
                x0, raritan.rpc.webcam.StorageManager.StorageImage, DecodeException
            )
        return (_ret_, image)

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

    def startActivity(self, webcam, count, interval):
        agent = self.agent
        typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
        typecheck.is_int(count, AssertionError)
        typecheck.is_int(interval, AssertionError)
        args = {}
        args["webcam"] = Interface.encode(webcam)
        args["count"] = count
        args["interval"] = interval
        rsp = agent.json_rpc(self.target, "startActivity", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_

    def stopActivity(self, webcam):
        agent = self.agent
        typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
        args = {}
        args["webcam"] = Interface.encode(webcam)
        rsp = agent.json_rpc(self.target, "stopActivity", args)
        _ret_ = rsp["_ret_"]
        typecheck.is_int(_ret_, DecodeException)
        return _ret_
