| | |
| | | package com.doumee.keyCabinet.utils.i485; |
| | | |
| | | import android.content.Context; |
| | | import android.hardware.usb.UsbConstants; |
| | | import android.hardware.usb.UsbDevice; |
| | | import android.hardware.usb.UsbInterface; |
| | | import android.hardware.usb.UsbManager; |
| | | import android.serialport.SerialPortFinder; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import android_serialport_api.SerialPortFinder; |
| | | |
| | | public class SportUtils { |
| | | public static List<String> getSerialPortPaths(Context context) { |
| | | // 获取所有串口设备路径 |
| | | String[] devices = new SerialPortFinder().getAllDevicesPath(); |
| | | SerialPortFinder mSerialPortFinder = new SerialPortFinder(); |
| | | String[] entryValues = mSerialPortFinder.getAllDevicesPath(); |
| | | List<String> serialPaths = new ArrayList<>(); |
| | | if(devices!=null){ |
| | | for(String key:devices){ |
| | | serialPaths.add(key); |
| | | } |
| | | for (int i = 0; i < entryValues.length; i++) { |
| | | serialPaths.add(entryValues[i]); |
| | | } |
| | | return serialPaths; |
| | | } |