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

use strict;

package Raritan::RPC::devsettings::Modbus_2_0_0::Settings;

use Raritan::RPC::devsettings::Modbus_2_0_0::SerialSettings;
use Raritan::RPC::devsettings::Modbus_2_0_0::TcpSettings;

sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'tcp'} = Raritan::RPC::devsettings::Modbus_2_0_0::TcpSettings::encode($in->{'tcp'});
    $encoded->{'serial'} = Raritan::RPC::devsettings::Modbus_2_0_0::SerialSettings::encode($in->{'serial'});
    $encoded->{'primaryUnitId'} = 1 * $in->{'primaryUnitId'};
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'tcp'} = Raritan::RPC::devsettings::Modbus_2_0_0::TcpSettings::decode($agent, $in->{'tcp'});
    $decoded->{'serial'} = Raritan::RPC::devsettings::Modbus_2_0_0::SerialSettings::decode($agent, $in->{'serial'});
    $decoded->{'primaryUnitId'} = $in->{'primaryUnitId'};
    return $decoded;
}

1;
