1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.mina.transport.serial;
21
22 import org.apache.mina.core.session.AbstractIoSessionConfig;
23 import org.apache.mina.core.session.IoSessionConfig;
24
25
26
27
28
29
30 class DefaultSerialSessionConfig extends AbstractIoSessionConfig implements SerialSessionConfig {
31
32 private int receiveThreshold = -1;
33
34 private int inputBufferSize = 8;
35
36 private int outputBufferSize = 8;
37
38 private boolean lowLatency = false;
39
40 public DefaultSerialSessionConfig() {
41
42 }
43
44
45
46
47 @Override
48 protected void doSetAll(IoSessionConfig config) {
49 if (config instanceof SerialSessionConfig) {
50 SerialSessionConfig cfg = (SerialSessionConfig) config;
51 setInputBufferSize(cfg.getInputBufferSize());
52 setReceiveThreshold(cfg.getReceiveThreshold());
53 }
54 }
55
56
57
58
59 public int getInputBufferSize() {
60 return inputBufferSize;
61 }
62
63
64
65
66 public boolean isLowLatency() {
67 return lowLatency;
68 }
69
70
71
72
73 public void setInputBufferSize(int bufferSize) {
74 inputBufferSize = bufferSize;
75 }
76
77
78
79
80 public void setLowLatency(boolean lowLatency) {
81 this.lowLatency = lowLatency;
82 }
83
84
85
86
87 public int getReceiveThreshold() {
88 return receiveThreshold;
89 }
90
91
92
93
94 public void setReceiveThreshold(int bytes) {
95 receiveThreshold = bytes;
96 }
97
98
99
100
101 public int getOutputBufferSize() {
102 return outputBufferSize;
103 }
104
105
106
107
108 public void setOutputBufferSize(int bufferSize) {
109 outputBufferSize = bufferSize;
110
111 }
112 }