Added Doxygen comments, incorporated recent CAPI changes
authorrajeev ranjan <rajeev.ran@samsung.com>
Wed, 20 Jul 2016 09:55:51 +0000 (15:25 +0530)
committerrajeev ranjan <rajeev.ran@samsung.com>
Thu, 28 Jul 2016 13:25:50 +0000 (18:55 +0530)
Change-Id: Ib5a97c92c7bd7cc35d2f93e130cfa6f74d503e7d
Signed-off-by: rajeev ranjan <rajeev.ran@samsung.com>
29 files changed:
Tizen.Network.IoTConnectivity/Interop/Interop.IoTConnectivity.Client.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs [changed mode: 0644->0755]
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/CacheUpdatedEventArgs.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/DeviceInformationFoundEventArgs.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/FindingErrorOccurredEventArgs.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityErrorFactory.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityServerManager.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/LiteResource.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObservePolicy.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObserveType.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObserverNotifiedEventArgs.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PlatformInformationFoundEventArgs.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PresenceEventType.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PresenceReceivedEventArgs.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/QualityOfService.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResponse.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Representation.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Request.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceFoundEventArgs.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceInterfaces.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceOptions.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceTypes.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Response.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResponseCode.cs
Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/StateChangedEventArgs.cs

