Class Representation
Definition
- Namespace:
- Tizen.Network.IoTConnectivity
- Assembly:
- Tizen.Network.IoTConnectivity.dll
This class provides APIs to manage representation. A representation is a payload of a request or a response.
public class Representation : IDisposable
- Inheritance
-
objectRepresentation
- Implements
-
System.IDisposable
Constructors
View SourceRepresentation()
The Representation constructor.
Declaration
public Representation()
Examples
Representation repr = new Representation();
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.OutOfMemoryException | Thrown when there is not enough memory. |
System.ArgumentException | Thrown when there is an invalid parameter. |
Properties
View SourceAttributes
Current attributes of the resource.
Declaration
public Attributes Attributes { get; set; }
Property Value
Type | Description |
---|---|
Attributes | Current attributes of the resource. |
Examples
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);
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.ArgumentException | Thrown when there is an invalid parameter. |
System.InvalidOperationException | Thrown when the operation is invalid. |
See Also
View SourceChildren
List of Child resource representation.
Declaration
public ICollection<Representation> Children { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<T><Representation> | List of Child resource representation. |
Examples
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);
}
View Source
Interface
The interface of the resource.
Declaration
public ResourceInterfaces Interface { get; set; }
Property Value
Type | Description |
---|---|
ResourceInterfaces | The interface of the resource. |
Examples
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);
}
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.ArgumentException | Thrown when there is an invalid parameter. |
System.InvalidOperationException | Thrown when the operation is invalid. |
See Also
View SourceType
The type of resource.
Declaration
public ResourceTypes Type { get; set; }
Property Value
Type | Description |
---|---|
ResourceTypes | The type of resource. |
Examples
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);
}
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.ArgumentException | Thrown when there is an invalid parameter. |
System.InvalidOperationException | Thrown when the operation is invalid. |
See Also
View SourceUriPath
The URI path of resource.
Declaration
public string UriPath { get; set; }
Property Value
Type | Description |
---|---|
string | The URI path of resource. Setter can throw exceptions. |
Examples
Representation repr = new Representation();
repr.UriPath = "/a/light";
Console.WriteLine("URI is {0}", repr.UriPath); //Getter
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.ArgumentException | Thrown when there is an invalid parameter. |
System.InvalidOperationException | Thrown when the operation is invalid. |
Methods
View SourceDispose()
Releases any unmanaged resources used by this object.
Declaration
public void Dispose()
Dispose(bool)
Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | If true, disposes any disposable objects. If false, does not dispose disposable objects. |
~Representation()
Destructor of the Representation class.
Declaration
protected ~Representation()