Interface IS7Block
Interface for S7 blocks. Implementations of this interface are private. They represent different
concrete implementations of a PLC block.
Currently, two implementations exist:
- binary format 1 (little-endian): used by Step 7 internally
- binary format 2 (big-endian): used during networks communication between a PLC and the
Programming Station (header starts with 'pp')
-
Method Summary
Modifier and TypeMethodDescriptiongenerateNativeHeaderType
(ITypeManager typeman) generateNativeTrailerType
(ITypeManager typeman) int
getBlockByte
(int offset) byte[]
int
Retrieve the block format version.int
int
getCrc()
byte[]
long
int
int
int
getKey()
long
getName()
Generate this block's normal name, that is<BLOCK_TYPE><BLOCK_NUMBER>
.int
byte[]
int
int
byte[]
Retrieve the block's payload.int
Get the payload offset within the block bytes.int
Get the payload size in bytes.int
int
getType()
int
int[]
boolean
Determine whether this block is an instance data block.
-
Method Details
-
getBlockFormatVersion
int getBlockFormatVersion()Retrieve the block format version.- Returns:
- an opaque 16-bit version number (for the block format, not the block itself)
-
getSourceLanguageId
int getSourceLanguageId() -
getSourceLanguage
S7.LangType getSourceLanguage() -
getTypeId
int getTypeId() -
getType
S7.BlockType getType() -
isInstanceDataBlock
boolean isInstanceDataBlock()Determine whether this block is an instance data block. The block type may beDB
orDI
.- Returns:
-
getNumber
int getNumber() -
getBlockSize
int getBlockSize() -
getBlockBytes
byte[] getBlockBytes() -
getBlockByte
int getBlockByte(int offset) -
getTrailerOffset
int getTrailerOffset()- Returns:
- optional trailer offset, -1 if there is no trailer
-
getPayloadOffset
int getPayloadOffset()Get the payload offset within the block bytes.- Returns:
-
getPayloadSize
int getPayloadSize()Get the payload size in bytes.- Returns:
-
getPayloadBytes
byte[] getPayloadBytes()Retrieve the block's payload.For a logic block, the payload bytes are the MC7 bytecode of the function. For a data block, the payload bytes are the current values of the interface elements (which may differ from the initial values, if any).
- Returns:
-
getInterfaceOffset
int getInterfaceOffset() -
getInterfaceSize
int getInterfaceSize() -
getInterfaceBytes
byte[] getInterfaceBytes() -
getOtherOffset
int getOtherOffset() -
getOtherSize
int getOtherSize() -
getOtherBytes
byte[] getOtherBytes() -
getModificationTimestamp
long getModificationTimestamp()- Returns:
- in ms since the epoch (1970/01/01)
-
getInterfaceModificationTimestamp
long getInterfaceModificationTimestamp()- Returns:
- in ms since the epoch (1970/01/01)
-
getKey
int getKey() -
getMetadataBlockName
String getMetadataBlockName() -
getMetadataFamilyName
String getMetadataFamilyName() -
getMetadataAuthorName
String getMetadataAuthorName() -
getVersion
int[] getVersion()- Returns:
- two-element array: {major version (0..15), minor version (0..15)}
-
getCrc
int getCrc() -
getName
String getName()Generate this block's normal name, that is<BLOCK_TYPE><BLOCK_NUMBER>
. Examples:OB1
,FB5
,DB10
.- Returns:
- the normal name
-
generateNativeHeaderType
-
generateNativeTrailerType
-