Class OmronBOOL
- java.lang.Object
-
- com.automation_pros.odva.cip.data.BaseDataType<java.lang.Boolean>
-
- com.automation_pros.odva.cip.data.CipBOOL
-
- com.automation_pros.odva.cip.data.CipBOOL.CipBOOL16
-
- com.automation_pros.odva.cip.data.OmronBOOL
-
public class OmronBOOL extends CipBOOL.CipBOOL16
Omron Booleans are chameleons for transfer on the wire. They are documented to occupy one or more 16 bit words in an NJ or NX processor. When accessed individually, you get or supply a 16-bit word with the boolean encoded in the low bit.When an array, they are documented to occupy consecutive 16 bit words, where all of the dimensions are unrolled and the bits are packed linearly in the words, from lowest bit to highest bit. However, encoding on the wire varies:
When accessing a structure that contains a boolean array, the structure's payload on the wire contains the boolean array in this packed format.
When directly accessing an array (qty>1) of booleans, whether a global variable or as a named element of a structure, the booleans are instead encoded in the low bit of as many bytes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.automation_pros.odva.cip.data.CipBOOL
CipBOOL.CipBOOL16, CipBOOL.CipBOOL32, CipBOOL.CipBOOL64
-
-
Field Summary
-
Fields inherited from class com.automation_pros.odva.cip.data.CipBOOL
storageBits
-
Fields inherited from class com.automation_pros.odva.cip.data.BaseDataType
dimensions, memberOffsets, sLogger, variantContext, varyingDimension
-
-
Constructor Summary
Constructors Constructor Description OmronBOOL(boolean state)
OmronBOOL(int[] dimensions)
OmronBOOL(PathSegment parentSeg, BoolHost parent, int bitnum)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
alignment()
Obtain the natural alignment of this data type.int
bytes(int... indices)
Arrays of booleans require special payload handling, as bits are packed into bytes, shorts, integers, or longs.int
bytesEach()
Obtain the bytes-per-element of this object's payload encoding.java.lang.String
crcName()
Obtain the name of this type as used for computing structure CRCs.DataDefinitionSeg
getNestingDef()
Return the element (not including array) type definition as a Path Segment, using the abbreviated form if a composite data type.int
maxEach()
Obtain the largest number of bytes a single item can occupy in encoded form.int
minEach()
Obtain the smallest number of bytes a single item can occupy in encoded form.int
nestedBytes(boolean asStruct, int... indices)
Certain types (Omron strings and booleans) can have different encodings when packed into structures.void
nestedPutPayload(boolean asStruct, java.nio.ByteBuffer dest, int... indices)
Variable-length types (Omron strings) can have different encodings when members of structures or arrays.void
nestedSetPayload(int startpos, boolean asStruct, java.nio.ByteBuffer source, int... indices)
Certain types (Omron strings and booleans) can have different encodings when packed into structures.void
putPayload(java.nio.ByteBuffer dest, int... indices)
Arrays of booleans require special payload handling, as bits are * packed into an array of primitive types.void
setPayload(java.nio.ByteBuffer source, int... indices)
Arrays of booleans require special payload handling, as bits are packed into an array of primitive types.-
Methods inherited from class com.automation_pros.odva.cip.data.CipBOOL
bytesImpl, copy, copyToImpl, copyToImpl, get, getSymbolType, intValue, leftShiftBytes, main, putAbbrevType, putPayloadImpl, rightShiftBytes, set, setDimensions, setPayloadImpl, singleToString, structCRCString, wrap
-
Methods inherited from class com.automation_pros.odva.cip.data.BaseDataType
browseInner, browseInnerImpl, checkDimensions, chkAbbrevType, concatIndices, conditionalSuffix, copyTo, CRC16, CRC16, CRC16, dim2linear, dim2linear, dim2qty, dim2suffix, dimensionToString, doubleValue, extendIntArray, fillIntArray, get, getCompleteDef, getDimensions, getMemberOffsets, getTypeCode, getVariantContext, getVaryingDimension, hasOffset, incIdx, intArray, linear2dim, linear2dim, longValue, makeInstance, nestedBytesEach, nestedBytesImpl, nestedPutPayloadImpl, nestedSetPayloadImpl, range2suffix, rawCRC16, set, setFromTokenImpl, setFromTokenizer, setFromTokenizerImpl, setFromTokenString, setInt, setLong, setMemberOffsets, setupTokenizer, setVariantContext, setVariantDimension, setVariantDimension, sliceTo, toString
-
-
-
-
Constructor Detail
-
OmronBOOL
public OmronBOOL(int[] dimensions)
-
OmronBOOL
public OmronBOOL(boolean state)
-
OmronBOOL
public OmronBOOL(PathSegment parentSeg, BoolHost parent, int bitnum)
-
-
Method Detail
-
bytesEach
public int bytesEach()
Description copied from class:BaseDataType
Obtain the bytes-per-element of this object's payload encoding. Objects with variable length encodings must return zero and implement the bytesImpl(), minEach(), maxEach(), and alignment() methods instead.
-
minEach
public int minEach()
Description copied from class:BaseDataType
Obtain the smallest number of bytes a single item can occupy in encoded form. Used in structures to compute min/max offset and total structure size range.Types where bytesEach is a constant should override this to return that constant too, as a performance optimization.
-
maxEach
public int maxEach()
Description copied from class:BaseDataType
Obtain the largest number of bytes a single item can occupy in encoded form. Used in structures to compute min/max offset and total structure size range.Types where bytesEach is a constant should override this to return that constant too, as a performance optimization.
-
alignment
public int alignment()
Description copied from class:BaseDataType
Obtain the natural alignment of this data type. Used in structures to compute min/max offset and alignment.Types where bytesEach is a constant should override this to return a suitable constant too, as a performance optimization.
-
bytes
public int bytes(int... indices)
Description copied from class:CipBOOL
Arrays of booleans require special payload handling, as bits are packed into bytes, shorts, integers, or longs.
-
nestedBytes
public int nestedBytes(boolean asStruct, int... indices)
Description copied from class:BaseDataType
Certain types (Omron strings and booleans) can have different encodings when packed into structures. CipStruct will always call this method with asStruct set true so that such types can report the correct size.- Overrides:
nestedBytes
in classCipBOOL
- Returns:
-
nestedSetPayload
public void nestedSetPayload(int startpos, boolean asStruct, java.nio.ByteBuffer source, int... indices)
Description copied from class:BaseDataType
Certain types (Omron strings and booleans) can have different encodings when packed into structures. CipStruct will always call this method with asStruct set true so that such types can perform the correct decoding.- Overrides:
nestedSetPayload
in classBaseDataType<java.lang.Boolean>
asStruct
- True to invoke nestedSetPayloadImpl for each member.
-
setPayload
public void setPayload(java.nio.ByteBuffer source, int... indices)
Description copied from class:CipBOOL
Arrays of booleans require special payload handling, as bits are packed into an array of primitive types.- Overrides:
setPayload
in classCipBOOL
-
nestedPutPayload
public void nestedPutPayload(boolean asStruct, java.nio.ByteBuffer dest, int... indices)
Description copied from class:BaseDataType
Variable-length types (Omron strings) can have different encodings when members of structures or arrays. CipStruct will always call this method with asStruct set true so that such types can perform the correct encoding.- Overrides:
nestedPutPayload
in classBaseDataType<java.lang.Boolean>
- Parameters:
asStruct
- True to invoke structPutPayloadImpl for each member.
-
putPayload
public void putPayload(java.nio.ByteBuffer dest, int... indices)
Description copied from class:CipBOOL
Arrays of booleans require special payload handling, as bits are * packed into an array of primitive types.- Overrides:
putPayload
in classCipBOOL
-
getNestingDef
public DataDefinitionSeg getNestingDef()
Description copied from class:BaseDataType
Return the element (not including array) type definition as a Path Segment, using the abbreviated form if a composite data type.- Overrides:
getNestingDef
in classCipBOOL.CipBOOL16
-
crcName
public java.lang.String crcName()
Description copied from class:BaseDataType
Obtain the name of this type as used for computing structure CRCs. Can be different from the name(s) used by the CipPath parser.- Overrides:
crcName
in classCipBOOL.CipBOOL16
- Returns:
-
-