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

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

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

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=0, height=0, pixelFormat=None):
        if pixelFormat is None:
            pixelFormat = raritan.rpc.webcam.PixelFormat.MJPEG
        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, useDefaults=False):
        obj = cls(
            width = json['width'] if 'width' in json or not useDefaults else 0,
            height = json['height'] if 'height' in json or not useDefaults else 0,
            pixelFormat = raritan.rpc.webcam.PixelFormat.decode(json['pixelFormat']) if 'pixelFormat' in json or not useDefaults else raritan.rpc.webcam.PixelFormat.MJPEG,
        )
        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=0, contrast=0, saturation=0, gain=0, gamma=0, powerLineFrequency=None):
        if powerLineFrequency is None:
            powerLineFrequency = raritan.rpc.webcam.PowerLineFrequency.NOT_SUPPORTED
        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, useDefaults=False):
        obj = cls(
            brightness = json['brightness'] if 'brightness' in json or not useDefaults else 0,
            contrast = json['contrast'] if 'contrast' in json or not useDefaults else 0,
            saturation = json['saturation'] if 'saturation' in json or not useDefaults else 0,
            gain = json['gain'] if 'gain' in json or not useDefaults else 0,
            gamma = json['gamma'] if 'gamma' in json or not useDefaults else 0,
            powerLineFrequency = raritan.rpc.webcam.PowerLineFrequency.decode(json['powerLineFrequency']) if 'powerLineFrequency' in json or not useDefaults else raritan.rpc.webcam.PowerLineFrequency.NOT_SUPPORTED,
        )
        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=""):
        if not typecheck._is_int(name):
            typecheck.is_string(name, AssertionError)
        if not typecheck._is_int(x):
            typecheck.is_string(x, AssertionError)
        if not typecheck._is_int(y):
            typecheck.is_string(y, AssertionError)
        if not typecheck._is_int(z):
            typecheck.is_string(z, AssertionError)

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

    @classmethod
    def decode(cls, json, agent, useDefaults=False):
        obj = cls(
            name = json['name'] if 'name' in json or not useDefaults else "",
            x = json['x'] if 'x' in json or not useDefaults else "",
            y = json['y'] if 'y' in json or not useDefaults else "",
            z = json['z'] if 'z' in json or not useDefaults else "",
        )
        return obj

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

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

    def __init__(self, format=None, timestamp=0, location=None):
        if format is None:
            format = raritan.rpc.webcam.Format()
        if location is None:
            location = raritan.rpc.webcam.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, useDefaults=False):
        obj = cls(
            format = raritan.rpc.webcam.Format.decode(json['format'], agent, useDefaults=useDefaults) if 'format' in json or not useDefaults else raritan.rpc.webcam.Format(),
            timestamp = int(json['timestamp']) if 'timestamp' in json or not useDefaults else 0,
            location = raritan.rpc.webcam.Location.decode(json['location'], agent, useDefaults=useDefaults) if 'location' in json or not useDefaults else raritan.rpc.webcam.Location(),
        )
        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=None, data=""):
        if meta is None:
            meta = raritan.rpc.webcam.ImageMetaData()
        typecheck.is_struct(meta, raritan.rpc.webcam.ImageMetaData, AssertionError)
        if not typecheck._is_int(data):
            typecheck.is_string(data, AssertionError)

        self.meta = meta
        self.data = data

    @classmethod
    def decode(cls, json, agent, useDefaults=False):
        obj = cls(
            meta = raritan.rpc.webcam.ImageMetaData.decode(json['meta'], agent, useDefaults=useDefaults) if 'meta' in json or not useDefaults else raritan.rpc.webcam.ImageMetaData(),
            data = json['data'] if 'data' in json or not useDefaults else "",
        )
        return obj

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

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

    def __init__(self, format=None, controls=None, name="", location=None, refreshInterval=0):
        if format is None:
            format = raritan.rpc.webcam.Format()
        if controls is None:
            controls = raritan.rpc.webcam.Controls()
        if location is None:
            location = raritan.rpc.webcam.Location()
        typecheck.is_struct(format, raritan.rpc.webcam.Format, AssertionError)
        typecheck.is_struct(controls, raritan.rpc.webcam.Controls, AssertionError)
        if not typecheck._is_int(name):
            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, useDefaults=False):
        obj = cls(
            format = raritan.rpc.webcam.Format.decode(json['format'], agent, useDefaults=useDefaults) if 'format' in json or not useDefaults else raritan.rpc.webcam.Format(),
            controls = raritan.rpc.webcam.Controls.decode(json['controls'], agent, useDefaults=useDefaults) if 'controls' in json or not useDefaults else raritan.rpc.webcam.Controls(),
            name = json['name'] if 'name' in json or not useDefaults else "",
            location = raritan.rpc.webcam.Location.decode(json['location'], agent, useDefaults=useDefaults) if 'location' in json or not useDefaults else raritan.rpc.webcam.Location(),
            refreshInterval = json['refreshInterval'] if 'refreshInterval' in json or not useDefaults else 0,
        )
        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'] = str(self.name)
        json['location'] = raritan.rpc.webcam.Location.encode(self.location)
        json['refreshInterval'] = self.refreshInterval
        return json

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

    def __init__(self, id="", model="", supportedFormats=[]):
        if not typecheck._is_int(id):
            typecheck.is_string(id, AssertionError)
        if not typecheck._is_int(model):
            typecheck.is_string(model, AssertionError)
        for x0 in supportedFormats:
            typecheck.is_struct(x0, raritan.rpc.webcam.Format, AssertionError)

        self.id = id
        self.model = model
        self.supportedFormats = supportedFormats

    @classmethod
    def decode(cls, json, agent, useDefaults=False):
        obj = cls(
            id = json['id'] if 'id' in json or not useDefaults else "",
            model = json['model'] if 'model' in json or not useDefaults else "",
            supportedFormats = [raritan.rpc.webcam.Format.decode(x0, agent, useDefaults=useDefaults) for x0 in json['supportedFormats']] if 'supportedFormats' in json or not useDefaults else [],
        )
        return obj

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

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

    NO_ERROR = 0

    ERR_INVALID_PARAM = 1

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

        def __init__(self, oldSettings=None, newSettings=None, actUserName="", actIpAddr="", source=None):
            super(raritan.rpc.webcam.Webcam.SettingsChangedEvent, self).__init__(actUserName, actIpAddr, source)
            if oldSettings is None:
                oldSettings = raritan.rpc.webcam.Settings()
            if newSettings is None:
                newSettings = raritan.rpc.webcam.Settings()
            typecheck.is_struct(oldSettings, raritan.rpc.webcam.Settings, AssertionError)
            typecheck.is_struct(newSettings, raritan.rpc.webcam.Settings, AssertionError)

            self.oldSettings = oldSettings
            self.newSettings = newSettings

        def encode(self):
            json = super(raritan.rpc.webcam.Webcam.SettingsChangedEvent, self).encode()
            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, useDefaults=False):
            obj = cls(
                oldSettings = raritan.rpc.webcam.Settings.decode(json['oldSettings'], agent, useDefaults=useDefaults) if 'oldSettings' in json or not useDefaults else raritan.rpc.webcam.Settings(),
                newSettings = raritan.rpc.webcam.Settings.decode(json['newSettings'], agent, useDefaults=useDefaults) if 'newSettings' in json or not useDefaults else raritan.rpc.webcam.Settings(),
                # for event.UserEvent
                actUserName = json['actUserName'] if 'actUserName' in json or not useDefaults else "",
                actIpAddr = json['actIpAddr'] if 'actIpAddr' in json or not useDefaults else "",
                # for idl.Event
                source = Interface.decode(json['source'], agent) if 'source' in json or not useDefaults else None,
            )
            return obj

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

    class _getInformation(Interface.Method):
        name = 'getInformation'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = raritan.rpc.webcam.Information.decode(rsp['_ret_'], agent, useDefaults=useDefaults)
            typecheck.is_struct(_ret_, raritan.rpc.webcam.Information, DecodeException)
            return _ret_

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

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

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

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

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_

    class _setControls(Interface.Method):
        name = 'setControls'

        @staticmethod
        def encode(controls):
            typecheck.is_struct(controls, raritan.rpc.webcam.Controls, AssertionError)
            args = {}
            args['controls'] = raritan.rpc.webcam.Controls.encode(controls)
            return args

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_

    class _getControlDefaults(Interface.Method):
        name = 'getControlDefaults'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = raritan.rpc.webcam.Controls.decode(rsp['_ret_'], agent, useDefaults=useDefaults)
            typecheck.is_struct(_ret_, raritan.rpc.webcam.Controls, DecodeException)
            return _ret_
    def __init__(self, target, agent):
        super(Webcam, self).__init__(target, agent)
        self.getInformation = Webcam._getInformation(self)
        self.getSettings = Webcam._getSettings(self)
        self.setSettings = Webcam._setSettings(self)
        self.setControls = Webcam._setControls(self)
        self.getControlDefaults = Webcam._getControlDefaults(self)

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

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

