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      /**
48       * Gets the output buffer size. Note that this method is advisory and the underlying OS
49       * may choose not to report correct values for the buffer size.
50       * @return input buffer size in bytes
51       */
52      int getOutputBufferSize();
53  
54      /**
55       * Sets the output buffer size. Note that this is advisory and memory availability may
56       * determine the ultimate buffer size used by the driver.
57       * @param bufferSize the buffer size in bytes
58       */
59      void setOutputBufferSize(int bufferSize);
60  
61      /**
62       * Is the low latency mode is enabled.
63       * @return low latency on
64       */
65      boolean isLowLatency();
66  
67      /**
68       * Set the low latency mode, be carefull it's not supported by all the OS/hardware.
69       * @param lowLatency
70       */
71      void setLowLatency(boolean lowLatency);
72  
73      /**
74       * The current receive threshold (-1 if not enabled). Give the value of the current buffer
75       * needed for generate a new frame.
76       * @return the receive thresold in bytes or -1 if disabled
77       */
78      int getReceiveThreshold();
79  
80      /**
81       * Set the receive threshold in byte (set it to -1 for disable). The serial port will try to
82       * provide frame of the given minimal byte count. Be carefull some devices doesn't support it.
83       * @param bytes minimal amount of byte before producing a new frame, or -1 if disabled
84       */
85      void setReceiveThreshold(int bytes);
86      
87      
88     
89  
90  }