diff options
author | Hongkuk, Son <hongkuk.son@samsung.com> | 2017-04-14 18:51:58 +0900 |
---|---|---|
committer | Hongkuk, Son <hongkuk.son@samsung.com> | 2017-04-14 18:53:50 +0900 |
commit | e1e1ef557a2c3fb0ac94f466aba0152855596165 (patch) | |
tree | 1ed468f79328c980ef3939872693182a9ec1a694 | |
parent | 4ecf2b65cfc18f41bb475bca5151fc82a8db8cb5 (diff) | |
download | iotcon-e1e1ef557a2c3fb0ac94f466aba0152855596165.tar.gz iotcon-e1e1ef557a2c3fb0ac94f466aba0152855596165.tar.bz2 iotcon-e1e1ef557a2c3fb0ac94f466aba0152855596165.zip |
Fix iotcon C# API SPEC and some methodssubmit/tizen/20170418.093354accepted/tizen/unified/20170418.153522
- remove not occurred exceptions
- fix XXX.Remove() method's definition
- and so on
Signed-off-by: Hongkuk, Son <hongkuk.son@samsung.com>
Change-Id: I2e1aa4de223365632897b1087e450438fb487701
9 files changed, 35 insertions, 52 deletions
diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs index 7514598..243771d 100755 --- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs +++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs @@ -40,7 +40,6 @@ namespace Tizen.Network.IoTConnectivity /// </summary> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <code> /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes(); /// </code> @@ -282,7 +281,6 @@ namespace Tizen.Network.IoTConnectivity /// Clears attributes collection /// </summary> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <exception cref="InvalidOperationException">Thrown when the operation is invalid</exception> /// <code> /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes(); @@ -417,17 +415,15 @@ namespace Tizen.Network.IoTConnectivity /// </code> public bool Remove(string key) { - bool isRemoved = _attributes.Remove(key); - if (isRemoved) + int ret = Interop.IoTConnectivity.Common.Attributes.Remove(_resourceAttributesHandle, key); + if (ret != (int)IoTConnectivityError.None) { - 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); - } + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); } + bool isRemoved = _attributes.Remove(key); + return isRemoved; } diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs index 5c057bd..95d42c7 100755 --- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs +++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs @@ -386,6 +386,12 @@ namespace Tizen.Network.IoTConnectivity /// </code> public static void StopReceivingPresence(int presenceId) { + if (!s_presenceHandlesMap.ContainsKey((IntPtr)presenceId)) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "this presenceId does not exist"); + throw new ArgumentException("this presenceId does not exist"); + } + if (s_presenceHandlesMap.ContainsKey((IntPtr)presenceId)) { IntPtr presenceHandle = s_presenceHandlesMap[(IntPtr)presenceId]; @@ -435,7 +441,6 @@ namespace Tizen.Network.IoTConnectivity /// <seealso cref="ResourceFoundEventArgs"/> /// <seealso cref="TimeOut"/> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <exception cref="InvalidOperationException">Thrown when the operation is invalid</exception> /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access</exception> /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory</exception> @@ -545,7 +550,6 @@ namespace Tizen.Network.IoTConnectivity /// <seealso cref="DeviceInformationFoundEventArgs"/> /// <seealso cref="TimeOut"/> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <exception cref="InvalidOperationException">Thrown when the operation is invalid</exception> /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access</exception> /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory</exception> @@ -645,7 +649,6 @@ namespace Tizen.Network.IoTConnectivity /// <seealso cref="PlatformInformationFoundEventArgs"/> /// <seealso cref="TimeOut"/> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <exception cref="InvalidOperationException">Thrown when the operation is invalid</exception> /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access</exception> /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory</exception> diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityServerManager.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityServerManager.cs index 92f340e..dde0f68 100755 --- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityServerManager.cs +++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityServerManager.cs @@ -166,7 +166,6 @@ namespace Tizen.Network.IoTConnectivity /// <seealso cref="Resource"/> /// <seealso cref="LiteResource"/> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access</exception> /// <code> /// ResourceTypes types = new ResourceTypes(new List<string>(){ "org.tizen.light" }); diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs index 77c5c71..463b8fa 100755 --- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs +++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs @@ -281,7 +281,6 @@ namespace Tizen.Network.IoTConnectivity /// <param name="policy">The type to specify how client wants to observe</param> /// <param name="query">The query to send to server</param> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <exception cref="InvalidOperationException">Thrown when the operation is invalid</exception> /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access</exception> /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory</exception> @@ -345,7 +344,6 @@ namespace Tizen.Network.IoTConnectivity /// http://tizen.org/privilege/internet /// </privilege> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <exception cref="InvalidOperationException">Thrown when the operation is invalid</exception> /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access</exception> public void StopObserving() diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs index e70d889..dd95cbc 100755 --- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs +++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs @@ -55,7 +55,6 @@ namespace Tizen.Network.IoTConnectivity /// <seealso cref="ResourcePolicy"/> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <code> /// // Create a class which inherits from Resource /// public class DoorResource : Resource @@ -159,7 +158,6 @@ namespace Tizen.Network.IoTConnectivity /// <seealso cref="Representation"/> /// <seealso cref="QualityOfService"/> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <exception cref="UnauthorizedAccessException">Thrown when app does not have privilege to access</exception> /// <exception cref="InvalidOperationException">Thrown when the operation is invalid</exception> /// <code> diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceInterfaces.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceInterfaces.cs index 169bab2..3975644 100755 --- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceInterfaces.cs +++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceInterfaces.cs @@ -65,7 +65,6 @@ namespace Tizen.Network.IoTConnectivity /// <seealso cref="Remove()"/> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <code> /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces(); /// </code> @@ -267,7 +266,7 @@ namespace Tizen.Network.IoTConnectivity internal static bool IsValid(string type) { Regex r = new Regex("^[a-zA-Z0-9.-]+$"); - return (type.Length <= MaxLength && char.IsLower(type[0]) && r.IsMatch(type)); + return (type.Length <= MaxLength && type.Length > 0 && char.IsLower(type[0]) && r.IsMatch(type)); } /// <summary> diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceOptions.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceOptions.cs index cd67379..0aa56b1 100755 --- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceOptions.cs +++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceOptions.cs @@ -45,7 +45,6 @@ namespace Tizen.Network.IoTConnectivity /// <seealso cref="Remove()"/> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <code> /// ResourceOptions options = new ResourceOptions(); /// </code> @@ -252,16 +251,15 @@ namespace Tizen.Network.IoTConnectivity /// </code> public bool Remove(ushort key) { - bool isRemoved = _options.Remove(key); - if (isRemoved) + int ret = Interop.IoTConnectivity.Common.Options.Remove(_resourceOptionsHandle, key); + if (ret != (int)IoTConnectivityError.None) { - 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); - } + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove option"); + throw IoTConnectivityErrorFactory.GetException(ret); } + + bool isRemoved = _options.Remove(key); + return isRemoved; } @@ -302,7 +300,6 @@ namespace Tizen.Network.IoTConnectivity /// Clears the Options collection /// </summary> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <code> /// ResourceOptions options = new ResourceOptions(); /// options.Add(2050, "12345"); diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs index 54153d0..9c152ee 100755 --- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs +++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs @@ -39,7 +39,6 @@ namespace Tizen.Network.IoTConnectivity /// <seealso cref="Remove()"/> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <code> /// ResourceQuery query = new ResourceQuery(); /// </code> @@ -322,16 +321,15 @@ namespace Tizen.Network.IoTConnectivity /// </code> public bool Remove(string key) { - bool isRemoved = _query.Remove(key); - if (isRemoved) + int ret = Interop.IoTConnectivity.Common.Query.Remove(_resourceQueryHandle, key); + if (ret != (int)IoTConnectivityError.None) { - 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); - } + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove query"); + throw IoTConnectivityErrorFactory.GetException(ret); } + + bool isRemoved = _query.Remove(key); + return isRemoved; } @@ -372,7 +370,6 @@ namespace Tizen.Network.IoTConnectivity /// Clears the Query collection /// </summary> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <exception cref="InvalidOperationException">Thrown when the operation is invalid</exception> /// <code> /// ResourceQuery query = new ResourceQuery(); diff --git a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceTypes.cs b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceTypes.cs index d01b4e1..65eef6c 100755 --- a/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceTypes.cs +++ b/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceTypes.cs @@ -40,7 +40,6 @@ namespace Tizen.Network.IoTConnectivity /// <seealso cref="Remove()"/> /// <exception cref="NotSupportedException">Thrown when the iotcon is not supported</exception> /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory</exception> - /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <code> /// ResourceTypes types = new ResourceTypes(); /// </code> @@ -58,6 +57,7 @@ namespace Tizen.Network.IoTConnectivity /// Constructor of ResourceTypes using list of types /// </summary> /// <param name="types">List of resource types</param> + /// <exception cref="ArgumentException">Thrown when there is an invalid parameter</exception> /// <code> /// ResourceTypes types = new ResourceTypes(new List<string>() { "org.tizen.light", "oic.if.room" }); /// </code> @@ -173,18 +173,14 @@ namespace Tizen.Network.IoTConnectivity /// </code> public void Remove(string item) { - bool isRemoved = _resourceTypes.Remove(item); - if (isRemoved) + int ret = Interop.IoTConnectivity.Common.ResourceTypes.Remove(_resourceTypeHandle, item); + if (ret != (int)IoTConnectivityError.None) { - 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); - } + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove type"); + throw IoTConnectivityErrorFactory.GetException(ret); } - else - throw IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.InvalidParameter); + + _resourceTypes.Remove(item); } /// <summary> @@ -231,7 +227,7 @@ namespace Tizen.Network.IoTConnectivity internal static bool IsValid(string type) { Regex r = new Regex("^[a-zA-Z0-9.-]+$"); - return (type.Length <= MaxLength && char.IsLower(type[0]) && r.IsMatch(type)); + return (type.Length <= MaxLength && type.Length > 0 && char.IsLower(type[0]) && r.IsMatch(type)); } /// <summary> |