|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.adventnet.cli.serial.SerialCommOptionsImpl
This class provides the Serial Port options implementation of the
CLIProtocolOptions Interface.
It contains parameters like the Baud rate, Parity, stop bits, etc.
In order to establish a CLI session over Serial Port with a particular
device the appropriate parameters has to be set on an instance of this
class and passed to the CLISession's constructor.
A subsequent call to the open() method in CLISession will
establish the Serial connection based on the parameters set here.
| Field Summary | |
static int |
DATABITS_5
5 bit Data Format |
static int |
DATABITS_6
6 bit Data Format |
static int |
DATABITS_7
7 bit Data Format |
static int |
DATABITS_8
8 bit Data Format |
static int |
FLOWCONTROL_NONE
No flow Control |
static int |
FLOWCONTROL_RTSCTS_IN
Hardware RTS/CTS flow Control on Input |
static int |
FLOWCONTROL_RTSCTS_OUT
Hardware RTS/CTS flow Control on Output |
static int |
FLOWCONTROL_XONXOFF_IN
Software (XON/XOFF) flow Control on Input |
static int |
FLOWCONTROL_XONXOFF_OUT
Software (XON/XOFF) flow Control on Output |
static int |
PARITY_EVEN
Even Parity |
static int |
PARITY_MARK
Mark Parity |
static int |
PARITY_NONE
No Parity |
static int |
PARITY_ODD
Odd Parity |
static int |
PARITY_SPACE
Space Parity |
static int |
STOPBITS_1
1 Stop Bit |
static int |
STOPBITS_1_5
1/2 Stop Bit |
static int |
STOPBITS_2
2 Stop Bit |
| Constructor Summary | |
SerialCommOptionsImpl()
This default constructor can be used for setting Serial port parameters for opening a CLISession. |
|
| Method Summary | |
java.lang.Object |
clone()
Performs a clone of this object. |
int |
getBaudRate()
Gets the baud rate configured for the data transfer. |
int |
getDataBits()
Gets the number of data bits used. |
int |
getFlowControlMode()
Gets the flow control mode set. |
java.lang.Object |
getID()
This is used to generate a unique id based on a particular connection. |
java.lang.String |
getInitialMessage()
Gets the initial message sent by the device after a connection is established. |
int |
getParity()
Gets the parity. |
java.lang.String |
getPortId()
Gets the PortId value |
java.util.Properties |
getProperties()
Gets the list of properties on this CLIProperty instance. |
int |
getStopBits()
Gets the no of Stop bits. |
void |
setBaudRate(int brate)
Sets the baud rate for the data transfer. |
void |
setDataBits(int dataBits)
Sets the no of data bits for each byte. |
void |
setFlowControlMode(int flowcontrol)
Sets the flow control mode. |
void |
setInitialMessage(java.lang.String message)
Sets the initial message sent by the device after a connection is established. |
void |
setParity(int parity)
Sets the parity type. |
void |
setPortId(java.lang.String portId)
Sets the PortId which identifies a particular serial port through which the communication has to be established. |
void |
setProperties(java.util.Properties properties)
Sets a list of properties on this CLIProperty instance. |
void |
setSerialCommParameters(int baudRate,
int dataBits,
int stopBits,
int parity)
Sets the various Communication parameters. |
void |
setStopBits(int stopBits)
Sets the no of Stop bits. |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final int DATABITS_5
public static final int DATABITS_6
public static final int DATABITS_7
public static final int DATABITS_8
public static final int STOPBITS_1
public static final int STOPBITS_2
public static final int STOPBITS_1_5
public static final int FLOWCONTROL_NONE
public static final int FLOWCONTROL_RTSCTS_IN
public static final int FLOWCONTROL_RTSCTS_OUT
public static final int FLOWCONTROL_XONXOFF_IN
public static final int FLOWCONTROL_XONXOFF_OUT
public static final int PARITY_NONE
public static final int PARITY_ODD
public static final int PARITY_EVEN
public static final int PARITY_MARK
public static final int PARITY_SPACE
| Constructor Detail |
public SerialCommOptionsImpl()
CLISession. The various parameters that can
be set on the class are the Port id, baud rate, parity and others.
The following code snippet shows how to set the various paramters:
SerialCommOptionsImpl sopt = new SerialCommOptionsImpl();
sopt.setPortId("COM1"); // set the port id
sopt.setBaudRate(19200); // set the baud rate
sopt.setStopBits(SerialCommOptionsImpl.STOPBITS_1); //set the stop bits
sopt.setDataBits(DATABITS_7); // set the no of data bits
This will create a SerialCommOptionsImpl class with the baud rate at
19200, with 1 stop bit and a data bits size of 7. This can be passed
to the CLISession.open(CLIProtocolOptions) method to open
a connection through the COM1 serial port with the above parameters.| Method Detail |
public void setPortId(java.lang.String portId)
portId - The String protId valuepublic java.lang.String getPortId()
public void setBaudRate(int brate)
brate - the baudratepublic int getBaudRate()
public void setStopBits(int stopBits)
stopBits - the no of Stop bits.public int getStopBits()
public void setFlowControlMode(int flowcontrol)
flowcontrol - the flow control mode.public int getFlowControlMode()
public void setParity(int parity)
parity - the parity type.public int getParity()
public void setDataBits(int dataBits)
dataBits - the number of data bits.public int getDataBits()
public void setSerialCommParameters(int baudRate,
int dataBits,
int stopBits,
int parity)
baudRate - the baud ratedataBits - the number of data bits to be usedstopBits - the number of stop bits to be usedparity - the parity typepublic java.lang.Object getID()
public void setInitialMessage(java.lang.String message)
message - the initial message from the device.public java.lang.String getInitialMessage()
public java.lang.Object clone()
public void setProperties(java.util.Properties properties)
props - the property object which contains the list of properties.public java.util.Properties getProperties()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||