当前位置: 首页>>代码示例>>Java>>正文


Java SerialInputOutputManager类代码示例

本文整理汇总了Java中com.hoho.android.usbserial.util.SerialInputOutputManager的典型用法代码示例。如果您正苦于以下问题:Java SerialInputOutputManager类的具体用法?Java SerialInputOutputManager怎么用?Java SerialInputOutputManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SerialInputOutputManager类属于com.hoho.android.usbserial.util包,在下文中一共展示了SerialInputOutputManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startIoManager

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
private void startIoManager(UsbSerialPort port) {
    if (port != null) {
        if (DEBUG) Log.i(TAG, "Starting io manager...");
        mDecoder.reset();
        mSerialIoManager = new SerialInputOutputManager(port, mListener);
        mExecutor.submit(mSerialIoManager);

        new Handler(Looper.myLooper()).postDelayed(new Runnable() {
            @Override
            public void run() {
                int randomMessageIndex = new Random(SystemClock.elapsedRealtimeNanos())
                        .nextInt(WELCOME_MESSAGES.length);
                Log.d(TAG, "Sending a welcome message, index: " + randomMessageIndex);
                BmwIBusService.this.sendTextMessageToObc(
                        WELCOME_MESSAGES[randomMessageIndex]);
            }
        }, 3000);
    }
}
 
开发者ID:OpilkiInside,项目名称:bimdroid,代码行数:20,代码来源:BmwIBusService.java

示例2: setupUsbDevice

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
private void setupUsbDevice() {
	mUsbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
	mSerialDevice = UsbSerialProber.acquire(mUsbManager);
	if (mSerialDevice == null) {
		Toast.makeText(this, "Cannot find USB device", Toast.LENGTH_SHORT)
				.show();
	} else {
		try {
			mSerialDevice.open();
		} catch (IOException e) {
			Log.e(TAG, "Error setting up device: " + e.getMessage(), e);
			try {
				mSerialDevice.close();
			} catch (IOException e2) {
				// Ignore.
			}
			mSerialDevice = null;
			return;
		}
	}
	mSerialIoManager = new SerialInputOutputManager(mSerialDevice,
			mListener);
	mExecutor.submit(mSerialIoManager);
}
 
开发者ID:tecip-nes,项目名称:sniffer154,代码行数:25,代码来源:SnifferDeviceService.java

示例3: sendIBusMessage

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
/**
 * Sends a IBus message
 *
 * @return {@code true} if message sent successfully otherwise returns {@code false}.
 */
public boolean sendIBusMessage(IBusRawPacket packet) {
    if (mSerialIoManager == null
            || mSerialIoManager.getState() != SerialInputOutputManager.State.RUNNING) {
        if (DEBUG) Log.w(TAG, "Attempt to send ODB message when serial IO manager is not running");
        return false;
    }

    if (DEBUG) Log.i(TAG, "Sending message to IBus: " + HexDump.toHexString(packet.toByteArray()));
    mSerialIoManager.writeAsync(packet.toByteArray());
    return true;
}
 
开发者ID:OpilkiInside,项目名称:bimdroid,代码行数:17,代码来源:BmwIBusService.java

示例4: startIoManager

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
private void startIoManager() {
    if (sPort != null) {
        Log.i(TAG, "Starting io manager ..");
        mSerialIoManager = new SerialInputOutputManager(sPort, mListener);
        mExecutor.submit(mSerialIoManager);
    }
}
 
开发者ID:msillano,项目名称:USBphpTunnel,代码行数:8,代码来源:SerialConsoleActivity.java

示例5: startIoManager

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
private void startIoManager() {

        if (sPort != null) {
            MLog.i(TAG, "Starting io manager ..");
            mSerialIoManager = new SerialInputOutputManager(sPort, mListener);
            mExecutor.submit(mSerialIoManager);
        }
    }
 
开发者ID:victordiaz,项目名称:phonk,代码行数:9,代码来源:PSerial.java

示例6: startIoManager

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
/**
 * シリアル通信を開始する.
 */
private void startIoManager() {
    if (mSerialPort != null) {
        if (debugFlag) {
            Toast.makeText(mContext, "Starting io manager.", Toast.LENGTH_SHORT).show();
        }
        mSerialIoManager = new SerialInputOutputManager(mSerialPort, mListener);
        mExecutor.submit(mSerialIoManager);

        listener.onChangeStatus(STATUS_UART_START);
    }
}
 
开发者ID:FaBoPlatform,项目名称:STK500-Android,代码行数:15,代码来源:StkWriter.java

示例7: closeDevice

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
/**
 * USBシリアルデバイスクローズ.
 */
