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

use strict;

package Raritan::RPC::peripheral::GatewaySensorManager_2_0_1::RemoteModbusRTUDevice;

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

sub encode {
    my ($in) = @_;
    my $encoded = Raritan::RPC::peripheral::GatewaySensorManager_2_0_1::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_1::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_1.RemoteModbusRTUDevice', 1, 0, 0, 'Raritan::RPC::peripheral::GatewaySensorManager_2_0_1::RemoteModbusRTUDevice');
1;
