Class IoTConnectivityServerManager
Definition
- Namespace:
- Tizen.Network.IoTConnectivity
- Assembly:
- Tizen.Network.IoTConnectivity.dll
IoT connectivity server manager consists of server side APIs.
public static class IoTConnectivityServerManager
- Inheritance
-
objectIoTConnectivityServerManager
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
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 |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.ArgumentException | Thrown when there is an invalid parameter. |
System.UnauthorizedAccessException | Thrown when an application does not have privilege to access |
See Also
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 |
---|---|
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.OutOfMemoryException | Thrown when there is not enough memory. |
System.UnauthorizedAccessException | Thrown when an application does not have privilege to access. |
See Also
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 |
---|---|
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. |
See Also
StartSendingPresence(uint)
Starts presence of a server.
Declaration
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
try {
IoTConnectivityServerManager.StartSendingPresence(120);
} catch(Exception ex) {
Console.Log("Exception caught : " + ex.Message);
}
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. |
See Also
StopSendingPresence()
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 |
---|---|
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. |
See Also
UnregisterResource(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 |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.UnauthorizedAccessException | Thrown when an application does not have privilege to access. |