Android Open Source - SmartCocktailShaker Usb Serial Output Stream






From Project

Back to project page SmartCocktailShaker.

License

The source code is released under:

MIT License

If you think the Android project SmartCocktailShaker listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.hoho.android.usbserial.util;
//from   w w  w .ja v  a2 s.  co m
import com.hoho.android.usbserial.driver.UsbSerialDriver;

import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;

/**
 * Created by Tony on 2/27/14.
 */
public class UsbSerialOutputStream extends OutputStream {

    private UsbSerialDriver driver;

    private int timeoutMillis;

    public UsbSerialOutputStream(UsbSerialDriver driver) {
        this(driver, 1000);
    }

    public UsbSerialOutputStream(UsbSerialDriver driver, int timeoutMillis) {
        this.driver = driver;
        this.timeoutMillis = timeoutMillis;
    }

    @Override
    public void write(int i) throws IOException {
        write(new byte[]{(byte) i});
    }

    @Override
    public void write(byte[] b) throws IOException {
        driver.write(b, timeoutMillis);
    }

    @Override
    public void write(byte[] b, int off, int len) throws IOException {
        write(Arrays.copyOfRange(b, off, off + len));
    }
}




Java Source Code List

com.hoho.android.usbserial.driver.CdcAcmSerialDriver.java
com.hoho.android.usbserial.driver.CommonUsbSerialDriver.java
com.hoho.android.usbserial.driver.Cp2102SerialDriver.java
com.hoho.android.usbserial.driver.FtdiSerialDriver.java
com.hoho.android.usbserial.driver.ProlificSerialDriver.java
com.hoho.android.usbserial.driver.UsbId.java
com.hoho.android.usbserial.driver.UsbSerialDriver.java
com.hoho.android.usbserial.driver.UsbSerialProber.java
com.hoho.android.usbserial.driver.UsbSerialRuntimeException.java
com.hoho.android.usbserial.util.HexDump.java
com.hoho.android.usbserial.util.SerialInputOutputManager.java
com.hoho.android.usbserial.util.UsbSerialInputStream.java
com.hoho.android.usbserial.util.UsbSerialOutputStream.java
com.tonydicola.smartshaker.BluetoothSppProvider.java
com.tonydicola.smartshaker.JsonDrinkProvider.java
com.tonydicola.smartshaker.MockConnectionProvider.java
com.tonydicola.smartshaker.PrepareDrinkModel.java
com.tonydicola.smartshaker.StepListAdapter.java
com.tonydicola.smartshaker.UsbSerialProvider.java
com.tonydicola.smartshaker.activities.ChooseConnection.java
com.tonydicola.smartshaker.activities.DrinkDetails.java
com.tonydicola.smartshaker.activities.DrinkList.java
com.tonydicola.smartshaker.activities.PrepareDrink.java
com.tonydicola.smartshaker.factories.ConnectionFactory.java
com.tonydicola.smartshaker.factories.DrinkFactory.java
com.tonydicola.smartshaker.interfaces.ConnectionProvider.java
com.tonydicola.smartshaker.interfaces.DeviceConnection.java
com.tonydicola.smartshaker.interfaces.DrinkProvider.java
com.tonydicola.smartshaker.interfaces.Drink.java
com.tonydicola.smartshaker.interfaces.PreparationStep.java