Hook up DTL to VarType enum and PLCHelper.

This commit is contained in:
Serge Camille
2020-08-16 22:36:23 +02:00
parent 5d59c8284d
commit 6614c7330a
3 changed files with 19 additions and 1 deletions

View File

@@ -186,6 +186,11 @@
/// <summary>
/// DateTIme variable type
/// </summary>
DateTime
DateTime,
/// <summary>
/// DTL variable type
/// </summary>
Dtl
}
}

View File

@@ -156,6 +156,15 @@ namespace S7.Net
{
return DateTime.ToArray(bytes);
}
case VarType.Dtl:
if (varCount == 1)
{
return Dtl.FromByteArray(bytes);
}
else
{
return Dtl.ToArray(bytes);
}
default:
return null;
}
@@ -190,6 +199,8 @@ namespace S7.Net
return varCount * 4;
case VarType.DateTime:
return varCount * 8;
case VarType.Dtl:
return varCount * 12;
default:
return 0;
}

View File

@@ -64,6 +64,8 @@ namespace S7.Net.Protocol
return Types.String.ToByteArray(stringVal, stringVal.Length);
case "DateTime[]":
return Types.DateTime.ToByteArray((System.DateTime[]) value);
case "Dtl[]":
return Types.Dtl.ToByteArray((System.DateTime[])value);
default:
throw new InvalidVariableTypeException();
}