diff --git a/dotnet/IEC61850forCSharp/SampledValuesSubscriber.cs b/dotnet/IEC61850forCSharp/SampledValuesSubscriber.cs
index 139bda67..7375367d 100644
--- a/dotnet/IEC61850forCSharp/SampledValuesSubscriber.cs
+++ b/dotnet/IEC61850forCSharp/SampledValuesSubscriber.cs
@@ -136,6 +136,9 @@ namespace IEC61850
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
private static extern IntPtr SVSubscriber_create([Out] byte[] ethAddr, UInt16 appID);
+ [DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
+ private static extern IntPtr SVSubscriber_create(IntPtr ethAddr, UInt16 appID);
+
[DllImport("iec61850", CallingConvention = CallingConvention.Cdecl)]
private static extern void SVSubscriber_setListener(IntPtr self, InternalSVUpdateListener listener, IntPtr parameter);
@@ -168,10 +171,15 @@ namespace IEC61850
public SVSubscriber(byte[] ethAddr, UInt16 appID)
{
- if (ethAddr.Length != 6)
- throw new ArgumentException ("ethAddr argument has to be of 6 byte size");
+ if (ethAddr == null) {
+ self = SVSubscriber_create (IntPtr.Zero, appID);
+ } else {
+
+ if (ethAddr.Length != 6)
+ throw new ArgumentException ("ethAddr argument has to be of 6 byte size");
- self = SVSubscriber_create (ethAddr, appID);
+ self = SVSubscriber_create (ethAddr, appID);
+ }
}
public void SetListener(SVUpdateListener listener, object parameter)
@@ -371,6 +379,16 @@ namespace IEC61850
return SVSubscriber_ASDU_getINT64U (self, index);
}
+ public float GetFLOAT32(int index)
+ {
+ return SVSubscriber_ASDU_getFLOAT32 (self, index);
+ }
+
+ public double GetFLOAT64(int index)
+ {
+ return SVSubscriber_ASDU_getFLOAT64 (self, index);
+ }
+
///
/// Gets the size of the payload data in bytes. The payload comprises the data set data.
///
diff --git a/dotnet/dotnet.sln b/dotnet/dotnet.sln
index 59941c71..067ccaf9 100644
--- a/dotnet/dotnet.sln
+++ b/dotnet/dotnet.sln
@@ -40,6 +40,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tls_client_example", "tls_c
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "goose_subscriber", "goose_subscriber\goose_subscriber.csproj", "{1285372C-2E62-494A-A661-8D5D3873318C}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "sv_subscriber", "sv_subscriber\sv_subscriber.csproj", "{44651D2D-3252-4FD5-8B8B-5552DBE1B499}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -62,6 +64,10 @@ Global
{2A226B6D-1D1F-4BFE-B8CC-158116F71270}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A226B6D-1D1F-4BFE-B8CC-158116F71270}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A226B6D-1D1F-4BFE-B8CC-158116F71270}.Release|Any CPU.Build.0 = Release|Any CPU
+ {44651D2D-3252-4FD5-8B8B-5552DBE1B499}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {44651D2D-3252-4FD5-8B8B-5552DBE1B499}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {44651D2D-3252-4FD5-8B8B-5552DBE1B499}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {44651D2D-3252-4FD5-8B8B-5552DBE1B499}.Release|Any CPU.Build.0 = Release|Any CPU
{59B85486-F48D-4978-BD35-8F5C3A8288D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{59B85486-F48D-4978-BD35-8F5C3A8288D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{59B85486-F48D-4978-BD35-8F5C3A8288D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/dotnet/sv_subscriber/Program.cs b/dotnet/sv_subscriber/Program.cs
new file mode 100644
index 00000000..9865356d
--- /dev/null
+++ b/dotnet/sv_subscriber/Program.cs
@@ -0,0 +1,70 @@
+using System;
+
+using IEC61850.SV.Subscriber;
+using IEC61850.Common;
+using System.Threading;
+
+namespace sv_subscriber
+{
+ class MainClass
+ {
+ private static void svUpdateListener(SVSubscriber subscriber, object parameter, SVSubscriberASDU asdu)
+ {
+ Console.WriteLine ("svUpdateListener called");
+
+ string svID = asdu.GetSvId ();
+
+ if (svID != null)
+ Console.WriteLine (" svID=" + svID);
+
+ Console.WriteLine (" smpCnt: " + asdu.GetSmpCnt ());
+ Console.WriteLine (" confRev: " + asdu.GetConfRev ());
+
+ if (asdu.GetDataSize () >= 8) {
+ Console.WriteLine (" DATA[0]: " + asdu.GetFLOAT32(0));
+ Console.WriteLine (" DATA[1]: " + asdu.GetFLOAT32(4));
+ }
+
+ }
+
+ public static void Main (string[] args)
+ {
+ Console.WriteLine ("Starting SV subscriber");
+
+ SVReceiver receiver = new SVReceiver ();
+
+ if (args.Length > 0) {
+ receiver.SetInterfaceId (args [0]);
+ }
+
+ SVSubscriber subscriber = new SVSubscriber (null, 0x4000);
+
+ subscriber.SetListener (svUpdateListener, null);
+
+ receiver.AddSubscriber (subscriber);
+
+ receiver.Start ();
+
+ if (receiver.IsRunning ()) {
+
+ bool running = true;
+
+ /* run until Ctrl-C is pressed */
+ Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) {
+ e.Cancel = true;
+ running = false;
+ };
+
+ while (running) {
+ Thread.Sleep (100);
+ }
+
+ receiver.Stop ();
+ } else
+ Console.WriteLine ("Failed to start SV receiver. Running as root?");
+
+ receiver.Dispose ();
+
+ }
+ }
+}
diff --git a/dotnet/sv_subscriber/Properties/AssemblyInfo.cs b/dotnet/sv_subscriber/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..ae4b1a2a
--- /dev/null
+++ b/dotnet/sv_subscriber/Properties/AssemblyInfo.cs
@@ -0,0 +1,27 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle ("sv_subscriber")]
+[assembly: AssemblyDescription ("")]
+[assembly: AssemblyConfiguration ("")]
+[assembly: AssemblyCompany ("")]
+[assembly: AssemblyProduct ("")]
+[assembly: AssemblyCopyright ("mzillgit")]
+[assembly: AssemblyTrademark ("")]
+[assembly: AssemblyCulture ("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion ("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
+
diff --git a/dotnet/sv_subscriber/sv_subscriber.csproj b/dotnet/sv_subscriber/sv_subscriber.csproj
new file mode 100644
index 00000000..dc8f53fe
--- /dev/null
+++ b/dotnet/sv_subscriber/sv_subscriber.csproj
@@ -0,0 +1,44 @@
+
+
+
+ Debug
+ AnyCPU
+ {44651D2D-3252-4FD5-8B8B-5552DBE1B499}
+ Exe
+ sv_subscriber
+ sv_subscriber
+ v4.5
+
+
+ true
+ full
+ false
+ bin\Debug
+ DEBUG;
+ prompt
+ 4
+ true
+
+
+ full
+ true
+ bin\Release
+ prompt
+ 4
+ true
+
+
+
+
+
+
+
+
+
+
+
+ {C35D624E-5506-4560-8074-1728F1FA1A4D}
+ IEC61850.NET
+
+
+
\ No newline at end of file