Interface CipMessage
-
- All Known Implementing Classes:
CipReply
,CipRequest
,CxMgrReq
,FwdCloseReq
,FwdCloseRsp
,FwdOpenReq
,FwdOpenRsp
,GetAttrListReq
,GetGenericReq
,GetInstAttrListReq
,MultipleReq
,UnCxSendReq
public interface CipMessage
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
bytes()
int
getServiceCode()
CIP messages always have a service code, either requesting or replying.byte[]
payloadBytes()
Encode the message payload for transmission and return it as an array of bytes.int
payloadLength()
void
put(java.nio.ByteBuffer dest)
Encode the entire message for transmission.void
putPayload(java.nio.ByteBuffer dest)
Encode the message payload for transmission.void
setPayload(java.nio.ByteBuffer source)
When parsing a packet containing a CIP message, the data area of the message varies.byte[]
toBytes()
Encode the entire message for transmission and return it as an array of bytes.
-
-
-
Method Detail
-
getServiceCode
int getServiceCode()
CIP messages always have a service code, either requesting or replying. In the protocol, replies have bit seven turned on. In reply classes implementing this interface, the bit is stripped.- Returns:
- The unsigned byte service code as an integer.
-
bytes
int bytes()
- Returns:
- The total byte length of the encoded message.
-
put
void put(java.nio.ByteBuffer dest)
Encode the entire message for transmission.- Parameters:
dest
- Destination buffer for the encoded message.
-
payloadLength
int payloadLength()
- Returns:
- The byte length of the encoded payload only.
-
setPayload
void setPayload(java.nio.ByteBuffer source)
When parsing a packet containing a CIP message, the data area of the message varies. Implementing classes must parse the payload into message-specific fields, if any.- Parameters:
source
- Source buffer containing the encoded new payload.
-
putPayload
void putPayload(java.nio.ByteBuffer dest)
Encode the message payload for transmission. The destination buffer may be a null pointer to trigger payload caching and/or length calculation.- Parameters:
dest
- Destination buffer for the encoded payload.
-
payloadBytes
byte[] payloadBytes()
Encode the message payload for transmission and return it as an array of bytes.- Returns:
- The encoded payload as a byte array.
-
toBytes
byte[] toBytes()
Encode the entire message for transmission and return it as an array of bytes.- Returns:
- The entire encoded message as a byte array.
-
-