Tizen Native API
Server

IoTCon Server provides API for server side.

Required Header

#include <iotcon.h>

Overview

This API set consists of server side API for Resource, Lite Resource, Observers, Request.

Functions

int iotcon_start_presence (unsigned int time_to_live)
 Starts presence of a server.
int iotcon_stop_presence (void)
 Stops presence of a server.
int iotcon_set_device_name (const char *device_name)
 Sets the device name.

Function Documentation

int iotcon_set_device_name ( const char *  device_name)

Sets the device name.

The function sets the name of the local device (the device calling the function). If the device name is set, clients can get the name using iotcon_device_info_get_property() or iotcon_remote_resource_get_device_name().

Since :
3.0
Remarks:
device_name may not be an empty string.
Parameters:
[in]device_nameThe device name
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_INVALID_PARAMETERInvalid parameter
IOTCON_ERROR_OUT_OF_MEMORYOut of memory
IOTCON_ERROR_IOTIVITYIotivity errors
See also:
iotcon_get_device_info()
iotcon_device_info_get_property()
iotcon_remote_resource_get_device_name()
int iotcon_start_presence ( unsigned int  time_to_live)

Starts presence of a server.

Use this function to send server's announcements to clients.
Server can call this function when online for the first time or come back from offline to online.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Remarks:
If time_to_live is 0, server will set default value as 60 seconds.
If time_to_live is very big, server will set maximum value as (60 * 60 * 24) seconds (24 hours).
Parameters:
[in]time_to_liveThe interval of announcing presence in seconds
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_SYSTEMSystem error
IOTCON_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
iotcon_initialize() should be called to initialize.
See also:
iotcon_stop_presence()
iotcon_add_presence_cb()
iotcon_remove_presence_cb()
int iotcon_stop_presence ( void  )

Stops presence of a server.

Use this function to stop sending server's announcements to clients. Server can call this function when terminating, entering to offline or out of network.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Returns:
0 on success, otherwise a negative error value
Return values:
IOTCON_ERROR_NONESuccessful
IOTCON_ERROR_NOT_SUPPORTEDNot supported
IOTCON_ERROR_SYSTEMSystem error
IOTCON_ERROR_PERMISSION_DENIEDPermission denied
Precondition:
iotcon_initialize() should be called to initialize.
See also:
iotcon_start_presence()
iotcon_add_presence_cb()
iotcon_remove_presence_cb()