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.
public class RemoteResource : IDisposable
- Inheritance
-
RemoteResource
- Implements
Constructors
View SourceRemoteResource(String, String, ResourcePolicy, ResourceTypes, ResourceInterfaces)
Creates a remote resource instance.
Declaration
public 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 |
---|---|
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 SourceCacheEnabled
Indicates the CacheEnabled status of the remote resource.
Declaration
public 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 |
---|---|
NotSupportedException | Thrown when the iotcon is not supported. |
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
View SourceDeviceId
The device ID of the resource.
Declaration
public string DeviceId { get; }
Property Value
Type | Description |
---|---|
String | The device ID of the resource. |
API Level: 3
View SourceHostAddress
The host address of the resource.
Declaration
public string HostAddress { get; }
Property Value
Type | Description |
---|---|
String | The host address of the resource. |
API Level: 3
View SourceInterfaces
The interfaces of the resource.
Declaration
public IEnumerable<string> Interfaces { get; }
Property Value
Type | Description |
---|---|
IEnumerable<String> | The interfaces of the resource. |
API Level: 3
View SourceOptions
The header options of the resource.
Declaration
public ResourceOptions Options { get; set; }
Property Value
Type | Description |
---|---|
ResourceOptions | The header options of the resource. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown when the iotcon is not supported. |
ArgumentException | Thrown when there is an invalid parameter. |
API Level: 3
View SourcePolicy
The policy of the resource.
Declaration
public ResourcePolicy Policy { get; }
Property Value
Type | Description |
---|---|
ResourcePolicy | The policy of the resource. |
API Level: 3
View SourceTimeInterval
Time interval of monitoring and caching API.
Declaration
public int TimeInterval { get; set; }
Property Value
Type | Description |
---|---|
Int32 | Default time interval is 10 seconds. Seconds for time interval (must be in range from 1 to 3600). |
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown when the iotcon is not supported. |
ArgumentException | Thrown when there is an invalid parameter. |
API Level: 3
View SourceTypes
The resource types of the remote resource.
Declaration
public IEnumerable<string> Types { get; }
Property Value
Type | Description |
---|---|
IEnumerable<String> | The resource types of the remote resource. |
API Level: 3
View SourceUriPath
The URI path of the resource.
Declaration
public string UriPath { get; }
Property Value
Type | Description |
---|---|
String | The URI path of the resource. |
API Level: 3
Methods
View SourceCachedRepresentation()
Gets cached representation from the remote resource.
Declaration
public Representation CachedRepresentation()
Returns
Type | Description |
---|---|
Representation | cached representation from the remote resource. |
API Level: 3
Feature: http://tizen.org/feature/iot.ocf
View SourceDeleteAsync()
Deletes the resource asynchronously.
Declaration
public Task<RemoteResponse> DeleteAsync()
Returns
Type | Description |
---|---|
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
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 RemoteResource class.
Declaration
protected void Finalize()
GetAsync(ResourceQuery)
Gets the attributes of a resource asynchronously.
Declaration
public Task<RemoteResponse> GetAsync(ResourceQuery query = null)
Parameters
Type | Name | Description |
---|---|---|
ResourceQuery | query | The ResourceQuery to send to server. |
Returns
Type | Description |
---|---|
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
View SourcePostAsync(Representation, ResourceQuery)
Posts request on a resource asynchronously.
Declaration
public 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 |
---|---|
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
View SourcePutAsync(Representation, ResourceQuery)
Puts the representation of a resource asynchronously.
Declaration
public 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 |
---|---|
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
View SourceStartObserving(ObservePolicy, ResourceQuery)
Starts observing on the resource.
Declaration
public 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 |
---|---|
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
View SourceStopObserving()
Stops observing on the resource.
Declaration
public void StopObserving()
Exceptions
Type | Condition |
---|---|
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
View SourceCacheUpdated
The event is invoked with cached resource attributes.
Declaration
public event EventHandler<CacheUpdatedEventArgs> CacheUpdated
Event Type
Type | Description |
---|---|
EventHandler<CacheUpdatedEventArgs> |
API Level: 3
View SourceObserverNotified
Observe an event on the resource sent by the server.
Declaration
public event EventHandler<ObserverNotifiedEventArgs> ObserverNotified
Event Type
Type | Description |
---|---|
EventHandler<ObserverNotifiedEventArgs> |
API Level: 3
View SourceStateChanged
The event is called when remote resource's state are changed.
Declaration
public event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type | Description |
---|---|
EventHandler<StateChangedEventArgs> |