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