@@ -57,27 +57,35 @@ public Serial() throws SerialException {
57
57
PreferencesData .getInteger ("serial.debug_rate" ),
58
58
PreferencesData .get ("serial.parity" ).charAt (0 ),
59
59
PreferencesData .getInteger ("serial.databits" ),
60
- new Float (PreferencesData .get ("serial.stopbits" )).floatValue ());
60
+ new Float (PreferencesData .get ("serial.stopbits" )).floatValue (),
61
+ BaseNoGui .getBoardPreferences ().get ("serial.disableRTS" ) == null ,
62
+ BaseNoGui .getBoardPreferences ().get ("serial.disableDTR" ) == null );
61
63
}
62
64
63
65
public Serial (int irate ) throws SerialException {
64
66
this (PreferencesData .get ("serial.port" ), irate ,
65
67
PreferencesData .get ("serial.parity" ).charAt (0 ),
66
68
PreferencesData .getInteger ("serial.databits" ),
67
- new Float (PreferencesData .get ("serial.stopbits" )).floatValue ());
69
+ new Float (PreferencesData .get ("serial.stopbits" )).floatValue (),
70
+ BaseNoGui .getBoardPreferences ().get ("serial.disableRTS" ) == null ,
71
+ BaseNoGui .getBoardPreferences ().get ("serial.disableDTR" ) == null );
68
72
}
69
73
70
74
public Serial (String iname , int irate ) throws SerialException {
71
75
this (iname , irate , PreferencesData .get ("serial.parity" ).charAt (0 ),
72
76
PreferencesData .getInteger ("serial.databits" ),
73
- new Float (PreferencesData .get ("serial.stopbits" )).floatValue ());
77
+ new Float (PreferencesData .get ("serial.stopbits" )).floatValue (),
78
+ BaseNoGui .getBoardPreferences ().get ("serial.disableRTS" ) == null ,
79
+ BaseNoGui .getBoardPreferences ().get ("serial.disableDTR" ) == null );
74
80
}
75
81
76
82
public Serial (String iname ) throws SerialException {
77
83
this (iname , PreferencesData .getInteger ("serial.debug_rate" ),
78
84
PreferencesData .get ("serial.parity" ).charAt (0 ),
79
85
PreferencesData .getInteger ("serial.databits" ),
80
- new Float (PreferencesData .get ("serial.stopbits" )).floatValue ());
86
+ new Float (PreferencesData .get ("serial.stopbits" )).floatValue (),
87
+ BaseNoGui .getBoardPreferences ().get ("serial.disableRTS" ) == null ,
88
+ BaseNoGui .getBoardPreferences ().get ("serial.disableDTR" ) == null );
81
89
}
82
90
83
91
public static boolean touchPort (String iname , int irate ) throws SerialException {
@@ -100,7 +108,7 @@ public static boolean touchPort(String iname, int irate) throws SerialException
100
108
}
101
109
}
102
110
103
- public Serial (String iname , int irate , char iparity , int idatabits , float istopbits ) throws SerialException {
111
+ public Serial (String iname , int irate , char iparity , int idatabits , float istopbits , boolean setRTS , boolean setDTR ) throws SerialException {
104
112
//if (port != null) port.close();
105
113
//this.parent = parent;
106
114
//parent.attach(this);
@@ -120,7 +128,7 @@ public Serial(String iname, int irate, char iparity, int idatabits, float istopb
120
128
try {
121
129
port = new SerialPort (iname );
122
130
port .openPort ();
123
- port .setParams (rate , databits , stopbits , parity , true , true );
131
+ port .setParams (rate , databits , stopbits , parity , setRTS , setDTR );
124
132
port .addEventListener (this );
125
133
} catch (Exception e ) {
126
134
throw new SerialException (I18n .format (_ ("Error opening serial port ''{0}''." ), iname ), e );
0 commit comments