001// Copyright (c) FIRST and other WPILib contributors. 002// Open Source Software; you can modify and/or share it under the terms of 003// the WPILib BSD license file in the root directory of this project. 004 005package edu.wpi.first.hal; 006 007public class SerialPortJNI extends JNIWrapper { 008 public static native int serialInitializePort(byte port); 009 010 public static native int serialInitializePortDirect(byte port, String portName); 011 012 public static native void serialSetBaudRate(int handle, int baud); 013 014 public static native void serialSetDataBits(int handle, byte bits); 015 016 public static native void serialSetParity(int handle, byte parity); 017 018 public static native void serialSetStopBits(int handle, byte stopBits); 019 020 public static native void serialSetWriteMode(int handle, byte mode); 021 022 public static native void serialSetFlowControl(int handle, byte flow); 023 024 public static native void serialSetTimeout(int handle, double timeout); 025 026 public static native void serialEnableTermination(int handle, char terminator); 027 028 public static native void serialDisableTermination(int handle); 029 030 public static native void serialSetReadBufferSize(int handle, int size); 031 032 public static native void serialSetWriteBufferSize(int handle, int size); 033 034 public static native int serialGetBytesReceived(int handle); 035 036 public static native int serialRead(int handle, byte[] buffer, int count); 037 038 public static native int serialWrite(int handle, byte[] buffer, int count); 039 040 public static native void serialFlush(int handle); 041 042 public static native void serialClear(int handle); 043 044 public static native void serialClose(int handle); 045}