Turn a port number into a device name
(portnumber)
| 39 | |
| 40 | |
| 41 | def device(portnumber): |
| 42 | """Turn a port number into a device name""" |
| 43 | enum = comm.CommPortIdentifier.getPortIdentifiers() |
| 44 | ports = [] |
| 45 | while enum.hasMoreElements(): |
| 46 | el = enum.nextElement() |
| 47 | if el.getPortType() == comm.CommPortIdentifier.PORT_SERIAL: |
| 48 | ports.append(el) |
| 49 | return ports[portnumber].getName() |
| 50 | |
| 51 | |
| 52 | class JavaSerial(SerialBase): |
no test coverage detected