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) Generate a native type describing the block header.generateNativeTrailerType(ITypeManager typeman) Generate a native type describing the block trailer.intgetBlockByte(int offset) Retrieve a byte from the complete block data.byte[]Retrieve the complete block bytes.intRetrieve the block format version.intRetrieve the total size of the block data.intgetCrc()Retrieve the block CRC.byte[]Retrieve the interface bytes.longintRetrieve the interface offset within the block bytes.intRetrieve the interface size.intgetKey()Retrieve the block key.Retrieve the metadata author name.Retrieve the metadata block name.Retrieve the metadata family name.longgetName()Generate this block's normal name, that is<BLOCK_TYPE><BLOCK_NUMBER>.intRetrieve the block number.byte[]Retrieve the additional data bytes.intRetrieve the offset of the additional data area.intRetrieve the size of the additional data area.byte[]Retrieve the block's payload.intGet the payload offset within the block bytes.intGet the payload size in bytes.Retrieve the source language.intRetrieve the raw source language id.intgetType()Retrieve the block type.intRetrieve the raw block type id.int[]booleanDetermine 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()Retrieve the raw source language id.- Returns:
- source language id
-
getSourceLanguage
S7.LangType getSourceLanguage()Retrieve the source language.- Returns:
- source language
-
getTypeId
int getTypeId()Retrieve the raw block type id.- Returns:
- block type id
-
getType
S7.BlockType getType()Retrieve the block type.- Returns:
- block type
-
isInstanceDataBlock
boolean isInstanceDataBlock()Determine whether this block is an instance data block. The block type may beDBorDI.- Returns:
- true if this block is an instance data block
-
getNumber
int getNumber()Retrieve the block number.- Returns:
- block number
-
getBlockSize
int getBlockSize()Retrieve the total size of the block data.- Returns:
- block size in bytes
-
getBlockBytes
byte[] getBlockBytes()Retrieve the complete block bytes.- Returns:
- block bytes
-
getBlockByte
int getBlockByte(int offset) Retrieve a byte from the complete block data.- Parameters:
offset- byte offset- Returns:
- byte value
-
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:
- payload offset
-
getPayloadSize
int getPayloadSize()Get the payload size in bytes.- Returns:
- payload size in bytes
-
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:
- payload bytes
-
getInterfaceOffset
int getInterfaceOffset()Retrieve the interface offset within the block bytes.- Returns:
- interface offset
-
getInterfaceSize
int getInterfaceSize()Retrieve the interface size.- Returns:
- interface size in bytes
-
getInterfaceBytes
byte[] getInterfaceBytes()Retrieve the interface bytes.- Returns:
- interface bytes
-
getOtherOffset
int getOtherOffset()Retrieve the offset of the additional data area.- Returns:
- additional data offset
-
getOtherSize
int getOtherSize()Retrieve the size of the additional data area.- Returns:
- additional data size in bytes
-
getOtherBytes
byte[] getOtherBytes()Retrieve the additional data bytes.- Returns:
- additional data bytes
-
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()Retrieve the block key.- Returns:
- key value
-
getMetadataBlockName
String getMetadataBlockName()Retrieve the metadata block name.- Returns:
- block name, possibly empty
-
getMetadataFamilyName
String getMetadataFamilyName()Retrieve the metadata family name.- Returns:
- family name, possibly empty
-
getMetadataAuthorName
String getMetadataAuthorName()Retrieve the metadata author name.- Returns:
- author name, possibly empty
-
getVersion
int[] getVersion()- Returns:
- two-element array: {major version (0..15), minor version (0..15)}
-
getCrc
int getCrc()Retrieve the block CRC.- Returns:
- CRC value
-
getName
String getName()Generate this block's normal name, that is<BLOCK_TYPE><BLOCK_NUMBER>. Examples:OB1,FB5,DB10.- Returns:
- the normal name
-
generateNativeHeaderType
Generate a native type describing the block header.- Parameters:
typeman- type manager- Returns:
- native header type
-
generateNativeTrailerType
Generate a native type describing the block trailer.- Parameters:
typeman- type manager- Returns:
- native trailer type, null if this block format has no trailer
-