|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectSerialPort.SPDMessage
This class contains a message sent to and received from the serial port server, spd. Its methods are used for assembling, unpacking and retrieving the message.
This class is not normally accessible to the calling program. It is used internally by the SerialPort class and no references to SPDMessage objects are returned to the caller.
Messages consist of a command field and a value field: Both fields must be present, but the value field may be empty. Messages sent to the server use the command field to request an action to be taken with parameters sent in the value field. Messages received from the server are always a response to the previous command. Here the command field indicates whether the value is a valid response to the request or an error response.
The environ jar file must be in the classpath for this class to compile and at run time.
SerialPort - serial connections for Java Copyright (C) 2005 Martin C Gregorie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Contact Martin Gregorie at
martin@gregorie.org.
Read the GNU General Public License.
| Constructor Summary | |
SPDMessage(int debug)
Construct an empty message object and set the debugging level. |
|
SPDMessage(java.lang.String msg,
int debug)
Construct an SPDMessage object from a received message. |
|
| Method Summary | |
void |
buildMessage(java.lang.String cmd,
java.lang.String val)
Assemble a message from its components. |
java.lang.String |
getCommand()
Retrieve the command field. |
java.lang.String |
getMessage()
Retrieve the message. |
java.lang.String |
getValue()
Retrieve the value field. |
int |
length()
Retrieve the message length. |
int |
unpackMessage()
Unpack a message, extracting the command and value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SPDMessage(java.lang.String msg,
int debug)
public SPDMessage(int debug)
| Method Detail |
public void buildMessage(java.lang.String cmd,
java.lang.String val)
public int unpackMessage()
public java.lang.String getMessage()
public java.lang.String getCommand()
public java.lang.String getValue()
public int length()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||