import raritan.rpc.webcam


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

    NO_ERROR = 0

    ERR_INVALID_PARAM = 1

    ERR_INIT_IN_PROGRESS = 2

    ERR_ALREADY_RUNNING = 3

    ERR_TOO_LARGE = 4

    ERR_OPERATION_NOT_SUPPORTED = 5

    # enumeration
    class StorageType(Enumeration):
        idlType = "webcam.StorageManager_1_0_3.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_1_0_3.Direction:1.0.0"
        values = ["ASCENDING", "DESCENDING"]

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

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

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

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

        def __init__(self, webcam=None, newestIndex=0, oldestIndex=0, count=0):
            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, useDefaults=False):
            obj = cls(
                webcam = Interface.decode(json['webcam'], agent) if 'webcam' in json or not useDefaults else None,
                newestIndex = int(json['newestIndex']) if 'newestIndex' in json or not useDefaults else 0,
                oldestIndex = int(json['oldestIndex']) if 'oldestIndex' in json or not useDefaults else 0,
                count = json['count'] if 'count' in json or not useDefaults else 0,
            )
            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_1_0_3.StorageInformation:1.0.0"
        elements = ["status", "capacity", "used", "webcamStorageInfo"]

        def __init__(self, status=None, capacity=0, used=0, webcamStorageInfo=[]):
            if status is None:
                status = raritan.rpc.webcam.StorageManager.StorageStatus.INITIALIZING
            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, useDefaults=False):
            obj = cls(
                status = raritan.rpc.webcam.StorageManager.StorageStatus.decode(json['status']) if 'status' in json or not useDefaults else raritan.rpc.webcam.StorageManager.StorageStatus.INITIALIZING,
                capacity = json['capacity'] if 'capacity' in json or not useDefaults else 0,
                used = json['used'] if 'used' in json or not useDefaults else 0,
                webcamStorageInfo = [raritan.rpc.webcam.StorageManager.WebcamStorageInfo.decode(x0, agent, useDefaults=useDefaults) for x0 in json['webcamStorageInfo']] if 'webcamStorageInfo' in json or not useDefaults else [],
            )
            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_1_0_3.StorageSettings:1.0.0"
        elements = ["type", "capacity", "server", "username", "password"]

        def __init__(self, type=None, capacity=0, server="", username="", password=""):
            if type is None:
                type = raritan.rpc.webcam.StorageManager.StorageType.LOCAL
            typecheck.is_enum(type, raritan.rpc.webcam.StorageManager.StorageType, AssertionError)
            typecheck.is_int(capacity, AssertionError)
            if not typecheck._is_int(server):
                typecheck.is_string(server, AssertionError)
            if not typecheck._is_int(username):
                typecheck.is_string(username, AssertionError)
            if not typecheck._is_int(password):
                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, useDefaults=False):
            obj = cls(
                type = raritan.rpc.webcam.StorageManager.StorageType.decode(json['type']) if 'type' in json or not useDefaults else raritan.rpc.webcam.StorageManager.StorageType.LOCAL,
                capacity = json['capacity'] if 'capacity' in json or not useDefaults else 0,
                server = json['server'] if 'server' in json or not useDefaults else "",
                username = json['username'] if 'username' in json or not useDefaults else "",
                password = json['password'] if 'password' in json or not useDefaults else "",
            )
            return obj

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

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

        def __init__(self, index=0, webcam=None):
            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, useDefaults=False):
            obj = cls(
                index = int(json['index']) if 'index' in json or not useDefaults else 0,
                webcam = Interface.decode(json['webcam'], agent) if 'webcam' in json or not useDefaults else None,
            )
            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_1_0_3.ImageStorageMetaData:1.0.0"
        elements = ["imageMeta", "fileSize", "storageMeta"]

        def __init__(self, imageMeta=None, fileSize=0, storageMeta=None):
            if imageMeta is None:
                imageMeta = raritan.rpc.webcam.ImageMetaData()
            if storageMeta is None:
                storageMeta = raritan.rpc.webcam.StorageManager.StorageMetaData()
            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, useDefaults=False):
            obj = cls(
                imageMeta = raritan.rpc.webcam.ImageMetaData.decode(json['imageMeta'], agent, useDefaults=useDefaults) if 'imageMeta' in json or not useDefaults else raritan.rpc.webcam.ImageMetaData(),
                fileSize = json['fileSize'] if 'fileSize' in json or not useDefaults else 0,
                storageMeta = raritan.rpc.webcam.StorageManager.StorageMetaData.decode(json['storageMeta'], agent, useDefaults=useDefaults) if 'storageMeta' in json or not useDefaults else raritan.rpc.webcam.StorageManager.StorageMetaData(),
            )
            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_1_0_3.StorageImage:1.0.0"
        elements = ["image", "metaData"]

        def __init__(self, image=None, metaData=None):
            if image is None:
                image = raritan.rpc.webcam.Image()
            if metaData is None:
                metaData = raritan.rpc.webcam.StorageManager.StorageMetaData()
            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, useDefaults=False):
            obj = cls(
                image = raritan.rpc.webcam.Image.decode(json['image'], agent, useDefaults=useDefaults) if 'image' in json or not useDefaults else raritan.rpc.webcam.Image(),
                metaData = raritan.rpc.webcam.StorageManager.StorageMetaData.decode(json['metaData'], agent, useDefaults=useDefaults) if 'metaData' in json or not useDefaults else raritan.rpc.webcam.StorageManager.StorageMetaData(),
            )
            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_1_0_3.Activity:1.0.0"
        elements = ["webcam", "interval", "count", "done"]

        def __init__(self, webcam=None, interval=0, count=0, done=0):
            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, useDefaults=False):
            obj = cls(
                webcam = Interface.decode(json['webcam'], agent) if 'webcam' in json or not useDefaults else None,
                interval = json['interval'] if 'interval' in json or not useDefaults else 0,
                count = json['count'] if 'count' in json or not useDefaults else 0,
                done = json['done'] if 'done' in json or not useDefaults else 0,
            )
            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

    # value object
    class ImageUploadStartedEvent(raritan.rpc.event.UserEvent):
        idlType = "webcam.StorageManager_1_0_3.ImageUploadStartedEvent:1.0.0"

        def __init__(self, webcam=None, folderUrl="", actUserName="", actIpAddr="", source=None):
            super(raritan.rpc.webcam.StorageManager.ImageUploadStartedEvent, self).__init__(actUserName, actIpAddr, source)
            typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
            if not typecheck._is_int(folderUrl):
                typecheck.is_string(folderUrl, AssertionError)

            self.webcam = webcam
            self.folderUrl = folderUrl

        def encode(self):
            json = super(raritan.rpc.webcam.StorageManager.ImageUploadStartedEvent, self).encode()
            json['webcam'] = Interface.encode(self.webcam)
            json['folderUrl'] = str(self.folderUrl)
            return json

        @classmethod
        def decode(cls, json, agent, useDefaults=False):
            obj = cls(
                webcam = Interface.decode(json['webcam'], agent) if 'webcam' in json or not useDefaults else None,
                folderUrl = json['folderUrl'] if 'folderUrl' in json or not useDefaults else "",
                # for event.UserEvent
                actUserName = json['actUserName'] if 'actUserName' in json or not useDefaults else "",
                actIpAddr = json['actIpAddr'] if 'actIpAddr' in json or not useDefaults else "",
                # for idl.Event
                source = Interface.decode(json['source'], agent) if 'source' in json or not useDefaults else None,
            )
            return obj

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

    class _getSupportedStorageTypes(Interface.Method):
        name = 'getSupportedStorageTypes'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _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_

    class _getInformation(Interface.Method):
        name = 'getInformation'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = raritan.rpc.webcam.StorageManager.StorageInformation.decode(rsp['_ret_'], agent, useDefaults=useDefaults)
            typecheck.is_struct(_ret_, raritan.rpc.webcam.StorageManager.StorageInformation, DecodeException)
            return _ret_

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

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = raritan.rpc.webcam.StorageManager.StorageSettings.decode(rsp['_ret_'], agent, useDefaults=useDefaults)
            typecheck.is_struct(_ret_, raritan.rpc.webcam.StorageManager.StorageSettings, DecodeException)
            return _ret_

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

        @staticmethod
        def encode(settings):
            typecheck.is_struct(settings, raritan.rpc.webcam.StorageManager.StorageSettings, AssertionError)
            args = {}
            args['settings'] = raritan.rpc.webcam.StorageManager.StorageSettings.encode(settings)
            return args

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_

    class _addImage(Interface.Method):
        name = 'addImage'

        @staticmethod
        def encode(webcam, image):
            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)
            return args

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            index = int(rsp['index'])
            typecheck.is_int(_ret_, DecodeException)
            typecheck.is_long(index, DecodeException)
            return (_ret_, index)

    class _removeImages(Interface.Method):
        name = 'removeImages'

        @staticmethod
        def encode(webcam, start, count, direction):
            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)
            return args

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_

    class _getMetaData(Interface.Method):
        name = 'getMetaData'

        @staticmethod
        def encode(webcam, start, count, direction):
            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)
            return args

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            meta = [raritan.rpc.webcam.StorageManager.ImageStorageMetaData.decode(x0, agent, useDefaults=useDefaults) 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)

    class _getImages(Interface.Method):
        name = 'getImages'

        @staticmethod
        def encode(webcam, start, count, direction):
            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)
            return args

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            image = [raritan.rpc.webcam.StorageManager.StorageImage.decode(x0, agent, useDefaults=useDefaults) 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)

    class _getActivities(Interface.Method):
        name = 'getActivities'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = [raritan.rpc.webcam.StorageManager.Activity.decode(x0, agent, useDefaults=useDefaults) for x0 in rsp['_ret_']]
            for x0 in _ret_:
                typecheck.is_struct(x0, raritan.rpc.webcam.StorageManager.Activity, DecodeException)
            return _ret_

    class _startActivity(Interface.Method):
        name = 'startActivity'

        @staticmethod
        def encode(webcam, count, interval):
            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
            return args

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_

    class _startActivityWithFolder(Interface.Method):
        name = 'startActivityWithFolder'

        @staticmethod
        def encode(webcam, count, interval, folder):
            typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
            typecheck.is_int(count, AssertionError)
            typecheck.is_int(interval, AssertionError)
            if not typecheck._is_int(folder):
                typecheck.is_string(folder, AssertionError)
            args = {}
            args['webcam'] = Interface.encode(webcam)
            args['count'] = count
            args['interval'] = interval
            args['folder'] = str(folder)
            return args

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_

    class _stopActivity(Interface.Method):
        name = 'stopActivity'

        @staticmethod
        def encode(webcam):
            typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
            args = {}
            args['webcam'] = Interface.encode(webcam)
            return args

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_
    def __init__(self, target, agent):
        super(StorageManager, self).__init__(target, agent)
        self.getSupportedStorageTypes = StorageManager._getSupportedStorageTypes(self)
        self.getInformation = StorageManager._getInformation(self)
        self.getSettings = StorageManager._getSettings(self)
        self.setSettings = StorageManager._setSettings(self)
        self.addImage = StorageManager._addImage(self)
        self.removeImages = StorageManager._removeImages(self)
        self.getMetaData = StorageManager._getMetaData(self)
        self.getImages = StorageManager._getImages(self)
        self.getActivities = StorageManager._getActivities(self)
        self.startActivity = StorageManager._startActivity(self)
        self.startActivityWithFolder = StorageManager._startActivityWithFolder(self)
        self.stopActivity = StorageManager._stopActivity(self)

