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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
|
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2020 Raritan Inc. All rights reserved.
#
# This is an auto-generated file.
#
# Section generated by IdlC from "Emd.idl"
#
import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.emdmodel
import raritan.rpc.event
import raritan.rpc.hmi
import raritan.rpc.pdumodel
import raritan.rpc.peripheral
import raritan.rpc.portsmodel
import raritan.rpc.sensors
# interface
class Emd(Interface):
idlType = "emdmodel.Emd:2.2.8"
ERR_INVALID_PARAMS = 1
# structure
class MetaData(Structure):
idlType = "emdmodel.Emd_2_2_8.MetaData:1.0.0"
elements = ["nameplate", "ctrlBoardSerial", "hwRevision", "fwRevision", "macAddress"]
def __init__(self, nameplate, ctrlBoardSerial, hwRevision, fwRevision, macAddress):
typecheck.is_struct(nameplate, raritan.rpc.pdumodel.Nameplate, AssertionError)
typecheck.is_string(ctrlBoardSerial, AssertionError)
typecheck.is_string(hwRevision, AssertionError)
typecheck.is_string(fwRevision, AssertionError)
typecheck.is_string(macAddress, AssertionError)
self.nameplate = nameplate
self.ctrlBoardSerial = ctrlBoardSerial
self.hwRevision = hwRevision
self.fwRevision = fwRevision
self.macAddress = macAddress
@classmethod
def decode(cls, json, agent):
obj = cls(
nameplate = raritan.rpc.pdumodel.Nameplate.decode(json['nameplate'], agent),
ctrlBoardSerial = json['ctrlBoardSerial'],
hwRevision = json['hwRevision'],
fwRevision = json['fwRevision'],
macAddress = json['macAddress'],
)
return obj
def encode(self):
json = {}
json['nameplate'] = raritan.rpc.pdumodel.Nameplate.encode(self.nameplate)
json['ctrlBoardSerial'] = self.ctrlBoardSerial
json['hwRevision'] = self.hwRevision
json['fwRevision'] = self.fwRevision
json['macAddress'] = self.macAddress
return json
# structure
class Settings(Structure):
idlType = "emdmodel.Emd_2_2_8.Settings:1.0.0"
elements = ["name"]
def __init__(self, name):
typecheck.is_string(name, AssertionError)
self.name = name
@classmethod
def decode(cls, json, agent):
obj = cls(
name = json['name'],
)
return obj
def encode(self):
json = {}
json['name'] = self.name
return json
# value object
class SettingsChangedEvent(raritan.rpc.event.UserEvent):
idlType = "emdmodel.Emd_2_2_8.SettingsChangedEvent:1.0.0"
def __init__(self, oldSettings, newSettings, actUserName, actIpAddr, source):
super(raritan.rpc.emdmodel.Emd.SettingsChangedEvent, self).__init__(actUserName, actIpAddr, source)
typecheck.is_struct(oldSettings, raritan.rpc.emdmodel.Emd.Settings, AssertionError)
typecheck.is_struct(newSettings, raritan.rpc.emdmodel.Emd.Settings, AssertionError)
self.oldSettings = oldSettings
self.newSettings = newSettings
def encode(self):
json = super(raritan.rpc.emdmodel.Emd.SettingsChangedEvent, self).encode()
json['oldSettings'] = raritan.rpc.emdmodel.Emd.Settings.encode(self.oldSettings)
json['newSettings'] = raritan.rpc.emdmodel.Emd.Settings.encode(self.newSettings)
return json
@classmethod
def decode(cls, json, agent):
obj = cls(
oldSettings = raritan.rpc.emdmodel.Emd.Settings.decode(json['oldSettings'], agent),
newSettings = raritan.rpc.emdmodel.Emd.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.emdmodel.Emd.SettingsChangedEvent, self).listElements()
return elements
class _getMetaData(Interface.Method):
name = 'getMetaData'
@staticmethod
def encode():
args = {}
return args
@staticmethod
def decode(rsp, agent):
_ret_ = raritan.rpc.emdmodel.Emd.MetaData.decode(rsp['_ret_'], agent)
typecheck.is_struct(_ret_, raritan.rpc.emdmodel.Emd.MetaData, DecodeException)
return _ret_
class _getPeripheralDeviceManager(Interface.Method):
name = 'getPeripheralDeviceManager'
@staticmethod
def encode():
args = {}
return args
@staticmethod
def decode(rsp, agent):
_ret_ = Interface.decode(rsp['_ret_'], agent)
typecheck.is_interface(_ret_, raritan.rpc.peripheral.DeviceManager, DecodeException)
return _ret_
class _getBeeper(Interface.Method):
name = 'getBeeper'
@staticmethod
def encode():
args = {}
return args
@staticmethod
def decode(rsp, agent):
_ret_ = Interface.decode(rsp['_ret_'], agent)
typecheck.is_interface(_ret_, raritan.rpc.hmi.InternalBeeper, DecodeException)
return _ret_
class _getSettings(Interface.Method):
name = 'getSettings'
@staticmethod
def encode():
args = {}
return args
@staticmethod
def decode(rsp, agent):
_ret_ = raritan.rpc.emdmodel.Emd.Settings.decode(rsp['_ret_'], agent)
typecheck.is_struct(_ret_, raritan.rpc.emdmodel.Emd.Settings, DecodeException)
return _ret_
class _setSettings(Interface.Method):
name = 'setSettings'
@staticmethod
def encode(settings):
typecheck.is_struct(settings, raritan.rpc.emdmodel.Emd.Settings, AssertionError)
args = {}
args['settings'] = raritan.rpc.emdmodel.Emd.Settings.encode(settings)
return args
@staticmethod
def decode(rsp, agent):
_ret_ = rsp['_ret_']
typecheck.is_int(_ret_, DecodeException)
return _ret_
class _getFeaturePorts(Interface.Method):
name = 'getFeaturePorts'
@staticmethod
def encode():
args = {}
return args
@staticmethod
def decode(rsp, agent):
_ret_ = [Interface.decode(x0, agent) for x0 in rsp['_ret_']]
for x0 in _ret_:
typecheck.is_interface(x0, raritan.rpc.portsmodel.Port, DecodeException)
return _ret_
class _getAuxiliaryPorts(Interface.Method):
name = 'getAuxiliaryPorts'
@staticmethod
def encode():
args = {}
return args
@staticmethod
def decode(rsp, agent):
_ret_ = [Interface.decode(x0, agent) for x0 in rsp['_ret_']]
for x0 in _ret_:
typecheck.is_interface(x0, raritan.rpc.portsmodel.Port, DecodeException)
return _ret_
class _getSensorLogger(Interface.Method):
name = 'getSensorLogger'
@staticmethod
def encode():
args = {}
return args
@staticmethod
def decode(rsp, agent):
_ret_ = Interface.decode(rsp['_ret_'], agent)
typecheck.is_interface(_ret_, raritan.rpc.sensors.Logger, DecodeException)
return _ret_
def __init__(self, target, agent):
super(Emd, self).__init__(target, agent)
self.getMetaData = Emd._getMetaData(self)
self.getPeripheralDeviceManager = Emd._getPeripheralDeviceManager(self)
self.getBeeper = Emd._getBeeper(self)
self.getSettings = Emd._getSettings(self)
self.setSettings = Emd._setSettings(self)
self.getFeaturePorts = Emd._getFeaturePorts(self)
self.getAuxiliaryPorts = Emd._getAuxiliaryPorts(self)
self.getSensorLogger = Emd._getSensorLogger(self)
|