diff --git a/src/bindings/mono/eldbus_mono/eldbus_connection.cs b/src/bindings/mono/eldbus_mono/eldbus_connection.cs index 18ec10f32a..6a75bb97ee 100644 --- a/src/bindings/mono/eldbus_mono/eldbus_connection.cs +++ b/src/bindings/mono/eldbus_mono/eldbus_connection.cs @@ -2,12 +2,14 @@ using System; using System.Runtime.InteropServices; +using System.ComponentModel; using static eldbus.EldbusConnectionNativeFunctions; namespace eldbus { +[EditorBrowsable(EditorBrowsableState.Never)] public static class EldbusConnectionNativeFunctions { [DllImport(efl.Libs.Eldbus)] public static extern IntPtr @@ -89,22 +91,55 @@ public static class EldbusConnectionNativeFunctions } /// Represents a DBus connection. -/// -/// Since EFL 1.23. +/// Since EFL 1.23. /// public class Connection : IDisposable { + /// + /// The type of the Connection. + /// Since EFL 1.23. + /// public enum Type { + /// + /// Unknown type. + /// It's a sentinel. + /// Since EFL 1.23. + /// Unknown = 0, // sentinel, not a real type + /// + /// Session type. + /// Since EFL 1.23. + /// Session, + /// + /// System type. + /// Since EFL 1.23. + /// System, + /// + /// Starter type. + /// Since EFL 1.23. + /// Starter, + /// + /// Address type. + /// Since EFL 1.23. + /// Address, + /// + /// Last type. + /// It's a sentinel. + /// Since EFL 1.23. + /// Last // sentinel, not a real type }; + [EditorBrowsable(EditorBrowsableState.Never)] public IntPtr Handle {get;set;} = IntPtr.Zero; + /// Whether this wrapper owns the native handle. + /// Since EFL 1.23. + /// public bool Own {get;set;} = true; private void InitNew(IntPtr handle, bool own) @@ -122,38 +157,67 @@ public class Connection : IDisposable } } + [EditorBrowsable(EditorBrowsableState.Never)] public Connection(IntPtr handle, bool own) { InitNew(handle, own); } - + /// + /// Constructor. + /// Since EFL 1.23. + /// + /// The type of the connection. public Connection(eldbus.Connection.Type type) { InitNew(eldbus_connection_get(type), true); } + /// + /// Constructor. + /// Since EFL 1.23. + /// + /// The address of the connection. public Connection(string address) { InitNew(eldbus_address_connection_get(address), true); } + /// + /// Gets a Connection with a type. + /// Since EFL 1.23. + /// + /// + /// A Connection with the type. public static eldbus.Connection GetPrivate(eldbus.Connection.Type type) { return new eldbus.Connection(eldbus_private_connection_get(type), true); } + /// + /// Gets a Connection with a address. + /// Since EFL 1.23. + /// + /// The address of the connection. public static eldbus.Connection GetPrivate(string address) { return new eldbus.Connection(eldbus_private_address_connection_get(address), true); } - + /// + /// Finalizer to be called from the Garbage Collector. + /// Since EFL 1.23. + /// ~Connection() { Dispose(false); } + /// Disposes of this wrapper, releasing the native array if owned. + /// Since EFL 1.23. + /// + /// True if this was called from public method. False if + /// called from the C# finalizer. protected virtual void Dispose(bool disposing) { IntPtr h = Handle; @@ -176,17 +240,28 @@ public class Connection : IDisposable } } + /// Releases the native resources held by this instance. + /// Since EFL 1.23. + /// public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } + /// Releases the native resources held by this instance. + /// Since EFL 1.23. + /// public void Free() { Dispose(); } + /// + /// Releases the native handler. + /// Since EFL 1.23. + /// + /// The native handler. public IntPtr Release() { IntPtr h = Handle; @@ -194,6 +269,14 @@ public class Connection : IDisposable return h; } + /// + /// Send a message. + /// Since EFL 1.23. + /// + /// The message that will be sent. + /// The function that is executed when a response arrives.. + /// The timeout of the message. + /// A public eldbus.Pending Send(eldbus.Message msg, eldbus.MessageDelegate dlgt = null, double timeout = -1) { CheckHandle(); @@ -218,6 +301,11 @@ public class Connection : IDisposable return new eldbus.Pending(pending_hdl, false); } + /// + /// Gets a unique name assigned by the message bus. + /// Since EFL 1.23. + /// + /// The unique name string. public string GetUniqueName() { CheckHandle(); @@ -230,6 +318,14 @@ public class Connection : IDisposable return Eina.StringConversion.NativeUtf8ToManagedString(ptr); } + /// + /// Send a RequestName method. + /// Since EFL 1.23. + /// + /// The name of the bus. + /// Parameter of the RequestName method. + /// The function to call when receiving answer. + /// A public eldbus.Pending NameRequest(string bus, uint flags, eldbus.MessageDelegate dlgt = null) { CheckHandle(); @@ -252,6 +348,13 @@ public class Connection : IDisposable return new eldbus.Pending(pending_hdl, false); } + /// + /// Send a ReleaseName method. + /// Since EFL 1.23. + /// + /// The name of the bus. + /// The function to call when receiving answer. + /// A public eldbus.Pending NameRelease(string bus, eldbus.MessageDelegate dlgt = null) { CheckHandle(); @@ -274,6 +377,13 @@ public class Connection : IDisposable return new eldbus.Pending(pending_hdl, false); } + /// + /// Send a GetNameOwner method. + /// Since EFL 1.23. + /// + /// The name of the bus. + /// The function to call when receiving answer. + /// A public eldbus.Pending GetNameOwner(string bus, eldbus.MessageDelegate dlgt = null) { CheckHandle(); @@ -296,6 +406,13 @@ public class Connection : IDisposable return new eldbus.Pending(pending_hdl, false); } + /// + /// Send NameHasOwner method. + /// Since EFL 1.23. + /// + /// The name of the bus. + /// The function to call when receiving the answer. + /// A public eldbus.Pending HasNameOwner(string bus, eldbus.MessageDelegate dlgt = null) { CheckHandle(); @@ -318,6 +435,12 @@ public class Connection : IDisposable return new eldbus.Pending(pending_hdl, false); } + /// + /// Send ListNames method. + /// Since EFL 1.23. + /// + /// The function to call when receiving answer. + /// A public eldbus.Pending NameList(eldbus.MessageDelegate dlgt = null) { CheckHandle(); @@ -335,6 +458,12 @@ public class Connection : IDisposable return new eldbus.Pending(pending_hdl, false); } + /// + /// Send ListActivatableNames method. + /// Since EFL 1.23. + /// + /// The function to call when receiving a method. + /// A public eldbus.Pending ActivatableList(eldbus.MessageDelegate dlgt = null) { CheckHandle(); @@ -352,6 +481,12 @@ public class Connection : IDisposable return new eldbus.Pending(pending_hdl, false); } + /// + /// Send Hello method. + /// Since EFL 1.23. + /// + /// The function to call when receiving answer. + /// A public eldbus.Pending Hello(eldbus.MessageDelegate dlgt = null) { CheckHandle(); @@ -369,6 +504,14 @@ public class Connection : IDisposable return new eldbus.Pending(pending_hdl, false); } + /// + /// Send StartServiceByName method. + /// Since EFL 1.23. + /// + /// The name of the bus. + /// Parameter of the StartServiceByName. + /// The function to call when receiving answer. + /// A public eldbus.Pending NameStart(string bus, uint flags, eldbus.MessageDelegate dlgt = null) { CheckHandle();