本文整理汇总了Java中com.ftdi.j2xx.D2xxManager类的典型用法代码示例。如果您正苦于以下问题:Java D2xxManager类的具体用法?Java D2xxManager怎么用?Java D2xxManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
D2xxManager类属于com.ftdi.j2xx包,在下文中一共展示了D2xxManager类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: convertFtdiParity
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
private byte convertFtdiParity(int parity) {
switch (parity) {
case UartConfig.PARITY_NONE:
return D2xxManager.FT_PARITY_NONE;
case UartConfig.PARITY_ODD:
return D2xxManager.FT_PARITY_ODD;
case UartConfig.PARITY_EVEN:
return D2xxManager.FT_PARITY_EVEN;
case UartConfig.PARITY_MARK:
return D2xxManager.FT_PARITY_MARK;
case UartConfig.PARITY_SPACE:
return D2xxManager.FT_PARITY_SPACE;
default:
return D2xxManager.FT_PARITY_NONE;
}
}
开发者ID:cattaka,项目名称:PhysicaloidVc,代码行数:17,代码来源:UartFtdi.java
示例2: convertFtdiParity
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
private byte convertFtdiParity(int parity) {
switch (parity) {
case UartConfig.PARITY_NONE:
return D2xxManager.FT_PARITY_NONE;
case UartConfig.PARITY_ODD:
return D2xxManager.FT_PARITY_ODD;
case UartConfig.PARITY_EVEN:
return D2xxManager.FT_PARITY_EVEN;
case UartConfig.PARITY_MARK:
return D2xxManager.FT_PARITY_MARK;
case UartConfig.PARITY_SPACE:
return D2xxManager.FT_PARITY_SPACE;
default:
return D2xxManager.FT_PARITY_NONE;
}
}
开发者ID:RobotPajamas,项目名称:SimpleUSB,代码行数:17,代码来源:UartFtdi.java
示例3: doInBackground
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
@Override
protected Void doInBackground(Void... params) {
bgThread = Thread.currentThread();
bgThread.setName("serialMonThread");
monThreadisInterrupted = false;
while (!monThreadisInterrupted) {
if (isPaused) {
continue;
}
long event;
synchronized (self_ftdi) {
event = self_ftdi.getEventStatus();
}
if (event < 0) {
// error in here...
} else if (Data
&& event == D2xxManager.FT_EVENT_RXCHAR) {
publishProgress();
}
// send event dataAvaiable.
}
return null;
}
开发者ID:thebigbang,项目名称:SerialPort_Android,代码行数:26,代码来源:SerialPort.java
示例4: UartFtdi
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
public UartFtdi(Context context) {
super(context);
mContext = context;
mReadThreadStop = true;
mUartConfig = new UartConfig();
mBuffer = new RingBuffer(RING_BUFFER_SIZE);
try {
ftD2xx = D2xxManager.getInstance(mContext);
} catch (D2xxManager.D2xxException ex) {
Log.e(TAG,ex.toString());
}
}
开发者ID:RobotPajamas,项目名称:SimpleUSB,代码行数:13,代码来源:UartFtdi.java
示例5: UartFtdi
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
public UartFtdi(Context context) {
super(context);
mContext = context;
mReadThreadStop = true;
mUartConfig = new UartConfig();
mBuffer = new RingBuffer(RING_BUFFER_SIZE);
try {
ftD2xx = D2xxManager.getInstance(mContext);
} catch (D2xxManager.D2xxException ex) {
Log.e(TAG, ex.toString());
}
}
开发者ID:cattaka,项目名称:PhysicaloidVc,代码行数:13,代码来源:UartFtdi.java
示例6: clearBuffer
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
@Override
public void clearBuffer() {
// clear ftdi chip buffer
synchronized (ftDev) {
ftDev.purge((byte) (D2xxManager.FT_PURGE_TX | D2xxManager.FT_PURGE_RX));
}
mBuffer.clear();
}
开发者ID:cattaka,项目名称:PhysicaloidVc,代码行数:9,代码来源:UartFtdi.java
示例7: convertFtdiDataBits
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
private byte convertFtdiDataBits(int dataBits) {
switch (dataBits) {
case UartConfig.DATA_BITS7:
return D2xxManager.FT_DATA_BITS_7;
case UartConfig.DATA_BITS8:
return D2xxManager.FT_DATA_BITS_8;
default:
return D2xxManager.FT_DATA_BITS_8;
}
}
开发者ID:cattaka,项目名称:PhysicaloidVc,代码行数:11,代码来源:UartFtdi.java
示例8: convertFtdiStopBits
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
private byte convertFtdiStopBits(int stopBits) {
switch (stopBits) {
case UartConfig.STOP_BITS1:
return D2xxManager.FT_STOP_BITS_1;
case UartConfig.STOP_BITS2:
return D2xxManager.FT_STOP_BITS_2;
default:
return D2xxManager.FT_STOP_BITS_1;
}
}
开发者ID:cattaka,项目名称:PhysicaloidVc,代码行数:11,代码来源:UartFtdi.java
示例9: onStartCommand
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (mIsRunning) {
Log.i(TAG, "Service already running.");
return Service.START_REDELIVER_INTENT;
}
mUsbDevice = (UsbDevice) intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
if (null == ftD2xx) {
try {
ftD2xx = D2xxManager.getInstance(this);
ftD2xx.createDeviceInfoList(this);
} catch (D2xxManager.D2xxException ex) {
Log.e(TAG, ex.getMessage(), ex);
}
}
// connect
if (null == ftDevice)
{
ftDevice = ftD2xx.openByUsbDevice(this, mUsbDevice);
}
if (ftDevice == null || !ftDevice.isOpen()) {
Log.e(TAG, "Opening ftDevice Failed");
stopSelf();
return Service.START_REDELIVER_INTENT;
}
ftDevice.setBitMode((byte) 0, D2xxManager.FT_BITMODE_RESET);
ftDevice.setBaudRate(baudRate);
ftDevice.setDataCharacteristics(dataBit, stopBit, parity);
ftDevice.setFlowControl(flowControl, (byte) 0x0b, (byte) 0x0d);
ftDevice.purge((byte) (D2xxManager.FT_PURGE_TX));
Log.d(TAG, "LATENCY_TIMER: " + ftDevice.getLatencyTimer());
// ftDevice.setLatencyTimer((byte) 200);
ftDevice.restartInTask();
mIsRunning = true;
Log.i(TAG, "Receiving!");
Toast.makeText(getBaseContext(), getString(R.string.receiving), Toast.LENGTH_SHORT).show();
startReceiverThread();
startSenderThread();
return Service.START_REDELIVER_INTENT;
}
开发者ID:florian-f,项目名称:braindroid,代码行数:58,代码来源:BrainDroidService.java
示例10: convertFtdiDataBits
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
private byte convertFtdiDataBits(int dataBits) {
switch (dataBits) {
case UartConfig.DATA_BITS7:
return D2xxManager.FT_DATA_BITS_7;
case UartConfig.DATA_BITS8:
return D2xxManager.FT_DATA_BITS_8;
default:
return D2xxManager.FT_DATA_BITS_8;
}
}
开发者ID:RobotPajamas,项目名称:SimpleUSB,代码行数:11,代码来源:UartFtdi.java
示例11: convertFtdiStopBits
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
private byte convertFtdiStopBits(int stopBits) {
switch (stopBits) {
case UartConfig.STOP_BITS1:
return D2xxManager.FT_STOP_BITS_1;
case UartConfig.STOP_BITS2:
return D2xxManager.FT_STOP_BITS_2;
default:
return D2xxManager.FT_STOP_BITS_1;
}
}
开发者ID:RobotPajamas,项目名称:SimpleUSB,代码行数:11,代码来源:UartFtdi.java
示例12: UartFtdi
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
public UartFtdi(Context context) {
super(context);
mContext = context;
mReadThreadStop = true;
mUartConfig = new UartConfig();
mBuffer = new RingBuffer(RING_BUFFER_SIZE);
try {
ftD2xx = D2xxManager.getInstance(mContext);
} catch (D2xxManager.D2xxException ex) {
Log.e(TAG,ex.toString());
}
}
开发者ID:guiruiz,项目名称:Twiteckon,代码行数:13,代码来源:UartFtdi.java
示例13: serial_initialize
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
public void serial_initialize() // Initialize all serial communication items
{
try
{
ftD2xx = D2xxManager.getInstance(this);
} catch (D2xxManager.D2xxException e)
{
Log.e("FTDI_HT", "getInstance fail!!");
}
global_context = this;
// init modem variables
modemReceiveDataBytes = new int[1];
modemReceiveDataBytes[0] = 0;
modemDataBuffer = new byte[MODEM_BUFFER_SIZE];
zmDataBuffer = new byte[MODEM_BUFFER_SIZE];
// file explore settings:
fileDialog = new SelectFileDialog(this, handler, mPath);
fileDialog.setCanceledOnTouchOutside(false);
fileDialog.addFileListener(new SelectFileDialog.FileSelectedListener() {
public void fileSelected(File file) {
Log.d(getClass().getName(), "selected file " + file.toString());
fGetFile = file;
}
});
//readText = (TextView) findViewById(R.id.ReadValues);
/* allocate buffer */
writeBuffer = new byte[512];
readBuffer = new byte[UI_READ_BUFFER_SIZE];
readBufferToChar = new char[UI_READ_BUFFER_SIZE];
readDataBuffer = new byte[MAX_NUM_BYTES];
actualNumBytes = 0;
// start main text area read thread
handlerThread = new HandlerThread(handler);
handlerThread.start();
/* setup the baud rate list*/
baudAdapter = ArrayAdapter.createFromResource(this,
R.array.baud_rate_1, R.layout.my_spinner_textview);
baudAdapter.setDropDownViewResource(R.layout.my_spinner_textview);
baudRate = 115200;
/* stop bits */
ArrayAdapter<CharSequence> stopAdapter = ArrayAdapter.createFromResource(this,
R.array.stop_bits, R.layout.my_spinner_textview);
stopAdapter.setDropDownViewResource(R.layout.my_spinner_textview);
stopBit = 1;
/* data bits */
ArrayAdapter<CharSequence> dataAdapter = ArrayAdapter.createFromResource(this,
R.array.data_bits, R.layout.my_spinner_textview);
dataAdapter.setDropDownViewResource(R.layout.my_spinner_textview);
dataBit = 8;
/* parity */
ArrayAdapter<CharSequence> parityAdapter = ArrayAdapter.createFromResource(this,
R.array.parity, R.layout.my_spinner_textview);
parityAdapter.setDropDownViewResource(R.layout.my_spinner_textview);
parity = 0;
/* flow control */
ArrayAdapter<CharSequence> flowAdapter = ArrayAdapter.createFromResource(this,
R.array.flow_control, R.layout.my_spinner_textview);
flowAdapter.setDropDownViewResource(R.layout.my_spinner_textview);
flowControl = 1;
/* port */
portAdapter = ArrayAdapter.createFromResource(this, R.array.port_list_1,
R.layout.my_spinner_textview);
flowAdapter.setDropDownViewResource(R.layout.my_spinner_textview);
portIndex = 0;
}
开发者ID:atarek92,项目名称:Intelligent_Indoor_Localization_System,代码行数:82,代码来源:J2xxHyperTerm.java
示例14: openUsbConnection
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
@Override
protected void openUsbConnection() throws IOException {
D2xxManager ftD2xx = null;
try {
ftD2xx = D2xxManager.getInstance(mContext);
} catch (D2xxManager.D2xxException ex) {
mLogger.logErr(TAG, ex);
}
if (ftD2xx == null) {
throw new IOException("Unable to retrieve D2xxManager instance.");
}
int DevCount = ftD2xx.createDeviceInfoList(mContext);
Log.d(TAG, "Found " + DevCount + " ftdi devices.");
if (DevCount < 1) {
throw new IOException("No Devices found");
}
try {
// FIXME: The NPE is coming from the library. Investigate if it's
// possible to fix there.
ftDev = ftD2xx.openByIndex(mContext, 0);
} catch (NullPointerException e) {
Log.e(TAG, e.getMessage(), e);
} finally {
if (ftDev == null) {
throw new IOException("No Devices found");
}
}
Log.d("USB", "Opening using Baud rate " + mBaudRate);
ftDev.setBitMode((byte) 0, D2xxManager.FT_BITMODE_RESET);
ftDev.setBaudRate(mBaudRate);
ftDev.setDataCharacteristics(D2xxManager.FT_DATA_BITS_8, D2xxManager.FT_STOP_BITS_1,
D2xxManager.FT_PARITY_NONE);
ftDev.setFlowControl(D2xxManager.FT_FLOW_NONE, (byte) 0x00, (byte) 0x00);
ftDev.setLatencyTimer(LATENCY_TIMER);
ftDev.purge((byte) (D2xxManager.FT_PURGE_TX | D2xxManager.FT_PURGE_RX));
if (!ftDev.isOpen()) {
throw new IOException();
} else {
Log.d("USB", "COM open");
}
}
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:47,代码来源:UsbFTDIConnection.java
示例15: open
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
@Override
public boolean open() {
if (ftD2xx == null) {
try {
ftD2xx = D2xxManager.getInstance(mContext);
} catch (D2xxManager.D2xxException ex) {
Log.e(TAG, ex.toString());
return false;
}
}
if (ftDev == null) {
int devCount = 0;
devCount = ftD2xx.createDeviceInfoList(mContext);
if (DEBUG_SHOW) {
Log.d(TAG, "Device number : " + Integer.toString(devCount));
}
D2xxManager.FtDeviceInfoListNode[] deviceList = new D2xxManager.FtDeviceInfoListNode[devCount];
ftD2xx.getDeviceInfoList(devCount, deviceList);
if (devCount <= 0) {
return false;
}
ftDev = ftD2xx.openByIndex(mContext, USB_OPEN_INDEX);
} else {
if (ftD2xx.createDeviceInfoList(mContext) > 0) {
synchronized (ftDev) {
ftDev = ftD2xx.openByIndex(mContext, USB_OPEN_INDEX);
}
}
}
if (ftDev.isOpen()) {
synchronized (ftDev) {
ftDev.resetDevice(); // flush any data from the device buffers
}
setBaudrate(mUartConfig.baudrate);
if (DEBUG_SHOW) {
Log.d(TAG, "An FTDI device is opened.");
}
startRead();
return true;
} else {
if (DEBUG_SHOW) {
Log.e(TAG, "Cannot open an FTDI device.");
}
}
return false;
}
开发者ID:cattaka,项目名称:PhysicaloidVc,代码行数:53,代码来源:UartFtdi.java
示例16: open
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
@Override
public boolean open() {
if(ftD2xx == null) {
try {
ftD2xx = D2xxManager.getInstance(mContext);
} catch (D2xxManager.D2xxException ex) {
Log.e(TAG,ex.toString());
return false;
}
}
if(ftDev == null) {
int devCount = 0;
devCount = ftD2xx.createDeviceInfoList(mContext);
if(DEBUG_SHOW) {Log.d(TAG, "Device number : "+ Integer.toString(devCount)); }
D2xxManager.FtDeviceInfoListNode[] deviceList = new D2xxManager.FtDeviceInfoListNode[devCount];
ftD2xx.getDeviceInfoList(devCount, deviceList);
if(devCount <= 0) {
return false;
}
ftDev = ftD2xx.openByIndex(mContext, USB_OPEN_INDEX);
} else {
if (ftD2xx.createDeviceInfoList(mContext) > 0) {
synchronized(ftDev) {
ftDev = ftD2xx.openByIndex(mContext, USB_OPEN_INDEX);
}
}
}
if(ftDev.isOpen()) {
synchronized(ftDev) {
ftDev.resetDevice(); // flush any data from the device buffers
}
setBaudrate(mUartConfig.baudrate);
if(DEBUG_SHOW){ Log.d(TAG, "An FTDI device is opened."); }
startRead();
return true;
} else {
if(DEBUG_SHOW){ Log.e(TAG, "Cannot open an FTDI device."); }
}
return false;
}
开发者ID:RobotPajamas,项目名称:SimpleUSB,代码行数:47,代码来源:UartFtdi.java
示例17: openDevice
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
private void openDevice() {
if(ftDev != null) {
if(ftDev.isOpen()) {
if(mThreadIsStopped) {
updateView(true);
SetConfig(19200, (byte)8, (byte)1, (byte)0, (byte)0);
ftDev.purge((byte) (D2xxManager.FT_PURGE_TX | D2xxManager.FT_PURGE_RX));
ftDev.restartInTask();
new Thread(mLoop).start();
}
return;
}
}
int devCount = 0;
devCount = ftD2xx.createDeviceInfoList(this);
Log.d(TAG, "Device number : "+ Integer.toString(devCount));
D2xxManager.FtDeviceInfoListNode[] deviceList = new D2xxManager.FtDeviceInfoListNode[devCount];
ftD2xx.getDeviceInfoList(devCount, deviceList);
if(devCount <= 0) {
return;
}
if(ftDev == null) {
ftDev = ftD2xx.openByIndex(this, 0);
} else {
synchronized (ftDev) {
ftDev = ftD2xx.openByIndex(this, 0);
}
}
if(ftDev.isOpen()) {
if(mThreadIsStopped) {
updateView(true);
SetConfig(19200, (byte)8, (byte)1, (byte)0, (byte)0);
ftDev.purge((byte) (D2xxManager.FT_PURGE_TX | D2xxManager.FT_PURGE_RX));
ftDev.restartInTask();
new Thread(mLoop).start();
}
}
}
开发者ID:Sector67,项目名称:nsa-away,代码行数:45,代码来源:DisplayCiphertextActivity.java
示例18: notifyOnDataAvailable
import com.ftdi.j2xx.D2xxManager; //导入依赖的package包/类
public void notifyOnDataAvailable(boolean enable) {
monThread.Data = enable;
self_ftdi.setEventNotification(D2xxManager.FT_EVENT_RXCHAR);
}
开发者ID:thebigbang,项目名称:SerialPort_Android,代码行数:5,代码来源:SerialPort.java
注:本文中的com.ftdi.j2xx.D2xxManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论