- added MmsValue_setUtcTimeQuality to vs def files

- added GetUtcTimeQuality and SetUtcTimeQuality to the C# API
pull/6/head
Michael Zillgith 9 years ago
parent 8864bdb02d
commit 24e1c902e4

@ -103,6 +103,12 @@ namespace IEC61850
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern ulong MmsValue_getUtcTimeInMsWithUs(IntPtr self, [Out] uint usec);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern byte MmsValue_getUtcTimeQuality (IntPtr self);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern void MmsValue_setUtcTimeQuality (IntPtr self, byte timeQuality);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern UInt32 MmsValue_toUnixTimestamp (IntPtr self);
@ -467,6 +473,44 @@ namespace IEC61850
throw new MmsValueException("Value is not a time type");
}
/// <summary>
/// Gets quality flags of an UTC timestamp.
/// </summary>
/// <description>
/// Meaning of the bits in the timeQuality byte:
/// bit 7 = leapSecondsKnown
/// bit 6 = clockFailure
/// bit 5 = clockNotSynchronized
/// bit 0-4 = subsecond time accuracy (number of significant bits of subsecond time)
/// </description>
/// <returns>The UTC time quality.</returns>
public byte GetUtcTimeQuality()
{
if (GetType() == MmsType.MMS_UTC_TIME)
return MmsValue_getUtcTimeQuality(valueReference);
else
throw new MmsValueException("Value is not a time type");
}
/// <summary>
/// Sets the quality flags of an UTC timestamp
/// </summary>
/// <description>
/// Meaning of the bits in the timeQuality byte:
/// bit 7 = leapSecondsKnown
/// bit 6 = clockFailure
/// bit 5 = clockNotSynchronized
/// bit 0-4 = subsecond time accuracy (number of significant bits of subsecond time)
/// </description>
/// <param name="timeQuality">Time quality.</param>
public void SetUtcTimeQuality(byte timeQuality)
{
if (GetType () == MmsType.MMS_UTC_TIME)
MmsValue_setUtcTimeQuality (valueReference, timeQuality);
else
throw new MmsValueException("Value is not a time type");
}
/// <summary>
/// Convert a millisecond time (milliseconds since epoch) to DataTimeOffset
/// </summary>

@ -523,4 +523,5 @@ EXPORTS
MmsValue_getUtcTimeQuality
MmsConnection_getMmsConnectionParameters
IedServer_updateVisibleStringAttributeValue
MmsValue_setUtcTimeQuality

@ -600,4 +600,5 @@ EXPORTS
MmsValue_getUtcTimeQuality
MmsConnection_getMmsConnectionParameters
IedServer_updateVisibleStringAttributeValue
MmsValue_setUtcTimeQuality

Loading…
Cancel
Save