Class IoTConnectivityServerManager
Definition
- Namespace:
- Tizen.Network.IoTConnectivity
- Assembly:
- Tizen.Network.IoTConnectivity.dll
- API Level:
- 3
IoT connectivity server manager consists of server side APIs.
public static class IoTConnectivityServerManager
- Inheritance
-
IoTConnectivityServerManager
Methods
View SourceDeinitialize()
Deinitializes IoTCon.
Declaration
public static void Deinitialize()
Remarks
This API must be called if IoTCon API is no longer needed.
Examples
IoTConnectivityServerManager.Deinitialize();
See Also
API Level: 3
Feature: http://tizen.org/feature/iot.ocf
Precondition: Initialize() should be called to initialize.
View SourceInitialize(String)
Initializes IoTCon. Calls this API to start IoTCon.
Declaration
public static void Initialize(string filePath)
Parameters
Type | Name | Description |
---|---|---|
String | filePath | The file path pointing to storage for handling secure virtual resources. |
Remarks
filePath
points to a file for handling secure virtual resources.
The file that is CBOR(Concise Binary Object Representation)-format must already exist
in filePath
. We recommend to use application-local file for filePath
.
Examples
string filePath = "../../res/iotcon-test-svr-db-server.dat";
IoTConnectivityServerManager.Initialize(filePath);
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown when the iotcon is not supported. |
ArgumentException | Thrown when there is an invalid parameter. |
UnauthorizedAccessException | Thrown when an application does not have privilege to access |
See Also
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/network.gethttp://tizen.org/privilege/internet
Feature: http://tizen.org/feature/iot.ocf
Postcondition: You must call Deinitialize() if IoTCon API is no longer needed.
View SourceRegisterResource(Resource)
Registers a resource in IoTCon server.
Declaration
public static void RegisterResource(Resource resource)
Parameters
Type | Name | Description |
---|---|---|
Resource | resource | The resource to register. |
Examples
ResourceTypes types = new ResourceTypes(new List<string>(){ "org.tizen.light" });
Attributes attributes = new Attributes { { "state", "ON" }};
Resource res = new LiteResource("/room/1", types, ResourcePolicy.Discoverable, attributes);
try {
IoTConnectivityServerManager.RegisterResource(res);
} catch(Exception ex) {
Console.Log("Exception caught : " + ex.Message);
}
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. |
OutOfMemoryException | Thrown when there is not enough memory. |
UnauthorizedAccessException | Thrown when an application does not have privilege to access. |
See Also
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/internet
Feature: http://tizen.org/feature/iot.ocf
Precondition: Initialize() should be called to initialize.
View SourceSetDeviceName(String)
Sets the device name.
Declaration
public static void SetDeviceName(string deviceName)
Parameters
Type | Name | Description |
---|---|---|
String | deviceName | The device name. |
Remarks
This API sets the name of the local device (the device calling the API).
If the device name is set, clients can get the name using StartFindingDeviceInformation(String, ResourceQuery).
Examples
IoTConnectivityServerManager.SetDeviceName("my-tizen");
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. |
See Also
API Level: 3
Feature: http://tizen.org/feature/iot.ocf
View SourceStartSendingPresence(UInt32)
Starts presence of a server.
Declaration
public static void StartSendingPresence(uint time)
Parameters
Type | Name | Description |
---|---|---|
UInt32 | time | The interval of announcing presence in seconds. |
Remarks
Use this API to send server's announcements to clients. Server can call this API when online for the first time or come back from offline to online.
If time
is 0, server will set default value as 60 seconds.
If time
is very big, server will set maximum value as (60 * 60 * 24) seconds, (24 hours).
Examples
try {
IoTConnectivityServerManager.StartSendingPresence(120);
} catch(Exception ex) {
Console.Log("Exception caught : " + ex.Message);
}
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. |
See Also
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/internet
Feature: http://tizen.org/feature/iot.ocf
Precondition: Initialize() should be called to initialize.
View SourceStopSendingPresence()
Stops presence of a server.
Declaration
public static void StopSendingPresence()
Remarks
Use this API to stop sending server's announcements to clients. Server can call this API when terminating, entering to offline or out of network.
Examples
IoTConnectivityServerManager.StopSendingPresence();
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. |
See Also
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/internet
Feature: http://tizen.org/feature/iot.ocf
Precondition: Initialize() should be called to initialize.
View SourceUnregisterResource(Resource)
Unregisters a resource in IoTCon server.
Declaration
public static void UnregisterResource(Resource resource)
Parameters
Type | Name | Description |
---|---|---|
Resource | resource | The resource to unregister. |
Examples
ResourceTypes types = new ResourceTypes(new List<string>(){ "org.tizen.light" });
Attributes attributes = new Attributes { { "state", "ON" }};
Resource res = new LiteResource("/room/1", types, ResourcePolicy.Discoverable, attributes);
IoTConnectivityServerManager.RegisterResource(res);
try {
IoTConnectivityServerManager.UnregisterResource(res);
} catch(Exception ex) {
Console.Log("Exception caught : " + ex.Message);
}
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown when the iotcon is not supported. |
UnauthorizedAccessException | Thrown when an application does not have privilege to access. |