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

using System;
using System.Linq;
using LightJson;
using Com.Raritan.Idl;
using Com.Raritan.JsonRpc;
using Com.Raritan.Util;

#pragma warning disable 0108, 0219, 0414, 1591

namespace Com.Raritan.Idl.peripheral {
  public class BatteryPoweredDevicePackage_1_0_1 : Com.Raritan.Idl.peripheral.Package_3_0_2 {

    static public readonly new TypeInfo typeInfo = new TypeInfo("peripheral.BatteryPoweredDevicePackage:1.0.1", Com.Raritan.Idl.peripheral.Package_3_0_2.typeInfo);

    public BatteryPoweredDevicePackage_1_0_1(Agent agent, string rid, TypeInfo ti) : base(agent, rid, ti) {}
    public BatteryPoweredDevicePackage_1_0_1(Agent agent, string rid) : this(agent, rid, typeInfo) {}

    public static new BatteryPoweredDevicePackage_1_0_1 StaticCast(ObjectProxy proxy) {
      return proxy == null ? null : new BatteryPoweredDevicePackage_1_0_1(proxy.Agent, proxy.Rid, proxy.StaticTypeInfo);
    }

    public class GetBatteryVoltageResult {
      public double _ret_;
    }

    public GetBatteryVoltageResult getBatteryVoltage() {
      JsonObject _parameters = null;
      var _result = RpcCall("getBatteryVoltage", _parameters);
      var _ret = new GetBatteryVoltageResult();
      _ret._ret_ = (double)_result["_ret_"];
      return _ret;
    }

    public AsyncRequest getBatteryVoltage(AsyncRpcResponse<GetBatteryVoltageResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail) {
      return getBatteryVoltage(rsp, fail, RpcCtrl.Default);
    }

    public AsyncRequest getBatteryVoltage(AsyncRpcResponse<GetBatteryVoltageResult>.SuccessHandler rsp, AsyncRpcResponse.FailureHandler fail, RpcCtrl rpcCtrl) {
      JsonObject _parameters = null;
      return RpcCall("getBatteryVoltage", _parameters,
        _result => {
          try {
            var _ret = new GetBatteryVoltageResult();
            _ret._ret_ = (double)_result["_ret_"];
            rsp(_ret);
          } catch (Exception e) {
            if (fail != null) fail(e);
          }
        }, fail, rpcCtrl);
    }

    public class VoltageChangedEvent : Com.Raritan.Idl.idl.Event {
      static public readonly new TypeInfo typeInfo = new TypeInfo("peripheral.BatteryPoweredDevicePackage_1_0_1.VoltageChangedEvent:1.0.0", Com.Raritan.Idl.idl.Event.typeInfo);

      public double oldVoltage = 0.0;
      public double newVoltage = 0.0;
    }

  }
}
