public class SecsMsg extends SecsTrigger implements java.io.Serializable
This superclass can be instantiated to send messages that do not have a stream or function associated with them and which have no data, that is, header only messages. HSMS uses this capability.
Modifier and Type | Field and Description |
---|---|
static boolean |
allowBrokenMessages
If set to true this will allow messages that are short, that is the number of byte do not match the required length
to be interpreted as far as possible.
|
static boolean |
allowGenericSecsMessage
This variable determines the disposition of messages that are not
represented by a subclass of SecsMsg.
|
static int |
ALWAYS
Always send multiblock messages.
|
static int |
ALWAYS_244BLOCK
Send multiblock messages when the message data is larger than 244
regardless of the protocol.
|
static int |
ALWAYS_SECS1
Send multiblock messages when the connection is SECSI regardless of the
message size.
|
static int |
CANNOT_SEND
Indicates that the message could not be sent.
|
static int |
F0_ERROR
Indicates that the transaction completed with a Function 0 message.
|
short |
maxRetryAttempts
If a SECS message timesout then it can be retried this number of times before being declared unsendable.
|
static int |
NO_ERROR
Indicates that the transaction completed successfully and that both
the request and response message are valid.
|
boolean |
replyBit
Set to true to indicate that the message will be sent with the W-bit set.
|
int |
responseError
The response error.
|
static int |
S9_ERROR
Indicates that the transaction completed with a Stream 9 message.
|
static int |
SECS1_244BLOCK
Send multiblock messages when the connection is SECSI and the message data
is larger than 244 bytes.
|
static int |
SECS1_MULTIBLOCK
Send multiblock messages when the connection is SECSI and the message
is multiblock.
|
static boolean |
sendErrors
Indicate whether we will send S9 messages for unhandled incoming
messages.
|
static int |
SPOOLED
Indicates that the message could not be sent.
|
static int |
TIMEOUT_ERROR
Indicates that the transaction completed with a T3.
|
static boolean |
towerAkrion
Tower broken Akrion SECS format.
|
static int |
UNSOLICITED
This indicates that we received a unsolicted message.
|
cvsRev
Constructor and Description |
---|
SecsMsg()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addResponseHandler(MessageResponseInterface listener)
Adds a response listener for this message.
|
boolean |
checkZeroLength(java.util.Vector theFormats)
Implemented by subclasses.
|
SecsFormat |
convertData(SecsFormat temp,
java.lang.Object[] struct) |
SecsFormat |
convertData(SecsFormat temp,
java.lang.Object[] struct,
java.util.Vector zeroLength) |
SecsFormat |
convertData(SecsFormat secsFormat,
java.lang.String className,
java.util.Vector zeroLength)
Recursively interpret the data structures for messages that have multiple formats embedded
within a list (SecsFormat00) object.
|
SecsFormat00 |
convertDataRecursive(SecsFormat00 secsFormattedMsg,
java.lang.Object[] structure,
java.util.Vector zeroLength)
Recursively interpret the data structures for messages that have multiple formats embedded
within a list (SecsFormat00) object.
|
boolean |
convertException(SecsFormat temp) |
static SecsMsg |
createMsg(int stream,
int function,
byte[] unconverted)
This will create an instance of a message S
|
SecsFormat |
createSecsFormatObject(int formatCode,
int size)
Creates a SecsFormat object based on the format code and the size.
|
static java.lang.String |
dateToString(java.util.Date d)
Returns the Date as a formatted string.
|
SecsMsg |
getAbortTransaction()
This will return the abort transaction for the current stream.
|
static SecsMsg |
getAbortTransaction(int stream)
This will return the abort transaction for a specific stream.
|
java.lang.Class |
getClassFromHeader()
Returns the class that corresponds to the type of this message.
|
SecsFormat |
getData()
This method converts the raw, or unconverted message to SECS data structures.
|
SecsFormat |
getDataFormats()
This method will return the data formats from the SECS Message.
|
SecsFormat |
getDataFormatsRecursive()
Returns a SecsFormat object, representing this message.
|
boolean |
getDefaultReplyBit()
Returns the default state of the reply bit.
|
java.lang.String |
getDetailedSML() |
int |
getDeviceId()
Returns the Device ID.
|
SecsException |
getError()
Returns the current error.
|
byte |
getException()
This will return the conversion exception during the conversion process.
|
byte[] |
getFormattedBytes()
Converts the message to a raw byte stream.
|
int |
getFunction()
Returns the SECSII Function for this message.
|
static boolean |
getIgnoreAllTimeouts()
Returns the status of timeout handling.
|
boolean |
getIgnoreTimeouts()
Returns the status of timeout handling.
|
short |
getMessageId()
Returns the message ID.
|
java.lang.Object |
getMsgId()
This method returns a unique ID for this message.
|
MultiBlockRequest |
getMultiBlockRequest()
This is called by send message for all messages that are multiblock.
|
SecsMsg |
getNACK()
Returns a nack for this message (ie SxF0)
|
SecsMsg |
getPrimaryMessage()
This method will returns the original message.
|
boolean |
getReplyBit()
Returns the value of replyBit.
|
SecsMsg |
getResponseMessage()
This method will returns the original message.
|
SessionManager |
getSessionManager()
Returns the current session manager.
|
static int |
getShouldSendMultiBlockRequests()
Returns the shouldSendMultiBlockRequests variable.
|
int |
getStream()
Returns the SECSII Stream for this message.
|
java.lang.Object[] |
getStructure()
Returns an array of objects representing the required structure for the message.
|
int |
getSystemBytes()
Returns the system bytes.
|
java.util.Date |
getTimeStamp()
Returns the time stamp of the current message.
|
int |
getTotalLength()
This will return the total length of the message when it sent.
|
byte[] |
getUnconvertedMsg()
Returns the the raw, unconverted msg.
|
static int |
getUniqueSystemBytes()
Returns a unique set of system bytes.
|
static UnrecoverableErrorInterface |
getUnrecoverableErrorHandler()
Returns the current unrecoverable error handler.
|
void |
handleResponseMessage(int status,
SecsMsg sm)
This message will be called if the message receives an expected reply.
|
boolean |
hasTimedOut()
Returns true if the message has timedout waiting for a response.
|
boolean |
isConsideredMultiblock()
Returns whether this message is considered multiblock.
|
boolean |
isLastBlock() |
boolean |
isMultiBlock()
Returns true if this message is multi-block.
|
boolean |
isReply()
Returns true if this message is a reply.
|
java.lang.String |
longName()
Returns the long name for this message.
|
void |
notifyResponse(int status,
SecsMsg sm)
This method is called on the primary message when the disposition of the
message is known.
|
boolean |
processSelf(java.lang.Object messageHandler)
Calls the message handle object.
|
static void |
registerMessageSpecificOutgoingVerifier(int stream,
int function,
SystemHandlerInterface verifier)
This handler will be called only for the stream/function specified.
|
void |
removeResponseHandler(MessageResponseInterface listener)
Removes a response listener.
|
void |
replaceDataWith(SecsFormat data)
Replaces the outgoing message with the new outgoing message.
|
void |
responseTimedout(boolean canRetry)
sent by the port manager to indicate that the message has timedout waiting for a response.
|
void |
sendMessage()
Sends the message.
|
SecsMsg |
sendMessageAndWait()
Sends a message using sendMessage and waits for a response.
|
void |
sendMessageInternal()
If all the send message checks pass then this routine will actually send
the message.
|
void |
setDetailedSML(java.lang.String sml)
Sets optional detailed SML used for logging this message.
|
void |
setDeviceId(int newValue)
Sets the device ID.
|
void |
setFunction(int function)
Sets the function number of this message.
|
static void |
setIgnoreAllTimeouts(boolean ignoreAllTimeouts)
Set to true to ignore timeouts.
|
void |
setIgnoreTimeouts(boolean ignoreTimeouts)
Set to true to ignore timeouts.
|
void |
setIsLastBlock(boolean newValue) |
void |
setMessageId(short newValue)
Sets the message ID.
|
void |
setPrimaryMessage(SecsMsg sm)
This method will set the original message.
|
void |
setReplyBit(boolean reply)
Controls the setting of the reply bit.
|
void |
setResponseMessage(SecsMsg sm)
This method will set the response message.
|
void |
SetSecsError(SecsException newError)
Sets the current error.
|
void |
SetSecsError(java.lang.String theString,
int newInt)
Sets the current error and creates a SecsException from the provided information.
|
void |
setSessionManager(SessionManager newValue)
Sets the session manager.
|
static void |
setShouldSendMultiBlockRequests(int value)
Set the shouldSendMultiBlockRequests variable.
|
void |
setStream(int stream)
Sets the stream number of this message.
|
void |
setSystemBytes(int newValue)
Sets the system bytes.
|
void |
setTimeStamp(java.util.Date newTime)
Sets the timestamp for the current message, usually called by the port manager
when the message is sent or received.
|
void |
setUnconvertedMsg(byte[] newValue)
Sets the the raw, unconverted msg into the new message
but it will not unconvert or interpret the information.
|
static void |
setUnrecoverableErrorHandler(UnrecoverableErrorInterface errorHandler)
Sets the unrecoverable error handler.
|
java.lang.String |
shortName()
Returns the short name for this message.
|
java.lang.String |
theExceptionString()
Returns a string description of the message exception.
|
boolean |
toEquipment()
Returns true if this message is intended to be sent to the equipment.
|
boolean |
toHost()
Returns true if this message is intended to be sent to the host.
|
java.lang.String |
toString()
Returns a nicely formatted text string.
|
boolean |
waitForReply()
Wait for a reply or for the message to timeout.
|
public static boolean allowBrokenMessages
public static boolean allowGenericSecsMessage
public static final int ALWAYS
public static final int ALWAYS_244BLOCK
public static final int ALWAYS_SECS1
public static final int CANNOT_SEND
public static final int F0_ERROR
public short maxRetryAttempts
public static final int NO_ERROR
public boolean replyBit
getDefaultReplyBit()
,
getReplyBit()
,
setReplyBit(boolean)
public int responseError
MessageResponseInterface
public static final int S9_ERROR
public static final int SECS1_244BLOCK
public static final int SECS1_MULTIBLOCK
public static boolean sendErrors
public static final int SPOOLED
public static final int TIMEOUT_ERROR
public static boolean towerAkrion
public static final int UNSOLICITED
public SecsMsg()
public void addResponseHandler(MessageResponseInterface listener)
public boolean checkZeroLength(java.util.Vector theFormats)
public SecsFormat convertData(SecsFormat temp, java.lang.Object[] struct) throws SecsException
SecsException
public SecsFormat convertData(SecsFormat temp, java.lang.Object[] struct, java.util.Vector zeroLength) throws SecsException
SecsException
public SecsFormat convertData(SecsFormat secsFormat, java.lang.String className, java.util.Vector zeroLength) throws SecsException
For example, an S7F5 message takes a
SecsException
public SecsFormat00 convertDataRecursive(SecsFormat00 secsFormattedMsg, java.lang.Object[] structure, java.util.Vector zeroLength) throws SecsException
For example, an S7F3 message takes a list containing a
SecsException
public boolean convertException(SecsFormat temp) throws SecsException
SecsException
public static SecsMsg createMsg(int stream, int function, byte[] unconverted) throws SecsException
SecsException
public SecsFormat createSecsFormatObject(int formatCode, int size) throws SecsException
SecsException
public static java.lang.String dateToString(java.util.Date d)
d
- the date to formatpublic SecsMsg getAbortTransaction()
public static SecsMsg getAbortTransaction(int stream)
public java.lang.Class getClassFromHeader() throws SecsException
SecsException
public SecsFormat getData() throws SecsException
SecsException
SecsFormat00
public SecsFormat getDataFormats() throws SecsException
SecsException
getDataFormatsRecursive()
public SecsFormat getDataFormatsRecursive() throws SecsException
SecsException
createSecsFormatObject(int, int)
,
getData()
,
getDataFormats()
public boolean getDefaultReplyBit()
getReplyBit()
,
setReplyBit(boolean)
public java.lang.String getDetailedSML()
public int getDeviceId()
public SecsException getError()
public byte getException()
public byte[] getFormattedBytes() throws SecsException
SecsException
public int getFunction()
public static boolean getIgnoreAllTimeouts()
public boolean getIgnoreTimeouts()
public short getMessageId()
public java.lang.Object getMsgId()
public MultiBlockRequest getMultiBlockRequest()
public SecsMsg getNACK() throws SecsException
SecsException
public SecsMsg getPrimaryMessage()
processSelf(java.lang.Object)
public boolean getReplyBit()
setReplyBit(boolean)
,
getDefaultReplyBit()
public SecsMsg getResponseMessage()
public SessionManager getSessionManager()
public static int getShouldSendMultiBlockRequests()
public int getStream()
public java.lang.Object[] getStructure()
SecsDataStructure
public int getSystemBytes()
public java.util.Date getTimeStamp()
public int getTotalLength() throws SecsException
SecsException
public byte[] getUnconvertedMsg()
public static int getUniqueSystemBytes()
public static UnrecoverableErrorInterface getUnrecoverableErrorHandler()
public void handleResponseMessage(int status, SecsMsg sm)
public boolean hasTimedOut()
public boolean isConsideredMultiblock() throws SecsException
SecsException
public boolean isLastBlock()
public boolean isMultiBlock() throws SecsException
SecsException
- if there is no session managerpublic boolean isReply()
getFunction()
public java.lang.String longName()
longName
in class SecsTrigger
shortName()
public void notifyResponse(int status, SecsMsg sm)
the
- status one of NO_ERROR, TIMEOUT_ERROR, S9_ERROR, F0_ERRORpublic boolean processSelf(java.lang.Object messageHandler) throws SecsException
processSelf
in class SecsTrigger
SecsException
SessionManager.createMessage(byte[])
public static void registerMessageSpecificOutgoingVerifier(int stream, int function, SystemHandlerInterface verifier)
public void removeResponseHandler(MessageResponseInterface listener)
public void replaceDataWith(SecsFormat data)
public void responseTimedout(boolean canRetry) throws SecsException
SecsException
public void sendMessage() throws SecsException
public SecsMsg sendMessageAndWait() throws SecsException
SecsException
sendMessage()
,
getResponseMessage()
public void sendMessageInternal() throws SecsException
SecsException
public void setDetailedSML(java.lang.String sml)
sml
- the detailed SMLpublic void setDeviceId(int newValue)
public void setFunction(int function)
newValue
- the function number.public static void setIgnoreAllTimeouts(boolean ignoreAllTimeouts)
public void setIgnoreTimeouts(boolean ignoreTimeouts)
public void setIsLastBlock(boolean newValue)
public void setMessageId(short newValue)
public void setPrimaryMessage(SecsMsg sm)
public void setReplyBit(boolean reply)
setReplyBit(boolean)
,
getDefaultReplyBit()
public void setResponseMessage(SecsMsg sm)
public void SetSecsError(SecsException newError)
public void SetSecsError(java.lang.String theString, int newInt)
public void setSessionManager(SessionManager newValue)
SessionManager
,
HSMSSessionManager
public static void setShouldSendMultiBlockRequests(int value)
public void setStream(int stream)
newValue
- the stream numberpublic void setSystemBytes(int newValue)
public void setTimeStamp(java.util.Date newTime)
public void setUnconvertedMsg(byte[] newValue)
public static void setUnrecoverableErrorHandler(UnrecoverableErrorInterface errorHandler)
public java.lang.String shortName()
shortName
in class SecsTrigger
longName()
public java.lang.String theExceptionString()
public boolean toEquipment()
public boolean toHost()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean waitForReply()
Copyright © 1999-2025 ErgoTech Systems, Inc. All Rights Reserved.