View Javadoc

    1   /*
    2    *  Licensed to the Apache Software Foundation (ASF) under one
    3    *  or more contributor license agreements.  See the NOTICE file
    4    *  distributed with this work for additional information
    5    *  regarding copyright ownership.  The ASF licenses this file
    6    *  to you under the Apache License, Version 2.0 (the
    7    *  "License"); you may not use this file except in compliance
    8    *  with the License.  You may obtain a copy of the License at
    9    *
    10   *    http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   *  Unless required by applicable law or agreed to in writing,
    13   *  software distributed under the License is distributed on an
    14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    15   *  KIND, either express or implied.  See the License for the
    16   *  specific language governing permissions and limitations
    17   *  under the License.
    18   *
    19   */
    20  package org.apache.mina.transport.serial;
    21
    22  import org.apache.mina.core.session.IoSessionConfig;
    23
    24  /**
    25   * An {@link IoSessionConfig} for serial transport type.
    26   * All those parameters are extracted from rxtx.org API for more details :
    27   * http://www.rxtx.org
    28   * @author <a href="http://mina.apache.org">Apache MINA Project</a>
    29   */
    30  public interface SerialSessionConfig extends IoSessionConfig {
    31
    32      /**
    33       * Gets the input buffer size. Note that this method is advisory and the underlying OS
    34       * may choose not to report correct values for the buffer size.
    35       * @return input buffer size in bytes
    36       */
    37      int getInputBufferSize();
    38
    39      /**
    40       * Sets the input buffer size. Note that this is advisory and memory availability may
    41       * determine the ultimate buffer size used by the driver.
    42       * @param bufferSize the buffer size in bytes
    43       */
    44      void setInputBufferSize(int bufferSize);
    45
    46      /**
    47       * Gets the output buffer size. Note that this method is advisory and the underlying OS
    48       * may choose not to report correct values for the buffer size.
    49       * @return input buffer size in bytes
    50       */
    51      int getOutputBufferSize();
    52
    53      /**
    54       * Sets the output buffer size. Note that this is advisory and memory availability may
    55       * determine the ultimate buffer size used by the driver.
    56       * @param bufferSize the buffer size in bytes
    57       */
    58      void setOutputBufferSize(int bufferSize);
    59
    60      /**
    61       * Is the low latency mode is enabled.
    62       * @return low latency on
    63       */
    64      boolean isLowLatency();
    65
    66      /**
    67       * Set the low latency mode, be carefull it's not supported by all the OS/hardware.
    68       * @param lowLatency
    69       */
    70      void setLowLatency(boolean lowLatency);
    71
    72      /**
    73       * The current receive threshold (-1 if not enabled). Give the value of the current buffer
    74       * needed for generate a new frame.
    75       * @return the receive thresold in bytes or -1 if disabled
    76       */
    77      int getReceiveThreshold();
    78
    79      /**
    80       * Set the receive threshold in byte (set it to -1 for disable). The serial port will try to
    81       * provide frame of the given minimal byte count. Be carefull some devices doesn't support it.
    82       * @param bytes minimal amount of byte before producing a new frame, or -1 if disabled
    83       */
    84      void setReceiveThreshold(int bytes);
    85
    86  }