1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2022 Raritan Inc. All rights reserved.
#
# This is an auto-generated file.
#
# Section generated by IdlC from "Usb.idl"
#
import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.event
import raritan.rpc.usb
# structure
class UsbDevice(Structure):
idlType = "usb.UsbDevice:1.0.0"
elements = ["bus", "device", "vendorId", "productId"]
def __init__(self, bus, device, vendorId, productId):
typecheck.is_int(bus, AssertionError)
typecheck.is_int(device, AssertionError)
typecheck.is_int(vendorId, AssertionError)
typecheck.is_int(productId, AssertionError)
self.bus = bus
self.device = device
self.vendorId = vendorId
self.productId = productId
@classmethod
def decode(cls, json, agent):
obj = cls(
bus = json['bus'],
device = json['device'],
vendorId = json['vendorId'],
productId = json['productId'],
)
return obj
def encode(self):
json = {}
json['bus'] = self.bus
json['device'] = self.device
json['vendorId'] = self.vendorId
json['productId'] = self.productId
return json
# interface
class Usb(Interface):
idlType = "usb.Usb:1.0.2"
# structure
class Settings(Structure):
idlType = "usb.Usb_1_0_2.Settings:1.0.0"
elements = ["hostPortsEnabled"]
def __init__(self, hostPortsEnabled):
typecheck.is_bool(hostPortsEnabled, AssertionError)
self.hostPortsEnabled = hostPortsEnabled
@classmethod
def decode(cls, json, agent):
obj = cls(
hostPortsEnabled = json['hostPortsEnabled'],
)
return obj
def encode(self):
json = {}
json['hostPortsEnabled'] = self.hostPortsEnabled
return json
# value object
class SettingsChangedEvent(raritan.rpc.event.UserEvent):
idlType = "usb.Usb_1_0_2.SettingsChangedEvent:1.0.0"
def __init__(self, oldSettings, newSettings, actUserName, actIpAddr, source):
super(raritan.rpc.usb.Usb.SettingsChangedEvent, self).__init__(actUserName, actIpAddr, source)
typecheck.is_struct(oldSettings, raritan.rpc.usb.Usb.Settings, AssertionError)
typecheck.is_struct(newSettings, raritan.rpc.usb.Usb.Settings, AssertionError)
self.oldSettings = oldSettings
self.newSettings = newSettings
def encode(self):
json = super(raritan.rpc.usb.Usb.SettingsChangedEvent, self).encode()
json['oldSettings'] = raritan.rpc.usb.Usb.Settings.encode(self.oldSettings)
json['newSettings'] = raritan.rpc.usb.Usb.Settings.encode(self.newSettings)
return json
@classmethod
def decode(cls, json, agent):
obj = cls(
oldSettings = raritan.rpc.usb.Usb.Settings.decode(json['oldSettings'], agent),
newSettings = raritan.rpc.usb.Usb.Settings.decode(json['newSettings'], agent),
# for event.UserEvent
actUserName = json['actUserName'],
actIpAddr = json['actIpAddr'],
# for idl.Event
source = Interface.decode(json['source'], agent),
)
return obj
def listElements(self):
elements = ["oldSettings", "newSettings"]
elements = elements + super(raritan.rpc.usb.Usb.SettingsChangedEvent, self).listElements()
return elements
class _getSettings(Interface.Method):
name = 'getSettings'
@staticmethod
def encode():
args = {}
return args
@staticmethod
def decode(rsp, agent):
_ret_ = raritan.rpc.usb.Usb.Settings.decode(rsp['_ret_'], agent)
typecheck.is_struct(_ret_, raritan.rpc.usb.Usb.Settings, DecodeException)
return _ret_
class _setSettings(Interface.Method):
name = 'setSettings'
@staticmethod
def encode(settings):
typecheck.is_struct(settings, raritan.rpc.usb.Usb.Settings, AssertionError)
args = {}
args['settings'] = raritan.rpc.usb.Usb.Settings.encode(settings)
return args
@staticmethod
def decode(rsp, agent):
_ret_ = rsp['_ret_']
typecheck.is_int(_ret_, DecodeException)
return _ret_
class _getDevices(Interface.Method):
name = 'getDevices'
@staticmethod
def encode():
args = {}
return args
@staticmethod
def decode(rsp, agent):
usbDevices = [raritan.rpc.usb.UsbDevice.decode(x0, agent) for x0 in rsp['usbDevices']]
for x0 in usbDevices:
typecheck.is_struct(x0, raritan.rpc.usb.UsbDevice, DecodeException)
return usbDevices
def __init__(self, target, agent):
super(Usb, self).__init__(target, agent)
self.getSettings = Usb._getSettings(self)
self.setSettings = Usb._setSettings(self)
self.getDevices = Usb._getDevices(self)
|