#
# Section generated by IdlC from "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.2"

    NO_ERROR = 0

    ERR_NOT_AVAILABLE = 2

    ERR_NO_SUCH_OBJECT = 3

    class _getClientType(Interface.Method):
        name = 'getClientType'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            if not typecheck._is_int(_ret_):
                typecheck.is_string(_ret_, DecodeException)
            return _ret_

    class _getWebcam(Interface.Method):
        name = 'getWebcam'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = Interface.decode(rsp['_ret_'], agent)
            typecheck.is_interface(_ret_, raritan.rpc.webcam.Webcam, DecodeException)
            return _ret_

    class _isAvailable(Interface.Method):
        name = 'isAvailable'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            typecheck.is_bool(_ret_, DecodeException)
            return _ret_

    class _release(Interface.Method):
        name = 'release'

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

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

    class _captureImage(Interface.Method):
        name = 'captureImage'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            image = raritan.rpc.webcam.Image.decode(rsp['image'], agent, useDefaults=useDefaults)
            typecheck.is_int(_ret_, DecodeException)
            typecheck.is_struct(image, raritan.rpc.webcam.Image, DecodeException)
            return (_ret_, image)

    class _triggerCapture(Interface.Method):
        name = 'triggerCapture'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            captureToken = rsp['captureToken']
            typecheck.is_int(_ret_, DecodeException)
            if not typecheck._is_int(captureToken):
                typecheck.is_string(captureToken, DecodeException)
            return (_ret_, captureToken)
    def __init__(self, target, agent):
        super(Channel, self).__init__(target, agent)
        self.getClientType = Channel._getClientType(self)
        self.getWebcam = Channel._getWebcam(self)
        self.isAvailable = Channel._isAvailable(self)
        self.release = Channel._release(self)
        self.captureImage = Channel._captureImage(self)
        self.triggerCapture = Channel._triggerCapture(self)

