mirror of
https://github.com/fbarresi/Sharp7.git
synced 2026-02-04 08:42:51 +00:00
changed to extension method calls
This commit is contained in:
@@ -434,7 +434,7 @@ namespace Sharp7
|
||||
{
|
||||
try
|
||||
{
|
||||
return new DateTime(0).AddMilliseconds(S7.GetDIntAt(buffer, pos));
|
||||
return new DateTime(0).AddMilliseconds(buffer.GetDIntAt(pos));
|
||||
}
|
||||
catch (System.ArgumentOutOfRangeException)
|
||||
{
|
||||
|
||||
@@ -551,7 +551,7 @@ namespace Sharp7
|
||||
RecvPacket(PDU, 0, 4);
|
||||
if (_LastError == 0)
|
||||
{
|
||||
Size = S7.GetWordAt(PDU, 2);
|
||||
Size = PDU.GetWordAt(2);
|
||||
// Check 0 bytes Data Packet (only TPKT+COTP = 7 bytes)
|
||||
if (Size == IsoHSize)
|
||||
RecvPacket(PDU, 4, 3); // Skip remaining 3 bytes and Done is still false
|
||||
@@ -612,7 +612,7 @@ namespace Sharp7
|
||||
{
|
||||
int Length;
|
||||
// Set PDU Size Requested
|
||||
S7.SetWordAt(S7_PN, 23, (ushort)_PduSizeRequested);
|
||||
S7_PN.SetWordAt(23, (ushort)_PduSizeRequested);
|
||||
// Sends the connection request telegram
|
||||
SendPacket(S7_PN);
|
||||
if (_LastError == 0)
|
||||
@@ -624,7 +624,7 @@ namespace Sharp7
|
||||
if ((Length == 27) && (PDU[17] == 0) && (PDU[18] == 0)) // 20 = size of Negotiate Answer
|
||||
{
|
||||
// Get PDU Size Negotiated
|
||||
_PDULength = S7.GetWordAt(PDU, 25);
|
||||
_PDULength = PDU.GetWordAt(25);
|
||||
if (_PDULength <= 0)
|
||||
_LastError = S7Consts.errCliNegotiatingPDU;
|
||||
}
|
||||
@@ -846,7 +846,7 @@ namespace Sharp7
|
||||
WordLen = S7Consts.S7WLTimer;
|
||||
|
||||
// Calc Word size
|
||||
WordSize = S7.DataSizeByte(WordLen);
|
||||
WordSize = WordLen.DataSizeByte();
|
||||
if (WordSize == 0)
|
||||
return S7Consts.errCliInvalidWordLen;
|
||||
|
||||
@@ -879,7 +879,7 @@ namespace Sharp7
|
||||
PDU[27] = (byte)Area;
|
||||
// Set Area
|
||||
if (Area == S7Consts.S7AreaDB)
|
||||
S7.SetWordAt(PDU, 25, (ushort)DBNumber);
|
||||
PDU.SetWordAt(25, (ushort)DBNumber);
|
||||
|
||||
// Adjusts Start and word length
|
||||
if ((WordLen == S7Consts.S7WLBit) || (WordLen == S7Consts.S7WLCounter) || (WordLen == S7Consts.S7WLTimer))
|
||||
@@ -891,7 +891,7 @@ namespace Sharp7
|
||||
Address = Start << 3;
|
||||
|
||||
// Num elements
|
||||
S7.SetWordAt(PDU, 23, (ushort)NumElements);
|
||||
PDU.SetWordAt(23, (ushort)NumElements);
|
||||
|
||||
// Address into the PLC (only 3 bytes)
|
||||
PDU[30] = (byte)(Address & 0x0FF);
|
||||
@@ -962,7 +962,7 @@ namespace Sharp7
|
||||
WordLen = S7Consts.S7WLTimer;
|
||||
|
||||
// Calc Word size
|
||||
WordSize = S7.DataSizeByte(WordLen);
|
||||
WordSize = WordLen.DataSizeByte();
|
||||
if (WordSize == 0)
|
||||
return S7Consts.errCliInvalidWordLen;
|
||||
|
||||
@@ -993,16 +993,16 @@ namespace Sharp7
|
||||
// Setup the telegram
|
||||
Array.Copy(S7_RW, 0, PDU, 0, Size_WR);
|
||||
// Whole telegram Size
|
||||
S7.SetWordAt(PDU, 2, (ushort)IsoSize);
|
||||
PDU.SetWordAt(2, (ushort)IsoSize);
|
||||
// Data Length
|
||||
Length = DataSize + 4;
|
||||
S7.SetWordAt(PDU, 15, (ushort)Length);
|
||||
PDU.SetWordAt(15, (ushort)Length);
|
||||
// Function
|
||||
PDU[17] = (byte)0x05;
|
||||
// Set DB Number
|
||||
PDU[27] = (byte)Area;
|
||||
if (Area == S7Consts.S7AreaDB)
|
||||
S7.SetWordAt(PDU, 25, (ushort)DBNumber);
|
||||
PDU.SetWordAt(25, (ushort)DBNumber);
|
||||
|
||||
|
||||
// Adjusts Start and word length
|
||||
@@ -1019,7 +1019,7 @@ namespace Sharp7
|
||||
}
|
||||
|
||||
// Num elements
|
||||
S7.SetWordAt(PDU, 23, (ushort)NumElements);
|
||||
PDU.SetWordAt(23, (ushort)NumElements);
|
||||
// Address into the PLC
|
||||
PDU[30] = (byte)(Address & 0x0FF);
|
||||
Address = Address >> 8;
|
||||
@@ -1042,7 +1042,7 @@ namespace Sharp7
|
||||
break;
|
||||
};
|
||||
// Length
|
||||
S7.SetWordAt(PDU, 33, (ushort)Length);
|
||||
PDU.SetWordAt(33, (ushort)Length);
|
||||
|
||||
// Copies the Data
|
||||
Array.Copy(Buffer, Offset, PDU, 35, DataSize);
|
||||
@@ -1096,7 +1096,7 @@ namespace Sharp7
|
||||
|
||||
// Fills Header
|
||||
Array.Copy(S7_MRD_HEADER, 0, PDU, 0, S7_MRD_HEADER.Length);
|
||||
S7.SetWordAt(PDU, 13, (ushort)(ItemsCount * S7Item.Length + 2));
|
||||
PDU.SetWordAt(13, (ushort)(ItemsCount * S7Item.Length + 2));
|
||||
PDU[18] = (byte)ItemsCount;
|
||||
// Fills the Items
|
||||
Offset = 19;
|
||||
@@ -1104,9 +1104,9 @@ namespace Sharp7
|
||||
{
|
||||
Array.Copy(S7_MRD_ITEM, S7Item, S7Item.Length);
|
||||
S7Item[3] = (byte)Items[c].WordLen;
|
||||
S7.SetWordAt(S7Item, 4, (ushort)Items[c].Amount);
|
||||
S7Item.SetWordAt(4, (ushort)Items[c].Amount);
|
||||
if (Items[c].Area == S7Consts.S7AreaDB)
|
||||
S7.SetWordAt(S7Item, 6, (ushort)Items[c].DBNumber);
|
||||
S7Item.SetWordAt(6, (ushort)Items[c].DBNumber);
|
||||
S7Item[8] = (byte)Items[c].Area;
|
||||
|
||||
// Address into the PLC
|
||||
@@ -1124,7 +1124,7 @@ namespace Sharp7
|
||||
if (Offset > _PDULength)
|
||||
return S7Consts.errCliSizeOverPDU;
|
||||
|
||||
S7.SetWordAt(PDU, 2, (ushort)Offset); // Whole size
|
||||
PDU.SetWordAt(2, (ushort)Offset); // Whole size
|
||||
SendPacket(PDU, Offset);
|
||||
|
||||
if (_LastError != 0)
|
||||
@@ -1140,11 +1140,11 @@ namespace Sharp7
|
||||
return _LastError;
|
||||
}
|
||||
// Check Global Operation Result
|
||||
_LastError = CpuError(S7.GetWordAt(PDU, 17));
|
||||
_LastError = CpuError(PDU.GetWordAt(17));
|
||||
if (_LastError != 0)
|
||||
return _LastError;
|
||||
// Get true ItemsCount
|
||||
int ItemsRead = S7.GetByteAt(PDU, 20);
|
||||
int ItemsRead = PDU.GetByteAt(20);
|
||||
if ((ItemsRead != ItemsCount) || (ItemsRead>MaxVars))
|
||||
{
|
||||
_LastError = S7Consts.errCliInvalidPlcAnswer;
|
||||
@@ -1158,7 +1158,7 @@ namespace Sharp7
|
||||
Array.Copy(PDU, Offset, S7ItemRead, 0, Length-Offset);
|
||||
if (S7ItemRead[0] == 0xff)
|
||||
{
|
||||
ItemSize = (int)S7.GetWordAt(S7ItemRead, 2);
|
||||
ItemSize = (int)S7ItemRead.GetWordAt(2);
|
||||
if ((S7ItemRead[1] != TS_ResOctet) && (S7ItemRead[1] != TS_ResReal) && (S7ItemRead[1] != TS_ResBit))
|
||||
ItemSize = ItemSize >> 3;
|
||||
Marshal.Copy(S7ItemRead, 4, Items[c].pData, ItemSize);
|
||||
@@ -1196,7 +1196,7 @@ namespace Sharp7
|
||||
// Fills Header
|
||||
Array.Copy(S7_MWR_HEADER, 0, PDU, 0, S7_MWR_HEADER.Length);
|
||||
ParLength = ItemsCount * S7_MWR_PARAM.Length + 2;
|
||||
S7.SetWordAt(PDU, 13, (ushort)ParLength);
|
||||
PDU.SetWordAt(13, (ushort)ParLength);
|
||||
PDU[18] = (byte)ItemsCount;
|
||||
// Fills Params
|
||||
Offset = S7_MWR_HEADER.Length;
|
||||
@@ -1205,8 +1205,8 @@ namespace Sharp7
|
||||
Array.Copy(S7_MWR_PARAM, 0, S7ParItem, 0, S7_MWR_PARAM.Length);
|
||||
S7ParItem[3] = (byte)Items[c].WordLen;
|
||||
S7ParItem[8] = (byte)Items[c].Area;
|
||||
S7.SetWordAt(S7ParItem, 4, (ushort)Items[c].Amount);
|
||||
S7.SetWordAt(S7ParItem, 6, (ushort)Items[c].DBNumber);
|
||||
S7ParItem.SetWordAt(4, (ushort)Items[c].Amount);
|
||||
S7ParItem.SetWordAt(6, (ushort)Items[c].DBNumber);
|
||||
// Address into the PLC
|
||||
int Address = Items[c].Start;
|
||||
S7ParItem[11] = (byte)(Address & 0x0FF);
|
||||
@@ -1241,9 +1241,9 @@ namespace Sharp7
|
||||
ItemDataSize = Items[c].Amount;
|
||||
|
||||
if ((S7DataItem[1] != TS_ResOctet) && (S7DataItem[1] != TS_ResBit))
|
||||
S7.SetWordAt(S7DataItem, 2, (ushort)(ItemDataSize*8));
|
||||
S7DataItem.SetWordAt(2, (ushort)(ItemDataSize*8));
|
||||
else
|
||||
S7.SetWordAt(S7DataItem, 2, (ushort)ItemDataSize);
|
||||
S7DataItem.SetWordAt(2, (ushort)ItemDataSize);
|
||||
|
||||
Marshal.Copy(Items[c].pData, S7DataItem, 4, ItemDataSize);
|
||||
if (ItemDataSize % 2 != 0)
|
||||
@@ -1260,19 +1260,19 @@ namespace Sharp7
|
||||
if (Offset > _PDULength)
|
||||
return S7Consts.errCliSizeOverPDU;
|
||||
|
||||
S7.SetWordAt(PDU, 2, (ushort)Offset); // Whole size
|
||||
S7.SetWordAt(PDU, 15, (ushort)DataLength); // Whole size
|
||||
PDU.SetWordAt(2, (ushort)Offset); // Whole size
|
||||
PDU.SetWordAt(15, (ushort)DataLength); // Whole size
|
||||
SendPacket(PDU, Offset);
|
||||
|
||||
RecvIsoPacket();
|
||||
if (_LastError==0)
|
||||
{
|
||||
// Check Global Operation Result
|
||||
_LastError = CpuError(S7.GetWordAt(PDU, 17));
|
||||
_LastError = CpuError(PDU.GetWordAt(17));
|
||||
if (_LastError != 0)
|
||||
return _LastError;
|
||||
// Get true ItemsCount
|
||||
int ItemsWritten = S7.GetByteAt(PDU, 20);
|
||||
int ItemsWritten = PDU.GetByteAt(20);
|
||||
if ((ItemsWritten != ItemsCount) || (ItemsWritten > MaxVars))
|
||||
{
|
||||
_LastError = S7Consts.errCliInvalidPlcAnswer;
|
||||
@@ -1429,24 +1429,24 @@ namespace Sharp7
|
||||
int Length = RecvIsoPacket();
|
||||
if (Length > 32) // the minimum expected
|
||||
{
|
||||
ushort Result = S7.GetWordAt(PDU, 27);
|
||||
ushort Result = PDU.GetWordAt(27);
|
||||
if (Result == 0)
|
||||
{
|
||||
Info.BlkFlags= PDU[42];
|
||||
Info.BlkLang = PDU[43];
|
||||
Info.BlkType = PDU[44];
|
||||
Info.BlkNumber = S7.GetWordAt(PDU, 45);
|
||||
Info.LoadSize = S7.GetDIntAt(PDU, 47);
|
||||
Info.CodeDate = SiemensTimestamp(S7.GetWordAt(PDU, 59));
|
||||
Info.IntfDate = SiemensTimestamp(S7.GetWordAt(PDU, 65));
|
||||
Info.SBBLength = S7.GetWordAt(PDU, 67);
|
||||
Info.LocalData = S7.GetWordAt(PDU, 71);
|
||||
Info.MC7Size = S7.GetWordAt(PDU, 73);
|
||||
Info.Author = S7.GetCharsAt(PDU, 75, 8).Trim(new char[]{(char)0});
|
||||
Info.Family = S7.GetCharsAt(PDU, 83, 8).Trim(new char[]{(char)0});
|
||||
Info.Header = S7.GetCharsAt(PDU, 91, 8).Trim(new char[]{(char)0});
|
||||
Info.BlkNumber = PDU.GetWordAt(45);
|
||||
Info.LoadSize = PDU.GetDIntAt(47);
|
||||
Info.CodeDate = SiemensTimestamp(PDU.GetWordAt(59));
|
||||
Info.IntfDate = SiemensTimestamp(PDU.GetWordAt(65));
|
||||
Info.SBBLength = PDU.GetWordAt(67);
|
||||
Info.LocalData = PDU.GetWordAt(71);
|
||||
Info.MC7Size = PDU.GetWordAt(73);
|
||||
Info.Author = PDU.GetCharsAt(75, 8).Trim(new char[]{(char)0});
|
||||
Info.Family = PDU.GetCharsAt(83, 8).Trim(new char[]{(char)0});
|
||||
Info.Header = PDU.GetCharsAt(91, 8).Trim(new char[]{(char)0});
|
||||
Info.Version = PDU[99];
|
||||
Info.CheckSum = S7.GetWordAt(PDU, 101);
|
||||
Info.CheckSum = PDU.GetWordAt(101);
|
||||
}
|
||||
else
|
||||
_LastError = CpuError(Result);
|
||||
@@ -1558,9 +1558,9 @@ namespace Sharp7
|
||||
Length = RecvIsoPacket();
|
||||
if (Length > 30) // the minimum expected
|
||||
{
|
||||
if ((S7.GetWordAt(PDU, 27) == 0) && (PDU[29] == 0xFF))
|
||||
if ((PDU.GetWordAt(27) == 0) && (PDU[29] == 0xFF))
|
||||
{
|
||||
DT = S7.GetDateTimeAt(PDU, 35);
|
||||
DT = PDU.GetDateTimeAt(35);
|
||||
}
|
||||
else
|
||||
_LastError = S7Consts.errCliInvalidPlcAnswer;
|
||||
@@ -1582,14 +1582,14 @@ namespace Sharp7
|
||||
Time_ms = 0;
|
||||
int Elapsed = Environment.TickCount;
|
||||
|
||||
S7.SetDateTimeAt(S7_SET_DT, 31, DT);
|
||||
S7_SET_DT.SetDateTimeAt(31, DT);
|
||||
SendPacket(S7_SET_DT);
|
||||
if (_LastError == 0)
|
||||
{
|
||||
Length = RecvIsoPacket();
|
||||
if (Length > 30) // the minimum expected
|
||||
{
|
||||
if (S7.GetWordAt(PDU, 27) != 0)
|
||||
if (PDU.GetWordAt(27) != 0)
|
||||
_LastError = S7Consts.errCliInvalidPlcAnswer;
|
||||
}
|
||||
else
|
||||
@@ -1619,7 +1619,7 @@ namespace Sharp7
|
||||
_LastError = ReadSZL(0x0011, 0x000, ref SZL, ref Size);
|
||||
if (_LastError == 0)
|
||||
{
|
||||
Info.Code = S7.GetCharsAt(SZL.Data, 2, 20);
|
||||
Info.Code = SZL.Data.GetCharsAt(2, 20);
|
||||
Info.V1 = SZL.Data[Size - 3];
|
||||
Info.V2 = SZL.Data[Size - 2];
|
||||
Info.V3 = SZL.Data[Size - 1];
|
||||
@@ -1638,11 +1638,11 @@ namespace Sharp7
|
||||
_LastError = ReadSZL(0x001C, 0x000, ref SZL, ref Size);
|
||||
if (_LastError == 0)
|
||||
{
|
||||
Info.ModuleTypeName = S7.GetCharsAt(SZL.Data, 172, 32);
|
||||
Info.SerialNumber = S7.GetCharsAt(SZL.Data, 138, 24);
|
||||
Info.ASName = S7.GetCharsAt(SZL.Data, 2, 24);
|
||||
Info.Copyright = S7.GetCharsAt(SZL.Data, 104, 26);
|
||||
Info.ModuleName = S7.GetCharsAt(SZL.Data, 36, 24);
|
||||
Info.ModuleTypeName = SZL.Data.GetCharsAt(172, 32);
|
||||
Info.SerialNumber = SZL.Data.GetCharsAt(138, 24);
|
||||
Info.ASName = SZL.Data.GetCharsAt(2, 24);
|
||||
Info.Copyright = SZL.Data.GetCharsAt(104, 26);
|
||||
Info.ModuleName = SZL.Data.GetCharsAt(36, 24);
|
||||
}
|
||||
if (_LastError == 0)
|
||||
Time_ms = Environment.TickCount - Elapsed;
|
||||
@@ -1658,10 +1658,10 @@ namespace Sharp7
|
||||
_LastError = ReadSZL(0x0131, 0x001, ref SZL, ref Size);
|
||||
if (_LastError == 0)
|
||||
{
|
||||
Info.MaxPduLength = S7.GetIntAt(PDU, 2);
|
||||
Info.MaxConnections = S7.GetIntAt(PDU, 4);
|
||||
Info.MaxMpiRate = S7.GetDIntAt(PDU, 6);
|
||||
Info.MaxBusRate = S7.GetDIntAt(PDU, 10);
|
||||
Info.MaxPduLength = PDU.GetIntAt(2);
|
||||
Info.MaxConnections = PDU.GetIntAt(4);
|
||||
Info.MaxMpiRate = PDU.GetDIntAt(6);
|
||||
Info.MaxBusRate = PDU.GetDIntAt(10);
|
||||
}
|
||||
if (_LastError == 0)
|
||||
Time_ms = Environment.TickCount - Elapsed;
|
||||
@@ -1687,14 +1687,14 @@ namespace Sharp7
|
||||
{
|
||||
if (First)
|
||||
{
|
||||
S7.SetWordAt(S7_SZL_FIRST, 11, ++Seq_out);
|
||||
S7.SetWordAt(S7_SZL_FIRST, 29, (ushort)ID);
|
||||
S7.SetWordAt(S7_SZL_FIRST, 31, (ushort)Index);
|
||||
S7_SZL_FIRST.SetWordAt(11, ++Seq_out);
|
||||
S7_SZL_FIRST.SetWordAt(29, (ushort)ID);
|
||||
S7_SZL_FIRST.SetWordAt(31, (ushort)Index);
|
||||
SendPacket(S7_SZL_FIRST);
|
||||
}
|
||||
else
|
||||
{
|
||||
S7.SetWordAt(S7_SZL_NEXT, 11, ++Seq_out);
|
||||
S7_SZL_NEXT.SetWordAt(11, ++Seq_out);
|
||||
PDU[24] = (byte)Seq_in;
|
||||
SendPacket(S7_SZL_NEXT);
|
||||
}
|
||||
@@ -1708,14 +1708,14 @@ namespace Sharp7
|
||||
{
|
||||
if (Length > 32) // the minimum expected
|
||||
{
|
||||
if ((S7.GetWordAt(PDU, 27) == 0) && (PDU[29] == (byte)0xFF))
|
||||
if ((PDU.GetWordAt(27) == 0) && (PDU[29] == (byte)0xFF))
|
||||
{
|
||||
// Gets Amount of this slice
|
||||
DataSZL = S7.GetWordAt(PDU, 31) - 8; // Skips extra params (ID, Index ...)
|
||||
DataSZL = PDU.GetWordAt(31) - 8; // Skips extra params (ID, Index ...)
|
||||
Done = PDU[26] == 0x00;
|
||||
Seq_in = (byte)PDU[24]; // Slice sequence
|
||||
SZL.Header.LENTHDR = S7.GetWordAt(PDU, 37);
|
||||
SZL.Header.N_DR = S7.GetWordAt(PDU, 39);
|
||||
SZL.Header.LENTHDR = PDU.GetWordAt(37);
|
||||
SZL.Header.N_DR = PDU.GetWordAt(39);
|
||||
Array.Copy(PDU, 41, SZL.Data, Offset, DataSZL);
|
||||
// SZL.Copy(PDU, 41, Offset, DataSZL);
|
||||
Offset += DataSZL;
|
||||
@@ -1731,10 +1731,10 @@ namespace Sharp7
|
||||
{
|
||||
if (Length > 32) // the minimum expected
|
||||
{
|
||||
if ((S7.GetWordAt(PDU, 27) == 0) && (PDU[29] == (byte)0xFF))
|
||||
if ((PDU.GetWordAt(27) == 0) && (PDU[29] == (byte)0xFF))
|
||||
{
|
||||
// Gets Amount of this slice
|
||||
DataSZL = S7.GetWordAt(PDU, 31);
|
||||
DataSZL = PDU.GetWordAt(31);
|
||||
Done = PDU[26] == 0x00;
|
||||
Seq_in = (byte)PDU[24]; // Slice sequence
|
||||
Array.Copy(PDU, 37, SZL.Data, Offset, DataSZL);
|
||||
@@ -1876,7 +1876,7 @@ namespace Sharp7
|
||||
int Length = RecvIsoPacket();
|
||||
if (Length > 30) // the minimum expected
|
||||
{
|
||||
ushort Result = S7.GetWordAt(PDU, 27);
|
||||
ushort Result = PDU.GetWordAt(27);
|
||||
if (Result == 0)
|
||||
{
|
||||
switch (PDU[44])
|
||||
@@ -1918,7 +1918,7 @@ namespace Sharp7
|
||||
_LastError = 0;
|
||||
int Elapsed = Environment.TickCount;
|
||||
// Encodes the Password
|
||||
S7.SetCharsAt(pwd, 0, Password);
|
||||
pwd.SetCharsAt(0, Password);
|
||||
pwd[0] = (byte)(pwd[0] ^ 0x55);
|
||||
pwd[1] = (byte)(pwd[1] ^ 0x55);
|
||||
for (int c = 2; c < 8; c++)
|
||||
@@ -1933,7 +1933,7 @@ namespace Sharp7
|
||||
Length = RecvIsoPacket();
|
||||
if (Length > 32) // the minimum expected
|
||||
{
|
||||
ushort Result = S7.GetWordAt(PDU, 27);
|
||||
ushort Result = PDU.GetWordAt(27);
|
||||
if (Result != 0)
|
||||
_LastError = CpuError(Result);
|
||||
}
|
||||
@@ -1956,7 +1956,7 @@ namespace Sharp7
|
||||
Length = RecvIsoPacket();
|
||||
if (Length > 30) // the minimum expected
|
||||
{
|
||||
ushort Result = S7.GetWordAt(PDU, 27);
|
||||
ushort Result = PDU.GetWordAt(27);
|
||||
if (Result != 0)
|
||||
_LastError = CpuError(Result);
|
||||
}
|
||||
@@ -1974,11 +1974,11 @@ namespace Sharp7
|
||||
_LastError = ReadSZL(0x0232, 0x0004, ref SZL, ref Size);
|
||||
if (_LastError == 0)
|
||||
{
|
||||
Protection.sch_schal = S7.GetWordAt(SZL.Data, 2);
|
||||
Protection.sch_par = S7.GetWordAt(SZL.Data, 4);
|
||||
Protection.sch_rel = S7.GetWordAt(SZL.Data, 6);
|
||||
Protection.bart_sch = S7.GetWordAt(SZL.Data, 8);
|
||||
Protection.anl_sch = S7.GetWordAt(SZL.Data, 10);
|
||||
Protection.sch_schal = SZL.Data.GetWordAt(2);
|
||||
Protection.sch_par = SZL.Data.GetWordAt(4);
|
||||
Protection.sch_rel = SZL.Data.GetWordAt(6);
|
||||
Protection.bart_sch = SZL.Data.GetWordAt(8);
|
||||
Protection.anl_sch = SZL.Data.GetWordAt(10);
|
||||
}
|
||||
return _LastError;
|
||||
}
|
||||
@@ -1992,7 +1992,7 @@ namespace Sharp7
|
||||
Time_ms = 0;
|
||||
int Elapsed = Environment.TickCount;
|
||||
Array.Copy(TPKT_ISO, 0, PDU, 0, TPKT_ISO.Length);
|
||||
S7.SetWordAt(PDU, 2, (ushort)(Size + TPKT_ISO.Length));
|
||||
PDU.SetWordAt(2, (ushort)(Size + TPKT_ISO.Length));
|
||||
try
|
||||
{
|
||||
Array.Copy(Buffer, 0, PDU, TPKT_ISO.Length, Size);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Sharp7
|
||||
private bool AdjustWordLength(int Area, ref int WordLen, ref int Amount, ref int Start)
|
||||
{
|
||||
// Calc Word size
|
||||
int WordSize = S7.DataSizeByte(WordLen);
|
||||
int WordSize = WordLen.DataSizeByte();
|
||||
if (WordSize == 0)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user