private void closeDevice() {
    Iterator<UsbSerialDevice> index = mUsbSerialDevices.iterator();

    while (index.hasNext()) {
        UsbSerialDevice device = index.next();
        final UsbManager mUsbManager = (UsbManager) this.getSystemService(Context.USB_SERVICE);
        UsbDeviceConnection connection = mUsbManager.openDevice(device.getSerialPort().getDriver().getDevice());
        if (connection == null) {
            SerialInputOutputManager manager = device.getSerialInputOutputManager();
            if (manager != null) {
                manager.stop();
            }
            device.setSerialInputOutputManager(null);

            UsbSerialPort serialPort = device.getSerialPort();
            if (serialPort != null) {
                try {
                    serialPort.close();
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            }
            device.setSerialPort(null);
            setOnlineStatus(device.getServiceId(), false, false);
            index.remove();
        }
    }
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:32,代码来源:SmartMeterMessageService.java

示例8: startIoManager

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
/**
 * シリアル通信を開始する.
 */
private void startIoManager() {
    if (mSerialPort != null) {
        mByteBuffer.clear();
        mSerialIoManager = new SerialInputOutputManager(mSerialPort, mListener);
        mExecutor.submit(mSerialIoManager);
    }
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:11,代码来源:SmartMeterMessageService.java

示例9: IOProcessor

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
public IOProcessor(UsbDevice device) throws IOException{
    mSendBuffer = new ArrayDeque<>();

    // Tweaked rom serial library example
    UsbDeviceConnection connection = mManager.openDevice(device);

    mSerialPort = mDriver.getPorts().get(0);
    mSerialPort.open(connection);
    mSerialPort.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE); // Arduino default settings
    mListener = new InputListener();
    mSerialIoManager = new SerialInputOutputManager(mSerialPort, mListener);
    mExecutor.submit(mSerialIoManager);
}
 
开发者ID:dgcrouse,项目名称:Loggerino,代码行数:14,代码来源:LogKeeper.java

示例10: startIoManager

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
private void startIoManager() {
    if (usbSerialPort != null) {
        Log.i(TAG, "Starting io manager ..");
        serialIoManager = new SerialInputOutputManager(usbSerialPort, serialInputListener);
        executor.submit(serialIoManager);
    }
}
 
开发者ID:handsomecode,项目名称:smart-foosball,代码行数:8,代码来源:ScoreboardActivity.java

示例11: startIoManager

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
private void startIoManager() {
  if (driver != null) {
    Log.i(TAG, "Starting io manager ..");

    serialListener = new DeviceBridge(driver, listener);
    serialManager = new SerialInputOutputManager(driver, serialListener);
    mExecutor.submit(serialManager);
    listener.onAttach(driver, serialListener);
  }
}
 
开发者ID:leorleor,项目名称:double-rainbow-fpv,代码行数:11,代码来源:UsbSerialTransfer.java

示例12: startIoManager

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
private void startIoManager() {
    if (mSerialDevice != null) {
        Log.i(TAG, "Starting io manager ..");
        mSerialIoManager = new SerialInputOutputManager(mSerialDevice, mListener);
        mExecutor.submit(mSerialIoManager);
    }
}
 
开发者ID:ThinkeryAustin,项目名称:RobotDisplay,代码行数:8,代码来源:DemoActivity.java

示例13: startIoManager

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
/**
 * Observe serial connection
 */
private void startIoManager() {
	if (driver != null) {
		Log.i(TAG, "Starting io manager.");
		mSerialIoManager = new SerialInputOutputManager(port, mListener);
		mExecutor.submit(mSerialIoManager);
	}
}
 
开发者ID:xseignard,项目名称:cordovarduino,代码行数:11,代码来源:Serial.java

示例14: connectSmartMeter

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
/**
 * スマートメーター通信接続.
 * @param response response.
 * @param device 接続USBシリアルデバイス.
 */
public void connectSmartMeter(final Intent response, final UsbSerialDevice device) {
    /* ID、パスワードチェック */
    if (mPrefUtil.getBRouteId() == null || mPrefUtil.getBRoutePass() == null) {
        if (response != null) {
            MessageUtils.setIllegalDeviceStateError(response, "Not found b-route ID or Password.");
            sendResponse(response);
        }
        return;
    }

    UsbSerialPort serialPort = device.getSerialPort();
    SerialInputOutputManager manager = device.getSerialInputOutputManager();
    if (manager != null) {
        manager.stop();
        device.setSerialInputOutputManager(null);
    }

    if (mSerialPort == null) {
        mSerialPort = device.getSerialPort();
    } else if (!(mSerialPort.equals(serialPort))) {
        try {
            mSerialPort.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        mSerialPort = device.getSerialPort();
    }

    mByteBuffer.clear();
    device.setSerialInputOutputManager(new SerialInputOutputManager(mSerialPort, mListener));
    updateUsbSerialDeviceTable(device);
    if (mSerialIoManager != null) {
        mSerialIoManager.stop();
        mSerialIoManager = null;
    }
    mSerialIoManager = device.getSerialInputOutputManager();
    mExecutor.submit(mSerialIoManager);

    // 初期コマンド送信.
    mPairingResponse = response;
    mPairngServiceId = device.getServiceId();
    mSequenceState = 0;
    ExecuteProcess(BP35C2.Command.ECHOBACK_OFF, null);
}
 
开发者ID:DeviceConnect,项目名称:DeviceConnect-Android,代码行数:50,代码来源:SmartMeterMessageService.java

示例15: setDevice

import com.hoho.android.usbserial.util.SerialInputOutputManager; //导入依赖的package包/类
/**
 * Set USB serial port device
 * @param port serial port to be set
 */
protected void setDevice(UsbSerialPort port)
{
	sPort = port;
	mSerialIoManager = new SerialInputOutputManager(sPort, mListener);
}
 
开发者ID:fr3ts0n,项目名称:AndrOBD,代码行数:10,代码来源:UsbCommService.java


注:本文中的com.hoho.android.usbserial.util.SerialInputOutputManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。