public final class SerialComPortHandleInfo extends Object
Encapsulates the information like port handle, looper object, event listener, data listener, port name etc associated with a particular port.
| Constructor and Description |
|---|
SerialComPortHandleInfo(String portName,
long handle,
SerialComLooper looper,
ISerialComDataListener dataListener,
ISerialComEventListener eventListener)
Allocates a new SerialComPortHandleInfo object.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsDataListener(ISerialComDataListener dataListener)
Check if there already exist a data listener for this handle.
|
boolean |
containsEventListener(ISerialComEventListener eventListener)
Check if there is already a registered event listener for this handle.
|
boolean |
containsHandle(long handle)
Check if the object of this class have this handle.
|
boolean |
containsPort(String portName)
Check if the corresponding port name exist.
|
ISerialComDataListener |
getDataListener()
Data Listener associated with this port, info and manipulation.
|
ISerialComEventListener |
getEventListener()
Event listener associated with this port, info and manipulation.
|
SerialComLooper |
getLooper()
Looper associated with this port, info and manipulation.
|
String |
getOpenedPortName()
Get the name of port associated with given handle Callers first find reference to this class
object using given handle and then invoke this method.
|
long |
getPortHandle()
Returns handle to the opened port.
|
SerialComInByteStream |
getSerialComInByteStream()
Return SerialComByteStream object associated with this handle.
|
SerialComOutByteStream |
getSerialComOutByteStream()
Return SerialComByteStream object associated with this handle.
|
void |
setDataListener(ISerialComDataListener dataListener)
Set the data listener for this handle.
|
void |
setEventListener(ISerialComEventListener eventListener)
Set the event listener associated with this handle.
|
void |
setLooper(SerialComLooper looper)
Set the looper object that is associated with this handle.
|
void |
setOpenedPortName(String portName)
Set the name of port.
|
void |
setPortHandle(long handle)
Sets the handle of the port opened.
|
void |
setSerialComInByteStream(SerialComInByteStream serialComInByteStream)
Set the SerialComByteStream object associated with this handle.
|
void |
setSerialComOutByteStream(SerialComOutByteStream serialComOutByteStream)
Set the SerialComByteStream object associated with this handle.
|
public SerialComPortHandleInfo(String portName, long handle, SerialComLooper looper, ISerialComDataListener dataListener, ISerialComEventListener eventListener)
Allocates a new SerialComPortHandleInfo object.
portName - name of port for which info is to stored.handle - handle of opened port.looper - looper object serving this handle.dataListener - listener to whom data bytes/errors will be delivered for this handle.eventListener - listener to whom events will be delivered for this handle.public String getOpenedPortName()
Get the name of port associated with given handle Callers first find reference to this class object using given handle and then invoke this method.
public void setOpenedPortName(String portName)
Set the name of port.
portName - name of port opened for communication.public boolean containsPort(String portName) throws IllegalArgumentException
Check if the corresponding port name exist.
portName - name of port to find.IllegalArgumentException - if portName is null.public long getPortHandle()
Returns handle to the opened port.
public void setPortHandle(long handle)
Sets the handle of the port opened.
handle - handle of port after opening it successfully.public boolean containsHandle(long handle)
Check if the object of this class have this handle.
public SerialComLooper getLooper()
Looper associated with this port, info and manipulation.
public void setLooper(SerialComLooper looper)
Set the looper object that is associated with this handle.
looper - looper object that will server this port/handle.public ISerialComEventListener getEventListener()
Event listener associated with this port, info and manipulation.
public void setEventListener(ISerialComEventListener eventListener)
Set the event listener associated with this handle.
eventListener - event listener who will get events for this port/handlepublic boolean containsEventListener(ISerialComEventListener eventListener)
Check if there is already a registered event listener for this handle.
eventListener - event listener who will get events for this port/handlepublic ISerialComDataListener getDataListener()
Data Listener associated with this port, info and manipulation.
public void setDataListener(ISerialComDataListener dataListener)
Set the data listener for this handle.
dataListener - listener who will get data bytes/errors for this port/handlepublic boolean containsDataListener(ISerialComDataListener dataListener)
Check if there already exist a data listener for this handle.
dataListener - who will get data bytes/errors for this port/handlepublic SerialComInByteStream getSerialComInByteStream()
Return SerialComByteStream object associated with this handle.
public void setSerialComInByteStream(SerialComInByteStream serialComInByteStream)
Set the SerialComByteStream object associated with this handle.
serialComInByteStream - input byte stream object for this port/handlepublic SerialComOutByteStream getSerialComOutByteStream()
Return SerialComByteStream object associated with this handle.
public void setSerialComOutByteStream(SerialComOutByteStream serialComOutByteStream)
Set the SerialComByteStream object associated with this handle.
serialComOutByteStream - output byte stream for this port/handleCopyright © 2017. All rights reserved.