//////////////////////////////////////////////////////////////////////////////////////////////// // // Constructor. Only used once to create the initial instance for the static functions. // //////////////////////////////////////////////////////////////////////////////////////////////// public UsbDeviceJNI() { m_instance = this; m_openedDevices = new HashMap<Integer, UsbSerialDriver>(); m_userData = new HashMap<Integer, Integer>(); m_ioManager = new HashMap<Integer, UsbIoManager>(); } ///////////////////////////////////////////////////////////////////////////////////////////////////////// // // Find all current devices that match the device filter described in the androidmanifest.xml and the // device_filter.xml // ///////////////////////////////////////////////////////////////////////////////////////////////////////// private static boolean getCurrentDevices() { if (m_instance == null){ Log.i("getCD", "null"); return false; } if (m_manager == null) m_manager = (UsbManager)m_instance.getSystemService(Context.USB_SERVICE); if (m_devices != null) m_devices.clear(); m_devices = UsbSerialProber.findAllDevices(m_manager); return true; } ///////////////////////////////////////////////////////////////////////////////////////////////////////// // // List all available devices that are not already open. It returns the serial port info // in a : separated string array. Each string entry consists of the following: // // DeviceName:Company:ProductId:VendorId // ///////////////////////////////////////////////////////////////////////////////////////////////////////// public static String[] availableDevicesInfo() { // GET THE LIST OF CURRENT DEVICES if (!getCurrentDevices()) return null; // MAKE SURE WE HAVE ENTRIES if (m_devices.size() <= 0) return null; if (m_openedDevices == null) return null; int countL = 0; int iL; // CHECK FOR ALREADY OPENED DEVICES AND DON"T INCLUDE THEM IN THE COUNT for (iL=0; iL<m_devices.size(); iL++) { if (m_openedDevices.get(m_devices.get(iL).getDevice().getDeviceId()) != null) { countL++; break; } } if (m_devices.size() - countL <= 0) return null; String[] listL = new String[m_devices.size() - countL]; UsbSerialDriver driverL; String tempL; // GET THE DATA ON THE INDIVIDUAL DEVICES SKIPPING THE ONES THAT ARE ALREADY OPEN countL = 0; for (iL=0; iL<m_devices.size(); iL++) { driverL = m_devices.get(iL); if (m_openedDevices.get(driverL.getDevice().getDeviceId()) == null) { UsbDevice deviceL = driverL.getDevice(); tempL = deviceL.getDeviceName() + ":"; if (driverL instanceof FtdiSerialDriver) tempL = tempL + "FTDI:"; else if (driverL instanceof CdcAcmSerialDriver) tempL = tempL + "Cdc Acm:"; else if (driverL instanceof Cp2102SerialDriver) tempL = tempL + "Cp2102:"; else if (driverL instanceof ProlificSerialDriver) tempL = tempL + "Prolific:"; else tempL = tempL + "Unknown:"; tempL = tempL + Integer.toString(deviceL.getProductId()) + ":"; tempL = tempL + Integer.toString(deviceL.getVendorId()) + ":"; listL[countL] = tempL; countL++; } } return listL; }
:-1: ошибка: Unknown module(s) in QT: serialport