# 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::SerialSettings;


sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'enabled'} = ($in->{'enabled'}) ? JSON::true : JSON::false;
    $encoded->{'baudrate'} = 1 * $in->{'baudrate'};
    $encoded->{'parity'} = $in->{'parity'};
    $encoded->{'stopbits'} = 1 * $in->{'stopbits'};
    $encoded->{'readonly'} = ($in->{'readonly'}) ? JSON::true : JSON::false;
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'enabled'} = ($in->{'enabled'}) ? 1 : 0;
    $decoded->{'baudrate'} = $in->{'baudrate'};
    $decoded->{'parity'} = $in->{'parity'};
    $decoded->{'stopbits'} = $in->{'stopbits'};
    $decoded->{'readonly'} = ($in->{'readonly'}) ? 1 : 0;
    return $decoded;
}

1;
