Back to project page LibGeppa.
The source code is released under:
Apache License
If you think the Android project LibGeppa listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.cattaka.libgeppa.net; /*ww w . ja v a 2 s . c o m*/ import com.physicaloid.lib.Physicaloid; import net.cattaka.libgeppa.IRawSocket; import net.cattaka.libgeppa.data.BaudRate; import net.cattaka.libgeppa.thread.ConnectionThread.IRawSocketPrepareTask; import android.content.Context; import android.hardware.usb.UsbDevice; public class PhysicaloidSocketPrepareTask implements IRawSocketPrepareTask { private Context mContext; private UsbDevice mUsbDevice; private BaudRate mBaudRate; public PhysicaloidSocketPrepareTask(Context context, UsbDevice usbDevice, BaudRate baudRate) { super(); mContext = context; mUsbDevice = usbDevice; mBaudRate = baudRate; } @Override public IRawSocket prepareRawSocket() { Physicaloid mPhysicaloid = new Physicaloid(mContext); if (mPhysicaloid.open(mBaudRate.getBaud(), mUsbDevice)) { return new PhysicaloidSocket(mPhysicaloid); } else { return null; } } }