Bug 1087 : Add Mark and Space parity to the Serial library
Last modified: 2010-06-05 09:49




Status:
RESOLVED
Resolution:
WONTFIX -
Priority:
P4
Severity:
enhancement

 

Reporter:
NoahBuddy
Assigned To:
fry

Attachment Type Created Size Actions
Serial.java text/x-java-source 2008-12-01 14:56 20.39 KB

Description:   Opened: 2008-12-01 14:53
Mark and Space parity for Serial
While not needed by most, but I found a use for the Mark and Space parity
on the Serial port.

Inserted into the constructor:
...
if (iparity == 'M') parity = SerialPort.PARITY_MARK;
if (iparity == 'S') parity = SerialPort.PARITY_SPACE;
...

and added:
/**
* Set parity, including Mark or Space.
*/
public void setParity(char parit) {

parity = SerialPort.PARITY_NONE;
if (parit== 'E') parity = SerialPort.PARITY_EVEN;
if (parit== 'O') parity = SerialPort.PARITY_ODD;
if (parit== 'M') parity = SerialPort.PARITY_MARK;
if (parit== 'S') parity = SerialPort.PARITY_SPACE;

try {sp.port.setSerialPortParams(rate, databits, stopbits, parity);}
catch (UnsupportedCommOperationException ex) {ex.printStackTrace();}
}
Additional Comment #1 From NoahBuddy 2008-12-01 14:56
edit]
Serial.java
Additional Comment #2 From fry 2008-12-02 03:34
Noted, thanks.
Additional Comment #3 From fry 2010-06-05 09:49
for sake of simplicity, i think we'll leave it out for now. it's a simple
fix for anyone who needs to make their own version of Serial.java, so i
think we'll leave it at that. thanks!