[Tizen.Core] Enhance API descriptions (#6378)
authorhjhun <36876573+hjhun@users.noreply.github.com>
Mon, 30 Sep 2024 00:44:45 +0000 (09:44 +0900)
committerGitHub <noreply@github.com>
Mon, 30 Sep 2024 00:44:45 +0000 (09:44 +0900)
* [Tizen.Core] Enhance API descriptions

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
* [Tizen.Core] Add a missing '/'

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
---------

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/Tizen.Core/Tizen.Core/Channel.cs
src/Tizen.Core/Tizen.Core/ChannelObject.cs
src/Tizen.Core/Tizen.Core/ChannelReceivedEventArgs.cs
src/Tizen.Core/Tizen.Core/ChannelReceiver.cs
src/Tizen.Core/Tizen.Core/ChannelSender.cs
src/Tizen.Core/Tizen.Core/Event.cs
src/Tizen.Core/Tizen.Core/EventObject.cs
src/Tizen.Core/Tizen.Core/EventReceivedEventArgs.cs
src/Tizen.Core/Tizen.Core/Task.cs

index 0079e83e7e7c427a48ecc861c9c0b488665c719e..e1727a642cf106bd35ccc1aa5eb56ec07805b4d3 100644 (file)
@@ -21,28 +21,39 @@ namespace Tizen.Core
     /// <summary>
     /// The class for managing communication channels between tasks of Tizen Core.
     /// </summary>
+    /// <remarks>
+    /// Channels are essential in inter-task communications because they provide a reliable way to exchange messages and data.
+    /// By creating a channel, you can establish a connection between two tasks that need to communicate with each other.
+    /// Once created, both tasks can send and receive messages through the channel.
+    /// It's important to note that channels have a limited capacity, so make sure to handle message overflows appropriately.
+    /// Additionally, remember to close the channel once it's no longer needed to avoid resource leaks.
+    /// </remarks>
     /// <since_tizen> 12 </since_tizen>
     public class Channel : IDisposable
     {
         private bool _disposed = false;
 
         /// <summary>
-        /// Constructor for creating a new channel with a sender and a receiver.
+        /// Creates a new channel with a sender and a receiver.
         /// </summary>
+        /// <remarks>
+        /// This constructor initializes a new channel that enables communication between a sender and a receiver.
+        /// It throws exceptions if any errors occur during initialization due to insufficient memory or invalid operations.
+        /// </remarks>
         /// <exception cref="OutOfMemoryException">Thrown when out of memory.</exception>
         /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
         /// <example>
+        /// In the following code snippet, we attempt to initialize a new channel by calling the constructor.
+        /// However, if there is not enough memory available, an OutOfMemoryException is thrown. We handle this exception by displaying a message in the console.
         /// <code>
-        /// 
         /// try
         /// {
-        ///   var channel = new Channel();
+        ///    var channel = new Channel();
         /// }
         /// catch (OutOfMemoryException)
         /// {
-        ///   Console.WriteLine("Exception occurs");
+        ///    Console.WriteLine("Exception occurs");
         /// }
-        /// 
         /// </code>
         /// </example>
         /// <since_tizen> 12 </since_tizen>
@@ -55,7 +66,7 @@ namespace Tizen.Core
         }
 
         /// <summary>
-        /// Finalizer of the class Channel.
+        /// Finalizes an instance of the Channel class.
         /// </summary>
         ~Channel()
         {
@@ -65,12 +76,21 @@ namespace Tizen.Core
         /// <summary>
         /// Gets the channel sender instance.
         /// </summary>
+        /// <remarks>
+        /// This property provides access to the channel sender instance that can be used to send messages through the specified channel.
+        /// It ensures that only one sender instance per channel exists in order to avoid any conflicts during message transmission.
+        /// </remarks>
         /// <since_tizen> 12 </since_tizen>
         public ChannelSender Sender { get; private set; }
 
         /// <summary>
-        /// Gets the channel receiver instance. 
+        /// Gets the channel receiver instance.
         /// </summary>
+        /// <remarks>
+        /// This property provides access to the channel receiver instance that handles incoming messages from other applications.
+        /// By utilizing this instance, you can subscribe to specific channels and receive notifications accordingly.
+        /// It is crucial to understand the concept of channels in order to effectively utilize this feature. For more details on channels, refer to the official documentation.
+        /// </remarks>
         /// <since_tizen> 12 </since_tizen>
         public ChannelReceiver Receiver { get; private set; }
 
index a721c60018bf274e255cd2cfa6705a8da9cec11f..eff18ba1fb78d1e367707906633201712950d0c6 100644 (file)
@@ -24,6 +24,11 @@ namespace Tizen.Core
     /// <summary>
     /// Represents a channel object used for inter-task communication.
     /// </summary>
+    /// <remarks>
+    /// A channel object provides a mechanism for tasks to communicate with each other in a process. It allows sending messages between tasks without any race conditions.
+    /// To create a channel object, call the static method 'Create'. Once created, you can send and receive messages through the channel by calling the respective methods on the channel object.
+    /// When you are done using the channel object, remember to dispose it properly to avoid resource leaks.
+    /// </remarks>
     /// <since_tizen> 12 </since_tizen>
     public class ChannelObject : IDisposable
     {
@@ -40,6 +45,10 @@ namespace Tizen.Core
         /// <param name="data">The data object.</param>
         /// <exception cref="OutOfMemoryException">Thrown when out of memory.</exception>
         /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
+        /// <remarks>
+        /// This constructor creates a new channel object with the specified ID and data. It throws an OutOfMemoryException if there isn't enough memory available to allocate the object.
+        /// Additionally, it may throw an InvalidOperationException if the operation fails due to an invalid condition.
+        /// </remarks>
         /// <example>
         /// <code>
         /// 
@@ -68,7 +77,7 @@ namespace Tizen.Core
         }
 
         /// <summary>
-        /// Finalizer of the class ChannelObject.
+        /// Finalizes an instance of the ChannelObject class.
         /// </summary>
         ~ChannelObject()
         {
@@ -135,7 +144,8 @@ namespace Tizen.Core
         /// Gets the name of the sender task.
         /// </summary>
         /// <since_tizen> 12 </since_tizen>
-        public string Sender {
+        public string Sender
+        {
             get
             {
                 Interop.LibTizenCore.TizenCoreChannel.ObjectGetSenderTaskName(_handle, out IntPtr taskName);
index 4c5fdf13eb4cfb391df2efb04e280250431d343f..64bf33459ef49f5bebe0521cb1c29e6faf4eb4e7 100644 (file)
@@ -19,7 +19,7 @@ using System;
 namespace Tizen.Core
 {
     /// <summary>
-    /// Arguments for the event raised when an object has been received through a channel.
+    /// Represents the arguments for the event raised when an object has been received through a channel.
     /// </summary>
     /// <since_tizen> 12 </since_tizen>
     public class ChannelReceivedEventArgs : System.EventArgs
index c1c62d435be9d399b0cdceedd68c679d8b436827..0c6ae5c6b1b0c87c024b31074e1be64643c6ccaa 100644 (file)
@@ -35,7 +35,7 @@ namespace Tizen.Core
         }
 
         /// <summary>
-        /// Finalizer of the class ChannelReceiver.
+        /// Finalizes an instance of the ChannelReceiver class.
         /// </summary>
         ~ChannelReceiver()
         {
@@ -43,7 +43,7 @@ namespace Tizen.Core
         }
 
         /// <summary>
-        /// Occurrs whenever the channel object is received in the main loop of the task.
+        /// Occurs whenever a channel object is received in the main loop of the task.
         /// </summary>
         /// <remarks>
         /// The registered event handler will be invoked when the channel receiver is added to the specific task.
@@ -53,8 +53,8 @@ namespace Tizen.Core
         /// 
         /// var channel = new Channel();
         /// var receiver = channel.Receiver;
-        /// receiver.Received += (s, e) => {
-        ///   Console.WriteLine("OnChannelObjectReceived. Message = {}", (string)e.Data);
+        /// receiver.Received += (sender, args) => {
+        ///   Console.WriteLine("OnChannelObjectReceived. Message = {0}", (string)args.Data);
         /// };
         /// 
         /// </code>
@@ -63,19 +63,23 @@ namespace Tizen.Core
         public event EventHandler<ChannelReceivedEventArgs> Received;
 
         /// <summary>
-        /// Receives the channel object from the sender asynchronously.
+        /// Asynchronously receives the channel object from the sender.
         /// </summary>
         /// <returns>The received channel object.</returns>
         /// <exception cref="OutOfMemoryException">Thrown when out of memory.</exception>
-        /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
+        /// <exception cref="InvalidOperationException">Thrown when failed due to an invalid operation.</exception>
         /// <example>
         /// <code>
         /// 
         /// var channel = new Channel();
         /// var task = TizenCore.Find("Test");
         /// task.Send(async () => {
-        ///   var channelObject = await channel.Receiver.Receive();
-        ///   Console.WriteLine("Message = {}", (string)channelObject.Data);
+        ///   try {
+        ///     var channelObject = await channel.Receiver.Receive();
+        ///     Console.WriteLine("Message = {}", (string)channelObject.Data);
+        ///   } catch (Exception e) {
+        ///     Console.Error.WriteLine("Failed to receive message: {0}", e.ToString());
+        ///   }
         /// });
         /// 
         /// </code>
index ae170bac46d1b53076a5a2d470e19e9b3bc76d38..1156d9ec49ec4359a3ecad1f0855d7b3f4ddea05 100644 (file)
@@ -19,7 +19,7 @@ using System;
 namespace Tizen.Core
 {
     /// <summary>
-    /// Represents the channel sender used for inter-task communication.
+    /// Represents the channel sender used for inter-task communication. It provides methods to send messages between tasks in order to facilitate task coordination.
     /// </summary>
     /// <since_tizen> 12 </since_tizen>
     public class ChannelSender : IDisposable
@@ -32,7 +32,7 @@ namespace Tizen.Core
         }
 
         /// <summary>
-        /// Finalizer of the class ChannelSender.
+        /// Finalizes an instance of the ChannelSender class.
         /// </summary>
         ~ChannelSender()
         {
index 21755d97df4afdcc95a9d0f68899506bb81fd362..f705845e5614a534282cc3f697b2075031b03033 100644 (file)
@@ -19,8 +19,13 @@ using System;
 namespace Tizen.Core
 {
     /// <summary>
-    /// Represents the event using for broadcasting events.
+    /// Represents the event used for broadcasting events.
     /// </summary>
+    /// <remarks>
+    /// This class provides functionality for managing events that are broadcasted across multiple components in an application.
+    /// It enables communication between different parts of the code without resorting to direct references or global variables.
+    /// By implementing the IDisposable interface, it ensures proper resource management and prevents memory leaks.
+    /// </remarks>
     /// <since_tizen> 12 </since_tizen>
 #pragma warning disable CA1716
     public class Event : IDisposable
@@ -33,13 +38,16 @@ namespace Tizen.Core
         /// <summary>
         /// Constructor for creating a new event instance.
         /// </summary>
+        /// <remarks>
+        /// This constructor initializes a new event instance. It may throw exceptions if there are any issues during initialization such as running out of memory or performing an invalid operation.
+        /// </remarks>
         /// <exception cref="OutOfMemoryException">Thrown when out of memory.</exception>
         /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
         /// <example>
+        /// Here's an example showing how to create a new event instance:
         /// <code>
-        /// 
+        /// Create a new event instance
         /// var coreEvent = new Event();
-        /// 
         /// </code>
         /// </example>
         /// <since_tizen> 12 </since_tizen>
@@ -57,7 +65,7 @@ namespace Tizen.Core
         }
 
         /// <summary>
-        /// Finalizer of the class Event.
+        /// Finalizes an instance of the Event class.
         /// </summary>
         ~Event()
         {
index 9012bc9094ae0123601a1f875dfd92ad5455e61b..22d2ff5af0785f56b6ed4c6d219537db0f9d203a 100644 (file)
@@ -70,7 +70,7 @@ namespace Tizen.Core
         }
 
         /// <summary>
-        /// Finalizer of the class EventObject.
+        /// Finalizes an instance of the EventObject class.
         /// </summary>
         ~EventObject()
         {
index fb561bbd68668e464566bbbb4e6c3584d044e8f7..93d91914d81b6c59e48b96ab18e9b7db523b125b 100644 (file)
@@ -19,7 +19,7 @@ using System;
 namespace Tizen.Core
 {
     /// <summary>
-    /// Arguments for the event raised when the event data is received.
+    /// Represents the arguments passed to the event handler when the event data is received.
     /// </summary>
     /// <since_tizen> 12 </since_tizen>
     public class EventReceivedEventArgs : System.EventArgs
index 4ca4cc81dd43e742c3910bf52e5d5de74cc7361a..a6796b368fb1dabcaaa8ca30e1c67e9f2c7dc0a8 100644 (file)
@@ -43,16 +43,16 @@ namespace Tizen.Core
         private static int _id = 1;
 
         /// <summary>
-        /// Initializes the Task class.
+        /// Initializes the Task class with the specified ID.
         /// </summary>
-        /// <param name="id">The ID of the task.</param>
+        /// <param name="id">The unique identifier for the task.</param>
         /// <exception cref="ArgumentException">Thrown when the <paramref name="id"/> is invalid or a Task with that ID already exists.</exception>
         /// <exception cref="OutOfMemoryException">Thrown when out of memory.</exception>
         /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
         /// <remarks>
-        /// The constructor throws an exception when the id already exists.
-        /// By default, the task creates a thread. However, if the <paramref name="id"/> is "main", a thread is not created.
-        /// The 'main' task will be operated in the main thread.
+        /// The constructor throws an exception when the ID already exists.
+        /// By default, the task creates a separate thread. However, if the <paramref name="id"/> is set to "main", no separate thread is created.
+        /// In such case, the 'main' task will operate on the main application thread instead.
         /// </remarks>
         /// <example>
         /// <code>
@@ -87,7 +87,6 @@ namespace Tizen.Core
              Dispose(false);
         }
 
-
         /// <summary>
         /// Posts an action to be executed later.
         /// </summary>
@@ -283,12 +282,14 @@ namespace Tizen.Core
         /// <summary>
         /// Adds a channel receiver to a main loop of the task.
         /// </summary>
-        /// <param name="receiver">The channel receiver instance.</param>
+        /// <param name="receiver">The channel receiver instance that needs to be added.</param>
         /// <exception cref="ArgumentNullException">Thrown when the argument is null.</exception>
         /// <exception cref="ArgumentException">Thrown when the argument is invalid.</exception>
         /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
         /// <exception cref="OutOfMemoryException">Thrown when out of memory.</exception>
         /// <example>
+        /// In the following code snippet, we create a channel, find or spawn a task named "ReceivingTask", and then add the channel receiver to the task's main loop by calling the 'AddChannelReceiver' method.
+        ///
         /// <code>
         /// 
         /// var channel = new Channel();
@@ -514,7 +515,7 @@ namespace Tizen.Core
         /// Emits the event object to all registered event handlers of the task. 
         /// It's similar to Event.Emit(), but EmitAllEvent() sends the event object to every event handler of the task while Event.Emit() sends the event object only to the target event's event handler.
         /// </summary>
-        /// <param name="eventObject">The event object instance.</param>
+        /// <param name="eventObject">The event object instance to be sent.</param>
         /// <exception cref="ArgumentNullException">Thrown when the argument is null.</exception>
         /// <exception cref="ArgumentException">Thrown when the argument is invalid.</exception>
         /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
@@ -675,11 +676,13 @@ namespace Tizen.Core
         /// </summary>
         /// <exception cref="InvalidOperationException">Thrown when failed because of an invalid operation.</exception>
         /// <example>
+        /// Here's an example that demonstrates how to create a Core Task and run its main loop:
         /// <code>
-        /// 
+        /// // Create a Core Task named "Runner"
         /// var coreTask = new TCoreTask("Runner");
-        /// coreTask.Run();
         /// 
+        /// // Start the main loop of the task
+        /// coreTask.Run();
         /// </code>
         /// </example>
         /// <since_tizen> 12 </since_tizen>