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

com.pi4j.io.serial.SerialConfigBuilder Maven / Gradle / Ivy

The newest version!
package com.pi4j.io.serial;

/*-
 * #%L
 * **********************************************************************
 * ORGANIZATION  :  Pi4J
 * PROJECT       :  Pi4J :: LIBRARY  :: Java Library (CORE)
 * FILENAME      :  SerialConfigBuilder.java
 *
 * This file is part of the Pi4J project. More information about
 * this project can be found here:  https://pi4j.com/
 * **********************************************************************
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import com.pi4j.context.Context;
import com.pi4j.io.IODeviceConfigBuilder;
import com.pi4j.io.serial.impl.DefaultSerialConfigBuilder;

/**
 * 

SerialConfigBuilder interface.

* * @author Robert Savage (http://www.savagehomeautomation.com) * @version $Id: $Id */ public interface SerialConfigBuilder extends IODeviceConfigBuilder { /** *

newInstance.

* * @param context {@link Context} * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ static SerialConfigBuilder newInstance(Context context) { return DefaultSerialConfigBuilder.newInstance(context); } /** *

baud.

* * @param rate a {@link java.lang.Integer} object. * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ SerialConfigBuilder baud(Integer rate); /** *

baud.

* * @param rate a {@link com.pi4j.io.serial.Baud} object. * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud(Baud rate){ return baud(rate.value()); } /** *

dataBits.

* * @param bits a {@link com.pi4j.io.serial.DataBits} object. * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ SerialConfigBuilder dataBits(DataBits bits); /** *

dataBits.

* * @param bits a {@link java.lang.Integer} object. * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder dataBits(Integer bits){ return dataBits(DataBits.getInstance(bits)); } /** *

parity.

* * @param parity a {@link com.pi4j.io.serial.Parity} object. * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ SerialConfigBuilder parity(Parity parity); /** *

parity.

* * @param parity a int. * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder parity(int parity){ return parity(Parity.getInstance(parity)); } /** *

stopBits.

* * @param bits a {@link com.pi4j.io.serial.StopBits} object. * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ SerialConfigBuilder stopBits(StopBits bits); /** *

stopBits.

* * @param bits a {@link java.lang.Integer} object. * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder stopBits(Integer bits){ return stopBits(StopBits.getInstance(bits)); } /** *

flowControl.

* * @param control a {@link com.pi4j.io.serial.FlowControl} object. * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ SerialConfigBuilder flowControl(FlowControl control); /** *

flowControl.

* * @param control a {@link java.lang.Integer} object. * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder flowControl(Integer control){ return flowControl(FlowControl.getInstance(control)); } /** *

baud_50.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_50() { return baud(Baud._50); } /** *

baud_75.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_75() { return baud(Baud._75); } /** *

baud_110.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_110() { return baud(Baud._110); } /** *

baud_134.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_134() { return baud(Baud._134); } /** *

baud_150.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_150() { return baud(Baud._150); } /** *

baud_200.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_200() { return baud(Baud._200); } /** *

baud_300.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_300() { return baud(Baud._300); } /** *

baud_600.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_600() { return baud(Baud._600); } /** *

baud_1200.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_1200() { return baud(Baud._1200); } /** *

baud_1800.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_1800() { return baud(Baud._1800); } /** *

baud_2400.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_2400() { return baud(Baud._2400); } /** *

baud_4800.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_4800() { return baud(Baud._4800); } /** *

baud_9600.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_9600() { return baud(Baud._9600); } /** *

baud_19200.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_19200() { return baud(Baud._19200); } /** *

baud_38400.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_38400() { return baud(Baud._38400); } /** *

baud_57600.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_57600() { return baud(Baud._57600); } /** *

baud_115200.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_115200() { return baud(Baud._115200); } /** *

baud_230400.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud_230400() { return baud(Baud._230400); } /** *

dataBits_5.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder dataBits_5() { return dataBits(DataBits._5); } /** *

dataBits_6.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder dataBits_6() { return dataBits(DataBits._6); } /** *

dataBits_7.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder dataBits_7() { return dataBits(DataBits._7); } /** *

dataBits_8.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder dataBits_8() { return dataBits(DataBits._8); } /** *

parityNone.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder parityNone() { return parity(Parity.NONE); } /** *

parityOdd.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder parityOdd() { return parity(Parity.ODD); } /** *

parityEven.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder parityEven() { return parity(Parity.EVEN); } /** *

parityMark.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder parityMark() { return parity(Parity.MARK); } /** *

paritySpace.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder paritySpace() { return parity(Parity.SPACE); } /** *

flowNone.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder flowNone() { return flowControl(FlowControl.NONE); } /** *

flowHardware.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder flowHardware(){ return flowControl(FlowControl.HARDWARE); } /** *

flowSoftware.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder flowSoftware(){ return flowControl(FlowControl.SOFTWARE); } /** *

stopBits_1.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder stopBits_1() { return stopBits(StopBits._1); } /** *

stopBits_2.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder stopBits_2() { return stopBits(StopBits._2); } /** *

baud8N1.

* * @param baud a {@link com.pi4j.io.serial.Baud} object. * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud8N1(Baud baud) { return baud8N1(baud.value()); } /** *

baud8N1.

* * @param baud a {@link java.lang.Integer} object. * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder baud8N1(Integer baud) { baud(baud); dataBits(DataBits._8); parity(Parity.NONE); stopBits(StopBits._1); flowControl(FlowControl.NONE); return this; } /** *

use_9600_N81.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder use_9600_N81() { return baud8N1(Baud._9600); } /** *

use_38400_N81.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder use_38400_N81() { return baud8N1(Baud._38400); } /** *

use_57600_N81.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder use_57600_N81() { return baud8N1(Baud._57600); } /** *

use_115200_N81.

* * @return a {@link com.pi4j.io.serial.SerialConfigBuilder} object. */ default SerialConfigBuilder use_115200_N81() { return baud8N1(Baud._115200); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy