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
|
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2022 Raritan Inc. All rights reserved.
#
# This is an auto-generated file.
#
# Section generated by IdlC from "ModbusGatewayMgr.idl"
#
import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.modbus
# interface
class GatewayMgr(Interface):
idlType = "modbus.GatewayMgr:1.0.0"
NO_ERROR = 0
ERR_INVALID_PARAMS = 1
# structure
class RtuSettings(Structure):
idlType = "modbus.GatewayMgr.RtuSettings:1.0.0"
elements = ["defaultAddr", "speed", "parity"]
def __init__(self, defaultAddr, speed, parity):
typecheck.is_byte(defaultAddr, AssertionError)
typecheck.is_int(speed, AssertionError)
typecheck.is_byte(parity, AssertionError)
self.defaultAddr = defaultAddr
self.speed = speed
self.parity = parity
@classmethod
def decode(cls, json, agent):
obj = cls(
defaultAddr = json['defaultAddr'],
speed = json['speed'],
parity = json['parity'],
)
return obj
def encode(self):
json = {}
json['defaultAddr'] = self.defaultAddr
json['speed'] = self.speed
json['parity'] = self.parity
return json
# structure
class Settings(Structure):
idlType = "modbus.GatewayMgr.Settings:1.0.0"
elements = ["rtu"]
def __init__(self, rtu):
typecheck.is_struct(rtu, raritan.rpc.modbus.GatewayMgr.RtuSettings, AssertionError)
self.rtu = rtu
@classmethod
def decode(cls, json, agent):
obj = cls(
rtu = raritan.rpc.modbus.GatewayMgr.RtuSettings.decode(json['rtu'], agent),
)
return obj
def encode(self):
json = {}
json['rtu'] = raritan.rpc.modbus.GatewayMgr.RtuSettings.encode(self.rtu)
return json
class _getSettings(Interface.Method):
name = 'getSettings'
@staticmethod
def encode():
args = {}
return args
@staticmethod
def decode(rsp, agent):
_ret_ = raritan.rpc.modbus.GatewayMgr.Settings.decode(rsp['_ret_'], agent)
typecheck.is_struct(_ret_, raritan.rpc.modbus.GatewayMgr.Settings, DecodeException)
return _ret_
class _setSettings(Interface.Method):
name = 'setSettings'
@staticmethod
def encode(settings):
typecheck.is_struct(settings, raritan.rpc.modbus.GatewayMgr.Settings, AssertionError)
args = {}
args['settings'] = raritan.rpc.modbus.GatewayMgr.Settings.encode(settings)
return args
@staticmethod
def decode(rsp, agent):
_ret_ = rsp['_ret_']
typecheck.is_int(_ret_, DecodeException)
return _ret_
def __init__(self, target, agent):
super(GatewayMgr, self).__init__(target, agent)
self.getSettings = GatewayMgr._getSettings(self)
self.setSettings = GatewayMgr._setSettings(self)
|