/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (https://www.swig.org).
 * Version 4.1.1
 *
 * Do not make changes to this file unless you know what you are doing - modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.nanotec.nanolib;

public class SamplerInterface {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected SamplerInterface(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(SamplerInterface obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected static long swigRelease(SamplerInterface obj) {
    long ptr = 0;
    if (obj != null) {
      if (!obj.swigCMemOwn)
        throw new RuntimeException("Cannot release ownership as memory is not owned");
      ptr = obj.swigCPtr;
      obj.swigCMemOwn = false;
      obj.delete();
    }
    return ptr;
  }

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        NanolibJNI.delete_SamplerInterface(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public ResultVoid configure(DeviceHandle deviceHandle, SamplerConfiguration samplerConfiguration) {
    return new ResultVoid(NanolibJNI.SamplerInterface_configure(swigCPtr, this, DeviceHandle.getCPtr(deviceHandle), deviceHandle, SamplerConfiguration.getCPtr(samplerConfiguration), samplerConfiguration), true);
  }

  public ResultVoid start(DeviceHandle deviceHandle, SamplerNotify samplerNotify, long applicationData) {
    return new ResultVoid(NanolibJNI.SamplerInterface_start(swigCPtr, this, DeviceHandle.getCPtr(deviceHandle), deviceHandle, SamplerNotify.getCPtr(samplerNotify), samplerNotify, applicationData), true);
  }

  public ResultSampleDataArray getData(DeviceHandle deviceHandle) {
    return new ResultSampleDataArray(NanolibJNI.SamplerInterface_getData(swigCPtr, this, DeviceHandle.getCPtr(deviceHandle), deviceHandle), true);
  }

  public ResultVoid stop(DeviceHandle deviceHandle) {
    return new ResultVoid(NanolibJNI.SamplerInterface_stop(swigCPtr, this, DeviceHandle.getCPtr(deviceHandle), deviceHandle), true);
  }

  public ResultSamplerState getState(DeviceHandle deviceHandle) {
    return new ResultSamplerState(NanolibJNI.SamplerInterface_getState(swigCPtr, this, DeviceHandle.getCPtr(deviceHandle), deviceHandle), true);
  }

  public ResultVoid getLastError(DeviceHandle deviceHandle) {
    return new ResultVoid(NanolibJNI.SamplerInterface_getLastError(swigCPtr, this, DeviceHandle.getCPtr(deviceHandle), deviceHandle), true);
  }

}
