Class Representation
Definition
- Namespace:
- Tizen.Network.IoTConnectivity
- Assembly:
- Tizen.Network.IoTConnectivity.dll
- API Level:
- 3
This class provides APIs to manage representation. A representation is a payload of a request or a response.
public class Representation : IDisposable
- Inheritance
-
Representation
- Implements
Constructors
View SourceRepresentation()
The Representation constructor.
Declaration
public Representation()
Examples
Representation repr = new Representation();
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown when the iotcon is not supported. |
OutOfMemoryException | Thrown when there is not enough memory. |
ArgumentException | Thrown when there is an invalid parameter. |
API Level: 3
Feature: http://tizen.org/feature/iot.ocf
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 |
---|---|
NotSupportedException | Thrown when the iotcon is not supported. |
ArgumentException | Thrown when there is an invalid parameter. |
InvalidOperationException | Thrown when the operation is invalid. |
See Also
API Level: 3
View SourceChildren
List of Child resource representation.
Declaration
public ICollection<Representation> Children { get; }
Property Value
Type | Description |
---|---|
ICollection<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);
}
API Level: 3
View SourceInterface
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 |
---|---|
NotSupportedException | Thrown when the iotcon is not supported. |
ArgumentException | Thrown when there is an invalid parameter. |
InvalidOperationException | Thrown when the operation is invalid. |
See Also
API Level: 3
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 |
---|---|
NotSupportedException | Thrown when the iotcon is not supported. |
ArgumentException | Thrown when there is an invalid parameter. |
InvalidOperationException | Thrown when the operation is invalid. |
See Also
API Level: 3
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 |
---|---|
NotSupportedException | Thrown when the iotcon is not supported. |
ArgumentException | Thrown when there is an invalid parameter. |
InvalidOperationException | Thrown when the operation is invalid. |
API Level: 3
Methods
View SourceDispose()
Releases any unmanaged resources used by this object.
Declaration
public void Dispose()
API Level: 3
Feature: http://tizen.org/feature/iot.ocf
View SourceDispose(Boolean)
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 |
---|---|---|
Boolean | disposing | If true, disposes any disposable objects. If false, does not dispose disposable objects. |
API Level: 3
Feature: http://tizen.org/feature/iot.ocf
View SourceFinalize()
Destructor of the Representation class.
Declaration
protected void Finalize()