Class RemoteResource
Definition
- Namespace:
- Tizen.Network.IoTConnectivity
- Assembly:
- Tizen.Network.IoTConnectivity.dll
This class represents a remote resource. It provides APIs to manage remote resource.
C#Copypublic class RemoteResource : IDisposable
- Inheritance
-
objectRemoteResource
- Implements
-
System.IDisposable
Constructors
RemoteResource(string, string, ResourcePolicy, ResourceTypes, ResourceInterfaces)
Creates a remote resource instance.
Declaration
C#Copypublic RemoteResource(string hostAddress, string uriPath, ResourcePolicy policy, ResourceTypes resourceTypes, ResourceInterfaces resourceInterfaces)
Parameters
| Type | Name | Description |
|---|---|---|
| string | hostAddress | The host address of the resource. |
| string | uriPath | The URI path of the resource. |
| ResourcePolicy | policy | The policies of the resource. |
| ResourceTypes | resourceTypes | The resource types of the resource. |
| ResourceInterfaces | resourceInterfaces | The resource interfaces of the resource. |
Remarks
To use this API, you should provide all the details required to correctly contact and observe the object.
If not, you should discover the resource object manually.
The policy can contain multiple policies like ResourcePolicy.Discoverable | ResourcePolicy.Observable.
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
Declaration
C#Copypublic bool CacheEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | Client can start caching only when this is set true. Set it to false to stop caching the resource attributes. |
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. |
| System.UnauthorizedAccessException | Thrown when an application does not have privilege to access. |
| System.OutOfMemoryException | Thrown when there is not enough memory. |
Declaration
C#Copypublic string DeviceId { get; }
Property Value
| Type | Description |
|---|---|
| string | The device ID of the resource. |
Declaration
C#Copypublic string HostAddress { get; }
Property Value
| Type | Description |
|---|---|
| string | The host address of the resource. |
Declaration
C#Copypublic IEnumerable<string> Interfaces { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><string> | The interfaces of the resource. |
Declaration
C#Copypublic ResourceOptions Options { get; set; }
Property Value
| Type | Description |
|---|---|
| ResourceOptions | The header options of the resource. |
Exceptions
| Type | Condition |
|---|---|
| System.NotSupportedException | Thrown when the iotcon is not supported. |
| System.ArgumentException | Thrown when there is an invalid parameter. |
Declaration
C#Copypublic ResourcePolicy Policy { get; }
Property Value
| Type | Description |
|---|---|
| ResourcePolicy | The policy of the resource. |
Declaration
C#Copypublic int TimeInterval { get; set; }
Property Value
| Type | Description |
|---|---|
| int | Default time interval is 10 seconds. Seconds for time interval (must be in range from 1 to 3600). |
Exceptions
| Type | Condition |
|---|---|
| System.NotSupportedException | Thrown when the iotcon is not supported. |
| System.ArgumentException | Thrown when there is an invalid parameter. |
Declaration
C#Copypublic IEnumerable<string> Types { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<T><string> | The resource types of the remote resource. |
Declaration
C#Copypublic string UriPath { get; }
Property Value
| Type | Description |
|---|---|
| string | The URI path of the resource. |
Methods
Declaration
C#Copypublic Representation CachedRepresentation()
Returns
| Type | Description |
|---|---|
| Representation | cached representation from the remote resource. |
Declaration
C#Copypublic Task<RemoteResponse> DeleteAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<TResult><RemoteResponse> | Remote response with result and representation. |
Declaration
C#Copypublic void Dispose()
Dispose(bool)
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 |
|---|---|---|
| bool | disposing | If true, disposes any disposable objects. If false, does not dispose disposable objects. |
Declaration
C#Copyprotected ~RemoteResource()
Declaration
C#Copypublic Task<RemoteResponse> GetAsync(ResourceQuery query = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ResourceQuery | query | The ResourceQuery to send to server. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<TResult><RemoteResponse> | Remote response with result and representation. |
Declaration
C#Copypublic Task<RemoteResponse> PostAsync(Representation representation, ResourceQuery query = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Representation | representation | Resource representation of request. |
| ResourceQuery | query | The ResourceQuery to send to server. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<TResult><RemoteResponse> | Remote response with result and representation. |
PutAsync(Representation, ResourceQuery)
Puts the representation of a resource asynchronously.
Declaration
C#Copypublic Task<RemoteResponse> PutAsync(Representation representation, ResourceQuery query = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Representation | representation | Resource representation to put. |
| ResourceQuery | query | The ResourceQuery to send to server. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<TResult><RemoteResponse> | Remote response with result and representation. |
Declaration
C#Copypublic void StartObserving(ObservePolicy policy, ResourceQuery query = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ObservePolicy | policy | The type to specify how client wants to observe. |
| ResourceQuery | query | The query to send to server. |
Remarks
When server sends notification message, ObserverNotified will be called.
Exceptions
| Type | Condition |
|---|---|
| System.NotSupportedException | Thrown when the iotcon is not supported. |
| System.InvalidOperationException | Thrown when the operation is invalid. |
| System.UnauthorizedAccessException | Thrown when an application does not have privilege to access. |
| System.OutOfMemoryException | Thrown when there is not enough memory. |
Declaration
C#Copypublic void StopObserving()
Exceptions
| Type | Condition |
|---|---|
| System.NotSupportedException | Thrown when the iotcon is not supported. |
| System.InvalidOperationException | Thrown when the operation is invalid. |
| System.UnauthorizedAccessException | Thrown when an application does not have privilege to access. |
Events
Declaration
C#Copypublic event EventHandler<CacheUpdatedEventArgs> CacheUpdated
Event Type
| Type | Description |
|---|---|
| System.EventHandler<TEventArgs><CacheUpdatedEventArgs> |
Declaration
C#Copypublic event EventHandler<ObserverNotifiedEventArgs> ObserverNotified
Event Type
| Type | Description |
|---|---|
| System.EventHandler<TEventArgs><ObserverNotifiedEventArgs> |
Declaration
C#Copypublic event EventHandler<StateChangedEventArgs> StateChanged
Event Type
| Type | Description |
|---|---|
| System.EventHandler<TEventArgs><StateChangedEventArgs> |