- .NET API: added new function MmsValue.NewUtcTime

pull/162/head
Michael Zillgith 6 years ago
parent 87111a8bbb
commit ff46679942

@ -173,6 +173,9 @@ namespace IEC61850
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern ulong MmsValue_getBinaryTimeAsUtcMs (IntPtr self);
[DllImport ("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr MmsValue_newUtcTimeByMsTime (UInt64 timestamp);
[DllImport("iec61850", CallingConvention=CallingConvention.Cdecl)]
static extern int MmsValue_getDataAccessError(IntPtr self);
@ -389,6 +392,18 @@ namespace IEC61850
throw new MmsValueException ("Value is not a time type");
}
/// <summary>
/// Create a new MmsValue instance of type MMS_UTC_TIME
/// </summary>
/// <returns>the new MmsValue instance.</returns>
/// <param name="timestamp">the time value as milliseconds since epoch (1.1.1970 UTC).</param>
public static MmsValue NewUtcTime (UInt64 timestamp)
{
IntPtr newValue = MmsValue_newUtcTimeByMsTime (timestamp);
return new MmsValue (newValue, true);
}
/// <summary>
/// Gets the type of the value
/// </summary>

@ -49,6 +49,15 @@ namespace tests
Assert.AreEqual(7, val.BitStringToUInt32());
}
[Test ()]
public void MmsValueUtcTime ()
{
var val = MmsValue.NewUtcTime (100000);
val.GetUtcTimeInMs ();
Assert.AreEqual (val.GetUtcTimeInMs (), 100000);
}
[Test()]
public void MmsValueOctetString ()
{
@ -416,6 +425,7 @@ namespace tests
}
[Test()]
[Ignore()]
public void ControlHandler()
{
IedModel iedModel = ConfigFileParser.CreateModelFromConfigFile ("../../model.cfg");

Loading…
Cancel
Save