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

use strict;

package Raritan::RPC::serial::SerialPort_1_0_1;

use parent qw(Raritan::RPC::RemoteObject);

use constant typeId => "serial.SerialPort:1.0.1";

sub new {
    my ($class, $agent, $rid, $typeId) = @_;
    $typeId = $typeId || Raritan::RPC::serial::SerialPort_1_0_1::typeId;
    return $class->SUPER::new($agent, $rid, $typeId);
}

use constant SUCCESS => 0;

use constant ERR_INVALID_VALUE => 1;

use constant ERR_NO_MODEM => 2;

use Raritan::RPC::serial::SerialPort_1_0_1::ConsoleSettings;

sub getConsoleSettings($) {
    my ($self) = @_;
    my $agent = $self->{'agent'};
    my $args = {};
    my $rsp = $agent->json_rpc($self->{'rid'}, 'getConsoleSettings', $args);
    my $_ret_;
    $_ret_ = Raritan::RPC::serial::SerialPort_1_0_1::ConsoleSettings::decode($agent, $rsp->{'_ret_'});
    return $_ret_;
}

use Raritan::RPC::serial::SerialPort_1_0_1::ConsoleSettings;

sub setConsoleSettings($$) {
    my ($self, $settings) = @_;
    my $agent = $self->{'agent'};
    my $args = {};
    $args->{'settings'} = Raritan::RPC::serial::SerialPort_1_0_1::ConsoleSettings::encode($settings);
    my $rsp = $agent->json_rpc($self->{'rid'}, 'setConsoleSettings', $args);
    my $_ret_;
    $_ret_ = $rsp->{'_ret_'};
    return $_ret_;
}

use Raritan::RPC::serial::SerialPort_1_0_1::State;

sub getState($) {
    my ($self) = @_;
    my $agent = $self->{'agent'};
    my $args = {};
    my $rsp = $agent->json_rpc($self->{'rid'}, 'getState', $args);
    my $_ret_;
    $_ret_ = Raritan::RPC::serial::SerialPort_1_0_1::State::decode($agent, $rsp->{'_ret_'});
    return $_ret_;
}


sub getGsmModem($$) {
    my ($self, $modem) = @_;
    my $agent = $self->{'agent'};
    my $args = {};
    my $rsp = $agent->json_rpc($self->{'rid'}, 'getGsmModem', $args);
    $$modem = Raritan::RPC::ObjectCodec::decode($agent, $rsp->{'modem'}, 'serial.GsmModem');
    my $_ret_;
    $_ret_ = $rsp->{'_ret_'};
    return $_ret_;
}

Raritan::RPC::Registry::registerProxyClass('serial.SerialPort', 1, 0, 1, 'Raritan::RPC::serial::SerialPort_1_0_1');
1;
