mirror of
https://github.com/S7NetPlus/s7netplus.git
synced 2026-02-17 22:38:27 +08:00
Write struct and multiple bytes from a specific start bytes address.
This commit is contained in:
@@ -803,9 +803,14 @@ namespace S7.Net
|
||||
}
|
||||
|
||||
public ErrorCode WriteStruct(object structValue, int db)
|
||||
{
|
||||
return WriteStruct(structValue, db, 0);
|
||||
}
|
||||
|
||||
public ErrorCode WriteStruct(object structValue, int db, int startByteAdr)
|
||||
{
|
||||
var bytes = Types.Struct.ToBytes(structValue).ToList();
|
||||
var errCode = WriteMultipleBytes(bytes, db);
|
||||
var errCode = WriteMultipleBytes(bytes, db, startByteAdr);
|
||||
return errCode;
|
||||
}
|
||||
|
||||
@@ -823,9 +828,14 @@ namespace S7.Net
|
||||
/// <param name="db">The DB number</param>
|
||||
/// <returns>ErrorCode when writing (NoError if everything was ok)</returns>
|
||||
private ErrorCode WriteMultipleBytes(List<byte> bytes, int db)
|
||||
{
|
||||
return WriteMultipleBytes(bytes, db, 0);
|
||||
}
|
||||
|
||||
private ErrorCode WriteMultipleBytes(List<byte> bytes, int db, int startByteAdr)
|
||||
{
|
||||
ErrorCode errCode = ErrorCode.NoError;
|
||||
int index = 0;
|
||||
int index = startByteAdr;
|
||||
try
|
||||
{
|
||||
while (bytes.Count > 0)
|
||||
|
||||
Reference in New Issue
Block a user