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

use strict;

package Raritan::RPC::peripheral::DeviceManager_2_0_0::DeviceEvent;

use constant typeId => "peripheral.DeviceManager_2_0_0.DeviceEvent:1.0.0";
use Raritan::RPC::idl::Event;
use Raritan::RPC::peripheral::Device_2_0_0;
use Raritan::RPC::peripheral::Device_2_0_0;

sub encode {
    my ($in) = @_;
    my $encoded = Raritan::RPC::idl::Event::encode($in);
    $encoded->{'device'} = Raritan::RPC::ValObjCodec::encode($in->{'device'});
    $encoded->{'allDevices'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'allDevices'}}; $i0++) {
        $encoded->{'allDevices'}->[$i0] = Raritan::RPC::ValObjCodec::encode($in->{'allDevices'}->[$i0]);
    }
    return $encoded;
}

sub decode {
    my ($agent, $in) = @_;
    my $decoded = Raritan::RPC::idl::Event::decode($agent, $in);
    $decoded->{'device'} = Raritan::RPC::ValObjCodec::decode($agent, $in->{'device'}, 'peripheral.Device');
    $decoded->{'allDevices'} = [];
    for (my $i0 = 0; $i0 <= $#{$in->{'allDevices'}}; $i0++) {
        $decoded->{'allDevices'}->[$i0] = Raritan::RPC::ValObjCodec::decode($agent, $in->{'allDevices'}->[$i0], 'peripheral.Device');
    }
    return $decoded;
}

Raritan::RPC::Registry::registerCodecClass('peripheral.DeviceManager_2_0_0.DeviceEvent', 1, 0, 0, 'Raritan::RPC::peripheral::DeviceManager_2_0_0::DeviceEvent');
1;
