當前位置: 首頁>>代碼示例>>Java>>正文


Java CommPortIdentifier.PORT_PARALLEL屬性代碼示例

本文整理匯總了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) {
        } 
    }
 
開發者ID:sbandur84,項目名稱:micro-Blagajna,代碼行數:26,代碼來源:CommStream.java

示例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";
	}
}
 
開發者ID:Twissi,項目名稱:Animator,代碼行數:16,代碼來源:FlashExporter.java

示例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";
    }
}
 
開發者ID:ultrac,項目名稱:JavaProjects,代碼行數:19,代碼來源:TwoWayNewComm.java

示例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";
    }
}
 
開發者ID:ultrac,項目名稱:JavaProjects,代碼行數:18,代碼來源:TwoWayComm.java

示例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";
	}
}
 
開發者ID:elexis,項目名稱:elexis-3-base,代碼行數:16,代碼來源:CobasMiraConnection.java

示例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;
	    }
 
開發者ID:lazyzero,項目名稱:kkMulticopterFlashTool,代碼行數:29,代碼來源:PortScanner.java


注:本文中的gnu.io.CommPortIdentifier.PORT_PARALLEL屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。