index e5c0dc6..22b7c96 100755 (executable)
@@ -17,7 +17,7 @@ internal static partial class Interop
         {
             internal static partial class DeviceInformation
             {
-                internal delegate void DeviceInformationCallback(IntPtr deviceInfoHandle, int result, IntPtr userData);
+                internal delegate bool DeviceInformationCallback(IntPtr deviceInfoHandle, int result, IntPtr userData);
 
                 internal enum Property
                 {
@@ -36,7 +36,7 @@ internal static partial class Interop
 
             internal static partial class PlatformInformation
             {
-                internal delegate void PlatformInformationCallback(IntPtr platformInfoHandle, int result, IntPtr userData);
+                internal delegate bool PlatformInformationCallback(IntPtr platformInfoHandle, int result, IntPtr userData);
 
                 internal enum Propery
                 {
@@ -162,11 +162,8 @@ internal static partial class Interop
 
             internal static partial class IoTCon
             {
-                [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_secure_initialize")]
-                internal static extern int SecureInitialize(string filePath);
-
                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_initialize")]
-                internal static extern int Initialize();
+                internal static extern int Initialize(string filePath);
 
                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_deinitialize")]
                 internal static extern void Deinitialize();
@@ -190,7 +187,7 @@ internal static partial class Interop
             internal static partial class ResourceFinder
             {
                 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-                internal delegate void FoundResourceCallback(IntPtr remoteResourceHandle, int result, IntPtr userData);
+                internal delegate bool FoundResourceCallback(IntPtr remoteResourceHandle, int result, IntPtr userData);
 
                 [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_find_resource")]
                 internal static extern int AddResourceFoundCb(string hostAddress, int connectivityType, string resourceType, bool isSecure, FoundResourceCallback cb, IntPtr userData);
old mode 100644 (file)
new mode 100755 (executable)
index 23e32c5..fdeb8d1
@@ -15,6 +15,8 @@ namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
     /// This class represents current attributes of a resource.
+    /// It provides API to manage attributes.
+    /// This class is accessed by using a constructor to create a new instance of this object.
     /// </summary>
     public class Attributes : IDictionary<string, object>, IDisposable
     {
@@ -23,8 +25,11 @@ namespace Tizen.Network.IoTConnectivity
         private bool _disposed = false;
 
         /// <summary>
-        /// Constructor
+        /// The Attributes constructor
         /// </summary>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes();
+        /// </code>
         public Attributes()
         {
             int ret = Interop.IoTConnectivity.Common.Attributes.Create(out _resourceAttributesHandle);
@@ -47,14 +52,23 @@ namespace Tizen.Network.IoTConnectivity
             SetAttributes(attributesHandleToClone);
         }
 
+        /// <summary>
+        /// Destructor of the Attributes class.
+        /// </summary>
         ~Attributes()
         {
             Dispose(false);
         }
 
         /// <summary>
-        /// Gets the number of status elements
+        /// Gets the number of keys
         /// </summary>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() {
+        /// attributes.Add("brightness", 50);
+        /// var count = attributes.Count;
+        /// Console.WriteLine("There are {0} keys in the attribute object", count);
+        /// </code>
         public int Count
         {
             get
@@ -64,8 +78,16 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Represents whether Attributes is readonly
+        /// Represents whether attribute is readonly
         /// </summary>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() {
+        ///     { "state", "ON" },
+        ///     { "dim", 10 }
+        /// };
+        /// if (attributes.IsReadOnly)
+        ///     Console.WriteLine("Read only attribute");
+        /// </code>
         public bool IsReadOnly
         {
             get
@@ -75,8 +97,16 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Contains all the status keys
+        /// Contains all the attribute keys
         /// </summary>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() {
+        ///     { "state", "ON" },
+        ///     { "dim", 10 }
+        /// };
+        /// var keys = attributes.Keys;
+        /// Console.WriteLine("Attribute contains keys {0} and {1}", keys.ElementAt(0), keys.ElementAt(1));
+        /// </code>
         public ICollection<string> Keys
         {
             get
@@ -86,8 +116,16 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Contains all the status values
+        /// Contains all the attribute values
         /// </summary>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() {
+        ///     { "state", "ON" },
+        ///     { "dim", 10 }
+        /// };
+        /// var values = attributes.Values;
+        /// Console.WriteLine("Attribute contains values {0} and {1}", values.ElementAt(0), values.ElementAt(1));
+        /// </code>
         public ICollection<object> Values
         {
             get
@@ -97,15 +135,23 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Gets or sets the status with the specified key.
+        /// Gets or sets the attribute with the specified key.
         /// </summary>
-        /// <param name="key">The key of the status to get or set.</param>
+        /// <param name="key">The key of the attribute to get or set.</param>
         /// <returns>The element with the specified key.</returns>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes();
+        /// attributes["state"] = "ON";
+        /// Console.WriteLine("Attribute value for key 'state' : {0}", attributes["state"]);
+        /// </code>
         public object this[string key]
         {
             get
             {
-                return _attributes[key];
+                if (_attributes.ContainsKey(key))
+                    return _attributes[key];
+                else
+                    return null;
             }
 
             set
@@ -115,19 +161,27 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Adds status key and value as a key value pair
+        /// Adds attribute key and value as a key value pair
         /// </summary>
-        /// <param name="item">The item to add</param>
+        /// <param name="item">The key value pair to add</param>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes();
+        /// attributes.Add(new KeyValuePair<string, object> ("state", "ON"));
+        /// </code>
         public void Add(KeyValuePair<string, object> item)
         {
             Add(item.Key, item.Value);
         }
 
         /// <summary>
-        /// Adds status element
+        /// Adds an attribute
         /// </summary>
-        /// <param name="key">The key representing the attributes</param>
-        /// <param name="value">The value representing the attributes</param>
+        /// <param name="key">The key representing the attribute</param>
+        /// <param name="value">The value representing the attribute</param>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes();
+        /// attributes.Add("brightness", 50);
+        /// </code>
         public void Add(string key, object value)
         {
             int ret = 0;
@@ -213,6 +267,11 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Clears attributes collection
         /// </summary>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes();
+        /// attributes.Add("brightness", 50);
+        /// attributes.Clear();
+        /// </code>
         public void Clear()
         {
             foreach (string key in _attributes.Keys)
@@ -228,30 +287,56 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Checks the given key value pair exists in attributes collection
+        /// Checks whether the given key value pair exists in attributes collection
         /// </summary>
         /// <param name="item">The status key value pair</param>
         /// <returns>true if exists. Otherwise, false</returns>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() {
+        ///     { "state", "ON" },
+        ///     { "dim", 10 }
+        /// };
+        /// if (attributes.Contains(new KeyValuePair<string, object> ("dim", 10))
+        ///     Console.WriteLine("Attribute conatins pair ('dim', 10)");
+        /// </code>
         public bool Contains(KeyValuePair<string, object> item)
         {
             return _attributes.Contains(item);
         }
 
         /// <summary>
-        /// Checks the given key exists in attributes collection
+        /// Checks whether the given key exists in attributes collection
         /// </summary>
-        /// <param name="key">The status key</param>
+        /// <param name="key">The status key to look for</param>
         /// <returns>true if exists. Otherwise, false</returns>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() {
+        ///     { "state", "ON" },
+        ///     { "dim", 10 }
+        /// };
+        /// if (attributes.ContainsKey("dim"))
+        ///     Console.WriteLine("Attribute conatins key : dim");
+        /// </code>
         public bool ContainsKey(string key)
         {
             return _attributes.ContainsKey(key);
         }
 
         /// <summary>
-        /// Copies the elements of the attributes to an Array, starting at a particular index.
+        /// Copies the elements of the attributes to an array, starting at a particular index.
         /// </summary>
         /// <param name="array">The destination array</param>
         /// <param name="arrayIndex">The zero-based index in array at which copying begins.</param>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() {
+        ///     { "state", "ON" },
+        ///     { "dim", 10 }
+        /// };
+        /// KeyValuePair<string, object>[] dest = new KeyValuePair<string, object>[attributes.Count];
+        /// int index = 0;
+        /// attributes.CopyTo(dest, index);
+        /// Console.WriteLine("Dest conatins ({0}, {1})", dest[0].Key, dest[0].Value);
+        /// </code>
         public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
         {
             _attributes.CopyTo(array, arrayIndex);
@@ -261,43 +346,66 @@ namespace Tizen.Network.IoTConnectivity
         ///   Returns an enumerator that iterates through the collection.
         /// </summary>
         /// <returns> An enumerator that can be used to iterate through the collection.</returns>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() {
+        ///     { "state", "ON" },
+        ///     { "dim", 10 }
+        /// };
+        /// foreach (KeyValuePair<string, object> pair in attributes)
+        /// {
+        ///     Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value);
+        /// }
+        /// </code>
         public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
         {
             return _attributes.GetEnumerator();
         }
 
         /// <summary>
-        /// Removes a attributes element from collection
+        /// Removes an attribute from collection
         /// </summary>
         /// <param name="item">The attributes element to remove</param>
         /// <returns>true if operation is success. Otherwise, false</returns>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() {
+        ///     { "state", "ON" },
+        ///     { "dim", 10 }
+        /// };
+        /// if (attributes.Remove(new KeyValuePair<string, object>("dim", 10)))
+        ///     Console.WriteLine("Remove was successful");
+        /// </code>
         public bool Remove(KeyValuePair<string, object> item)
         {
-            int ret = Interop.IoTConnectivity.Common.Attributes.Remove(_resourceAttributesHandle, item.Key);
-            if (ret != (int)IoTConnectivityError.None)
-            {
-                Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove attributes");
-                throw IoTConnectivityErrorFactory.GetException(ret);
-            }
-
-            return _attributes.Remove(item);
+            return Remove(item.Key);
         }
 
         /// <summary>
-        ///  Removes a attributes element from collection using key
+        ///  Removes an attribute from collection using key
         /// </summary>
         /// <param name="key">The attributes element to remove</param>
-        /// <returns>true if operation is success. Otherwise, false</returns>
+        /// <returns>true if operation is successful, Otherwise, false</returns>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() {
+        ///     { "state", "ON" },
+        ///     { "dim", 10 }
+        /// };
+        /// if (attributes.Remove("state"))
+        ///     Console.WriteLine("Remove was successful");
+        /// </code>
         public bool Remove(string key)
         {
-            int ret = Interop.IoTConnectivity.Common.Attributes.Remove(_resourceAttributesHandle, key);
-            if (ret != (int)IoTConnectivityError.None)
+            bool isRemoved = _attributes.Remove(key);
+            if (isRemoved)
             {
-                Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove attributes");
-                throw IoTConnectivityErrorFactory.GetException(ret);
+                int ret = Interop.IoTConnectivity.Common.Attributes.Remove(_resourceAttributesHandle, key);
+                if (ret != (int)IoTConnectivityError.None)
+                {
+                    Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove attributes");
+                    throw IoTConnectivityErrorFactory.GetException(ret);
+                }
             }
 
-            return _attributes.Remove(key);
+            return isRemoved;
         }
 
         /// <summary>
@@ -306,22 +414,41 @@ namespace Tizen.Network.IoTConnectivity
         /// <param name="key">The key whose value to get.</param>
         /// <param name="value"> The value associated with the specified key</param>
         /// <returns> true if the attributes collection contains an element with the specified key; otherwise, false.</returns>
+        /// <code>
+        /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() {
+        ///     { "state", "ON" }
+        /// };
+        /// object value;
+        /// var isPresent = attributes.TryGetValue("state", out value);
+        /// if (isPresent)
+        ///     Console.WriteLine("value : {0}", value);
+        /// </code>
         public bool TryGetValue(string key, out object value)
         {
             return _attributes.TryGetValue(key, out value);
         }
 
+        /// <summary>
+        ///   Returns an enumerator that iterates through the collection.
+        /// </summary>
         IEnumerator IEnumerable.GetEnumerator()
         {
             return _attributes.GetEnumerator();
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
             GC.SuppressFinalize(this);
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (_disposed)
index 95a8f5b..3edb802 100755 (executable)
@@ -18,9 +18,8 @@ namespace Tizen.Network.IoTConnectivity
         internal CacheUpdatedEventArgs() { }
 
         /// <summary>
-        /// Representation property.
+        /// Indicates the updated representation of the resource
         /// </summary>
-        /// <returns>Representation Representation.</returns>
         public Representation Representation { get; internal set; }
     }
 }
index ceab212..d0cee2d 100755 (executable)
@@ -26,7 +26,7 @@ namespace Tizen.Network.IoTConnectivity
         public string Name { get; internal set; }
 
         /// <summary>
-        /// Indicates human friendly name for device
+        /// Indicates spec version of the core specification
         /// </summary>
         public string SpecVersion { get; internal set; }
 
index d5453e8..f0280a5 100755 (executable)
@@ -18,15 +18,13 @@ namespace Tizen.Network.IoTConnectivity
         internal FindingErrorOccurredEventArgs() { }
 
         /// <summary>
-        /// RequestId property.
+        /// The request id of the operation which caused this error
         /// </summary>
-        /// <returns>int RequestId.</returns>
         public int RequestId { get; internal set; }
 
         /// <summary>
-        /// Result property.
+        /// Contains error details.
         /// </summary>
-        /// <returns>FindingError Result.</returns>
         public Exception Error { get; internal set; }
     }
 }
index fcc7129..846df77 100755 (executable)
@@ -13,10 +13,13 @@ using System.Runtime.InteropServices;
 namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
-    /// IoT connectivity client manager.
+    /// IoT connectivity client manager consists of client side APIs.
     /// </summary>
     public static class IoTConnectivityClientManager
     {
+        /// <summary>
+        /// The IP Address for multicast
+        /// </summary>
         public const string MulticastAddress = null;
 
         private static int s_presenceListenerId = 1;
@@ -29,33 +32,49 @@ namespace Tizen.Network.IoTConnectivity
         private static Dictionary<IntPtr, Interop.IoTConnectivity.Client.PlatformInformation.PlatformInformationCallback> s_platformInformationCallbacksMap = new Dictionary<IntPtr, Interop.IoTConnectivity.Client.PlatformInformation.PlatformInformationCallback>();
 
         /// <summary>
-        /// presence event on the resource
+        /// PresenceReceived event. This event is occurred when server starts sending presence of a resource.
         /// </summary>
         public static event EventHandler<PresenceReceivedEventArgs> PresenceReceived;
 
         /// <summary>
-        /// Resource found event handler
+        /// ResourceFound event. This event is occurred when a resource is found from the remote server
+        /// after sending request using API StartFindingResource().
         /// </summary>
         public static event EventHandler<ResourceFoundEventArgs> ResourceFound;
 
         /// <summary>
-        /// PlatformInformationFound event handler
+        /// PlatformInformationFound event. This event is occurred when platform information is found
+        /// after sending request using API StartFindingPlatformInformation().
         /// </summary>
         public static event EventHandler<PlatformInformationFoundEventArgs> PlatformInformationFound;
 
         /// <summary>
-        /// DeviceInformationFound event handler
+        /// DeviceInformationFound event. This event is occurred when device information is found
+        /// after sending request using API StartFindingDeviceInformation().
         /// </summary>
         public static event EventHandler<DeviceInformationFoundEventArgs> DeviceInformationFound;
 
         /// <summary>
-        /// FoundError event handler
+        /// FindingError event. This event is occurred when an error is found.
         /// </summary>
         public static event EventHandler<FindingErrorOccurredEventArgs> FindingErrorOccurred;
 
         /// <summary>
-        /// Timeout property
+        /// Timeout in seconds
         /// </summary>
+        /// <remarks>
+        /// Value to be set must be in range from 1 to 3600. Default timeout interval value is 30.\n
+        /// Sets/gets the timeout of StartFindingResource(), StartFindingDeviceInformation(), StartFindingPlatformInformation(),
+        /// RemoteResource.GetAsync(), RemoteResource.PutAsync(), RemoteResource.PostAsync() and RemoteResource.DeleteAsync() APIs.\n
+        /// Setter can throw exception.
+        /// </remarks>
+        /// <pre>
+        /// Initialize() should be called to initialize
+        /// </pre>
+        /// <code>
+        /// IoTConnectivityClientManager.Initialize();
+        /// IoTConnectivityClientManager.TimeOut = 120;
+        /// </code>
         public static int TimeOut
         {
             get
@@ -81,8 +100,22 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Timeout property
+        /// Polling interval of IoTConnectivity
         /// </summary>
+        /// <remarks>
+        /// Sets/Gets the polling inerval(milliseconds) of IoTCon. Default value is 100 milliseconds.
+        /// Value to be set must be in range from 1 to 999. The closer to 0, the faster it operates.
+        /// Setter is invoked immediately for changing the interval.
+        /// If you want the faster operation, we recommend you set 10 milliseconds for polling interval.
+        /// Setter can throw exception.
+        /// </remarks>
+        /// <pre>
+        /// Initialize() should be called to initialize
+        /// </pre>
+        /// <code>
+        /// IoTConnectivityClientManager.Initialize();
+        /// IoTConnectivityClientManager.PollingInterval = 100;
+        /// </code>
         public static int PollingInterval
         {
             get
@@ -108,11 +141,30 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Connects to the iotcon service
+        /// Initializes IoTCon.
+        /// Call this function to start IoTCon.
         /// </summary>
-        public static void Initialize()
+        /// <remarks>
+        /// @a filePath point to a file for handling secure virtual resources.
+        /// The file that is CBOR(Concise Binary Object Representation)-format must already exist
+        /// in @a filePath. We recommend to use application-local file for @a filePath.
+        /// </remarks>
+        /// <privilege>
+        /// http://tizen.org/privilege/network.get \n
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
+        /// <param name="filePath">The file path to point to storage for handling secure virtual resources.</param>
+        /// <post>
+        /// You must call Deinitialize() if IoTCon API is no longer needed.
+        /// </post>
+        /// <seealso cref="Deinitialize()"/>
+        /// <code>
+        /// string filePath = "../../res/iotcon-test-svr-db-client.dat";
+        /// IoTConnectivityClientManager.Initialize(filePath);
+        /// </code>
+        public static void Initialize(string filePath)
         {
-            int ret = Interop.IoTConnectivity.Client.IoTCon.Initialize();
+            int ret = Interop.IoTConnectivity.Client.IoTCon.Initialize(filePath);
             if (ret != (int)IoTConnectivityError.None)
             {
                 Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to initialize");
@@ -121,21 +173,19 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Initializes IoTCon with secure mode.
-        /// </summary>
-        public static void SecureInitialize(string filePath)
-        {
-            int ret = Interop.IoTConnectivity.Client.IoTCon.SecureInitialize(filePath);
-            if (ret != (int)IoTConnectivityError.None)
-            {
-                Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to initialize securely");
-                throw IoTConnectivityErrorFactory.GetException(ret);
-            }
-        }
-
-        /// <summary>
-        /// Disconnects from the iotcon service
+        /// Deinitializes IoTCon.
         /// </summary>
+        /// <remarks>
+        /// This API must be called if IoTCon API is no longer needed.
+        /// </remarks>
+        /// <pre>
+        /// Initialize() should be called to initialize.
+        /// </pre>
+        /// <seealso cref="Initialize()"/>
+        /// <seealso cref="SecureInitialize()"/>
+        /// <code>
+        /// IoTConnectivityClientManager.Deinitialize();
+        /// </code>
         public static void Deinitialize()
         {
             Interop.IoTConnectivity.Client.IoTCon.Deinitialize();
@@ -144,6 +194,16 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Invokes a next message from a queue for receiving messages from others, immediately.
         /// </summary>
+        /// <remarks>
+        /// This API invokes a next message from a queue for receiving messages from others, immediately.
+        /// After calling the API, it continues the polling with existing interval.
+        /// </remarks>
+        /// <pre>
+        /// Initialize() should be called to initialize.
+        /// </pre>
+        /// <code>
+        /// IoTConnectivityClientManager.InvokePolling();
+        /// </code>
         public static void InvokePolling()
         {
             int ret = Interop.IoTConnectivity.Client.IoTCon.InvokePolling();
@@ -157,9 +217,41 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Starts receiving presence events
         /// </summary>
-        /// <returns>
-        /// PresenceId
-        /// </returns>
+        /// <remarks>
+        /// Sends request to receive presence to an interested server's resource with resourceType.
+        /// If succeeded, <see cref="PresenceReceived"/> event handler will be triggered when the server sends presence.
+        /// A server sends presence events when adds / removes / alters a resource or start / stop presence.\n
+        /// @a hostAddress could be <see cref="MulticastAddress"/> for IPv4 multicast.
+        /// The length of @ resourceType should be less than or equal to 61. The @ resourceType must start with a lowercase alphabetic character, followed by a sequence
+        /// of lowercase alphabetic, numeric, ".", or "-" characters, and contains no white space.
+        /// </remarks>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
+        /// <param name="hostAddress">The address or addressable name of the server</param>
+        /// <param name="resourceType">A resource type that a client is interested in</param>
+        /// <returns>PresenceId - An identifier for this request</returns>
+        /// <pre>Initialize() should be called to initialize.</pre>
+        /// <post>
+        /// When the resource receive presence, <see cref="PresenceReceived"/> event handler will be invoked.\n
+        /// You must destroy presence by calling StopReceivingPresence() if presence event is no longer needed.
+        /// </post>
+        /// <seealso cref="IoTConnectivityServerManager.StartSendingPresence()"/>
+        /// <seealso cref="IoTConnectivityServerManager.StopSendingPresence()"/>
+        /// <seealso cref="StopReceivingPresence()"/>
+        /// <seealso cref="PresenceReceived"/>
+        /// <code>
+        /// EventHandler<PresenceReceivedEventArgs> handler = (sender, e) => {
+        ///     Console.Log("PresenceReceived, presence id :" + e.PresenceId);
+        /// }
+        /// EventHandler<FindingErrorOccurredEventArgs> errorHandler = (sender, e) => {
+        ///     Console.Log("Found error :" + e.Error.Message);
+        /// }
+        /// IoTConnectivityClientManager.PresenceReceived += handler;
+        /// IoTConnectivityClientManager.FindingErrorOccurred += errorHandler;
+        /// // Do not forget to remove these event handlers when they are not required any more.
+        /// int id = IoTConnectivityClientManager.StartReceivingPresence(IoTConnectivityClientManager.MulticastAddress, "oic.iot.door");
+        /// </code>
         public static int StartReceivingPresence(string hostAddress, string resourceType)
         {
             Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType connectivityType = RemoteResource.GetConnectivityType(hostAddress);
@@ -230,6 +322,36 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Stops receiving presence events
         /// </summary>
+        /// <remarks>
+        /// Sends request to not to receive server's presence any more.
+        /// </remarks>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
+        /// <param name="presenceId">The start presence request identifier</param>
+        /// <pre>
+        /// Initialize() should be called to initialize.
+        /// </pre>
+        /// <seealso cref="IoTConnectivityServerManager.StartSendingPresence()"/>
+        /// <seealso cref="IoTConnectivityServerManager.StopSendingPresence()"/>
+        /// <seealso cref="StartReceivingPresence()"/>
+        /// <seealso cref="PresenceReceived"/>
+        /// <code>
+        /// EventHandler<PresenceReceivedEventArgs> handler = (sender, e) => {
+        ///     Console.Log("PresenceReceived, presence id :" + e.PresenceId);
+        /// }
+        /// EventHandler<FindingErrorOccurredEventArgs> errorHandler = (sender, e) => {
+        ///     Console.Log("Found error :" + e.Error.Message);
+        /// }
+        /// IoTConnectivityClientManager.PresenceReceived += handler;
+        /// IoTConnectivityClientManager.FindingErrorOccurred += errorHandler;
+        /// int id = IoTConnectivityClientManager.StartReceivingPresence(IoTConnectivityClientManager.MulticastAddress, "oic.iot.door");
+        /// await Task.Delay(5000); // Do other things here
+        /// // Call StopReceivingPresence() when receiving presence is not required any more
+        /// IoTConnectivityClientManager.PresenceReceived -= handler;
+        /// IoTConnectivityClientManager.FindingErrorOccurred -= errorHandler;
+        /// IoTConnectivityClientManager.StopReceivingPresence(id);
+        /// </code>
         public static void StopReceivingPresence(int presenceId)
         {
             if (s_presenceHandlesMap.ContainsKey((IntPtr)presenceId))
@@ -258,11 +380,41 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Starts finding resource events
+        /// Starts finding resources.
         /// </summary>
-        /// <returns>
-        /// RequestId
-        /// </returns>
+        /// <remarks>
+        /// Sends request to find a resource of @a hostAddress server with @a resourceType.
+        /// If succeeded, <see cref="ResourceFound"/> event handler will be triggered with information of the resource.\n
+        /// @a hostAddress could be <see cref="MulticastAddress"/> for IPv4 multicast.
+        /// The length of @a resourceType should be less than or equal to 61. The @ resourceType must start with a lowercase alphabetic character, followed by a sequence
+        /// of lowercase alphabetic, numeric, ".", or "-" characters, and contains no white space.
+        /// </remarks>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
+        /// <param name="hostAddress">The address or addressable name of the server</param>
+        /// <param name="resourceType">A resource type specified as a filter for the resource</param>
+        /// <param name="isSecure">The flag for secure communication with the server</param>
+        /// <returns>RequestId - An identifier for this request</returns>
+        /// <pre>Initialize() should be called to initialize.</pre>
+        /// <post>
+        /// When the resource is found, <see cref="ResourceFound"/> event handler will be invoked.
+        /// </post>
+        /// <seealso cref="ResourceFound"/>
+        /// <seealso cref="ResourceFoundEventArgs"/>
+        /// <seealso cref="TimeOut"/>
+        /// <code>
+        /// EventHandler<ResourceFoundEventArgs> handler = (sender, e) => {
+        ///     Console.Log("Found resource at host address :" + e.Resource.HostAddress + ", uri :" + e.Resource.UriPath);
+        /// }
+        /// EventHandler<FindingErrorOccurredEventArgs> errorHandler = (sender, e) => {
+        ///     Console.Log("Found error :" + e.Error.Message);
+        /// }
+        /// IoTConnectivityClientManager.ResourceFound += handler;
+        /// IoTConnectivityClientManager.FindingErrorOccurred += errorHandler;
+        /// // Do not forget to remove these event handlers when they are not required any more.
+        /// int id = IoTConnectivityClientManager.StartFindingResource(null, "oic.iot.door");
+        /// </code>
         public static int StartFindingResource(string hostAddress, string resourceType, bool isSecure = false)
         {
             Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType connectivityType = RemoteResource.GetConnectivityType(hostAddress);
@@ -284,6 +436,9 @@ namespace Tizen.Network.IoTConnectivity
             }
             s_resourceFoundCallbacksMap[id] = (IntPtr remoteResourceHandle, int result, IntPtr userData) =>
             {
+                if (ResourceFound == null)
+                    return false;
+
                 int requestId = (int)userData;
                 if (result == (int)IoTConnectivityError.None)
                 {
@@ -297,7 +452,7 @@ namespace Tizen.Network.IoTConnectivity
                         catch (Exception exp)
                         {
                             Log.Error(IoTConnectivityErrorFactory.LogTag, "Can't clone RemoteResource's handle: " + exp.Message);
-                            return;
+                            return true;
                         }
                         ResourceFoundEventArgs e = new ResourceFoundEventArgs()
                         {
@@ -309,7 +464,6 @@ namespace Tizen.Network.IoTConnectivity
                     else
                     {
                         Log.Error(IoTConnectivityErrorFactory.LogTag, "Handle is null");
-                        return;
                     }
                 }
                 else
@@ -322,6 +476,7 @@ namespace Tizen.Network.IoTConnectivity
                         s_resourceFoundCallbacksMap.Remove(id);
                     }
                 }
+                return true;
             };
             int errorCode = Interop.IoTConnectivity.Client.ResourceFinder.AddResourceFoundCb(hostAddress, (int)connectivityType, resourceType, isSecure, s_resourceFoundCallbacksMap[id], id);
             if (errorCode != (int)IoTConnectivityError.None)
@@ -337,11 +492,38 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Starts finding device information events
+        /// Starts finding the device information of remote server.
         /// </summary>
-        /// <returns>
-        /// RequestId
-        /// </returns>
+        /// <remarks>
+        /// Requests server for device information.
+        /// If succeeded, <see cref="DeviceInformationFound"/> event handler will be triggered with information of the device.\n
+        /// @a hostAddress could be <see cref="MulticastAddress"/> for IPv4 multicast.
+        /// </remarks>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
+        /// <param name="hostAddress">The host address of remote server</param>
+        /// <returns>RequestId - An identifier for this request</returns>
+        /// <pre>Initialize() should be called to initialize.</pre>
+        /// <post>
+        /// <see cref="DeviceInformationFound" /> event handler will be invoked.
+        /// </post>
+        /// <seealso cref="IoTConnectivityServerManager.SetDeviceName()"/>
+        /// <seealso cref="DeviceInformationFound"/>
+        /// <seealso cref="DeviceInformationFoundEventArgs"/>
+        /// <seealso cref="TimeOut"/>
+        /// <code>
+        /// EventHandler<DeviceInformationFoundEventArgs> handler = (sender, e) => {
+        ///     Console.Log("Device information found, id : " + e.RequestId + ", name : " + e.Name);
+        /// }
+        /// EventHandler<FindingErrorOccurredEventArgs> errorHandler = (sender, e) => {
+        ///     Console.Log("Found error :" + e.Error.Message);
+        /// }
+        /// IoTConnectivityClientManager.DeviceInformationFound += handler;
+        /// IoTConnectivityClientManager.FindingErrorOccurred += errorHandler;
+        /// // Do not forget to remove these event handlers when they are not required any more.
+        /// int id = IoTConnectivityClientManager.StartFindingDeviceInformation(IoTConnectivityClientManager.MulticastAddress);
+        /// </code>
         public static int StartFindingDeviceInformation(string hostAddress)
         {
             Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType connectivityType = RemoteResource.GetConnectivityType(hostAddress);
@@ -358,6 +540,9 @@ namespace Tizen.Network.IoTConnectivity
             }
             s_deviceInformationCallbacksMap[id] = (IntPtr deviceInfoHandle, int result, IntPtr userData) =>
             {
+                if (DeviceInformationFound == null)
+                    return false;
+
                 int requestId = (int)userData;
                 if (result == (int)IoTConnectivityError.None)
                 {
@@ -367,14 +552,13 @@ namespace Tizen.Network.IoTConnectivity
                         if (e == null)
                         {
                             Log.Error(IoTConnectivityErrorFactory.LogTag, "Can't get DeviceInformationFoundEventArgs");
-                            return;
+                            return true;
                         }
                         DeviceInformationFound?.Invoke(null, e);
                     }
                     else
                     {
                         Log.Error(IoTConnectivityErrorFactory.LogTag, "Handle is null");
-                        return;
                     }
                 }
                 else
@@ -387,6 +571,7 @@ namespace Tizen.Network.IoTConnectivity
                         s_deviceInformationCallbacksMap.Remove(id);
                     }
                 }
+                return true;
             };
 
             int errorCode = Interop.IoTConnectivity.Client.DeviceInformation.Find(hostAddress, (int)connectivityType, s_deviceInformationCallbacksMap[id], id);
@@ -404,11 +589,37 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Starts finding platform information events
+        /// Starts finding the platform information of remote server.
         /// </summary>
-        /// <returns>
-        /// RequestId
-        /// </returns>
+        /// <remarks>
+        /// Requests server for platform information.
+        /// If succeeded, <see cref="PlatformInformationFound" /> event handler will be triggered with information of the platform.\n
+        /// @a hostAddress could be <see cref="MulticastAddress"/> for IPv4 multicast.
+        /// </remarks>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
+        /// <param name="hostAddress">The host address of remote server</param>
+        /// <returns>RequestId - An identifier for this request</returns>
+        /// <pre>Initialize() should be called to initialize.</pre>
+        /// <post>
+        /// <see cref="PlatformInformationFound" /> event handler will be invoked.
+        /// </post>
+        /// <seealso cref="PlatformInformationFound"/>
+        /// <seealso cref="PlatformInformationFoundEventArgs"/>
+        /// <seealso cref="TimeOut"/>
+        /// <code>
+        /// EventHandler<PlatformInformationFoundEventArgs> handler = (sender, e) => {
+        ///     Console.Log("PlatformInformationFound :" + e.RequestId);
+        /// }
+        /// EventHandler<FindingErrorOccurredEventArgs> errorHandler = (sender, e) => {
+        ///     Console.Log("Found error :" + e.Error.Message);
+        /// }
+        /// IoTConnectivityClientManager.PlatformInformationFound += handler;
+        /// IoTConnectivityClientManager.FindingErrorOccurred += errorHandler;
+        /// // Do not forget to remove these event handlers when they are not required any more.
+        /// int id = IoTConnectivityClientManager.StartFindingPlatformInformation(IoTConnectivityClientManager.MulticastAddress);
+        /// </code>
         public static int StartFindingPlatformInformation(string hostAddress)
         {
             Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType connectivityType = RemoteResource.GetConnectivityType(hostAddress);
@@ -425,6 +636,9 @@ namespace Tizen.Network.IoTConnectivity
             }
             s_platformInformationCallbacksMap[id] = (IntPtr platformInfoHandle, int result, IntPtr userData) =>
             {
+                if (PlatformInformationFound == null)
+                    return false;
+
                 int requestId = (int)userData;
                 if (result == (int)IoTConnectivityError.None)
                 {
@@ -434,14 +648,13 @@ namespace Tizen.Network.IoTConnectivity
                         if (e == null)
                         {
                             Log.Error(IoTConnectivityErrorFactory.LogTag, "Can't get PlatformInformationFoundEventArgs");
-                            return;
+                            return true; ;
                         }
                         PlatformInformationFound?.Invoke(null, e);
                     }
                     else
                     {
                         Log.Error(IoTConnectivityErrorFactory.LogTag, "Handle is null");
-                        return;
                     }
                 }
                 else
@@ -454,6 +667,7 @@ namespace Tizen.Network.IoTConnectivity
                         s_platformInformationCallbacksMap.Remove(id);
                     }
                 }
+                return true;
             };
 
             int errorCode = Interop.IoTConnectivity.Client.PlatformInformation.Find(hostAddress, (int)connectivityType, s_platformInformationCallbacksMap[id], id);
@@ -470,6 +684,7 @@ namespace Tizen.Network.IoTConnectivity
             return (int)id;
         }
 
+        // Private methods
         private static PresenceReceivedEventArgs GetPresenceReceivedEventArgs(int presenceId, IntPtr presenceResponseHandle)
         {
             int trigger;
@@ -635,17 +850,17 @@ namespace Tizen.Network.IoTConnectivity
             PlatformInformationFoundEventArgs e = new PlatformInformationFoundEventArgs()
             {
                 RequestId = requestId,
-                PlatformId = Marshal.PtrToStringAuto(platformId),
-                ManufacturerName = Marshal.PtrToStringAuto(manufacturerName),
-                ManufacturerURL = Marshal.PtrToStringAuto(manufacturerUrl),
-                DateOfManufacture = Marshal.PtrToStringAuto(dateOfManufacture),
-                ModelNumber = Marshal.PtrToStringAuto(modelNumber),
-                PlatformVersion = Marshal.PtrToStringAuto(platformVersion),
-                OsVersion = Marshal.PtrToStringAuto(osVersion),
-                HardwareVersion = Marshal.PtrToStringAuto(hardwareVersion),
-                FirmwareVersion = Marshal.PtrToStringAuto(firmwareVersion),
-                SupportUrl = Marshal.PtrToStringAuto(supportUrl),
-                SystemTime = Marshal.PtrToStringAuto(systemTime)
+                PlatformId = (platformId != IntPtr.Zero) ? Marshal.PtrToStringAuto(platformId) : string.Empty,
+                ManufacturerName = (manufacturerName != IntPtr.Zero) ? Marshal.PtrToStringAuto(manufacturerName) : string.Empty,
+                ManufacturerURL = (manufacturerUrl != IntPtr.Zero) ? Marshal.PtrToStringAuto(manufacturerUrl) : string.Empty,
+                DateOfManufacture = (dateOfManufacture != IntPtr.Zero) ? Marshal.PtrToStringAuto(dateOfManufacture) : string.Empty,
+                ModelNumber = (modelNumber != IntPtr.Zero) ? Marshal.PtrToStringAuto(modelNumber) : string.Empty,
+                PlatformVersion = (platformVersion != IntPtr.Zero) ? Marshal.PtrToStringAuto(platformVersion) : string.Empty,
+                OsVersion = (osVersion != IntPtr.Zero) ? Marshal.PtrToStringAuto(osVersion) : string.Empty,
+                HardwareVersion = (hardwareVersion != IntPtr.Zero) ? Marshal.PtrToStringAuto(hardwareVersion) : string.Empty,
+                FirmwareVersion = (firmwareVersion != IntPtr.Zero) ? Marshal.PtrToStringAuto(firmwareVersion) : string.Empty,
+                SupportUrl = (supportUrl != IntPtr.Zero) ? Marshal.PtrToStringAuto(supportUrl) : string.Empty,
+                SystemTime = (systemTime != IntPtr.Zero) ? Marshal.PtrToStringAuto(systemTime) : string.Empty
             };
 
             return e;
index f0dc3be..8c897c7 100755 (executable)
@@ -7,6 +7,7 @@
 /// you entered into with Samsung.
 
 using System;
+using System.IO;
 using Tizen.Internals.Errors;
 
 namespace Tizen.Network.IoTConnectivity
@@ -34,51 +35,7 @@ namespace Tizen.Network.IoTConnectivity
 
         internal static void ThrowException(int err)
         {
-            IoTConnectivityError error = (IoTConnectivityError)err;
-            if (error == IoTConnectivityError.OutOfMemory)
-            {
-                throw new InvalidOperationException("Out of memory");
-            }
-            else if (error == IoTConnectivityError.InvalidParameter)
-            {
-                throw new ArgumentException("Invalid parameter");
-            }
-            else if (error == IoTConnectivityError.Io)
-            {
-                throw new ArgumentException("I/O Error");
-            }
-            else if (error == IoTConnectivityError.NoData)
-            {
-                throw new ArgumentException("No data found");
-            }
-            else if (error == IoTConnectivityError.TimedOut)
-            {
-                throw new ArgumentException("timed out");
-            }
-            else if (error == IoTConnectivityError.PermissionDenied)
-            {
-                throw new ArgumentException("Permission denied");
-            }
-            else if (error == IoTConnectivityError.NotSupported)
-            {
-                throw new ArgumentException("Not supported");
-            }
-            else if (error == IoTConnectivityError.Representation)
-            {
-                throw new ArgumentException("Representation error");
-            }
-            else if (error == IoTConnectivityError.InvalidType)
-            {
-                throw new ArgumentException("Invalid type");
-            }
-            else if (error == IoTConnectivityError.Already)
-            {
-                throw new ArgumentException("Duplicate");
-            }
-            else if (error == IoTConnectivityError.System)
-            {
-                throw new InvalidOperationException("System error");
-            }
+            throw GetException(err);
         }
 
         internal static Exception GetException(int err)
@@ -86,7 +43,7 @@ namespace Tizen.Network.IoTConnectivity
             IoTConnectivityError error = (IoTConnectivityError)err;
             if (error == IoTConnectivityError.OutOfMemory)
             {
-                return new InvalidOperationException("Out of memory");
+                return new OutOfMemoryException("Out of memory");
             }
             else if (error == IoTConnectivityError.InvalidParameter)
             {
@@ -94,27 +51,27 @@ namespace Tizen.Network.IoTConnectivity
             }
             else if (error == IoTConnectivityError.Io)
             {
-                return new ArgumentException("I/O Error");
+                return new IOException("I/O Error");
             }
             else if (error == IoTConnectivityError.NoData)
             {
-                return new ArgumentException("No data found");
+                return new InvalidOperationException("No data found");
             }
             else if (error == IoTConnectivityError.TimedOut)
             {
-                return new ArgumentException("timed out");
+                return new TimeoutException("timed out");
             }
             else if (error == IoTConnectivityError.PermissionDenied)
             {
-                return new ArgumentException("Permission denied");
+                return new UnauthorizedAccessException("Permission denied");
             }
             else if (error == IoTConnectivityError.NotSupported)
             {
-                return new ArgumentException("Not supported");
+                return new NotSupportedException("Not supported");
             }
             else if (error == IoTConnectivityError.Representation)
             {
-                return new ArgumentException("Representation error");
+                return new InvalidOperationException("Representation error");
             }
             else if (error == IoTConnectivityError.InvalidType)
             {
@@ -122,11 +79,11 @@ namespace Tizen.Network.IoTConnectivity
             }
             else if (error == IoTConnectivityError.Already)
             {
-                return new ArgumentException("Duplicate");
+                return new InvalidOperationException("Duplicate");
             }
             else if (error == IoTConnectivityError.System)
             {
-                return new InvalidOperationException("System error");
+                return new SystemException("System error");
             }
             else
             {
index a24ca7c..c939255 100755 (executable)
@@ -11,16 +11,34 @@ using System;
 namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
-    /// IoT connectivity server manager.
+    /// IoT connectivity server manager consists of server side APIs.
     /// </summary>
     public static class IoTConnectivityServerManager
     {
         /// <summary>
-        /// Initializes connection with IoTCon service
+        /// Initializes IoTCon. Call this API to start IoTCon.
         /// </summary>
-        public static void Initialize()
+        /// <remarks>
+        /// @a filePath point to a file for handling secure virtual resources.
+        /// The file that is CBOR(Concise Binary Object Representation)-format must already exist
+        /// in @a filePath. We recommend to use application-local file for @a filePath.
+        /// </remarks>
+        /// <privilege>
+        /// http://tizen.org/privilege/network.get \n
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
+        /// <param name="filePath">The file path to point to storage for handling secure virtual resources.</param>
+        /// <post>
+        /// You must call Deinitialize() if IoTCon API is no longer needed.
+        /// </post>
+        /// <seealso cref="Deinitialize()"/>
+        /// <code>
+        /// string filePath = "../../res/iotcon-test-svr-db-server.dat";
+        /// IoTConnectivityServerManager.Initialize(filePath);
+        /// </code>
+        public static void Initialize(string filePath)
         {
-            int ret = Interop.IoTConnectivity.Client.IoTCon.Initialize();
+            int ret = Interop.IoTConnectivity.Client.IoTCon.Initialize(filePath);
             if (ret != (int)IoTConnectivityError.None)
             {
                 Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to initialize");
@@ -29,17 +47,45 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Disconnects with IoTCon service
+        /// Deinitializes IoTCon.
         /// </summary>
+        /// <remarks>
+        /// This API must be called if IoTCon API is no longer needed.
+        /// </remarks>
+        /// <pre>
+        /// Initialize() should be called to initialize.
+        /// </pre>
+        /// <seealso cref="Initialize()"/>
+        /// <code>
+        /// IoTConnectivityServerManager.Deinitialize();
+        /// </code>
         public static void Deinitialize()
         {
             Interop.IoTConnectivity.Client.IoTCon.Deinitialize();
         }
 
         /// <summary>
-        /// Registers a resource to be available from IoTCon server
+        /// Registers a resource in IoTCon server
         /// </summary>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
         /// <param name="resource">The resource to register</param>
+        /// <pre>
+        /// Initialize() should be called to initialize.
+        /// </pre>
+        /// <seealso cref="Resource"/>
+        /// <seealso cref="LiteResource"/>
+        /// <code>
+        /// ResourceTypes types = new ResourceTypes(new List<string>(){ "org.tizen.light" });
+        /// Attributes attributes = new Attributes { { "state", "ON" }};
+        /// Resource res = new LiteResource("/room/1", types, ResourcePolicy.Discoverable, attributes);
+        /// try {
+        ///     IoTConnectivityServerManager.RegisterResource(res);
+        /// } catch(Exception ex) {
+        ///     Console.Log("Exception caught : " + ex.Message);
+        /// }
+        /// </code>
         public static void RegisterResource(Resource resource)
         {
             IntPtr handle = IntPtr.Zero;
@@ -58,7 +104,30 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Starts presence of a server
         /// </summary>
+        /// <remarks>
+        /// Use this API to send server's announcements to clients.
+        /// Server can call this API when online for the first time or come back from offline to online.\n
+        /// If @a time is 0, server will set default value as 60 seconds.\n
+        /// If @a time is very big, server will set maximum value as (60 * 60 * 24) seconds, (24 hours).
+        /// </remarks>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
         /// <param name="time">The interval of announcing presence in seconds.</param>
+        /// <pre>
+        /// Initialize() should be called to initialize.
+        /// </pre>
+        /// <seealso cref="IoTConnectivityClientManager.StartReceivingPresence()"/>
+        /// <seealso cref="IoTConnectivityClientManager.StopReceivingPresence()"/>
+        /// <seealso cref="IoTConnectivityClientManager.PresenceReceived"/>
+        /// <seealso cref="StopSendingPresence()"/>
+        /// <code>
+        /// try {
+        ///     IoTConnectivityServerManager.StartSendingPresence(120);
+        /// } catch(Exception ex) {
+        ///     Console.Log("Exception caught : " + ex.Message);
+        /// }
+        /// </code>
         public static void StartSendingPresence(uint time)
         {
             int ret = Interop.IoTConnectivity.Server.IoTCon.StartPresence(time);
@@ -72,6 +141,23 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Stops presence of a server.
         /// </summary>
+        /// <remarks>
+        /// Use this API to stop sending server's announcements to clients.
+        /// Server can call this API when terminating, entering to offline or out of network.
+        /// </remarks>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
+        /// <pre>
+        /// Initialize() should be called to initialize.
+        /// </pre>
+        /// <seealso cref="IoTConnectivityClientManager.StartReceivingPresence()"/>
+        /// <seealso cref="IoTConnectivityClientManager.StopReceivingPresence()"/>
+        /// <seealso cref="IoTConnectivityClientManager.PresenceReceived"/>
+        /// <seealso cref="StartSendingPresence()"/>
+        /// <code>
+        /// IoTConnectivityServerManager.StopSendingPresence();
+        /// </code>
         public static void StopSendingPresence()
         {
             int ret = Interop.IoTConnectivity.Server.IoTCon.StopPresence();
@@ -85,7 +171,19 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Sets the device name
         /// </summary>
+        /// <remarks>
+        /// This API sets the name of the local device (the device calling the API).\n
+        /// If the device name is set, clients can get the name using <see cref="IoTConnectivityClientManager.StartFindingDeviceInformation()"/>.
+        /// Clients can also get the name using <see cref="RemoteResource.DeviceName"/> property.
+        /// </remarks>
         /// <param name="deviceName">The device name</param>
+        /// <seealso cref="IoTConnectivityClientManager.DeviceInformationFound"/>
+        /// <seealso cref="IoTConnectivityClientManager.StartFindingDeviceInformation()"/>
+        /// <seealso cref="DeviceInformationFoundEventArgs"/>
+        /// <seealso cref="RemoteResource.DeviceName"/>
+        /// <code>
+        /// IoTConnectivityServerManager.SetDeviceName("my-tizen");
+        /// </code>
         public static void SetDeviceName(string deviceName)
         {
             int ret = Interop.IoTConnectivity.Server.IoTCon.SetDeviceName(deviceName);
index d22ed2a..f089e30 100755 (executable)
@@ -6,22 +6,44 @@
 /// it only in accordance with the terms of the license agreement
 /// you entered into with Samsung.
 
-using System.Collections.Generic;
 
 namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
-    /// Class represnets a lite resource.
+    /// This class represents a lite resource.
+    /// It provides APIs to encapsulate resources.
+    /// This class is accessed by using a constructor to create a new instance of this object.
     /// </summary>
     public class LiteResource : Resource
     {
         /// <summary>
-        /// Constructor
+        /// The LiteResource constructor
         /// </summary>
+        /// <remarks>
+        /// Creates a lite resource which can then be registered in server using <see cref="IoTConnectivityServerManager.RegisterResource()"/>.\n
+        /// When client requests some operations, it send a response to client, automatically.\n
+        /// @a uri length must be less than 128.
+        /// </remarks>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
         /// <param name="uri">The uri path of the lite resource</param>
-        /// <param name="types">Resource type</param>
+        /// <param name="types">The type of the resource</param>
         /// <param name="policy">Policy of the resource</param>
         /// <param name="attribs">Optional attributes of the resource</param>
+        /// <pre>
+        /// IoTConnectivityServerManager.Initialize() should be called to initialize
+        /// </pre>
+        /// <seealso cref="ResourceTypes"/>
+        /// <seealso cref="ResourcePolicy"/>
+        /// <seealso cref="Attributes"/>
+        /// <code>
+        /// List<string> list = new List<string>() { "org.tizen.light" };
+        /// Attributes attributes = new Attributes() {
+        ///     { "state", "ON" }
+        /// };
+        /// LiteResource res = new LiteResource("/light/1", new ResourceTypes(list), ResourcePolicy.Discoverable, attributes);
+        /// </code>
         public LiteResource(string uri, ResourceTypes types, ResourcePolicy policy, Attributes attribs = null)
             : base(uri, types, new ResourceInterfaces(new string[] { ResourceInterfaces.DefaultInterface }), policy)
         {
@@ -29,24 +51,48 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// The attributes of the lite resource
+        /// Gets or sets the attributes of the lite resource
         /// </summary>
+        /// <code>
+        /// List<string> list = new List<string>() { "org.tizen.light" };
+        /// LiteResource res = new LiteResource("/light/1", new ResourceTypes(list), ResourcePolicy.Discoverable);
+        /// Attributes attributes = new Attributes() {
+        ///     { "state", "ON" }
+        /// };
+        /// res.Attributes = newAttributes;
+        /// foreach (KeyValuePair<string, object> pair in res.Attributes)
+        /// {
+        ///     Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value);
+        /// }
+        /// </code>
         public Attributes Attributes { get; set; }
 
         /// <summary>
-        /// The method to accept post request
+        /// Decides whether to accept or reject a post request.
         /// </summary>
+        /// <remarks>
+        /// Child classes of this class can override this method to accept or reject post request.
+        /// </remarks>
         /// <param name="attribs">The new attributes of the lite resource</param>
         /// <returns>true to accept post request, false to reject it</returns>
+        /// <code>
+        /// public class MyLightResource : LiteResource
+        /// {
+        ///     protected override bool OnPost(Attributes attributes)
+        ///     {
+        ///         object newAttributes;
+        ///         attributes.TryGetValue("LIGHT_ATTRIBUTE", out newAttributes);
+        ///         if((int)newAttributes == 1)
+        ///             return true;
+        ///         return false;
+        ///     }
+        /// }
+        /// </code>
         protected virtual bool OnPost(Attributes attribs)
         {
             return true;
         }
 
-        /// <summary>
-        /// Called on the get event.
-        /// </summary>
-        /// <param name="request">Request.</param>
         protected sealed override Response OnGet(Request request)
         {
             Representation representation = new Representation()
@@ -66,10 +112,6 @@ namespace Tizen.Network.IoTConnectivity
             return response;
         }
 
-        /// <summary>
-        /// Called on the put event.
-        /// </summary>
-        /// <param name="request">Request.</param>
         protected sealed override Response OnPut(Request request)
         {
             Response response = new Response();
@@ -77,10 +119,6 @@ namespace Tizen.Network.IoTConnectivity
             return response;
         }
 
-        /// <summary>
-        /// Called on the post event.
-        /// </summary>
-        /// <param name="request">Request.</param>
         protected sealed override Response OnPost(Request request)
         {
             if (OnPost(request.Representation.Attributes))
@@ -108,10 +146,6 @@ namespace Tizen.Network.IoTConnectivity
             };
         }
 
-        /// <summary>
-        /// Called on the delete event.
-        /// </summary>
-        /// <param name="request">Request.</param>
         protected sealed override Response OnDelete(Request request)
         {
             Response response = new Response();
@@ -119,12 +153,6 @@ namespace Tizen.Network.IoTConnectivity
             return response;
         }
 
-        /// <summary>
-        /// Called on the observing event.
-        /// </summary>
-        /// <param name="request">Request.</param>
-        /// <param name="observerType">Observer type</param>
-        /// <param name="observeId">Observe identifier.</param>
         protected sealed override bool OnObserving(Request request, ObserveType observeType, int observeId)
         {
             return true;
index 0d013db..c4b0503 100755 (executable)
@@ -9,7 +9,7 @@
 namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
-    /// Indicates delete method of request
+    /// Enumeration for policy of observation
     /// </summary>
     public enum ObservePolicy
     {
index 6ff7ec0..6b3619a 100755 (executable)
@@ -9,7 +9,7 @@
 namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
-    /// Observe type.
+    /// Enumeration for type of observation
     /// </summary>
     public enum ObserveType
     {
index 616912a..1b2aae0 100755 (executable)
@@ -18,15 +18,13 @@ namespace Tizen.Network.IoTConnectivity
         internal ObserverNotifiedEventArgs() { }
 
         /// <summary>
-        /// Result property.
+        /// Result of the observe response
         /// </summary>
-        /// <returns>ResponseCode Result.</returns>
         public ResponseCode Result { get; internal set; }
 
         /// <summary>
-        /// Representation property.
+        /// Representation of the resource being observed.
         /// </summary>
-        /// <returns>Representation Representation.</returns>
         public Representation Representation { get; internal set; }
     }
 }
index 176c425..e102d41 100755 (executable)
@@ -16,62 +16,62 @@ namespace Tizen.Network.IoTConnectivity
         internal PlatformInformationFoundEventArgs() { }
 
         /// <summary>
-        /// The request id
+        /// Indicates the request id
         /// </summary>
         public int RequestId { get; internal set; }
 
         /// <summary>
-        /// The platform identifier
+        /// Indicates the platform identifier
         /// </summary>
         public string PlatformId { get; internal set; }
 
         /// <summary>
-        /// The name of manufacturer
+        /// Indicates the name of manufacturer
         /// </summary>
         public string ManufacturerName { get; internal set; }
 
         /// <summary>
-        /// URL of the manufacturer
+        /// Indicates URL of the manufacturer
         /// </summary>
         public string ManufacturerURL { get; internal set; }
 
         /// <summary>
-        /// Model number as designated by manufacturer
+        /// Indicates model number as designated by manufacturer
         /// </summary>
         public string ModelNumber { get; internal set; }
 
         /// <summary>
-        /// Manugacturing date of the device
+        /// Indicates manufacturing date of the device
         /// </summary>
         public string DateOfManufacture { get; internal set; }
 
         /// <summary>
-        /// Version of platfrom defined by manufacturer
+        /// Indicates version of platfrom defined by manufacturer
         /// </summary>
         public string PlatformVersion { get; internal set; }
 
         /// <summary>
-        /// Version of platfrom resident OS
+        /// Indicates version of platfrom resident OS
         /// </summary>
         public string OsVersion { get; internal set; }
 
         /// <summary>
-        /// Version of platform Hardware
+        /// Indicates version of platform Hardware
         /// </summary>
         public string HardwareVersion { get; internal set; }
 
         /// <summary>
-        /// Version of device firmware
+        /// Indicates version of device firmware
         /// </summary>
         public string FirmwareVersion { get; internal set; }
 
         /// <summary>
-        /// URL that points to support information from manufacturer
+        /// Indicates URL that points to support information from manufacturer
         /// </summary>
         public string SupportUrl { get; internal set; }
 
         /// <summary>
-        /// Reference time of the device
+        /// Indicates reference time of the device
         /// </summary>
         public string SystemTime { get; internal set; }
     }
index 19d2cc4..c070974 100755 (executable)
@@ -9,7 +9,7 @@
 namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
-    /// Enumeration for presence events.
+    /// Enumeration for operation of presence response.
     /// </summary>
     public enum PresenceEventType
     {
@@ -18,7 +18,7 @@ namespace Tizen.Network.IoTConnectivity
         /// </summary>
         ResourceCreated = 0,
         /// <summary>
-        /// Indicates for resource creation operation of server
+        /// Indicates for resource updation operation of server
         /// </summary>
         ResourceUpdated,
         /// <summary>
index 75b4c41..a66019f 100755 (executable)
@@ -18,27 +18,23 @@ namespace Tizen.Network.IoTConnectivity
         internal PresenceReceivedEventArgs() { }
 
         /// <summary>
-        /// PresenceId property.
+        /// Indicates request id of presence event.
         /// </summary>
-        /// <returns>int PresenceId.</returns>
         public int PresenceId { get; internal set; }
 
         /// <summary>
-        /// EventType property.
+        /// Indicates event type
         /// </summary>
-        /// <returns>PresenceEventType EventType.</returns>
         public PresenceEventType EventType { get; internal set; }
 
         /// <summary>
-        /// HostAddress property.
+        /// Indicates host address of resource
         /// </summary>
-        /// <returns>string HostAddress.</returns>
         public string HostAddress { get; internal set; }
 
         /// <summary>
-        /// Type property.
+        /// Indicates type of the resource
         /// </summary>
-        /// <returns>string Type.</returns>
         public string Type { get; internal set; }
     }
 }
index 65624e6..7d51e56 100755 (executable)
@@ -9,7 +9,7 @@
 namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
-    /// Indicates observation request for all notifications including stale notifications
+    /// Enumeration for states of remote resource.
     /// </summary>
     public enum QualityOfService
     {
index e7af5bf..c861155 100755 (executable)
@@ -16,6 +16,7 @@ namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
     /// This class represents a remote resource.
+    /// It provides APIs to manage remote resource.
     /// </summary>
     public class RemoteResource : IDisposable
     {
@@ -36,8 +37,19 @@ namespace Tizen.Network.IoTConnectivity
         private EventHandler<StateChangedEventArgs> _stateChangedEventHandler;
 
         /// <summary>
-        /// Constructor
+        /// Creates a remote resource instance
         /// </summary>
+        /// <remarks>
+        /// To use this API, you should provide all of the details required to correctly contact and
+        /// observe the object.\n
+        /// If not, you should discover the resource object manually.\n
+        /// The @a policy can contain multiple policies like ResourcePolicy.Discoverable | ResourcePolicy.Observable.
+        /// </remarks>
+        /// <param name="hostAddress">The host address of the resource</param>
+        /// <param name="uriPath">The URI path of the resource</param>
+        /// <param name="policy">The policies of the resource</param>
+        /// <param name="resourceTypes">The resource types of the resource</param>
+        /// <param name="resourceInterfaces">The resource interfaces of the resource</param>
         public RemoteResource(string hostAddress, string uriPath, ResourcePolicy policy, ResourceTypes resourceTypes, ResourceInterfaces resourceInterfaces)
         {
             if (hostAddress == null || uriPath == null || resourceTypes == null || resourceInterfaces == null)
@@ -67,18 +79,21 @@ namespace Tizen.Network.IoTConnectivity
             SetRemoteResource();
         }
 
+        /// <summary>
+        /// Destructor of the RemoteResource class.
+        /// </summary>
         ~RemoteResource()
         {
             Dispose(false);
         }
 
         /// <summary>
-        /// Event that is called to cache resource attribute's
+        /// Event that is invoked with cached resource attributes
         /// </summary>
         public event EventHandler<CacheUpdatedEventArgs> CacheUpdated;
 
         /// <summary>
-        /// Observe event on the resource
+        /// Observe event on the resource sent by the server
         /// </summary>
         public event EventHandler<ObserverNotifiedEventArgs> ObserverNotified;
 
@@ -160,8 +175,11 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Cache enabled property
+        /// Indicates the CacheEnabled status of the remote resource.
         /// </summary>
+        /// <remarks>
+        /// Client can start caching only when this is set true. Set it to false to stop caching the resource attributes.
+        /// </remarks>
         public bool CacheEnabled
         {
             get
@@ -181,6 +199,10 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Time interval of monitoring and caching API
         /// </summary>
+        /// <remarks>
+        /// Default time interval is 10 seconds.\n
+        /// Seconds for time interval (must be in range from 1 to 3600)
+        /// </remarks>
         public int TimeInterval
         {
             get
@@ -197,7 +219,7 @@ namespace Tizen.Network.IoTConnectivity
             set
             {
                 int ret = (int)IoTConnectivityError.InvalidParameter;
-                if (value < TimeOutMax && value > 0)
+                if (value <= TimeOutMax && value > 0)
                 {
                     ret = Interop.IoTConnectivity.Client.RemoteResource.SetTimeInterval(value);
                 }
@@ -215,7 +237,7 @@ namespace Tizen.Network.IoTConnectivity
         public string DeviceId { get; private set; }
 
         /// <summary>
-        /// Gets cached representation of the remote resource
+        /// Gets cached representation from the remote resource
         /// </summary>
         public Representation CachedRepresentation()
         {
@@ -232,10 +254,16 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Registers the observe callback on the resource
+        /// Starts observing on the resource
         /// </summary>
+        /// <remarks>
+        /// When server sends notification message, <see cref="ObserverNotified"/> will be called.
+        /// </remarks>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
         /// <param name="policy">The type to specify how client wants to observe</param>
-        /// <param name="query">The ResourceQuery to send to server</param>
+        /// <param name="query">The query to send to server</param>
         public void StartObserving(ObservePolicy policy, ResourceQuery query = null)
         {
             _observeCallback = (IntPtr resource, int err, int sequenceNumber, IntPtr response, IntPtr userData) =>
@@ -290,8 +318,11 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Deregisters the observe callback on the resource
+        /// Stops observing on the resource
         /// </summary>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
         public void StopObserving()
         {
             int ret = Interop.IoTConnectivity.Client.RemoteResource.DeregisterObserve(_remoteResourceHandle);
@@ -303,10 +334,13 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Gets the attributes of a resource
+        /// Gets the attributes of a resource, asynchronously
         /// </summary>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
         /// <param name="query">The ResourceQuery to send to server</param>
-        /// <returns></returns>
+        /// <returns>Remote response with result and representation</returns>
         public async Task<RemoteResponse> GetAsync(ResourceQuery query = null)
         {
             TaskCompletionSource<RemoteResponse> tcsRemoteResponse = new TaskCompletionSource<RemoteResponse>();
@@ -355,9 +389,12 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Puts the representation of a resource, asynchronously.
         /// </summary>
-        /// <param name="representation">Resource representation</param>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
+        /// <param name="representation">Resource representation to put</param>
         /// <param name="query">The ResourceQuery to send to server</param>
-        /// <returns></returns>
+        /// <returns>Remote response with result and representation</returns>
         public async Task<RemoteResponse> PutAsync(Representation representation, ResourceQuery query = null)
         {
             TaskCompletionSource<RemoteResponse> tcsRemoteResponse = new TaskCompletionSource<RemoteResponse>();
@@ -409,11 +446,14 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Post request on a resource
+        /// Post request on a resource, asynchronously
         /// </summary>
-        /// <param name="representation">Resource representation</param>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
+        /// <param name="representation">Resource representation of request</param>
         /// <param name="query">The ResourceQuery to send to server</param>
-        /// <returns></returns>
+        /// <returns>Remote response with result and representation</returns>
         public async Task<RemoteResponse> PostAsync(Representation representation, ResourceQuery query = null)
         {
             TaskCompletionSource<RemoteResponse> tcsRemoteResponse = new TaskCompletionSource<RemoteResponse>();
@@ -430,7 +470,6 @@ namespace Tizen.Network.IoTConnectivity
                 {
                     _responseCallbacksMap.Remove(responseCallbackId);
                 }
-
                 if (responseHandle != IntPtr.Zero)
                 {
                     try
@@ -448,7 +487,6 @@ namespace Tizen.Network.IoTConnectivity
                     tcsRemoteResponse.TrySetException(IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.System));
                 }
             };
-
             IntPtr queryHandle = (query == null) ? IntPtr.Zero : query._resourceQueryHandle;
             int errCode = Interop.IoTConnectivity.Client.RemoteResource.Post(_remoteResourceHandle, representation._representationHandle, queryHandle, _responseCallbacksMap[id], id);
             if (errCode != (int)IoTConnectivityError.None)
@@ -460,9 +498,12 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Delete the resource
+        /// Deletes the resource, asynchronously
         /// </summary>
-        /// <returns></returns>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
+        /// <returns>Remote response with result and representation</returns>
         public async Task<RemoteResponse> DeleteAsync()
         {
             TaskCompletionSource<RemoteResponse> tcsRemoteResponse = new TaskCompletionSource<RemoteResponse>();
@@ -513,6 +554,9 @@ namespace Tizen.Network.IoTConnectivity
             return await tcsRemoteResponse.Task;
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
@@ -558,6 +602,10 @@ namespace Tizen.Network.IoTConnectivity
             return type;
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (_disposed)
index a17c30d..d57472f 100755 (executable)
@@ -10,9 +10,12 @@ namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
     /// This class represents remote response.
+    /// It represents the response of all CRUD operations.
     /// </summary>
     public class RemoteResponse
     {
+        internal RemoteResponse() { }
+
         /// <summary>
         /// Indicates the result of the response
         /// </summary>
index 1a5af8a..52c5c29 100755 (executable)
@@ -14,7 +14,8 @@ using System.Runtime.InteropServices;
 namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
-    /// Class containing representation of a resource.
+    /// This class provides API to manage representation.
+    /// A representation is a payload of a request or a response.
     /// </summary>
     public class Representation : IDisposable
     {
@@ -24,8 +25,12 @@ namespace Tizen.Network.IoTConnectivity
         private ObservableCollection<Representation> _children = new ObservableCollection<Representation>();
 
         /// <summary>
-        /// Constructor
+        /// The Representation constructor
         /// </summary>
+        /// </summary>
+        /// <code>
+        /// Representation repr = new Representation();
+        /// </code>
         public Representation()
         {
             int ret = Interop.IoTConnectivity.Common.Representation.Create(out _representationHandle);
@@ -55,14 +60,25 @@ namespace Tizen.Network.IoTConnectivity
             _children.CollectionChanged += ChildrenCollectionChanged;
         }
 
+        /// <summary>
+        /// Destructor of the Representation class.
+        /// </summary>
         ~Representation()
         {
             Dispose(false);
         }
 
         /// <summary>
-        /// The URI of resource
+        /// The URI path of resource
         /// </summary>
+        /// <remarks>
+        /// Setter can throw exceptions
+        /// </remarks>
+        /// <code>
+        /// Representation repr = new Representation();
+        /// repr.UriPath = "/a/light";
+        /// Console.WriteLine("URI is {0}", repr.UriPath);  //Getter
+        /// </code>
         public string UriPath
         {
             get
@@ -92,6 +108,17 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// The type of resource
         /// </summary>
+        /// <seealso cref="ResourceTypes"/>
+        /// <code>
+        /// Representation repr = new Representation();
+        /// ResourceTypes types = new ResourceTypes (new List<string>(){ "org.tizen.light" });
+        /// repr.Type = types;
+        /// var type = repr.Type;   // Getter
+        /// foreach (string item in type)
+        /// {
+        ///     Console.WriteLine("Type is {0}", item);
+        /// }
+        /// </code>
         public ResourceTypes Type
         {
             get
@@ -103,6 +130,10 @@ namespace Tizen.Network.IoTConnectivity
                     Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get type");
                     throw IoTConnectivityErrorFactory.GetException(ret);
                 }
+                if (typeHandle == IntPtr.Zero)
+                {
+                    return null;
+                }
                 return new ResourceTypes(typeHandle);
             }
             set
@@ -121,6 +152,17 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// The interface of the resource
         /// </summary>
+        /// <seealso cref="ResourceInterfaces"/>
+        /// <code>
+        /// Representation repr = new Representation();
+        /// ResourceInterfaces ifaces = new ResourceInterfaces (new List<string>(){ ResourceInterfaces.DefaultInterface });
+        /// repr.Interface = ifaces;
+        /// var iface = repr.Interface;   // Getter
+        /// foreach (string item in iface)
+        /// {
+        ///     Console.WriteLine("Interface is {0}", iface);
+        /// }
+        /// </code>
         public ResourceInterfaces Interface
         {
             get
@@ -132,6 +174,10 @@ namespace Tizen.Network.IoTConnectivity
                     Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get interface");
                     throw IoTConnectivityErrorFactory.GetException(ret);
                 }
+                if (interfaceHandle == IntPtr.Zero)
+                {
+                    return null;
+                }
                 return new ResourceInterfaces(interfaceHandle);
             }
             set
@@ -150,6 +196,19 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Current attributes of the resource
         /// </summary>
+        /// <seealso cref="Attributes"/>
+        /// <code>
+        /// Representation repr = new Representation();
+        /// Attributes attributes = new Attributes() {
+        ///     { "state", "ON" },
+        ///     { "dim", 10 }
+        /// };
+        /// repr.Attributes = attributes;
+        /// var newAttributes = repr.Attributes;   // Getter
+        /// string strval = newAttributes["state"] as string;
+        /// int intval = (int)newAttributes["dim"];
+        /// Console.WriteLine("attributes are {0} and {1}", strval, intval);
+        /// </code>
         public Attributes Attributes
         {
             get
@@ -181,6 +240,23 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// List of Child resource representation
         /// </summary>
+        /// <code>
+        /// Representation repr = new Representation();
+        /// Representation child1 = new Representation();
+        /// ResourceTypes types1 = new ResourceTypes(new List<string>() { "org.tizen.light" });
+        /// child1.Type = types1;
+        /// ResourceInterfaces ifaces1 = new ResourceInterfaces(new List<string>() { ResourceInterfaces.DefaultInterface });
+        /// child1.Interface = ifaces1;
+        /// try
+        /// {
+        ///     repr.Children.Add(child1);
+        ///     Console.WriteLine("Number of children : {0}", repr.Children.Count);
+        ///     Representation firstChild = repr.Children.ElementAt(0);
+        /// } catch(Exception ex)
+        /// {
+        ///     Console.WriteLine("Exception caught : " + ex.Message);
+        /// }
+        /// </code>
         public ICollection<Representation> Children
         {
             get
@@ -189,12 +265,19 @@ namespace Tizen.Network.IoTConnectivity
             }
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
             GC.SuppressFinalize(this);
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (_disposed)
@@ -206,6 +289,10 @@ namespace Tizen.Network.IoTConnectivity
                 Type?.Dispose();
                 Interface?.Dispose();
                 Attributes?.Dispose();
+                foreach(var child in Children)
+                {
+                    child.Dispose();
+                }
             }
 
             Interop.IoTConnectivity.Common.Representation.Destroy(_representationHandle);
index 929fb45..2746e54 100755 (executable)
@@ -12,6 +12,7 @@ namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
     /// Class respresenting request to a resource.
+    /// It provides APIs to manage client's request.
     /// </summary>
     public class Request : IDisposable
     {
@@ -21,6 +22,9 @@ namespace Tizen.Network.IoTConnectivity
         {
         }
 
+        /// <summary>
+        /// Destructor of the Request class.
+        /// </summary>
         ~Request()
         {
             Dispose(false);
@@ -46,12 +50,19 @@ namespace Tizen.Network.IoTConnectivity
         /// </summary>
         public ResourceOptions Options { get; internal set; }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
             GC.SuppressFinalize(this);
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (_disposed)
index 8fef403..aeeefdd 100755 (executable)
@@ -15,6 +15,7 @@ namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
     /// Abstract class respresenting a resource.
+    /// All resources need to inherit from this class.
     /// </summary>
     public abstract class Resource : IDisposable
     {
@@ -26,10 +27,44 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// The constructor
         /// </summary>
-        /// <param name="uri">URI of the resource</param>
+        /// <remarks>
+        /// @a uri format would be relative URI path like '/a/light'
+        /// and its length must be less than 128.
+        /// </remarks>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
+        /// <param name="uri">The URI path of the resource</param>
         /// <param name="types">Resource types</param>
         /// <param name="interfaces">Resource interfaces</param>
-        /// <param name="policy">Policy input of the resoruce</param>
+        /// <param name="policy">The policies of the resoruce</param>
+        /// <pre>
+        /// IoTConnectivityServerManager.Initialize() should be called to initialize
+        /// </pre>
+        /// <seealso cref="ResourceTypes"/>
+        /// <seealso cref="ResourceInterfaces"/>
+        /// <seealso cref="ResourcePolicy"/>
+        /// <code>
+        /// // Create a class which inherits from Resource
+        /// public class DoorResource : Resource
+        /// {
+        ///     public DoorResource(string uri, ResourceTypes types, ResourceInterfaces interfaces, ResourcePolicy policy)
+        ///             : base(uri, types, interfaces, policy) {
+        ///     }
+        ///     protected override Response OnDelete(Request request) {
+        ///         // Do something
+        ///     }
+        ///     protected override Response OnGet(Request request) {
+        ///         // Do something
+        ///     }
+        ///     // Override other abstract methods of Resource class
+        /// }
+        ///
+        /// // Use it like below
+        /// ResourceInterfaces ifaces = new ResourceInterfaces(new List<string>(){ ResourceInterfaces.DefaultInterface });
+        /// ResourceTypes types = new ResourceTypes(new List<string>(){ "oic.iot.door.new" });
+        /// Resource resource = new DoorResource("/door/uri1", types, ifaces, ResourcePolicy.Discoverable | ResourcePolicy.Observable);
+        /// </code>
         protected Resource(string uri, ResourceTypes types, ResourceInterfaces interfaces, ResourcePolicy policy)
         {
             UriPath = uri;
@@ -47,6 +82,9 @@ namespace Tizen.Network.IoTConnectivity
             }
         }
 
+        /// <summary>
+        /// Destructor of the Resource class.
+        /// </summary>
         ~Resource()
         {
             Dispose(false);
@@ -63,12 +101,12 @@ namespace Tizen.Network.IoTConnectivity
         public ResourceInterfaces Interfaces { get; internal set; }
 
         /// <summary>
-        /// The policy
+        /// The policies of the resource
         /// </summary>
         public ResourcePolicy Policy { get; internal set; }
 
         /// <summary>
-        /// URI of the resource
+        /// URI path of the resource
         /// </summary>
         public string UriPath { get; internal set; }
 
@@ -98,8 +136,30 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Notify the specified representation and qos.
         /// </summary>
+        /// <privilege>
+        /// http://tizen.org/privilege/internet
+        /// </privilege>
         /// <param name="representation">Representation.</param>
-        /// <param name="qos">Qos.</param>
+        /// <param name="qos">The quality of service for message transfer.</param>
+        /// <pre>
+        /// IoTConnectivityServerManager.Initialize() should be called to initialize
+        /// </pre>
+        /// <seealso cref="Representation"/>
+        /// <seealso cref="QualityOfService"/>
+        /// <code>
+        /// ResourceInterfaces ifaces = new ResourceInterfaces(new List<string>(){ ResourceInterfaces.DefaultInterface });
+        /// ResourceTypes types = new ResourceTypes(new List<string>(){ "oic.iot.door.new.notify" });
+        /// Resource resource = new DoorResource("/door/uri/new/notify", types, ifaces, ResourcePolicy.Discoverable | ResourcePolicy.Observable);
+        /// IoTConnectivityServerManager.RegisterResource(resource);
+        ///
+        /// Representation repr = new Representation();
+        /// repr.UriPath = "/door/uri/new/notify";
+        /// repr.Type = new ResourceTypes(new List<string>(){ "oic.iot.door.new.notify" });
+        /// repr.Attributes = new Attributes() {
+        ///      _attribute, 1 }
+        /// };
+        /// resource.Notify(repr, QualityOfService.High);
+        /// </code>
         public void Notify(Representation representation, QualityOfService qos)
         {
             int ret = (int)IoTConnectivityError.None;
@@ -112,43 +172,55 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Called on the get event.
+        /// This is Called when the client performs get operation on this resource.
         /// </summary>
-        /// <param name="request">Request.</param>
+        /// <param name="request">A request from client</param>
+        /// <returns>A response having the representation and the result</returns>
         protected abstract Response OnGet(Request request);
 
         /// <summary>
-        /// Called on the put event.
+        /// This is Called when the client performs put operation on this resource.
         /// </summary>
-        /// <param name="request">Request.</param>
+        /// <param name="request">A request from client</param>
+        /// <returns>A response</returns>
         protected abstract Response OnPut(Request request);
 
         /// <summary>
-        /// Called on the post event.
+        /// This is Called when the client performs post operation on this resource.
         /// </summary>
-        /// <param name="request">Request.</param>
+        /// <param name="request">A request from client</param>
+        /// <returns>A response having the representation and the result</returns>
         protected abstract Response OnPost(Request request);
 
         /// <summary>
-        /// Called on the delete event.
+        /// This is Called when the client performs delete operation on this resource.
         /// </summary>
-        /// <param name="request">Request.</param>
+        /// <param name="request">A request from client</param>
+        /// <returns>A response</returns>
         protected abstract Response OnDelete(Request request);
 
         /// <summary>
         /// Called on the observing event.
         /// </summary>
-        /// <param name="request">Request.</param>
-        /// <param name="policy">Policy.</param>
+        /// <param name="request">A request from client</param>
+        /// <param name="type">Observer type</param>
         /// <param name="observeId">Observe identifier.</param>
+        /// <returns>Returns true if it wants to be observed, else false.</returns>
         protected abstract bool OnObserving(Request request, ObserveType type, int observeId);
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
             GC.SuppressFinalize(this);
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (_disposed)
@@ -188,7 +260,6 @@ namespace Tizen.Network.IoTConnectivity
                     Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to Get observe type");
                     return;
                 }
-
                 if ((ObserveType)observeType != ObserveType.NoType)
                 {
                     int observeId;
@@ -238,7 +309,6 @@ namespace Tizen.Network.IoTConnectivity
                         }
                     }
                 }
-
                 int requestType;
                 ret = Interop.IoTConnectivity.Server.Request.GetRequestType(requestHandle, out requestType);
                 if (ret != (int)IoTConnectivityError.None)
@@ -246,7 +316,6 @@ namespace Tizen.Network.IoTConnectivity
                     Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to Get request type");
                     return;
                 }
-
                 switch ((Interop.IoTConnectivity.Server.RequestType)requestType)
                 {
                     case Interop.IoTConnectivity.Server.RequestType.Put:
index 0d37588..050ff68 100755 (executable)
@@ -18,15 +18,16 @@ namespace Tizen.Network.IoTConnectivity
         internal ResourceFoundEventArgs() { }
 
         /// <summary>
-        /// RequestId property.
+        /// Indicates the request id.
+        /// This is the same request id returned by the <see cref="IoTConnectivityClientManager.StartFindingResource()"/> API.
         /// </summary>
-        /// <returns>int RequestId.</returns>
         public int RequestId { get; internal set; }
 
         /// <summary>
-        /// Resource property.
+        /// Remote resource which is found after <see cref="IoTConnectivityClientManager.StartFindingResource()"/>.
         /// </summary>
-        /// <returns>RemoteResource Resource.</returns>
+        /// <seealso cref="IoTConnectivityClientManager.ResourceFound"/>
+        /// <seealso cref="IoTConnectivityClientManager.StartFindingResource()"/>
         public RemoteResource Resource { get; internal set; }
     }
 }
index 95227ff..aa05b66 100755 (executable)
@@ -14,7 +14,8 @@ using System.Text.RegularExpressions;
 namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
-    /// Class containing resource interfaces
+    /// This class contains resource interfaces and provides APIs to manage, add, remove those interfaces.
+    /// A resource interface indicates a class or category of resources.
     /// </summary>
     public class ResourceInterfaces : IEnumerable<string>, IDisposable
     {
@@ -24,7 +25,7 @@ namespace Tizen.Network.IoTConnectivity
         public const string DefaultInterface = "oic.if.baseline";
 
         /// <summary>
-        /// List Links Interface which is used to list the references to other resources  contained in a resource.
+        /// List Links Interface which is used to list the references to other resources contained in a resource.
         /// </summary>
         public const string LinkInterface = "oic.if.ll";
 
@@ -49,8 +50,13 @@ namespace Tizen.Network.IoTConnectivity
         private bool _disposed = false;
 
         /// <summary>
-        /// Constructor
+        /// Constructor of ResourceInterfaces
         /// </summary>
+        /// <seealso cref="Add()"/>
+        /// <seealso cref="Remove()"/>
+        /// <code>
+        /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces();
+        /// </code>
         public ResourceInterfaces()
         {
             int ret = Interop.IoTConnectivity.Common.ResourceInterfaces.Create(out _resourceInterfacesHandle);
@@ -62,9 +68,13 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Constructor
+        /// Constructor of ResourceInterfaces using list of interfaces
         /// </summary>
         /// <param name="ifaces">List of resource interfaces</param>
+        /// <code>
+        /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces(new List<string>()
+        ///     { ResourceInterfaces.LinkInterface, ResourceInterfaces.ReadonlyInterface });
+        /// </code>
         public ResourceInterfaces(IEnumerable<string> ifaces)
         {
             int ret = Interop.IoTConnectivity.Common.ResourceInterfaces.Create(out _resourceInterfacesHandle);
@@ -79,9 +89,6 @@ namespace Tizen.Network.IoTConnectivity
             }
         }
 
-        /// <summary>
-        /// Constructor
-        /// </summary>
         internal ResourceInterfaces(IntPtr ifacesHandleToClone)
         {
             int ret = Interop.IoTConnectivity.Common.ResourceInterfaces.Clone(ifacesHandleToClone, out _resourceInterfacesHandle);
@@ -105,6 +112,9 @@ namespace Tizen.Network.IoTConnectivity
             }
         }
 
+        /// <summary>
+        /// Destructor of the ResourceInterfaces class.
+        /// </summary>
         ~ResourceInterfaces()
         {
             Dispose(false);
@@ -119,8 +129,13 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Count of interfaces in the list
+        /// Indicates count of interfaces in the list
         /// </summary>
+        /// <code>
+        /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces(new List<string>()
+        ///     { ResourceInterfaces.LinkInterface, ResourceInterfaces.ReadonlyInterface });
+        /// Console.WriteLine("There are {0} interfaces", resourceInterfaces.Count);
+        /// </code>
         public int Count
         {
             get
@@ -132,7 +147,15 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Adds a resource interface into the list.
         /// </summary>
-        /// <param name="item"> Resource interface</param>
+        /// <remarks>
+        /// @a item could be a value such as <see cref="DefaultInterface"/>
+        /// </remarks>
+        /// <param name="item">The string data to insert into the resource interfaces</param>
+        /// <seealso cref="Remove()"/>
+        /// <code>
+        /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces();
+        /// resourceInterfaces.Add(ResourceInterfaces.BatchInterface);
+        /// </code>
         public void Add(string item)
         {
             if (IsValid(item))
@@ -155,36 +178,69 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Removes a resource interface from the list
         /// </summary>
-        /// <param name="item">Resource interface</param>
+        /// <param name="item">The string data to delete from the resource ifaces</param>
+        /// <seealso cref="Add()"/>
+        /// <code>
+        /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces(new List<string>(){ ResourceInterfaces.BatchInterface });
+        /// resourceInterfaces.Add(ResourceInterfaces.BatchInterface);
+        /// </code>
         public void Remove(string item)
         {
-            int ret = Interop.IoTConnectivity.Common.ResourceInterfaces.Remove(_resourceInterfacesHandle, item);
-            if (ret != (int)IoTConnectivityError.None)
+            bool isRemoved = _resourceInterfaces.Remove(item);
+            if (isRemoved)
             {
-                Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add interface");
-                throw IoTConnectivityErrorFactory.GetException(ret);
+                int ret = Interop.IoTConnectivity.Common.ResourceInterfaces.Remove(_resourceInterfacesHandle, item);
+                if (ret != (int)IoTConnectivityError.None)
+                {
+                    Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add interface");
+                    throw IoTConnectivityErrorFactory.GetException(ret);
+                }
             }
-            _resourceInterfaces.Remove(item);
+            else
+                throw IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.InvalidParameter);
         }
 
         /// <summary>
         /// Return enumerator for the list of interfaces
         /// </summary>
         /// <returns>The enumerator</returns>
+        /// <code>
+        /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces(new List<string>()
+        ///     { ResourceInterfaces.LinkInterface, ResourceInterfaces.ReadonlyInterface });
+        /// foreach(string item in resourceInterfaces)
+        /// {
+        ///     Console.WriteLine("Interface : {0}", item);
+        /// }
+        /// </code>
         public IEnumerator<string> GetEnumerator()
         {
             return _resourceInterfaces.GetEnumerator();
         }
 
-        public void Dispose()
+        /// <summary>
+        /// Return enumerator for the list of interfaces
+        /// </summary>
+        /// <returns>The enumerator</returns>
+        /// <code>
+        /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces(new List<string>()
+        ///     { ResourceInterfaces.LinkInterface, ResourceInterfaces.ReadonlyInterface });
+        /// foreach(string item in resourceInterfaces)
+        /// {
+        ///     Console.WriteLine("Interface : {0}", item);
+        /// }
+        /// </code>
+        IEnumerator IEnumerable.GetEnumerator()
         {
-            Dispose(true);
-            GC.SuppressFinalize(this);
+            return _resourceInterfaces.GetEnumerator();
         }
 
-        IEnumerator IEnumerable.GetEnumerator()
+        /// <summary>
+        /// Releases any unmanaged resources used by this object.
+        /// </summary>
+        public void Dispose()
         {
-            return _resourceInterfaces.GetEnumerator();
+            Dispose(true);
+            GC.SuppressFinalize(this);
         }
 
         internal static bool IsValid(string type)
@@ -193,6 +249,10 @@ namespace Tizen.Network.IoTConnectivity
             return (type.Length <= MaxLength && char.IsLower(type[0]) && r.IsMatch(type));
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (_disposed)
index 055f24d..373078f 100755 (executable)
@@ -10,12 +10,13 @@ using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Linq;
-using Tizen;
 
 namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
-    /// This class represents resource options.
+    /// This class represents resource options. It provides APIs to manage them.\n
+    /// The iotcon options API provides methods for managing vendor specific options of coap packet.\n
+    /// See more about coap packet in http://tools.ietf.org/html/rfc7252.
     /// </summary>
     public class ResourceOptions : IDictionary<ushort, string>, IDisposable
     {
@@ -28,6 +29,14 @@ namespace Tizen.Network.IoTConnectivity
         private readonly IDictionary<ushort, string> _options = new Dictionary<ushort, string>();
         private bool _disposed = false;
 
+        /// <summary>
+        /// The resource options constructor
+        /// </summary>
+        /// <seealso cref="Add()"/>
+        /// <seealso cref="Remove()"/>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// </code>
         public ResourceOptions()
         {
             int ret = Interop.IoTConnectivity.Common.Options.Create(out _resourceOptionsHandle);
@@ -38,6 +47,7 @@ namespace Tizen.Network.IoTConnectivity
             }
         }
 
+        // internal constructor
         internal ResourceOptions(IntPtr handleToClone)
         {
             int ret = Interop.IoTConnectivity.Common.Options.Create(out _resourceOptionsHandle);
@@ -61,6 +71,9 @@ namespace Tizen.Network.IoTConnectivity
             }
         }
 
+        /// <summary>
+        /// Destructor of the ResourceOptions class.
+        /// </summary>
         ~ResourceOptions()
         {
             Dispose(false);
@@ -69,6 +82,13 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Contains all the Option keys
         /// </summary>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(2050, "sample-data");
+        /// options.Add(2055, "sample value");
+        /// var keys = options.Keys;
+        /// Console.WriteLine("Resource options contains keys {0} and {1}", keys.ElementAt(0), keys.ElementAt(1));
+        /// </code>
         public ICollection<ushort> Keys
         {
             get
@@ -80,6 +100,13 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Contains all the Option values
         /// </summary>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(2050, "sample-data");
+        /// options.Add(2055, "sample value");
+        /// var values = options.Values;
+        /// Console.WriteLine("Resource options contains values {0} and {1}", values.ElementAt(0), values.ElementAt(1));
+        /// </code>
         public ICollection<string> Values
         {
             get
@@ -91,6 +118,13 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Gets the number of options
         /// </summary>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(2050, "sample-data");
+        /// options.Add(2055, "sample value");
+        /// var count = options.Count;
+        /// Console.WriteLine("There are {0} keys in the options object", count);
+        /// </code>
         public int Count
         {
             get
@@ -102,6 +136,11 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Represents whether the collection is readonly
         /// </summary>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// if (options.IsReadOnly)
+        ///     Console.WriteLine("Read only options");
+        /// </code>
         public bool IsReadOnly
         {
             get
@@ -111,17 +150,22 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Gets or sets the option
+        /// Gets or sets the option data
         /// </summary>
+        /// <remarks>
         /// <param name="key">The option id to get or set.</param>
         /// <returns>The option with the specified id.</returns>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options[2055] = "sample-data";
+        /// Console.WriteLine("Option has : {0}", options[2055]);
+        /// </code>
         public string this[ushort key]
         {
             get
             {
                 return _options[key];
             }
-
             set
             {
                 Add(key, value);
@@ -129,20 +173,36 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Checks the given key exists in Options collection
+        /// Checks whether the given key exists in Options collection
         /// </summary>
         /// <param name="key">The key to look for</param>
-        /// <returns></returns>
+        /// <returns>true if exists. Otherwise, false</returns>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(2050, "sample-data");
+        /// if (options.ContainsKey(2050))
+        ///     Console.WriteLine("options conatins key : 2050");
+        /// </code>
         public bool ContainsKey(ushort key)
         {
             return _options.ContainsKey(key);
         }
 
         /// <summary>
-        ///  Adds option key and value
+        /// Adds a new id and a correspoding data into the options.
         /// </summary>
-        /// <param name="key">Option ID</param>
-        /// <param name="value">Value coresponding to option</param>
+        /// <remarks>
+        /// ResourceOptions can have up to 2 options. \n
+        /// key is always situated between 2048 and 3000. \n
+        /// Length of option data is less than or equal to 15.
+        /// </remarks>
+        /// <param name="key">The id of the option to insert</param>
+        /// <param name="value">The string data to insert into the options</param>
+        /// <seealso cref="Remove()"/>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(2050, "sample-data");
+        /// </code>
         public void Add(ushort key, string value)
         {
             int ret = (int)IoTConnectivityError.InvalidParameter;
@@ -164,28 +224,45 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Removes an option
+        /// Removes the id and its associated data from the options.
         /// </summary>
-        /// <param name="key">The option to remvoe</param>
-        /// <returns></returns>
+        /// <param name="key">The id of the option to delete</param>
+        /// <returns>True if operation is successful. Otherwise, false</returns>
+        /// <seealso cref="Add()"/>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(2050, "12345");
+        /// var result = options.Remove(2050);
+        /// </code>
         public bool Remove(ushort key)
         {
-            int ret = Interop.IoTConnectivity.Common.Options.Remove(_resourceOptionsHandle, key);
-            if (ret != (int)IoTConnectivityError.None)
+            bool isRemoved = _options.Remove(key);
+            if (isRemoved)
             {
-                Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove option");
-                throw IoTConnectivityErrorFactory.GetException(ret);
+                int ret = Interop.IoTConnectivity.Common.Options.Remove(_resourceOptionsHandle, key);
+                if (ret != (int)IoTConnectivityError.None)
+                {
+                    Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove option");
+                    throw IoTConnectivityErrorFactory.GetException(ret);
+                }
             }
-
-            return _options.Remove(key);
+            return isRemoved;
         }
 
         /// <summary>
         /// Gets the value associated with the specified key.
         /// </summary>
         /// <param name="key">The option id</param>
-        /// <param name="value">value corresponding to option id</param>
-        /// <returns>true if the key exists, false otherwise</returns>
+        /// <param name="value">Value corresponding to option id</param>
+        /// <returns>True if the key exists, false otherwise</returns>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(2050, "12345");
+        /// string value;
+        /// var isPresent = options.TryGetValue(2050, out value);
+        /// if (isPresent)
+        ///     Console.WriteLine("value : {0}", value);
+        /// </code>
         public bool TryGetValue(ushort key, out string value)
         {
             return _options.TryGetValue(key, out value);
@@ -195,6 +272,11 @@ namespace Tizen.Network.IoTConnectivity
         ///  Adds options key and value as a key value pair
         /// </summary>
         /// <param name="item">The key value pair</param>
+        /// <seealso cref="Remove()"/>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(new KeyValuePair<ushort, string>(2050, "12345"));
+        /// </code>
         public void Add(KeyValuePair<ushort, string> item)
         {
             Add(item.Key, item.Value);
@@ -203,6 +285,12 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Clears the Options collection
         /// </summary>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(2050, "12345");
+        /// options.Add(2055, "sample");
+        /// options.Clear();
+        /// </code>
         public void Clear()
         {
             foreach (ushort key in Keys)
@@ -221,7 +309,14 @@ namespace Tizen.Network.IoTConnectivity
         /// Checks if the given option pair exists
         /// </summary>
         /// <param name="item">The key value pair</param>
-        /// <returns></returns>
+        /// <returns>True if exists. Otherwise, false</returns>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(new KeyValuePair<ushort, string>(2050, "12345"));
+        /// var isPresent = options.Contains(new KeyValuePair<ushort, string>(2050, "12345"));
+        /// if (isPresent)
+        ///     Console.WriteLine("Key value pair is present");
+        /// </code>
         public bool Contains(KeyValuePair<ushort, string> item)
         {
             return _options.Contains(item);
@@ -232,16 +327,29 @@ namespace Tizen.Network.IoTConnectivity
         /// </summary>
         /// <param name="array">The destination array</param>
         /// <param name="arrayIndex">Index parameter</param>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(new KeyValuePair<ushort, string>(2050, "12345"));
+        /// KeyValuePair<ushort, string>[] dest = new KeyValuePair<ushort, string>[options.Count];
+        /// options.CopyTo(dest, 0);
+        /// Console.WriteLine("Dest conatins ({0}, {1})", dest[0].Key, dest[0].Value);
+        /// </code>
         public void CopyTo(KeyValuePair<ushort, string>[] array, int arrayIndex)
         {
             _options.CopyTo(array, arrayIndex);
         }
 
         /// <summary>
-        /// Remove the gien option pair
+        /// Remove the given key value pair from the options
         /// </summary>
-        /// <param name="item">The option pair to remove</param>
-        /// <returns></returns>
+        /// <param name="item">The key value pair to remove</param>
+        /// <returns>True if operation is successful. Otherwise, false</returns>
+        /// <seealso cref="Add()"/>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(new KeyValuePair<ushort, string>(2050, "12345"));
+        /// var result = options.Remove(new KeyValuePair<ushort, string>(2050, "12345"));
+        /// </code>
         public bool Remove(KeyValuePair<ushort, string> item)
         {
             return Remove(item.Key);
@@ -250,23 +358,52 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Get the enumerator to options collection
         /// </summary>
-        /// <returns> Enumerator to option pairs</returns>
+        /// <returns>Enumerator to option pairs</returns>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(new KeyValuePair<ushort, string>(2050, "sample1"));
+        /// options.Add(new KeyValuePair<ushort, string>(2055, "sample2"));
+        /// foreach (KeyValuePair<string, object> pair in options)
+        /// {
+        ///     Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value);
+        /// }
+        /// </code>
         public IEnumerator<KeyValuePair<ushort, string>> GetEnumerator()
         {
             return _options.GetEnumerator();
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
             GC.SuppressFinalize(this);
         }
 
+        /// <summary>
+        /// Get the enumerator to options collection
+        /// </summary>
+        /// <returns>Enumerator to option pairs</returns>
+        /// <code>
+        /// ResourceOptions options = new ResourceOptions();
+        /// options.Add(new KeyValuePair<ushort, string>(2050, "sample1"));
+        /// options.Add(new KeyValuePair<ushort, string>(2055, "sample2"));
+        /// foreach (KeyValuePair<string, object> pair in options)
+        /// {
+        ///     Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value);
+        /// }
+        /// </code>
         IEnumerator IEnumerable.GetEnumerator()
         {
             return _options.GetEnumerator();
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (_disposed)
index 10a872c..afc3843 100755 (executable)
@@ -14,7 +14,7 @@ using System.Runtime.InteropServices;
 namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
-    /// Class to manage query of request.
+    /// This class provides APIs to manage query of request.
     /// </summary>
     public class ResourceQuery : IDictionary<string, string>, IDisposable
     {
@@ -24,8 +24,13 @@ namespace Tizen.Network.IoTConnectivity
         private bool _disposed = false;
 
         /// <summary>
-        /// Constructor
+        /// The resource query constructor
         /// </summary>
+        /// <seealso cref="Add()"/>
+        /// <seealso cref="Remove()"/>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// </code>
         public ResourceQuery()
         {
             int ret = Interop.IoTConnectivity.Common.Query.Create(out _resourceQueryHandle);
@@ -59,14 +64,22 @@ namespace Tizen.Network.IoTConnectivity
             }
         }
 
+        /// <summary>
+        /// Destructor of the ResourceQuery class.
+        /// </summary>
         ~ResourceQuery()
         {
             Dispose(false);
         }
 
         /// <summary>
-        /// Resource type of the query
+        /// Gets and sets the resource type of the query
         /// </summary>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Type = "org.tizen.light";
+        /// Console.WriteLine("Type of query : {0}", query.Type);
+        /// </code>
         public string Type
         {
             get
@@ -95,8 +108,15 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Resource interface of the query
+        /// Gets and sets the resource interface of the query
         /// </summary>
+        /// <remarks>
+        /// Setter value could be a value such as <see cref="ResourceInterfaces.DefaultInterface"/>
+        /// </remarks>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Interface = ResourceInterfaces.LinkInterface;
+        /// </code>
         public string Interface
         {
             get
@@ -125,8 +145,15 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Contains all keys of Query
+        /// Contains all the query keys
         /// </summary>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add("key", "value");
+        /// query.Add("newKey", "sample value");
+        /// var keys = query.Keys;
+        /// Console.WriteLine("Resource query contains keys {0} and {1}", keys.ElementAt(0), keys.ElementAt(1));
+        /// </code>
         public ICollection<string> Keys
         {
             get
@@ -136,8 +163,15 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Contains all the values of Query
+        /// Contains all the query values
         /// </summary>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add("key", "value");
+        /// query.Add("newKey", "sample value");
+        /// var values = query.Values;
+        /// Console.WriteLine("Resource query contains values {0} and {1}", values.ElementAt(0), values.ElementAt(1));
+        /// </code>
         public ICollection<string> Values
         {
             get
@@ -149,6 +183,13 @@ namespace Tizen.Network.IoTConnectivity
         /// <summary>
         /// Gets the number of query elements
         /// </summary>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add("key", "value");
+        /// query.Add("newKey", "sample value");
+        /// var count = query.Count;
+        /// Console.WriteLine("There are {0} keys in the query object", count);
+        /// </code>
         public int Count
         {
             get
@@ -158,8 +199,13 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Represents whether Query is readonly
+        /// Represents whether the collection is readonly
         /// </summary>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// if (query.IsReadOnly)
+        ///     Console.WriteLine("Read only query");
+        /// </code>
         public bool IsReadOnly
         {
             get
@@ -169,10 +215,15 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Gets or sets the Query key..
+        /// Gets or sets the query data
         /// </summary>
-        /// <param name="key">The key of the Query to get or set.</param>
-        /// <returns>The element with the specified key.</returns>
+        /// <param name="key">The query key to get or set.</param>
+        /// <returns>The query with the specified key.</returns>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query["key1"] = "sample-data";
+        /// Console.WriteLine("query has : {0}", query["key1"]);
+        /// </code>
         public string this[string key]
         {
             get
@@ -187,20 +238,34 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Checks the given key exists in Query
+        /// Checks whether the given key exists in Query collection
         /// </summary>
-        /// <param name="key">The Query key</param>
+        /// <param name="key">The key to look for</param>
         /// <returns>true if exists. Otherwise, false</returns>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add("key1", "value1");
+        /// if (query.ContainsKey("key1"))
+        ///     Console.WriteLine("query conatins key : key1");
+        /// </code>
         public bool ContainsKey(string key)
         {
             return _query.ContainsKey(key);
         }
 
         /// <summary>
-        /// Adds Query element
+        /// Adds a new key and correspoding value into the query.
         /// </summary>
-        /// <param name="key">The key representing the Query</param>
-        /// <param name="value">The value representing the Query</param>
+        /// <remarks>
+        /// The full length of query should be less than or equal to 64.
+        /// </remarks>
+        /// <param name="key">The key of the query to insert</param>
+        /// <param name="value">The string data to insert into the query</param>
+        /// <seealso cref="Remove()"/>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add("key1", "value1");
+        /// </code>
         public void Add(string key, string value)
         {
             if (CanAddQuery(key, value))
@@ -221,45 +286,73 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Removes a Query element from collection
+        /// Removes the key and its associated value from the query.
         /// </summary>
-        /// <param name="item">The Query element to remove</param>
-        /// <returns>true if operation is success. Otherwise, false</returns>
+        /// <param name="key">The id of the query to delete</param>
+        /// <returns>True if operation is successful. Otherwise, false</returns>
+        /// <seealso cref="Add()"/>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add("key1", "value1");
+        /// var result = query.Remove("key1");
+        /// </code>
         public bool Remove(string key)
         {
-            int ret = Interop.IoTConnectivity.Common.Query.Remove(_resourceQueryHandle, key);
-            if (ret != (int)IoTConnectivityError.None)
+            bool isRemoved = _query.Remove(key);
+            if (isRemoved)
             {
-                Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove query");
-                throw IoTConnectivityErrorFactory.GetException(ret);
+                int ret = Interop.IoTConnectivity.Common.Query.Remove(_resourceQueryHandle, key);
+                if (ret != (int)IoTConnectivityError.None)
+                {
+                    Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove query");
+                    throw IoTConnectivityErrorFactory.GetException(ret);
+                }
             }
-
-            return _query.Remove(key);
+            return isRemoved;
         }
 
         /// <summary>
         /// Gets the value associated with the specified key.
         /// </summary>
-        /// <param name="key">The key whose value to get.</param>
-        /// <param name="value"> The value associated with the specified key</param>
-        /// <returns> true if the Query contains an element with the specified key; otherwise, false.</returns>
+        /// <param name="key">The query key</param>
+        /// <param name="value">Value corresponding to query key</param>
+        /// <returns>True if the key exists, false otherwise</returns>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add("key1", "value1");
+        /// string value;
+        /// var isPresent = query.TryGetValue("key1", out value);
+        /// if (isPresent)
+        ///     Console.WriteLine("value : {0}", value);
+        /// </code>
         public bool TryGetValue(string key, out string value)
         {
             return _query.TryGetValue(key, out value);
         }
 
         /// <summary>
-        /// Adds Query as a key value pair
+        ///  Adds query key and value as a key value pair
         /// </summary>
         /// <param name="item">The key value pair</param>
+        /// <seealso cref="Remove()"/>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add(new KeyValuePair<string, string>("key1", "value1"));
+        /// </code>
         public void Add(KeyValuePair<string, string> item)
         {
             Add(item.Key, item.Value);
         }
 
         /// <summary>
-        /// Clears Query
+        /// Clears the Query collection
         /// </summary>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add("key1", "value1");
+        /// query.Add("key2", "value2");
+        /// query.Clear();
+        /// </code>
         public void Clear()
         {
             foreach (string key in _query.Keys)
@@ -275,62 +368,104 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Checks the given key value pair exists in Query
+        /// Checks if the given query pair exists
         /// </summary>
         /// <param name="item">The key value pair</param>
-        /// <returns>true if exists. Otherwise, false</returns>
+        /// <returns>True if exists. Otherwise, false</returns>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add(new KeyValuePair<string, string>("key1", "value1"));
+        /// var isPresent = query.Contains(new KeyValuePair<string, string>("key1", "value1"));
+        /// if (isPresent)
+        ///     Console.WriteLine("Key value pair is present");
+        /// </code>
         public bool Contains(KeyValuePair<string, string> item)
         {
             return _query.Contains(item);
         }
 
         /// <summary>
-        /// Copies the elements of the Query to an Array, starting at a particular index.
+        /// Copies the elements of the query collection to an Array, starting at a particular index.
         /// </summary>
         /// <param name="array">The destination array</param>
-        /// <param name="arrayIndex">The zero-based index in array at which copying begins.</param>
+        /// <param name="arrayIndex">Index parameter</param>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add(new KeyValuePair<string, string>("key1", "value1"));
+        /// KeyValuePair<string, string>[] dest = new KeyValuePair<string, string>[query.Count];
+        /// query.CopyTo(dest, 0);
+        /// Console.WriteLine("Dest conatins ({0}, {1})", dest[0].Key, dest[0].Value);
+        /// </code>
         public void CopyTo(KeyValuePair<string, string>[] array, int arrayIndex)
         {
             _query.CopyTo(array, arrayIndex);
         }
 
         /// <summary>
-        /// Removes a Query element from collection
+        /// Remove the given key value pair from the query
         /// </summary>
-        /// <param name="item">The Query element to remove</param>
-        /// <returns>true if operation is success. Otherwise, false</returns>
+        /// <param name="item">The key value pair to remove</param>
+        /// <returns>True if operation is successful. Otherwise, false</returns>
+        /// <seealso cref="Add()"/>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add(new KeyValuePair<string, string>("key1", "value1"));
+        /// var result = query.Remove(new KeyValuePair<string, string>("key1", "value1"));
+        /// </code>
         public bool Remove(KeyValuePair<string, string> item)
         {
-            int ret = Interop.IoTConnectivity.Common.Query.Remove(_resourceQueryHandle, item.Key);
-            if (ret != (int)IoTConnectivityError.None)
-            {
-                Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove query");
-                throw IoTConnectivityErrorFactory.GetException(ret);
-            }
-
-            return _query.Remove(item);
+            return Remove(item.Key);
         }
 
         /// <summary>
-        ///   Returns an enumerator that iterates through the collection.
+        /// Get the enumerator to query collection
         /// </summary>
-        /// <returns> An enumerator that can be used to iterate through the collection.</returns>
+        /// <returns>Enumerator to query pairs</returns>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add(new KeyValuePair<string, string>("key1", "value1"));
+        /// query.Add(new KeyValuePair<string, string>("key2", "value2"));
+        /// foreach (KeyValuePair<string, string> pair in query)
+        /// {
+        ///     Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value);
+        /// }
+        /// </code>
         public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
         {
             return _query.GetEnumerator();
         }
 
+        /// <summary>
+        /// Get the enumerator to query collection
+        /// </summary>
+        /// <returns>Enumerator to query pairs</returns>
+        /// <code>
+        /// ResourceQuery query = new ResourceQuery();
+        /// query.Add(new KeyValuePair<string, string>("key1", "value1"));
+        /// query.Add(new KeyValuePair<string, string>("key2", "value2"));
+        /// foreach (KeyValuePair<string, string> pair in query)
+        /// {
+        ///     Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value);
+        /// }
+        /// </code>
         IEnumerator IEnumerable.GetEnumerator()
         {
             return _query.GetEnumerator();
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
             GC.SuppressFinalize(this);
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (_disposed)
@@ -350,14 +485,14 @@ namespace Tizen.Network.IoTConnectivity
             int queryLenth = 0;
             foreach (string key in Keys)
             {
-                queryLenth += key.Length;
+                queryLenth += key.Length + 2;
             }
             foreach (string value in Values)
             {
                 queryLenth += value.Length;
             }
 
-            if ((newKey.Length + newValue.Length + queryLenth) < QueryMaxLenth)
+            if ((newKey.Length + newValue.Length + queryLenth + 2) < QueryMaxLenth)
                 return true;
 
             return false;
index 83e9afa..1e3d26a 100755 (executable)
@@ -14,7 +14,8 @@ using System.Text.RegularExpressions;
 namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
-    /// Class containing resource types
+    /// This class contains resource types and provides APIs to manage, add, remove those types.
+    /// A resource type indicates a class or category of resources.
     /// </summary>
     public class ResourceTypes : IEnumerable<string>, IDisposable
     {
@@ -24,8 +25,13 @@ namespace Tizen.Network.IoTConnectivity
         private bool _disposed = false;
 
         /// <summary>
-        /// Constructor
+        /// Constructor of ResourceTypes
         /// </summary>
+        /// <seealso cref="Add()"/>
+        /// <seealso cref="Remove()"/>
+        /// <code>
+        /// ResourceTypes types = new ResourceTypes();
+        /// </code>
         public ResourceTypes()
         {
             int ret = Interop.IoTConnectivity.Common.ResourceTypes.Create(out _resourceTypeHandle);
@@ -37,8 +43,12 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        /// Constructor
+        /// Constructor of ResourceTypes using list of types
         /// </summary>
+        /// <param name="types">List of resource types</param>
+        /// <code>
+        /// ResourceTypes types = new ResourceTypes(new List<string>() { "org.tizen.light", "oic.if.room" });
+        /// </code>
         public ResourceTypes(IEnumerable<string> types)
         {
             int ret = Interop.IoTConnectivity.Common.ResourceTypes.Create(out _resourceTypeHandle);
@@ -54,9 +64,6 @@ namespace Tizen.Network.IoTConnectivity
             }
         }
 
-        /// <summary>
-        /// Constructor
-        /// </summary>
         internal ResourceTypes(IntPtr typesHandleToClone)
         {
             int ret = Interop.IoTConnectivity.Common.ResourceTypes.Clone(typesHandleToClone, out _resourceTypeHandle);
@@ -80,14 +87,21 @@ namespace Tizen.Network.IoTConnectivity
             }
         }
 
+        /// <summary>
+        /// Destructor of the ResourceTypes class.
+        /// </summary>
         ~ResourceTypes()
         {
             Dispose(false);
         }
 
         /// <summary>
-        /// Count of resource types in the list
+        /// Indicates count of types in the list
         /// </summary>
+        /// <code>
+        /// ResourceTypes types = new ResourceTypes(new List<string>() { "org.tizen.light", "oic.if.room" });
+        /// Console.WriteLine("There are {0} items", types.Count);
+        /// </code>
         public int Count
         {
             get
@@ -97,9 +111,20 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        ///  Inserts a resource type into the list.
+        /// Adds a resource type into the list.
         /// </summary>
-        /// <param name="item">The resource type to add</param>
+        /// <remarks>
+        /// The length of @a item should be less than or equal to 61.\n
+        /// The @a item must start with a lowercase alphabetic character, followed by a sequence
+        /// of lowercase alphabetic, numeric, ".", or "-" characters, and contains no white space.\n
+        /// Duplicate strings are not allowed.
+        /// </remarks>
+        /// <param name="item">The string data to insert into the resource types</param>
+        /// <seealso cref="Remove()"/>
+        /// <code>
+        /// ResourceTypes resourceTypes = new ResourceTypes();
+        /// resourceTypes.Add("org.tizen.light");
+        /// </code>
         public void Add(string item)
         {
             if (IsValid(item))
@@ -120,35 +145,65 @@ namespace Tizen.Network.IoTConnectivity
         }
 
         /// <summary>
-        ///  Removes a resource type from the list
+        /// Removes a resource type from the list
         /// </summary>
-        /// <param name="item">The resource type to remove</param>
+        /// <param name="item">The string data to delete from the resource types</param>
+        /// <seealso cref="Add()"/>
+        /// <code>
+        /// ResourceTypes resourceTypes = new ResourceTypes(new List<string>() { "org.tizen.light", "oic.if.room" });
+        /// resourceTypes.Remove("oic.if.room");
+        /// </code>
         public void Remove(string item)
         {
-            int ret = Interop.IoTConnectivity.Common.ResourceTypes.Remove(_resourceTypeHandle, item);
-            if (ret != (int)IoTConnectivityError.None)
+            bool isRemoved = _resourceTypes.Remove(item);
+            if (isRemoved)
             {
-                Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove type");
-                throw IoTConnectivityErrorFactory.GetException(ret);
+                int ret = Interop.IoTConnectivity.Common.ResourceTypes.Remove(_resourceTypeHandle, item);
+                if (ret != (int)IoTConnectivityError.None)
+                {
+                    Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove type");
+                    throw IoTConnectivityErrorFactory.GetException(ret);
+                }
             }
-
-            _resourceTypes.Remove(item);
+            else
+                throw IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.InvalidParameter);
         }
 
         /// <summary>
-        ///  Return enumerator for the list of types
+        /// Return enumerator for the list of types
         /// </summary>
-        /// <returns>Enumerator of the collection</returns>
+        /// <returns>The enumerator</returns>
+        /// <code>
+        /// ResourceTypes resourceTypes = new ResourceTypes(new List<string>() { "org.tizen.light", "oic.if.room" });
+        /// foreach(string item in resourceTypes)
+        /// {
+        ///     Console.WriteLine("Type : {0}", item);
+        /// }
+        /// </code>
         public IEnumerator<string> GetEnumerator()
         {
             return _resourceTypes.GetEnumerator();
         }
 
+        /// <summary>
+        /// Return enumerator for the list of types
+        /// </summary>
+        /// <returns>The enumerator</returns>
+        /// <code>
+        /// ResourceTypes resourceTypes = new ResourceTypes(new List<string>() { "org.tizen.light", "oic.if.room" });
+        /// foreach(string item in resourceTypes)
+        /// {
+        ///     Console.WriteLine("Type : {0}", item);
+        /// }
+        /// </code>
         IEnumerator IEnumerable.GetEnumerator()
         {
             return _resourceTypes.GetEnumerator();
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
@@ -161,6 +216,10 @@ namespace Tizen.Network.IoTConnectivity
             return (type.Length <= MaxLength && char.IsLower(type[0]) && r.IsMatch(type));
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (_disposed)
index bab888e..858210e 100755 (executable)
@@ -12,26 +12,46 @@ namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
     /// This class represents response from a resource.
+    /// It provides APIs to manage response.
     /// </summary>
     public class Response : IDisposable
     {
         private bool _disposed = false;
 
+        /// <summary>
+        /// Constructor of Response
+        /// </summary>
+        /// <code>
+        /// Response response = new Response();
+        /// </code>
+        public Response() { }
+
+        /// <summary>
+        /// Destructor of the Response class.
+        /// </summary>
         ~Response()
         {
             Dispose(false);
         }
 
         /// <summary>
-        /// Result corresponding to a request
+        /// Gets or sets the result from/into the reponse
         /// </summary>
         public ResponseCode Result { get; set; }
 
         /// <summary>
-        /// Representation of the resource
+        /// Gets or sets the representation from/into the reponse
         /// </summary>
         public Representation Representation { get; set; }
 
+        /// <summary>
+        /// Gets or sets the options from/into the reponse
+        /// </summary>
+        public ResourceOptions Options { get; set; }
+
+        /// <summary>
+        /// Releases any unmanaged resources used by this object.
+        /// </summary>
         public void Dispose()
         {
             Dispose(true);
@@ -67,6 +87,17 @@ namespace Tizen.Network.IoTConnectivity
                 }
             }
 
+            if (Options != null)
+            {
+                ret = Interop.IoTConnectivity.Server.Response.SetOptions(responseHandle, Options._resourceOptionsHandle);
+                if (ret != (int)IoTConnectivityError.None)
+                {
+                    Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to send response");
+                    Interop.IoTConnectivity.Server.Response.Destroy(responseHandle);
+                    return false;
+                }
+            }
+
             ret = Interop.IoTConnectivity.Server.Response.Send(responseHandle);
             if (ret != (int)IoTConnectivityError.None)
             {
@@ -79,6 +110,10 @@ namespace Tizen.Network.IoTConnectivity
             return true;
         }
 
+        /// <summary>
+        /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
+        /// </summary>
+        /// <param name="disposing">If true, disposes any disposable objects. If false, does not dispose disposable objects.</param>
         protected virtual void Dispose(bool disposing)
         {
             if (_disposed)
index 3bddc37..c610a1e 100755 (executable)
@@ -9,7 +9,7 @@
 namespace Tizen.Network.IoTConnectivity
 {
     /// <summary>
-    /// Enumeration for result response
+    /// Enumeration for result of response
     /// </summary>
     public enum ResponseCode
     {
@@ -18,15 +18,15 @@ namespace Tizen.Network.IoTConnectivity
         /// </summary>
         Ok = 0,
         /// <summary>
-        /// Indicates result of response for something error
+        /// Indicates result of response for some error
         /// </summary>
         Error,
         /// <summary>
-        /// Indicates result of response for resource has created
+        /// Indicates result of response for created resource
         /// </summary>
         Created,
         /// <summary>
-        ///  Indicates result of response for resource has deleted
+        ///  Indicates result of response for deleted resource
         /// </summary>
         Deleted,
         /// <summary>
index db72864..a1b9f3b 100755 (executable)
@@ -18,9 +18,8 @@ namespace Tizen.Network.IoTConnectivity
         internal StateChangedEventArgs() { }
 
         /// <summary>
-        /// State property.
+        /// Indicates the new state of the resource
         /// </summary>
-        /// <returns>ResourceState State.</returns>
         public ResourceState State { get; internal set; }
     }
 }