Search in sources :

Example 1 with RobotUsbManager

use of com.qualcomm.robotcore.hardware.usb.RobotUsbManager in project robotcode by OutoftheBoxFTC.

the class FtcEventLoopBase method getLynxUsbDeviceForFirmwareUpdate.

protected LynxUsbDeviceContainer getLynxUsbDeviceForFirmwareUpdate(SerialNumber serialNumber) {
    // Is is it something that's already open?
    for (LynxUsbDeviceImpl lynxUsbDevice : ftcEventLoopHandler.getExtantLynxDeviceImpls()) {
        if (lynxUsbDevice.getSerialNumber().equals(serialNumber)) {
            return new LynxUsbDeviceContainer(lynxUsbDevice);
        }
    }
    // No, then open it
    try {
        RobotUsbManager robotUsbManager = HardwareDeviceManager.createUsbManager(AppUtil.getDefContext());
        RobotUsbDevice robotUsbDevice = LynxUsbUtil.openUsbDevice(robotUsbManager, serialNumber);
        return new LynxUsbDeviceContainer(robotUsbDevice);
    } catch (RobotCoreException e) {
    // ignored;
    }
    return null;
}
Also used : RobotUsbManager(com.qualcomm.robotcore.hardware.usb.RobotUsbManager) LynxUsbDeviceImpl(com.qualcomm.hardware.lynx.LynxUsbDeviceImpl) RobotCoreException(com.qualcomm.robotcore.exception.RobotCoreException) RobotUsbDevice(com.qualcomm.robotcore.hardware.usb.RobotUsbDevice)

Example 2 with RobotUsbManager

use of com.qualcomm.robotcore.hardware.usb.RobotUsbManager in project robotcode by OutoftheBoxFTC.

the class HardwareDeviceManager method createUsbManager.

public static RobotUsbManager createUsbManager(Context context) throws RobotCoreException {
    RobotUsbManager usbManager = new RobotUsbManagerFtdi(context);
    if (LynxConstants.isRevControlHub()) {
        RobotUsbManagerCombining combiner = new RobotUsbManagerCombining();
        combiner.addManager(usbManager);
        combiner.addManager(new RobotUsbManagerTty(context));
        usbManager = combiner;
    }
    return usbManager;
}
Also used : RobotUsbManager(com.qualcomm.robotcore.hardware.usb.RobotUsbManager) RobotUsbManagerFtdi(com.qualcomm.robotcore.hardware.usb.ftdi.RobotUsbManagerFtdi) RobotUsbManagerTty(com.qualcomm.robotcore.hardware.usb.serial.RobotUsbManagerTty) RobotUsbManagerCombining(com.qualcomm.robotcore.hardware.usb.RobotUsbManagerCombining)

Aggregations

RobotUsbManager (com.qualcomm.robotcore.hardware.usb.RobotUsbManager)2 LynxUsbDeviceImpl (com.qualcomm.hardware.lynx.LynxUsbDeviceImpl)1 RobotCoreException (com.qualcomm.robotcore.exception.RobotCoreException)1 RobotUsbDevice (com.qualcomm.robotcore.hardware.usb.RobotUsbDevice)1 RobotUsbManagerCombining (com.qualcomm.robotcore.hardware.usb.RobotUsbManagerCombining)1 RobotUsbManagerFtdi (com.qualcomm.robotcore.hardware.usb.ftdi.RobotUsbManagerFtdi)1 RobotUsbManagerTty (com.qualcomm.robotcore.hardware.usb.serial.RobotUsbManagerTty)1