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#Copypublic class Representation : IDisposable
- Inheritance
-
Representation
- Implements
-
System.IDisposable
Constructors
Declaration
C#Copypublic Representation()
Examples
CopyRepresentation 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
Declaration
C#Copypublic Attributes Attributes { get; set; }
Property Value
Type | Description |
---|---|
Attributes | Current attributes of the resource. |
Examples
CopyRepresentation 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. |
InvalidOperationException | Thrown when the operation is invalid. |
See Also
API Level: 3
Declaration
C#Copypublic ICollection<Representation> Children { get; }
Property Value
Type | Description |
---|---|
ICollection<Representation> | List of Child resource representation. |
Examples
CopyRepresentation 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
Declaration
C#Copypublic ResourceInterfaces Interface { get; set; }
Property Value
Type | Description |
---|---|
ResourceInterfaces | The interface of the resource. |
Examples
CopyRepresentation 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. |
InvalidOperationException | Thrown when the operation is invalid. |
See Also
API Level: 3
Declaration
C#Copypublic ResourceTypes Type { get; set; }
Property Value
Type | Description |
---|---|
ResourceTypes | The type of resource. |
Examples
CopyRepresentation 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. |
InvalidOperationException | Thrown when the operation is invalid. |
See Also
API Level: 3
Declaration
C#Copypublic string UriPath { get; set; }
Property Value
Type | Description |
---|---|
System.String | The URI path of resource. Setter can throw exceptions. |
Examples
CopyRepresentation 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. |
InvalidOperationException | Thrown when the operation is invalid. |
API Level: 3
Methods
Declaration
C#Copypublic void Dispose()
API Level: 3
Feature: http://tizen.org/feature/iot.ocf
Dispose(Boolean)
Releases any unmanaged resources used by this object. Can also dispose any other disposable objects.
Declaration
C#Copyprotected 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
Declaration
C#Copyprotected void Finalize()