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

use strict;

package Raritan::RPC::dsam::DsamPort::Settings;


sub encode {
    my ($in) = @_;
    my $encoded = {};
    $encoded->{'name'} = "$in->{'name'}";
    $encoded->{'devIfType'} = 1 * $in->{'devIfType'};
    $encoded->{'baudRate'} = 1 * $in->{'baudRate'};
    $encoded->{'parity'} = 1 * $in->{'parity'};
    $encoded->{'stopBits'} = 1 * $in->{'stopBits'};
    $encoded->{'flowCtrl'} = 1 * $in->{'flowCtrl'};
    $encoded->{'breakDurationMs'} = 1 * $in->{'breakDurationMs'};
    $encoded->{'sshDpaPortEnabled'} = ($in->{'sshDpaPortEnabled'}) ? JSON::true : JSON::false;
    $encoded->{'sshDpaPort'} = 1 * $in->{'sshDpaPort'};
    $encoded->{'allowSharedAccess'} = ($in->{'allowSharedAccess'}) ? JSON::true : JSON::false;
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = {};
    $decoded->{'name'} = $in->{'name'};
    $decoded->{'devIfType'} = $in->{'devIfType'};
    $decoded->{'baudRate'} = $in->{'baudRate'};
    $decoded->{'parity'} = $in->{'parity'};
    $decoded->{'stopBits'} = $in->{'stopBits'};
    $decoded->{'flowCtrl'} = $in->{'flowCtrl'};
    $decoded->{'breakDurationMs'} = $in->{'breakDurationMs'};
    $decoded->{'sshDpaPortEnabled'} = ($in->{'sshDpaPortEnabled'}) ? 1 : 0;
    $decoded->{'sshDpaPort'} = $in->{'sshDpaPort'};
    $decoded->{'allowSharedAccess'} = ($in->{'allowSharedAccess'}) ? 1 : 0;
    return $decoded;
}

1;
