CommHandlerImpl.java 文件源码

java
阅读 18 收藏 0 点赞 0 评论 0

项目:jmoduleconnect 作者:
/**
 * Creates an instance of this class.
 * @param commPortIdentifier Must point to an serial port
 * @param baudrate The baudrate of the communication. The baudrate must be 
 *        setted with <code>AT+IPR=*baudrate*</code>. The default baudrate
 *        of an device is <code>115200</code>
 * @param flowControlMode The flow control mode of the serial port
 * @return An instance of <code>CommHandlerImpl</code>
 * @throws PortInUseException The selected port is used by another application
 * @throws IOException The communication to the device failed
 * @throws IllegalArgumentException If parameter commPortIdentifier is 
 *         <code>null</code> or the result of {@link CommPortIdentifier#open(java.lang.String, int) } 
 *         is not an instance of {@link SerialPort}.
 * @since 1.5
 */
public static final CommHandler createCommHandler(final CommPortIdentifier commPortIdentifier
        , final int baudrate, final EnumSet<FlowControlMode> flowControlMode) 
        throws PortInUseException, IOException
{
    final CommHandlerImpl commHandler = new CommHandlerImpl();

    try
    {
        commHandler.init(commPortIdentifier, baudrate, flowControlMode);
        return commHandler;
    }
    catch (final PortInUseException | IOException ex)
    {
        commHandler.close();
        throw ex;
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号