#
# Section generated by IdlC from "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.2"

    def __init__(self, webcam=None, information=None, name="", source=None):
        super(raritan.rpc.webcam.WebcamEvent, self).__init__(source)
        if information is None:
            information = raritan.rpc.webcam.Information()
        typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
        typecheck.is_struct(information, raritan.rpc.webcam.Information, AssertionError)
        if not typecheck._is_int(name):
            typecheck.is_string(name, AssertionError)

        self.webcam = webcam
        self.information = information
        self.name = name

    def encode(self):
        json = super(raritan.rpc.webcam.WebcamEvent, self).encode()
        json['webcam'] = Interface.encode(self.webcam)
        json['information'] = raritan.rpc.webcam.Information.encode(self.information)
        json['name'] = str(self.name)
        return json

    @classmethod
    def decode(cls, json, agent, useDefaults=False):
        obj = cls(
            webcam = Interface.decode(json['webcam'], agent) if 'webcam' in json or not useDefaults else None,
            information = raritan.rpc.webcam.Information.decode(json['information'], agent, useDefaults=useDefaults) if 'information' in json or not useDefaults else raritan.rpc.webcam.Information(),
            name = json['name'] if 'name' in json or not useDefaults else "",
            # for idl.Event
            source = Interface.decode(json['source'], agent) if 'source' in json or not useDefaults else None,
        )
        return obj

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

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

    def __init__(self, webcam=None, information=None, name="", source=None):
        super(raritan.rpc.webcam.WebcamAddedEvent, self).__init__(webcam, information, name, source)

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

    @classmethod
    def decode(cls, json, agent, useDefaults=False):
        obj = cls(
            # for webcam.WebcamEvent_1_0_2
            webcam = Interface.decode(json['webcam'], agent) if 'webcam' in json or not useDefaults else None,
            information = raritan.rpc.webcam.Information.decode(json['information'], agent, useDefaults=useDefaults) if 'information' in json or not useDefaults else raritan.rpc.webcam.Information(),
            name = json['name'] if 'name' in json or not useDefaults else "",
            # for idl.Event
            source = Interface.decode(json['source'], agent) if 'source' in json or not useDefaults else None,
        )
        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.2"

    def __init__(self, webcam=None, information=None, name="", source=None):
        super(raritan.rpc.webcam.WebcamRemovedEvent, self).__init__(webcam, information, name, source)

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

    @classmethod
    def decode(cls, json, agent, useDefaults=False):
        obj = cls(
            # for webcam.WebcamEvent_1_0_2
            webcam = Interface.decode(json['webcam'], agent) if 'webcam' in json or not useDefaults else None,
            information = raritan.rpc.webcam.Information.decode(json['information'], agent, useDefaults=useDefaults) if 'information' in json or not useDefaults else raritan.rpc.webcam.Information(),
            name = json['name'] if 'name' in json or not useDefaults else "",
            # for idl.Event
            source = Interface.decode(json['source'], agent) if 'source' in json or not useDefaults else None,
        )
        return obj

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

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

    NO_ERROR = 0

    ERR_INVALID_PARAM = 1

    class _getWebcams(Interface.Method):
        name = 'getWebcams'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _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_

    class _getChannel(Interface.Method):
        name = 'getChannel'

        @staticmethod
        def encode(webcam, clientType):
            typecheck.is_interface(webcam, raritan.rpc.webcam.Webcam, AssertionError)
            if not typecheck._is_int(clientType):
                typecheck.is_string(clientType, AssertionError)
            args = {}
            args['webcam'] = Interface.encode(webcam)
            args['clientType'] = str(clientType)
            return args

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _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)

    class _getChannels(Interface.Method):
        name = 'getChannels'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _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_

    class _removeClientType(Interface.Method):
        name = 'removeClientType'

        @staticmethod
        def encode(clientType):
            if not typecheck._is_int(clientType):
                typecheck.is_string(clientType, AssertionError)
            args = {}
            args['clientType'] = str(clientType)
            return args

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_

    class _getClientTypes(Interface.Method):
        name = 'getClientTypes'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = [x0 for x0 in rsp['_ret_']]
            for x0 in _ret_:
                if not typecheck._is_int(x0):
                    typecheck.is_string(x0, DecodeException)
            return _ret_

    class _getClientTypePriorities(Interface.Method):
        name = 'getClientTypePriorities'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = dict([(
                elem['key'],
                raritan.rpc.webcam.Priority.decode(elem['value']))
                for elem in rsp['_ret_']])
            return _ret_

    class _setClientTypePriorities(Interface.Method):
        name = 'setClientTypePriorities'

        @staticmethod
        def encode(priorities):
            args = {}
            args['priorities'] = [dict(
                key = str(k),
                value = raritan.rpc.webcam.Priority.encode(v))
                for k, v in priorities.items()]
            return args

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_

    class _getWebcamPriorities(Interface.Method):
        name = 'getWebcamPriorities'

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

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = dict([(
                elem['key'],
                raritan.rpc.webcam.Priority.decode(elem['value']))
                for elem in rsp['_ret_']])
            return _ret_

    class _setWebcamPriorities(Interface.Method):
        name = 'setWebcamPriorities'

        @staticmethod
        def encode(priorities):
            args = {}
            args['priorities'] = [dict(
                key = str(k),
                value = raritan.rpc.webcam.Priority.encode(v))
                for k, v in priorities.items()]
            return args

        @staticmethod
        def decode(rsp, agent, useDefaults=False):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_
    def __init__(self, target, agent):
        super(WebcamManager, self).__init__(target, agent)
        self.getWebcams = WebcamManager._getWebcams(self)
        self.getChannel = WebcamManager._getChannel(self)
        self.getChannels = WebcamManager._getChannels(self)
        self.removeClientType = WebcamManager._removeClientType(self)
        self.getClientTypes = WebcamManager._getClientTypes(self)
        self.getClientTypePriorities = WebcamManager._getClientTypePriorities(self)
        self.setClientTypePriorities = WebcamManager._setClientTypePriorities(self)
        self.getWebcamPriorities = WebcamManager._getWebcamPriorities(self)
        self.setWebcamPriorities = WebcamManager._setWebcamPriorities(self)
