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 The Apache MINA Project (dev@mina.apache.org)
29   * @version $Rev: 529576 $, $Date: 2007-04-17 14:25:07 +0200 (mar., 17 avr. 2007) $
30   */
31  public interface SerialSessionConfig extends IoSessionConfig {
32  
33      /**
34       * Gets the input buffer size. Note that this method is advisory and the underlying OS
35       * may choose not to report correct values for the buffer size.
36       * @return input buffer size in bytes
37       */
38      int getInputBufferSize();
39  
40      /**
41       * Sets the input buffer size. Note that this is advisory and memory availability may
42       * determine the ultimate buffer size used by the driver.
43       * @param bufferSize the buffer size in bytes
44       */
45      void setInputBufferSize(int bufferSize);
46  
47      /**
48       * Is the low latency mode is enabled.
49       * @return low latency on
50       */
51      boolean isLowLatency();
52  
53      /**
54       * Set the low latency mode, be carefull it's not supported by all the OS/hardware.
55       * @param lowLatency
56       */
57      void setLowLatency(boolean lowLatency);
58  
59      /**
60       * The current receive threshold (-1 if not enabled). Give the value of the current buffer
61       * needed for generate a new frame.
62       * @return the receive thresold in bytes or -1 if disabled
63       */
64      int getReceiveThreshold();
65  
66      /**
67       * Set the receive threshold in byte (set it to -1 for disable). The serial port will try to
68       * provide frame of the given minimal byte count. Be carefull some devices doesn't support it.
69       * @param bytes minimal amount of byte before producing a new frame, or -1 if disabled
70       */
71      void setReceiveThreshold(int bytes);
72  
73  }