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#
Copy
public static class IoTConnectivityServerManager
Inheritance
System.Object
IoTConnectivityServerManager

Methods

View Source

Deinitialize()

Deinitializes IoTCon.

Declaration
C#
Copy
public static void Deinitialize()
Remarks

This API must be called if IoTCon API is no longer needed.

Examples
Copy
IoTConnectivityServerManager.Deinitialize();
API Level: 3
Feature: http://tizen.org/feature/iot.ocf
Precondition: Initialize() should be called to initialize.
View Source

Initialize(String)

Initializes IoTCon. Calls this API to start IoTCon.

Declaration
C#
Copy
public 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
Copy
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.

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 Source

RegisterResource(Resource)

Registers a resource in IoTCon server.

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.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.
View Source

SetDeviceName(String)

Sets the device name.

Declaration
C#
Copy
public 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
Copy
IoTConnectivityServerManager.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.

API Level: 3
Feature: http://tizen.org/feature/iot.ocf
View Source

StartSendingPresence(UInt32)

Starts presence of a server.

Declaration
C#
Copy
public 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
Copy
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.

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.
View Source

StopSendingPresence()

Stops presence of a server.

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.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.

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 Source

UnregisterResource(Resource)

Unregisters a resource in IoTCon server.

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.NotSupportedException

Thrown when the iotcon is not supported.

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.