# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2023 Raritan Inc. All rights reserved.
#
# This file was generated by IdlC from GatewaySensorManager.idl.

use strict;

package Raritan::RPC::peripheral::GatewaySensorManager_2_0_0::RemoteModbusRTUDevice;

use constant typeId => "peripheral.GatewaySensorManager_2_0_0.RemoteModbusRTUDevice:1.0.0";
use Raritan::RPC::peripheral::ModbusCfg::SerialSettings;
use Raritan::RPC::peripheral::GatewaySensorManager_2_0_0::RemoteModbusDevice;

sub encode {
    my ($in) = @_;
    my $encoded = Raritan::RPC::peripheral::GatewaySensorManager_2_0_0::RemoteModbusDevice::encode($in);
    $encoded->{'busInterface'} = "$in->{'busInterface'}";
    $encoded->{'busSettings'} = Raritan::RPC::peripheral::ModbusCfg::SerialSettings::encode($in->{'busSettings'});
    $encoded->{'interframeDelayDeciChars'} = 1 * $in->{'interframeDelayDeciChars'};
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = Raritan::RPC::peripheral::GatewaySensorManager_2_0_0::RemoteModbusDevice::decode($agent, $in);
    $decoded->{'busInterface'} = $in->{'busInterface'};
    $decoded->{'busSettings'} = Raritan::RPC::peripheral::ModbusCfg::SerialSettings::decode($agent, $in->{'busSettings'});
    $decoded->{'interframeDelayDeciChars'} = $in->{'interframeDelayDeciChars'};
    return $decoded;
}

Raritan::RPC::Registry::registerCodecClass('peripheral.GatewaySensorManager_2_0_0.RemoteModbusRTUDevice', 1, 0, 0, 'Raritan::RPC::peripheral::GatewaySensorManager_2_0_0::RemoteModbusRTUDevice');
1;
