/// <summary> /// Constructor with initial value. /// </summary> /// <param name="identifier"> <see cref="IPlcItem.Identifier"/> </param> /// <param name="type"> <see cref="IPlcItem.Type"/> </param> /// <param name="dataBlock"> <see cref="IPlcItem.DataBlock"/> </param> /// <param name="position"> <see cref="IPlcItem.Position"/> </param> /// <param name="isFlexible"> Is the <see cref="IPlcItem.Value"/>s <see cref="BitCollection"/> fixed or will it change size according to its data. </param> /// <param name="initialValue"> The initial value. </param> private BytesPlcItem(PlcItemType type, ushort dataBlock, ushort position, bool isFlexible, byte[] initialValue, string identifier = default) : base ( type, dataBlock, position, byteAmount: (ushort)(initialValue?.Length ?? 0), isFlexible, initialValue ?? new byte[0], identifier ) { }
/// <inheritdoc /> /// <summary> /// Constructor /// </summary> /// <param name="byteAmount"> The amount of <see cref="Byte"/>s of this item. </param> protected TypedBytesPlcItem ( PlcItemType type, ushort dataBlock, ushort position, ushort byteAmount, bool isFlexible, TValue initialValue, string identifier = default ) : base(type, dataBlock, position, Items.BitPosition.X0, bitAmount: (uint)byteAmount * 8, isFlexible, initialValue, identifier) { }
/// <inheritdoc /> protected TypedBitsPlcItem ( PlcItemType type, ushort dataBlock, ushort position, BitPosition bitPosition, byte bitAmount, bool isFlexible, TValue initialValue, string identifier = default ) : base(type, dataBlock, position, bitPosition, bitAmount, isFlexible, initialValue, identifier) { }
/// <summary> /// Constructor with initial value. /// </summary> /// <param name="identifier"> <see cref="IPlcItem.Identifier"/> </param> /// <param name="type"> <see cref="IPlcItem.Type"/> </param> /// <param name="dataBlock"> <see cref="IPlcItem.DataBlock"/> </param> /// <param name="position"> <see cref="IPlcItem.Position"/> </param> /// <param name="initialValue"> The initial value. </param> public BytesPlcItem(PlcItemType type, ushort dataBlock, ushort position, byte[] initialValue, string identifier = default) : this(type, dataBlock, position, false, initialValue, identifier) { }
/// <summary> /// Constructor with amount. /// </summary> /// <param name="identifier"> <see cref="IPlcItem.Identifier"/> </param> /// <param name="type"> <see cref="IPlcItem.Type"/> </param> /// <param name="dataBlock"> <see cref="IPlcItem.DataBlock"/> </param> /// <param name="position"> <see cref="IPlcItem.Position"/> </param> /// <param name="byteAmount"> The total amount of <see cref="Byte"/>s for this item. </param> public BytesPlcItem(PlcItemType type, ushort dataBlock, ushort position, ushort byteAmount, string identifier = default) : this(type, dataBlock, position, false, new byte[byteAmount], identifier) { }
/// <inheritdoc /> /// <summary> /// Constructor with initial value. /// </summary> public BitsPlcItem(PlcItemType type, ushort dataBlock, ushort position, BitPosition bitPosition, BitCollection initialValue, string identifier = default) : base(type, dataBlock, position, bitPosition, initialValue, identifier) { }
/// <inheritdoc /> /// <summary> /// Constructor with bit amount. /// </summary> public BitsPlcItem(PlcItemType type, ushort dataBlock, ushort position, BitPosition bitPosition, byte bitAmount, string identifier = default) : base(type, dataBlock, position, bitPosition, bitAmount, isFlexible: false, identifier: identifier) { }
/// <summary> /// Constructor /// </summary> public BitPlcItem(PlcItemType type, ushort dataBlock, ushort position, BitPosition bitPosition, bool initialValue = default, string identifier = default) : base(type, dataBlock, position, bitPosition, bitAmount: 1, false, initialValue, identifier) { }