/// </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>
/// 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();
/// </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;
}
/// </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];
/// <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>
/// <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>
/// <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>
/// <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" });
/// <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>
/// 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()
/// <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
/// <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>
/// <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>
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>
/// <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>
/// </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;
}
/// 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");
/// <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>
/// </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;
}
/// 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();
/// <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>
/// 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>
/// </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>
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>