28.12.2013 Views

Serial Programming - upload.wikimedia....

Serial Programming - upload.wikimedia....

Serial Programming - upload.wikimedia....

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

JavaComm API<br />

// makes sense to enable events. The event handler might be called<br />

immediately<br />

// after an event is enabled.<br />

...<br />

//<br />

// Typically, if the current class implements the<br />

<strong>Serial</strong>EventListener interface<br />

// one would call<br />

//<br />

// port.addEventListener(this);<br />

//<br />

// but for our example a new instance of <strong>Serial</strong>Listener is created:<br />

//<br />

port.addEventListener(new <strong>Serial</strong>Listener());<br />

//<br />

// Enable the events we are interested in<br />

//<br />

port.notifyOnDataAvailable(true);<br />

port.notifyOnOutputEmpty(true);<br />

/* other events not used in this example -><br />

port.notifyOnBreakInterrupt(true);<br />

port.notifyOnCarrierDetect(true);<br />

port.notifyOnCTS(true);<br />

port.notifyOnDSR(true);<br />

port.notifyOnFramingError(true);<br />

port.notifyOnOverrunError(true);<br />

port.notifyOnParityError(true);<br />

port.notifyOnRingIndicator(true);<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!