Class IoTConnectivityServerManager
Definition
- Namespace:
- Tizen.Network.Io
TConnectivity
- Assembly:
- Tizen.Network.IoTConnectivity.dll
IoT connectivity server manager consists of server side APIs.
C#
Copy
public static class IoTConnectivityServerManager
- Inheritance
-
objectIo
TConnectivity Server Manager
Methods
Declaration
C#
Copy
public static void Deinitialize()
Remarks
This API must be called if IoTCon API is no longer needed.
Examples
Copy
IoTConnectivityServerManager.Deinitialize();
See Also
Declaration
C#
Copy
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
Copy
string filePath = "../../res/iotcon-test-svr-db-server.dat";
IoTConnectivityServerManager.Initialize(filePath);
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the iotcon is not supported. |
System. |
Thrown when there is an invalid parameter. |
System. |
Thrown when an application does not have privilege to access |
See Also
Declaration
C#
Copy
public static void RegisterResource(Resource resource)
Parameters
Type | Name | Description |
---|---|---|
Resource | resource | The resource to register. |
Examples
Copy
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 |
---|---|
System. |
Thrown when the iotcon is not supported. |
System. |
Thrown when there is an invalid parameter. |
System. |
Thrown when the operation is invalid. |
System. |
Thrown when there is not enough memory. |
System. |
Thrown when an application does not have privilege to access. |
Declaration
C#
Copy
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 Start
Examples
Copy
IoTConnectivityServerManager.SetDeviceName("my-tizen");
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the iotcon is not supported. |
System. |
Thrown when the operation is invalid. |
System. |
Thrown when an application does not have privilege to access. |
See Also
Declaration
C#
Copy
public static void StartSendingPresence(uint time)
Parameters
Type | Name | Description |
---|---|---|
uint | 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
Copy
try {
IoTConnectivityServerManager.StartSendingPresence(120);
} catch(Exception ex) {
Console.Log("Exception caught : " + ex.Message);
}
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the iotcon is not supported. |
System. |
Thrown when the operation is invalid. |
System. |
Thrown when an application does not have privilege to access. |
See Also
Declaration
C#
Copy
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
Copy
IoTConnectivityServerManager.StopSendingPresence();
Exceptions
Type | Condition |
---|---|
System. |
Thrown when the iotcon is not supported. |
System. |
Thrown when the operation is invalid. |
System. |
Thrown when an application does not have privilege to access. |
See Also
Declaration
C#
Copy
public static void UnregisterResource(Resource resource)
Parameters
Type | Name | Description |
---|---|---|
Resource | resource | The resource to unregister. |
Examples
Copy
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 |
---|---|
System. |
Thrown when the iotcon is not supported. |
System. |
Thrown when an application does not have privilege to access. |