|
|
@ -44,9 +44,15 @@ namespace IEC61850
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
static extern float MmsValue_toFloat (IntPtr self);
|
|
|
|
static extern float MmsValue_toFloat (IntPtr self);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
|
|
|
static extern void MmsValue_setFloat (IntPtr self, float value);
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
static extern double MmsValue_toDouble (IntPtr self);
|
|
|
|
static extern double MmsValue_toDouble (IntPtr self);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
|
|
|
static extern void MmsValue_setDouble (IntPtr self, double newFloatValue);
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
[return: MarshalAs(UnmanagedType.I1)]
|
|
|
|
[return: MarshalAs(UnmanagedType.I1)]
|
|
|
|
static extern bool MmsValue_getBoolean (IntPtr self);
|
|
|
|
static extern bool MmsValue_getBoolean (IntPtr self);
|
|
|
@ -91,6 +97,9 @@ namespace IEC61850
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
static extern ulong MmsValue_getUtcTimeInMs (IntPtr self);
|
|
|
|
static extern ulong MmsValue_getUtcTimeInMs (IntPtr self);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
|
|
|
static extern void MmsValue_setUtcTimeMs (IntPtr self, ulong timeval);
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
static extern ulong MmsValue_getUtcTimeInMsWithUs(IntPtr self, [Out] uint usec);
|
|
|
|
static extern ulong MmsValue_getUtcTimeInMsWithUs(IntPtr self, [Out] uint usec);
|
|
|
|
|
|
|
|
|
|
|
@ -146,13 +155,14 @@ namespace IEC61850
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
static extern void MmsValue_setBinaryTime (IntPtr self, UInt64 timestamp);
|
|
|
|
static extern void MmsValue_setBinaryTime (IntPtr self, UInt64 timestamp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO make internal
|
|
|
|
internal MmsValue (IntPtr value)
|
|
|
|
public MmsValue (IntPtr value)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
valueReference = value;
|
|
|
|
valueReference = value;
|
|
|
|
this.responsableForDeletion = false;
|
|
|
|
this.responsableForDeletion = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO make internal
|
|
|
|
internal MmsValue (IntPtr value, bool responsableForDeletion)
|
|
|
|
internal MmsValue (IntPtr value, bool responsableForDeletion)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
valueReference = value;
|
|
|
|
valueReference = value;
|
|
|
@ -395,6 +405,22 @@ namespace IEC61850
|
|
|
|
throw new MmsValueException ("Value is not a time type");
|
|
|
|
throw new MmsValueException ("Value is not a time type");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Sets the timestamp value as UTC time in ms.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <description>
|
|
|
|
|
|
|
|
/// Sets the value as milliseconds since epoch (1.1.1970 UTC).
|
|
|
|
|
|
|
|
/// The value has to be of type MMS_UTC_TIME.
|
|
|
|
|
|
|
|
/// </description>
|
|
|
|
|
|
|
|
/// <exception cref="MmsValueException">This exception is thrown if the value has the wrong type.</exception>
|
|
|
|
|
|
|
|
public void SetUtcTimeMs(ulong timeval)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (GetType () == MmsType.MMS_UTC_TIME) {
|
|
|
|
|
|
|
|
MmsValue_setUtcTimeMs(valueReference, timeval);
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
throw new MmsValueException ("Value is not a time type");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the timestamp value as UTC time in ms.
|
|
|
|
/// Gets the timestamp value as UTC time in ms.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -616,6 +642,21 @@ namespace IEC61850
|
|
|
|
throw new MmsValueException ("Value type is not float");
|
|
|
|
throw new MmsValueException ("Value type is not float");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Sets the float value of an MMS_FLOAT instance
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name='value'>
|
|
|
|
|
|
|
|
/// the new value to set
|
|
|
|
|
|
|
|
/// </param>
|
|
|
|
|
|
|
|
/// <exception cref="MmsValueException">This exception is thrown if the value has the wrong type.</exception>
|
|
|
|
|
|
|
|
public void SetFloat (float value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (GetType () == MmsType.MMS_FLOAT)
|
|
|
|
|
|
|
|
MmsValue_setFloat (valueReference, value);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
throw new MmsValueException ("Value type is not float");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the double value of an MMS_FLOAT instance
|
|
|
|
/// Gets the double value of an MMS_FLOAT instance
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -631,6 +672,21 @@ namespace IEC61850
|
|
|
|
throw new MmsValueException ("Value type is not float");
|
|
|
|
throw new MmsValueException ("Value type is not float");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Sets the float/double value of an MMS_FLOAT instance
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name='value'>
|
|
|
|
|
|
|
|
/// the new value to set
|
|
|
|
|
|
|
|
/// </param>
|
|
|
|
|
|
|
|
/// <exception cref="MmsValueException">This exception is thrown if the value has the wrong type.</exception>
|
|
|
|
|
|
|
|
public void SetDouble (double value)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (GetType () == MmsType.MMS_FLOAT)
|
|
|
|
|
|
|
|
MmsValue_setDouble (valueReference, value);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
throw new MmsValueException ("Value type is not float");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool Equals (object obj)
|
|
|
|
public override bool Equals (object obj)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
MmsValue otherValue = (MmsValue) obj;
|
|
|
|
MmsValue otherValue = (MmsValue) obj;
|
|
|
|