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.

C#
Copy
public class Representation : IDisposable
Inheritance
System.Object
Representation
Implements
System.IDisposable

Constructors

View Source

Representation()

The Representation constructor.

Declaration
C#
Copy
public Representation()
Examples
Copy
Representation repr = new Representation();
Exceptions
Type Condition
System.NotSupportedException

Thrown when the iotcon is not supported.

OutOfMemoryException

Thrown when there is not enough memory.

System.ArgumentException

Thrown when there is an invalid parameter.

API Level: 3
Feature: http://tizen.org/feature/iot.ocf

Properties

View Source

Attributes

Current attributes of the resource.

Declaration
C#
Copy
public Attributes Attributes { get; set; }
Property Value
Type Description
Attributes

Current attributes of the resource.

Examples
Copy
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
API Level: 3
View Source

Children

List of Child resource representation.

Declaration
C#
Copy
public ICollection<Representation> Children { get; }
Property Value
Type Description
System.Collections.Generic.ICollection<Representation>

List of Child resource representation.

Examples
Copy
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 Source

Interface

The interface of the resource.

Declaration
C#
Copy
public ResourceInterfaces Interface { get; set; }
Property Value
Type Description
ResourceInterfaces

The interface of the resource.

Examples
Copy
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.

API Level: 3
View Source

Type

The type of resource.

Declaration
C#
Copy
public ResourceTypes Type { get; set; }
Property Value
Type Description
ResourceTypes

The type of resource.

Examples
Copy
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
API Level: 3
View Source

UriPath

The URI path of resource.

Declaration
C#
Copy
public string UriPath { get; set; }
Property Value
Type Description
System.String

The URI path of resource. Setter can throw exceptions.

Examples
Copy
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.

API Level: 3

Methods

View Source

Dispose()

Releases any unmanaged resources used by this object.

Declaration
C#
Copy
public void Dispose()
API Level: 3
Feature: http://tizen.org/feature/iot.ocf
View Source

Dispose(Boolean)

Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.

Declaration
C#
Copy
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 Source

Finalize()

Destructor of the Representation class.

Declaration
C#
Copy
protected void Finalize()

Implements

System.IDisposable