public static void utc_eldbus_introspect_p() { var conn = new eldbus.Connection(eldbus.Connection.Type.System); var obj = new eldbus.Object(conn, DBusBus, DBusPath); IntPtr timeout = IntPtr.Zero; int messageCapture = 0; bool isSuccess = false; eldbus.MessageDelegate objectMessageCb = delegate(eldbus.Message msg, eldbus.Pending p) { try { if (timeout != IntPtr.Zero) { ecore_timer_del(timeout); timeout = IntPtr.Zero; } string errname; string errmsg; if (messageCapture == 5) { if (!msg.GetError(out errname, out errmsg)) { string txt; if (msg.Get(out txt)) { if (!String.IsNullOrEmpty(txt)) { isSuccess = true; } } } } } finally { ecore_main_loop_quit(); } }; eldbus.Pending pending = obj.Introspect(objectMessageCb); AssertEquals(pending.GetMethod(), "Introspect"); timeout = ecore_timer_add(2.0, GetEcoreLoopClose(), IntPtr.Zero); Assert(timeout != IntPtr.Zero); messageCapture = 5; ecore_main_loop_begin(); Assert(isSuccess, "Method Introspect is not call"); obj.Dispose(); conn.Dispose(); }
eldbus.Pending Send(eldbus.Message msg, eldbus.MessageDelegate dlgt = null, double timeout = -1) { CheckHandle(); if (msg == null) { throw new ArgumentNullException(nameof(msg)); } // Native send() takes ownership of the message. We ref here to keep the IDisposable // behavior simpler and keeping the original object alive in case the user wants. msg.Ref(); IntPtr cb_wrapper = dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr(); IntPtr cb_data = dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt); var pending_hdl = eldbus_proxy_send(Handle, msg.Handle, cb_wrapper, cb_data, timeout); if (pending_hdl == IntPtr.Zero) { throw new SEHException("Eldbus: could not get `Pending' object from eldbus_proxy_send"); } return(new eldbus.Pending(pending_hdl, false)); }
public static void utc_eldbus_introspect_p() { var app = Efl.App.AppMain; var conn = new eldbus.Connection(eldbus.Connection.Type.Session); var obj = new eldbus.Object(conn, DBusBus, DBusPath); int messageCapture = 0; bool isSuccess = false; eldbus.MessageDelegate objectMessageCb = delegate(eldbus.Message msg, eldbus.Pending p) { try { string errname; string errmsg; if (messageCapture == 5) { if (!msg.GetError(out errname, out errmsg)) { string txt; if (msg.Get(out txt)) { if (!String.IsNullOrEmpty(txt)) { isSuccess = true; } } } } } finally { app.Quit(0); } }; eldbus.Pending pending = obj.Introspect(objectMessageCb); AssertEquals(pending.GetMethod(), "Introspect"); var timer = new Efl.LoopTimer(app, 2.0); timer.TimerTickEvent += (object sender, EventArgs e) => { app.Quit(0); }; messageCapture = 5; app.Begin(); Assert(isSuccess, "Method Introspect is not call"); timer.Dispose(); obj.Dispose(); conn.Dispose(); }
eldbus.Pending Call(string member, eldbus.MessageDelegate dlgt, double timeout, params BasicMessageArgument[] args) { CheckHandle(); var msg = NewMethodCall(member); foreach (BasicMessageArgument arg in args) { arg.AppendTo(msg); } return(Send(msg, dlgt, timeout)); }
public static void utc_eldbus_message_iterator_activatable_list_p() { eldbus.MessageDelegate responseMessageCb = delegate(eldbus.Message msg, eldbus.Pending p) { try { if (timeout != IntPtr.Zero) { ecore_timer_del(timeout); timeout = IntPtr.Zero; } string errname, errmsg; if (msg.GetError(out errname, out errmsg)) { return; } eldbus.MessageIterator iterMain = msg.GetMessageIterator(); string signature = iterMain.GetSignature(); if (String.IsNullOrEmpty(signature)) { return; } eldbus.MessageIterator iterator; iterMain.Get(out iterator, signature); string bus_name; bool isHasData = false; while (iterator.GetAndNext(out bus_name)) { if (String.IsNullOrEmpty(bus_name)) { return; } isHasData = true; } isSuccess = isHasData; } finally { ecore_main_loop_quit(); } }; ActivatableList(responseMessageCb); }
public eldbus.Pending Hello(eldbus.MessageDelegate dlgt = null) { CheckHandle(); IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr()); IntPtr cb_data = (dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt)); var pending_hdl = eldbus_hello(Handle, cb_wrapper, cb_data); if (pending_hdl == IntPtr.Zero) { throw new SEHException("Eldbus: could not get `Pending' object from eldbus_hello"); } return(new eldbus.Pending(pending_hdl, false)); }
private static void ActivableList(eldbus.MessageDelegate messageCb) { isSuccess = false; var conn = new eldbus.Connection(eldbus.Connection.Type.System); eldbus.Pending pending = conn.ActivableList(messageCb); timeout = ecore_timer_add(2.0, GetEcoreLoopClose(), IntPtr.Zero); Assert(timeout != IntPtr.Zero); ecore_main_loop_begin(); Assert(isSuccess, "Method ListActivatableNames is not call"); conn.Dispose(); }
public eldbus.Pending GetPeerMachineId(eldbus.MessageDelegate dlgt = null) { CheckHandle(); IntPtr cb_wrapper = dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr(); IntPtr cb_data = dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt); var pending_hdl = eldbus_object_peer_machine_id_get(Handle, cb_wrapper, cb_data); if (pending_hdl == IntPtr.Zero) { eina.Error.RaiseIfOccurred(); throw new SEHException("Eldbus: could not get `Pending' object from eldbus_object_peer_machine_id_get"); } return(new eldbus.Pending(pending_hdl, false)); }
public eldbus.Pending ActivatableList(eldbus.MessageDelegate dlgt = null) { CheckHandle(); IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr()); IntPtr cb_data = (dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt)); var pending_hdl = eldbus_names_activatable_list(Handle, cb_wrapper, cb_data); if (pending_hdl == IntPtr.Zero) { eina.Error.RaiseIfOccurred(); throw new SEHException("Eldbus: could not get `Pending' object from eldbus_names_activatable_list"); } return(new eldbus.Pending(pending_hdl, false)); }
public static void utc_eldbus_message_iter_next_p() { eldbus.MessageDelegate activatableListResponseCb = delegate(eldbus.Message msg, eldbus.Pending p) { try { string errname, errmsg; if (msg.GetError(out errname, out errmsg)) { return; } eldbus.MessageIterator iterMain = msg.GetMessageIterator(); string signature = iterMain.GetSignature(); if (String.IsNullOrEmpty(signature)) { return; } eldbus.MessageIterator iterator; iterMain.Get(out iterator, signature); bool isHasData = false; do { string busName; iterator.Get(out busName); if (String.IsNullOrEmpty(busName)) { return; } isHasData = true; } while (iterator.Next()); isSuccess = isHasData; } finally { Efl.App.AppMain.Quit(0); } }; ActivatableList(activatableListResponseCb); }
public eldbus.Pending NameStart(string bus, uint flags, eldbus.MessageDelegate dlgt = null) { CheckHandle(); if (bus == null) { throw new ArgumentNullException("bus"); } IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr()); IntPtr cb_data = (dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt)); var pending_hdl = eldbus_name_start(Handle, bus, flags, cb_wrapper, cb_data); if (pending_hdl == IntPtr.Zero) { throw new SEHException("Eldbus: could not get `Pending' object from eldbus_name_start"); } return(new eldbus.Pending(pending_hdl, false)); }
eldbus.Pending Send(eldbus.Message msg, eldbus.MessageDelegate dlgt = null, double timeout = -1) { CheckHandle(); if (msg == null) { throw new ArgumentNullException("msg"); } IntPtr cb_wrapper = dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr(); IntPtr cb_data = dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt); var pending_hdl = eldbus_proxy_send(Handle, msg.Handle, cb_wrapper, cb_data, timeout); if (pending_hdl == IntPtr.Zero) { throw new SEHException("Eldbus: could not get `Pending' object from eldbus_proxy_send"); } return(new eldbus.Pending(pending_hdl, false)); }
public eldbus.Pending HasNameOwner(string bus, eldbus.MessageDelegate dlgt = null) { CheckHandle(); if (bus == null) { throw new ArgumentNullException("bus"); } IntPtr cb_wrapper = (dlgt == null ? IntPtr.Zero : eldbus.Common.GetMessageCbWrapperPtr()); IntPtr cb_data = (dlgt == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(dlgt)); var pending_hdl = eldbus_name_owner_has(Handle, bus, cb_wrapper, cb_data); if (pending_hdl == IntPtr.Zero) { eina.Error.RaiseIfOccurred(); throw new SEHException("Eldbus: could not get `Pending' object from eldbus_name_owner_has"); } return(new eldbus.Pending(pending_hdl, false)); }
private static void ActivatableList(eldbus.MessageDelegate messageCb) { isSuccess = false; var app = Efl.App.AppMain; var conn = new eldbus.Connection(eldbus.Connection.Type.Session); eldbus.Pending pending = conn.ActivatableList(messageCb); AssertEquals(pending.GetMethod(), "ListActivatableNames"); var timer = new Efl.LoopTimer(app, 2.0); timer.TimerTickEvent += (object sender, EventArgs e) => { app.Quit(0); }; app.Begin(); Assert(isSuccess, "Method ListActivatableNames is not call"); timer.Dispose(); conn.Dispose(); }
public static void utc_eldbus_object_send_info_get_p() { var conn = new eldbus.Connection(eldbus.Connection.Type.System); var obj = new eldbus.Object(conn, DBusBus, DBusPath); string busFromObject = obj.GetBusName(); AssertEquals(DBusBus, busFromObject); string pathFromObject = obj.GetPath(); AssertEquals(DBusPath, pathFromObject); obj.Ref(); obj.Unref(); { var connectionFromObj = obj.GetConnection(); Assert(conn.Handle == connectionFromObj.Handle); connectionFromObj.Dispose(); } IntPtr timeout = IntPtr.Zero; int messageCapture = 0; bool isSuccess = false; eldbus.MessageDelegate objectMessageCb = delegate(eldbus.Message msg, eldbus.Pending p) { try { if (timeout != IntPtr.Zero) { ecore_timer_del(timeout); timeout = IntPtr.Zero; } string errname; string errmsg; if (messageCapture == 5) { if (!msg.GetError(out errname, out errmsg)) { string txt; if (msg.Get(out txt)) { if (!String.IsNullOrEmpty(txt)) { isSuccess = true; } } } } } finally { ecore_main_loop_quit(); } }; var methodName = "GetId"; var message = obj.NewMethodCall(DBusInterface, methodName); eldbus.Pending pending = obj.Send(message, objectMessageCb, -1); AssertEquals(pending.GetMethod(), methodName); timeout = ecore_timer_add(2.0, GetEcoreLoopClose(), IntPtr.Zero); Assert(timeout != IntPtr.Zero); messageCapture = 5; ecore_main_loop_begin(); Assert(isSuccess, $"Method {methodName} is not call"); message.Dispose(); obj.Dispose(); conn.Dispose(); }
public static void utc_eldbus_message_info_data_get_p() { isSuccess = false; var conn = new eldbus.Connection(eldbus.Connection.Type.System); string methodName = "GetId"; eldbus.Message msg = eldbus.Message.NewMethodCall(DBusBus, DBusPath, DBusInterface, methodName); string interfaceMsg = msg.GetInterface(); AssertEquals(DBusInterface, interfaceMsg); string methodMsg = msg.GetMember(); AssertEquals(methodName, methodMsg); string pathMsg = msg.GetPath(); AssertEquals(DBusPath, pathMsg); eldbus.MessageDelegate messageMethodCb = delegate(eldbus.Message m, eldbus.Pending p) { try { if (timeout != IntPtr.Zero) { ecore_timer_del(timeout); timeout = IntPtr.Zero; } string errname, errmsg; if (!m.GetError(out errname, out errmsg)) { string txt; if (m.Get(out txt)) { if (!String.IsNullOrEmpty(txt)) { if (m.GetSender() == DBusBus && !String.IsNullOrEmpty(m.GetDestination())) { isSuccess = true; } } } } } finally { ecore_main_loop_quit(); } }; const int timeoutSendMs = 1000; eldbus.Pending pending = conn.Send(msg, messageMethodCb, timeoutSendMs); AssertEquals(pending.GetMethod(), methodName); timeout = ecore_timer_add(2.0, GetEcoreLoopClose(), IntPtr.Zero); Assert(timeout != IntPtr.Zero); ecore_main_loop_begin(); Assert(isSuccess, $"Method {methodName} is not call"); msg.Dispose(); conn.Dispose(); }
public static void utc_eldbus_object_send_info_get_p() { var app = Efl.App.AppMain; var conn = new eldbus.Connection(eldbus.Connection.Type.Session); var obj = new eldbus.Object(conn, DBusBus, DBusPath); string busFromObject = obj.GetBusName(); AssertEquals(DBusBus, busFromObject); string pathFromObject = obj.GetPath(); AssertEquals(DBusPath, pathFromObject); obj.Ref(); obj.Unref(); { var connectionFromObj = obj.GetConnection(); Assert(conn.Handle == connectionFromObj.Handle); connectionFromObj.Dispose(); } int messageCapture = 0; bool isSuccess = false; eldbus.MessageDelegate objectMessageCb = delegate(eldbus.Message msg, eldbus.Pending p) { try { string errname; string errmsg; if (messageCapture == 5) { if (!msg.GetError(out errname, out errmsg)) { string txt; if (msg.Get(out txt)) { if (!String.IsNullOrEmpty(txt)) { isSuccess = true; } } } } } finally { app.Quit(0); } }; var methodName = "GetId"; var message = obj.NewMethodCall(DBusInterface, methodName); eldbus.Pending pending = obj.Send(message, objectMessageCb, -1); AssertEquals(pending.GetMethod(), methodName); var timer = new Efl.LoopTimer(app, 2.0); timer.TimerTickEvent += (object sender, EventArgs e) => { app.Quit(0); }; messageCapture = 5; app.Begin(); Assert(isSuccess, $"Method {methodName} is not call"); timer.Dispose(); message.Dispose(); obj.Dispose(); conn.Dispose(); }
public static void utc_eldbus_message_info_data_get_p() { isSuccess = false; var app = Efl.App.AppMain; var conn = new eldbus.Connection(eldbus.Connection.Type.Session); string methodName = "GetId"; eldbus.Message msg = eldbus.Message.NewMethodCall(DBusBus, DBusPath, DBusInterface, methodName); string interfaceMsg = msg.GetInterface(); AssertEquals(DBusInterface, interfaceMsg); string methodMsg = msg.GetMember(); AssertEquals(methodName, methodMsg); string pathMsg = msg.GetPath(); AssertEquals(DBusPath, pathMsg); eldbus.MessageDelegate messageMethodCb = delegate(eldbus.Message m, eldbus.Pending p) { try { string errname, errmsg; if (!m.GetError(out errname, out errmsg)) { string txt; if (m.Get(out txt)) { if (!String.IsNullOrEmpty(txt)) { if (m.GetSender() == DBusBus && !String.IsNullOrEmpty(m.GetDestination())) { isSuccess = true; } } } } } finally { app.Quit(0); } }; const int timeoutSendMs = 1000; eldbus.Pending pending = conn.Send(msg, messageMethodCb, timeoutSendMs); AssertEquals(pending.GetMethod(), methodName); var timer = new Efl.LoopTimer(app, 2.0); timer.TimerTickEvent += (object sender, EventArgs e) => { app.Quit(0); }; app.Begin(); Assert(isSuccess, $"Method {methodName} is not call"); timer.Dispose(); msg.Dispose(); conn.Dispose(); }