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

use strict;

package Raritan::RPC::peripheral::GatewaySensorManager::ModbusValueEncoding8;

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

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

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

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