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.adapter; /* w w w.j a va 2s. c o m*/ import net.cattaka.libgeppa.data.BaudRate; import net.cattaka.libgeppa.data.DeviceInfo; import net.cattaka.libgeppa.data.IPacket; import net.cattaka.libgeppa.data.IPacketFactory; import net.cattaka.libgeppa.net.PhysicaloidSocketPrepareTask; import net.cattaka.libgeppa.thread.ConnectionThread.IRawSocketPrepareTask; import android.content.Context; import android.hardware.usb.UsbDevice; public class LocalDeviceAdapter<T extends IPacket> extends AbsConnectionAdapter<T> { private Context mContext; private UsbDevice mUsbDevice; private BaudRate mBaudRate; public LocalDeviceAdapter(IDeviceAdapterListener<T> listener, IPacketFactory<T> packetFactory, boolean useMainLooperForListener, Context context, UsbDevice usbDevice, BaudRate baudRate) { super(listener, packetFactory, useMainLooperForListener); mContext = context; mUsbDevice = usbDevice; mBaudRate = baudRate; } @Override protected IRawSocketPrepareTask createRawSocketPrepareTask() { return new PhysicaloidSocketPrepareTask(mContext, mUsbDevice, mBaudRate); } public UsbDevice getUsbDevice() { return mUsbDevice; } @Override public DeviceInfo getDeviceInfo() { return DeviceInfo.createUsb(mUsbDevice.getDeviceName(), false); } }