Merge pull request #211 from andy1547/feature/add-iedserver-set-attribute-methods

Added SetBoolean and SetInt32 methods for dotnet.
pull/212/head
Michael Zillgith 6 years ago committed by GitHub
commit ca43b02095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -54,7 +54,10 @@ namespace IEC61850
[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);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern void MmsValue_setBoolean(IntPtr self, [MarshalAs(UnmanagedType.I1)] bool value);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern UInt32 MmsValue_getBitStringAsInteger (IntPtr self); static extern UInt32 MmsValue_getBitStringAsInteger (IntPtr self);
@ -81,6 +84,9 @@ namespace IEC61850
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern Int32 MmsValue_toInt32 (IntPtr self); static extern Int32 MmsValue_toInt32 (IntPtr self);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern void MmsValue_setInt32(IntPtr self, int value);
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)] [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
static extern Int64 MmsValue_toInt64 (IntPtr self); static extern Int64 MmsValue_toInt64 (IntPtr self);
@ -737,19 +743,34 @@ namespace IEC61850
throw new MmsValueException ("Value type is not integer"); throw new MmsValueException ("Value type is not integer");
return MmsValue_toInt32 (valueReference); return MmsValue_toInt32 (valueReference);
} }
/// <summary>
/// Sets the 32 bit signed integer.
/// </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 SetInt32(int value)
{
if (GetType() != MmsType.MMS_INTEGER)
throw new MmsValueException("Value type is not integer");
/// <summary> MmsValue_setInt32(valueReference, value);
/// Return the value as 64 bit signed integer. }
/// </summary>
/// <description> /// <summary>
/// Return the value as 64 bit signed integer (Int64). /// Return the value as 64 bit signed integer.
/// The value has to be of type MMS_INTEGER. /// </summary>
/// </description> /// <description>
/// <returns> /// Return the value as 64 bit signed integer (Int64).
/// the value if the object as 64 bit signed integer /// The value has to be of type MMS_INTEGER.
/// </returns> /// </description>
/// <exception cref="MmsValueException">This exception is thrown if the value has the wrong type.</exception> /// <returns>
/// the value if the object as 64 bit signed integer
/// </returns>
/// <exception cref="MmsValueException">This exception is thrown if the value has the wrong type.</exception>
public Int64 ToInt64 () public Int64 ToInt64 ()
{ {
if (GetType () != MmsType.MMS_INTEGER) if (GetType () != MmsType.MMS_INTEGER)
@ -858,15 +879,30 @@ namespace IEC61850
return MmsValue_getBoolean (valueReference); return MmsValue_getBoolean (valueReference);
else else
throw new MmsValueException ("Value type is not boolean"); throw new MmsValueException ("Value type is not boolean");
} }
/// <summary>
/// Sets the boolean value of an MMS_BOOLEAN 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 SetBoolean(bool value)
{
if (GetType() != MmsType.MMS_BOOLEAN)
throw new MmsValueException("Value type is not boolean");
/// <summary> MmsValue_setBoolean(valueReference, value);
/// Gets the float value of an MMS_FLOAT instance }
/// </summary>
/// <returns> /// <summary>
/// The float value /// Gets the float value of an MMS_FLOAT instance
/// </returns> /// </summary>
/// <exception cref="MmsValueException">This exception is thrown if the value has the wrong type.</exception> /// <returns>
/// The float value
/// </returns>
/// <exception cref="MmsValueException">This exception is thrown if the value has the wrong type.</exception>
public float ToFloat () public float ToFloat ()
{ {
if (GetType () == MmsType.MMS_FLOAT) if (GetType () == MmsType.MMS_FLOAT)

Loading…
Cancel
Save