本文整理匯總了Java中gnu.io.CommPortIdentifier.PORT_PARALLEL屬性的典型用法代碼示例。如果您正苦於以下問題:Java CommPortIdentifier.PORT_PARALLEL屬性的具體用法?Java CommPortIdentifier.PORT_PARALLEL怎麽用?Java CommPortIdentifier.PORT_PARALLEL使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類gnu.io.CommPortIdentifier
的用法示例。
在下文中一共展示了CommPortIdentifier.PORT_PARALLEL屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
private void init() {
try {
if (m_out == null) {
m_PortIdPrinter = CommPortIdentifier.getPortIdentifier(m_sPort); // Tomamos el puerto
m_CommPortPrinter = m_PortIdPrinter.open("PORTID", 2000); // Abrimos el puerto
m_out = m_CommPortPrinter.getOutputStream(); // Tomamos el chorro de escritura
if (m_PortIdPrinter.getPortType() == CommPortIdentifier.PORT_SERIAL) {
((SerialPort)m_CommPortPrinter).setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); // Configuramos el puerto
} else if (m_PortIdPrinter.getPortType() == CommPortIdentifier.PORT_PARALLEL) {
((ParallelPort)m_CommPortPrinter).setMode(1);
}
}
} catch (Exception e) {
m_PortIdPrinter = null;
m_CommPortPrinter = null;
m_out = null;
m_in = null;
// } catch (NoSuchPortException e) {
// } catch (PortInUseException e) {
// } catch (UnsupportedCommOperationException e) {
// } catch (IOException e) {
}
}
示例2: getPortTypeName
public String getPortTypeName(int portType) {
switch (portType) {
case CommPortIdentifier.PORT_I2C:
return "I2C";
case CommPortIdentifier.PORT_PARALLEL:
return "Parallel";
case CommPortIdentifier.PORT_RAW:
return "Raw";
case CommPortIdentifier.PORT_RS485:
return "RS485";
case CommPortIdentifier.PORT_SERIAL:
return "Serial";
default:
return "unknown type";
}
}
示例3: getPortTypeName
static String getPortTypeName ( int portType )
{
switch ( portType )
{
case CommPortIdentifier.PORT_I2C:
return "I2C";
case CommPortIdentifier.PORT_PARALLEL:
return "Parallel";
case CommPortIdentifier.PORT_RAW:
return "Raw";
case CommPortIdentifier.PORT_RS485:
return "RS485";
// We need Serial Port
case CommPortIdentifier.PORT_SERIAL:
return "Serial";
default:
return "unknown type";
}
}
示例4: getPortTypeName
static String getPortTypeName ( int portType )
{
switch ( portType )
{
case CommPortIdentifier.PORT_I2C:
return "I2C";
case CommPortIdentifier.PORT_PARALLEL:
return "Parallel";
case CommPortIdentifier.PORT_RAW:
return "Raw";
case CommPortIdentifier.PORT_RS485:
return "RS485";
case CommPortIdentifier.PORT_SERIAL:
return "Serial";
default:
return "unknown type";
}
}
示例5: getPortTypeName
static String getPortTypeName(int portType){
switch (portType) {
case CommPortIdentifier.PORT_I2C:
return "I2C";
case CommPortIdentifier.PORT_PARALLEL:
return "Parallel";
case CommPortIdentifier.PORT_RAW:
return "Raw";
case CommPortIdentifier.PORT_RS485:
return "RS485";
case CommPortIdentifier.PORT_SERIAL:
return "Serial";
default:
return "unknown type";
}
}
示例6: listParallelPorts
/**
* @return List all parallel ports
*/
public static Vector<String> listParallelPorts()
{
Vector<String> ports = new Vector<String>();
if (KKMulticopterFlashTool.ENABLE_PORT_CHECK) {
java.util.Enumeration<CommPortIdentifier> portEnum = CommPortIdentifier.getPortIdentifiers();
while ( portEnum.hasMoreElements() )
{
CommPortIdentifier portIdentifier = portEnum.nextElement();
if (portIdentifier.getPortType()==CommPortIdentifier.PORT_PARALLEL){
// if (System.getProperty("os.name").toLowerCase().contains("mac")) {
// if (portIdentifier.getName().contains("cu")){
// ports.add(portIdentifier.getName());
// }
// } else {
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
ports.add(portIdentifier.getName().toLowerCase());
} else {
ports.add(portIdentifier.getName());
}
// }
}
}
}
return ports;
}