All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sources.Uart Maven / Gradle / Ivy

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

package mraa;

public class Uart {
  private long swigCPtr;
  protected boolean swigCMemOwn;

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

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

  protected void finalize() {
    delete();
  }

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

  public Uart(int uart) {
    this(mraaJNI.new_Uart__SWIG_0(uart), true);
  }

  public Uart(String path) {
    this(mraaJNI.new_Uart__SWIG_1(path), true);
  }

  public String getDevicePath() {
    return mraaJNI.Uart_getDevicePath(swigCPtr, this);
  }

  public String readStr(int length) {
    return mraaJNI.Uart_readStr(swigCPtr, this, length);
  }

  public int writeStr(String data) {
    return mraaJNI.Uart_writeStr(swigCPtr, this, data);
  }

  public boolean dataAvailable(long millis) {
    return mraaJNI.Uart_dataAvailable__SWIG_0(swigCPtr, this, millis);
  }

  public boolean dataAvailable() {
    return mraaJNI.Uart_dataAvailable__SWIG_1(swigCPtr, this);
  }

  public Result flush() {
    return Result.swigToEnum(mraaJNI.Uart_flush(swigCPtr, this));
  }

  public Result setBaudRate(long baud) {
    return Result.swigToEnum(mraaJNI.Uart_setBaudRate(swigCPtr, this, baud));
  }

  public Result setMode(int bytesize, UartParity parity, int stopbits) {
    return Result.swigToEnum(mraaJNI.Uart_setMode(swigCPtr, this, bytesize, parity.swigValue(), stopbits));
  }

  public Result setFlowcontrol(boolean xonxoff, boolean rtscts) {
    return Result.swigToEnum(mraaJNI.Uart_setFlowcontrol(swigCPtr, this, xonxoff, rtscts));
  }

  public Result setTimeout(int read, int write, int interchar) {
    return Result.swigToEnum(mraaJNI.Uart_setTimeout(swigCPtr, this, read, write, interchar));
  }

  public Result setNonBlocking(boolean nonblock) {
    return Result.swigToEnum(mraaJNI.Uart_setNonBlocking(swigCPtr, this, nonblock));
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy