Class RemoteResource
Definition
- Namespace:
- Tizen.Network.IoTConnectivity
- Assembly:
- Tizen.Network.IoTConnectivity.dll
- API Level:
- 3
This class represents a remote resource. It provides APIs to manage remote resource.
C#Copypublic class RemoteResource : IDisposable
- Inheritance
-
RemoteResource
- 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 |
---|---|---|
System.String | hostAddress | The host address of the resource. |
System.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. |
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 bool CacheEnabled { get; set; }
Property Value
Type | Description |
---|---|
Boolean | 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. |
InvalidOperationException | Thrown when the operation is invalid. |
UnauthorizedAccessException | Thrown when an application does not have privilege to access. |
OutOfMemoryException | Thrown when there is not enough memory. |
API Level: 3
Declaration
C#Copypublic string DeviceId { get; }
Property Value
Type | Description |
---|---|
System.String | The device ID of the resource. |
API Level: 3
Declaration
C#Copypublic string HostAddress { get; }
Property Value
Type | Description |
---|---|
System.String | The host address of the resource. |
API Level: 3
Declaration
C#Copypublic IEnumerable<string> Interfaces { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> | The interfaces of the resource. |
API Level: 3
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. |
API Level: 3
Declaration
C#Copypublic ResourcePolicy Policy { get; }
Property Value
Type | Description |
---|---|
ResourcePolicy | The policy of the resource. |
API Level: 3
Declaration
C#Copypublic int TimeInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | 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. |
API Level: 3
Declaration
C#Copypublic IEnumerable<string> Types { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> | The resource types of the remote resource. |
API Level: 3
Declaration
C#Copypublic string UriPath { get; }
Property Value
Type | Description |
---|---|
System.String | The URI path of the resource. |
API Level: 3
Methods
Declaration
C#Copypublic Representation CachedRepresentation()
Returns
Type | Description |
---|---|
Representation | cached representation from the remote resource. |
API Level: 3
Feature: http://tizen.org/feature/iot.ocf
Declaration
C#Copypublic Task<RemoteResponse> DeleteAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<RemoteResponse> | Remote response with result and representation. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/internet
Feature: http://tizen.org/feature/iot.ocf
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()
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<RemoteResponse> | Remote response with result and representation. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/internet
Feature: http://tizen.org/feature/iot.ocf
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<RemoteResponse> | Remote response with result and representation. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/internet
Feature: http://tizen.org/feature/iot.ocf
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<RemoteResponse> | Remote response with result and representation. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/internet
Feature: http://tizen.org/feature/iot.ocf
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. |
InvalidOperationException | Thrown when the operation is invalid. |
UnauthorizedAccessException | Thrown when an application does not have privilege to access. |
OutOfMemoryException | Thrown when there is not enough memory. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/internet
Feature: http://tizen.org/feature/iot.ocf
Declaration
C#Copypublic void StopObserving()
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
InvalidOperationException | Thrown when the operation is invalid. |
UnauthorizedAccessException | Thrown when an application does not have privilege to access. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/internet
Feature: http://tizen.org/feature/iot.ocf
Events
Declaration
C#Copypublic event EventHandler<CacheUpdatedEventArgs> CacheUpdated
Event Type
Type | Description |
---|---|
System.EventHandler<CacheUpdatedEventArgs> |
API Level: 3
Declaration
C#Copypublic event EventHandler<ObserverNotifiedEventArgs> ObserverNotified
Event Type
Type | Description |
---|---|
System.EventHandler<ObserverNotifiedEventArgs> |
API Level: 3
Declaration
C#Copypublic event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<StateChangedEventArgs> |