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

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

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