Skip to content

SerialPortEventListener returns invalid type #84

@GoogleCodeExporter

Description

@GoogleCodeExporter

This isn't necessarily a bug, it just looks incredibly weird.

In SerialPortEvent the event types look exactly like a bit field:


    public static final int RXCHAR = 1;
    public static final int RXFLAG = 2;
    public static final int TXEMPTY = 4;
    public static final int CTS = 8;
    public static final int DSR = 16;
    public static final int RLSD = 32;
    public static final int BREAK = 64;
    public static final int ERR = 128;
    public static final int RING = 256;

All the values are double previous values.

And yet all the code doesn't examine the value like a bitfield, but like a 
regular field:

    public boolean isRXCHAR() {
        if(eventType == RXCHAR){
            return true;
        }
        else {
            return false;
        }
    }

Maybe not wrong, but just looks a lot like it!

Original issue reported on code.google.com by xpusosto...@gmail.com on 23 May 2015 at 7:54

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions