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

use strict;

package Raritan::RPC::peripheral::GatewaySensorManager_2_0_1::ModbusValueEncoding8;

use constant typeId => "peripheral.GatewaySensorManager_2_0_1.ModbusValueEncoding8:1.0.0";
use Raritan::RPC::peripheral::GatewaySensorManager_2_0_1::NumericValueEncoding;

sub encode {
    my ($in) = @_;
    my $encoded = Raritan::RPC::peripheral::GatewaySensorManager_2_0_1::NumericValueEncoding::encode($in);
    $encoded->{'byteSwap'} = ($in->{'byteSwap'}) ? JSON::true : JSON::false;
    $encoded->{'mask'} = 1 * $in->{'mask'};
    $encoded->{'start'} = 1 * $in->{'start'};
    $encoded->{'width'} = 1 * $in->{'width'};
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = Raritan::RPC::peripheral::GatewaySensorManager_2_0_1::NumericValueEncoding::decode($agent, $in);
    $decoded->{'byteSwap'} = ($in->{'byteSwap'}) ? 1 : 0;
    $decoded->{'mask'} = $in->{'mask'};
    $decoded->{'start'} = $in->{'start'};
    $decoded->{'width'} = $in->{'width'};
    return $decoded;
}

Raritan::RPC::Registry::registerCodecClass('peripheral.GatewaySensorManager_2_0_1.ModbusValueEncoding8', 1, 0, 0, 'Raritan::RPC::peripheral::GatewaySensorManager_2_0_1::ModbusValueEncoding8');
1;
