I have written a C# application to connect with the linux application running on virtual machine and i am able to connect and execute different methods.
I am not able to catch the signal emitted by my Linux application even though i can see it in the dubs-monitor.
C# Code:
using System;
using NDesk.DBus;
using org.freedesktop.DBus;
using System.Threading;
namespace DBusGeneric
{
public class Program
{
public static Connection conn;
public static Test Store;
public static string InterfaceName = "org.gnome.Shell.SearchProvider2";
public delegate void OnEmitSignalHandler();
static void Main(string[] args)
{
conn = Connection.Open("tcp:host=IP Address,port=Port No");
Thread thread = new Thread(MainLoop);
thread.Start();
string name = "org.freedesktop.DBus";
ObjectPath opath = new ObjectPath("/");
IBus bus = conn.GetObject<IBus>(name, opath);
bus.Hello();
string busName = "org.example.TestServer";
ObjectPath objPath = new ObjectPath("/org/example/TestObject");
Introspectable intr = conn.GetObject<Introspectable>(busName, objPath);
string xmlData = intr.Introspect(); ;
Console.WriteLine("\n");
Console.WriteLine("xmlData: " + xmlData);
Console.WriteLine("\n");
Store = conn.GetObject<Test>(busName, objPath);
Store.OnEmitSignal += Store_OnEmitSignal;
Store.EmitSignal();
Store.Ping();
Console.ReadKey();
}
public static void MainLoop()
{
while(true)
{
conn.Iterate();
}
}
private static void Store_OnEmitSignal()
{
Console.WriteLine("/////////////////// Received Signal ///////////////////////");
}
[Interface("org.example.TestInterface")]
public interface Test
{
event OnEmitSignalHandler OnEmitSignal;
void EmitSignal();
string Ping();
}
}
}
I have written a C# application to connect with the linux application running on virtual machine and i am able to connect and execute different methods. I am not able to catch the signal emitted by my Linux application even though i can see it in the dubs-monitor.
C# Code:
dbus-monitor (Virtual Machine)
It is visible that when i call EmitSignal method, OnEmitSignal is being emitted but i cant see it on the windows side.
I tried to do the Glib main loop integration but i could not build and use the reference of Ndesk.Dbus.Glib.
Can anyone help me on how can i achieve this and also capture signals from VM on my windows system.