Class IoTConnectivityServerManager
Definition
- Namespace:
- Tizen.Network.IoTConnectivity
- Assembly:
- Tizen.Network.IoTConnectivity.dll
- API Level:
- 3
IoT connectivity server manager consists of server side APIs.
C#Copypublic static class IoTConnectivityServerManager
- Inheritance
-
System.ObjectIoTConnectivityServerManager
Methods
Declaration
C#Copypublic static void Deinitialize()
Remarks
This API must be called if IoTCon API is no longer needed.
Examples
CopyIoTConnectivityServerManager.Deinitialize();
See Also
API Level: 3
Feature: http://tizen.org/feature/iot.ocf
Precondition: Initialize() should be called to initialize.
Declaration
C#Copypublic static void Initialize(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.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
Copystring 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. |
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.
Declaration
C#Copypublic static void RegisterResource(Resource resource)
Parameters
Type | Name | Description |
---|---|---|
Resource | resource | The resource to register. |
Examples
CopyResourceTypes 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. |
OutOfMemoryException | Thrown when there is not enough memory. |
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
Precondition: Initialize() should be called to initialize.
Declaration
C#Copypublic static void SetDeviceName(string deviceName)
Parameters
Type | Name | Description |
---|---|---|
System.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
CopyIoTConnectivityServerManager.SetDeviceName("my-tizen");
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.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
Declaration
C#Copypublic static void StartSendingPresence(uint time)
Parameters
Type | Name | Description |
---|---|---|
System.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
Copytry { 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. |
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.
Declaration
C#Copypublic 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
CopyIoTConnectivityServerManager.StopSendingPresence();
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the iotcon is not supported. |
System.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.
Declaration
C#Copypublic static void UnregisterResource(Resource resource)
Parameters
Type | Name | Description |
---|---|---|
Resource | resource | The resource to unregister. |
Examples
CopyResourceTypes 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. |
UnauthorizedAccessException | Thrown when an application does not have privilege to access. |