* @description get remote resource clone
* @parameter iotcon_remote_resource_h : The remote resource handle, iotcon_error_e : iotcon error
* user_data : The user data passed from function
-* @return NA
+* @return bool
*/
-static void presence_found_resource(iotcon_remote_resource_h resource,
+static bool presence_found_resource(iotcon_remote_resource_h resource,
iotcon_error_e err, void *user_data)
{
int nRet;
{
FPRINTF("[Line : %d][%s] iotcon_find_resource fail in startup error returned : %s\\n", __LINE__, API_NAMESPACE, IotConGetError(nRet));
presence_main_loop_quit(false);
- return;
+
}
- return;
+ return false;
}
else if (IOTCON_ERROR_NONE != err)
{
presence_main_loop_quit(false);
- return;
+ return false;
}
if (g_found)
- return;
+ return false;
g_found = true;
if(resource == NULL)
{
FPRINTF("[Line : %d][%s] iotcon_remote_resource_h is null in presence_found_resource callback. \\n", __LINE__, API_NAMESPACE);
- return;
+ return false;
}
nRet = iotcon_remote_resource_get_host_address(resource, &host_address);
if (IOTCON_ERROR_NONE != nRet) {
FPRINTF("[Line : %d][%s] Handle iotcon_remote_resource_get_host_address failed: %s\\n", __LINE__, API_NAMESPACE,IotConGetError(nRet));
presence_main_loop_quit(false);
- return;
+ return false;
}
char *uri;
if (IOTCON_ERROR_NONE != nRet) {
FPRINTF("[Line : %d][%s] iotcon_remote_resource_get_connectivity_type failed: %s\\n", __LINE__, API_NAMESPACE,IotConGetError(nRet));
presence_main_loop_quit(false);
- return;
+ return false;
}
switch (tc_index)
{
FPRINTF("[Line : %d][%s] iotcon_add_presence_cb failed: %s\\n", __LINE__, API_NAMESPACE,IotConGetError(nRet));
presence_main_loop_quit(false);
- return;
+ return false;
}
nRet = iotcon_remove_presence_cb(g_presence);
if (IOTCON_ERROR_NONE != nRet) {
FPRINTF("[Line : %d][%s] iotcon_remove_presence_cb failed: %s\\n", __LINE__, API_NAMESPACE,IotConGetError(nRet));
presence_main_loop_quit(false);
- return;
+ return false;
}
presence_main_loop_quit(true);
- return;
+ return true;
case PRESENCE_GET_HOST_ADDR_P:
nRet = iotcon_add_presence_cb(host_address, conn_type,PRESENCE_LIGHT_RESOURCE_TYPE,presence_handler, NULL, &g_presence);
if (IOTCON_ERROR_NONE != nRet)
{
FPRINTF("[Line : %d][%s] iotcon_add_presence_cb failed: %s\\n", __LINE__, API_NAMESPACE,IotConGetError(nRet));
presence_main_loop_quit(false);
- return;
+ return false;
}
nRet = iotcon_presence_get_host_address(g_presence, &presence_host_address);
if (IOTCON_ERROR_NONE != nRet)
FPRINTF("[Line : %d][%s] iotcon_presence_get_host_address failed: %s\\n", __LINE__, API_NAMESPACE,IotConGetError(nRet));
iotcon_remove_presence_cb(g_presence);
presence_main_loop_quit(false);
- return;
+ return false;
}
iotcon_remove_presence_cb(g_presence);
presence_main_loop_quit(true);
- return;
+ return true;
case PRESENCE_GET_CONN_TYPE_P:
nRet = iotcon_add_presence_cb(host_address, conn_type,PRESENCE_LIGHT_RESOURCE_TYPE,presence_handler, NULL, &g_presence);
if (IOTCON_ERROR_NONE != nRet)
{
FPRINTF("[Line : %d][%s] iotcon_add_presence_cb failed: %s\\n", __LINE__, API_NAMESPACE,IotConGetError(nRet));
presence_main_loop_quit(false);
- return;
+ return false;
}
nRet = iotcon_presence_get_connectivity_type(g_presence, &presence_conn_type);
if (IOTCON_ERROR_NONE != nRet)
FPRINTF("[Line : %d][%s] iotcon_presence_get_connectivity_type failed: %s\\n", __LINE__, API_NAMESPACE,IotConGetError(nRet));
iotcon_remove_presence_cb(g_presence);
presence_main_loop_quit(false);
- return;
+ return false;
}
iotcon_remove_presence_cb(g_presence);
presence_main_loop_quit(true);
- return;
+ return true;
case PRESENCE_GET_RSRC_TYPE_P:
nRet = iotcon_add_presence_cb(host_address, conn_type,PRESENCE_LIGHT_RESOURCE_TYPE,presence_handler, NULL, &g_presence);
if (IOTCON_ERROR_NONE != nRet)
{
FPRINTF("[Line : %d][%s] iotcon_add_presence_cb failed: %s\\n", __LINE__, API_NAMESPACE,IotConGetError(nRet));
presence_main_loop_quit(false);
- return;
+ return false;
}
nRet = iotcon_presence_get_resource_type(g_presence, &presence_resource_type);
if (IOTCON_ERROR_NONE != nRet)
FPRINTF("[Line : %d][%s] iotcon_presence_get_resource_type failed: %s\\n", __LINE__, API_NAMESPACE,IotConGetError(nRet));
iotcon_remove_presence_cb(g_presence);
presence_main_loop_quit(false);
- return;
+ return false;
}
iotcon_remove_presence_cb(g_presence);
presence_main_loop_quit(true);
- return;
+ return true;
default:
FPRINTF("[Line : %d][%s] invalid index %d\\n", __LINE__, API_NAMESPACE,tc_index);
- return;
+ return false;
}
+ return false;
}
static int CreateAndFindResource(int tc_index)
{
* @parameter[IN] iotcon_remote_resource_h resource
* @parameter[IN] iotcon_error_e err
* @parameter[IN] user_data The user data to pass to the function
-* @return void
+* @return bool
*/
-static void IotcoRemoteResourceMonitoringCB(iotcon_remote_resource_h resource, iotcon_error_e err, void *user_data)
+static bool IotcoRemoteResourceMonitoringCB(iotcon_remote_resource_h resource, iotcon_error_e err, void *user_data)
{
FPRINTF("[Line : %d][%s] IotcoRemoteResourceMonitoringCB\\n", __LINE__, API_NAMESPACE);
int nIotconTimeoutId = 0;
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+
}
- return;
+ return false;
}
else if (IOTCON_ERROR_NONE != err)
{
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+ return false;
}
if (g_found)
- return;
+ return false;
g_found = true;
g_main_loop_quit(g_pMainLoop);
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
- return;
+ return false;
}
g_nCheckAPICb = iotcon_remote_resource_start_monitoring(g_hcacheHandle, IotconMonitoringChangedCB,NULL);
iotcon_resource_destroy(g_light_resource);
g_main_loop_quit(g_pMainLoop);
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
- return;
+ return false;
}
g_nCheckAPICb = iotcon_remote_resource_stop_monitoring(g_hcacheHandle);
if (IOTCON_ERROR_NONE != g_nCheckAPICb)
g_main_loop_quit(g_pMainLoop);
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
- return;
+ return false;
}
iotcon_remote_resource_destroy(g_hcacheHandle);
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+ return true;
}
/**
* @parameter[IN] iotcon_remote_resource_h resource
* @parameter[IN] iotcon_error_e err
* @parameter[IN] user_data The user data to pass to the function
-* @return void
+* @return bool
*/
-static void IotconRemoteResourceCachingCB(iotcon_remote_resource_h resource,iotcon_error_e err, void *user_data)
+static bool IotconRemoteResourceCachingCB(iotcon_remote_resource_h resource,iotcon_error_e err, void *user_data)
{
FPRINTF("[Line : %d][%s] IotconRemoteResourceCachingCB\\n", __LINE__, API_NAMESPACE);
int nIotconTimeoutId = 0;
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+
}
- return;
+ return false;
}
else if (IOTCON_ERROR_NONE != err)
{
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+ return false;
}
if (g_found)
- return;
+ return false;
g_found = true;
g_main_loop_quit(g_pMainLoop);
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
- return;
+ return false;
}
g_nCheckAPICb = iotcon_remote_resource_start_caching(g_hcacheHandle, IotconCachingChangedCB, NULL);
if (IOTCON_ERROR_NONE != g_nCheckAPICb)
g_main_loop_quit(g_pMainLoop);
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
- return;
+ return false;
}
Iotcon_update_lite_resource();
RUN_POLLING_LOOP;
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+ return true;
}
/**
* @parameter[IN] iotcon_remote_resource_h resource
* @parameter[IN] iotcon_error_e err
* @parameter[IN] user_data The user data to pass to the function
-* @return void
+* @return bool
*/
-static void IotconRemoteResourceRepresentationCB(iotcon_remote_resource_h resource, iotcon_error_e err, void *user_data)
+static bool IotconRemoteResourceRepresentationCB(iotcon_remote_resource_h resource, iotcon_error_e err, void *user_data)
{
FPRINTF("[Line : %d][%s] IotconRemoteResourceRepresentationCB\\n", __LINE__, API_NAMESPACE);
g_bCheckCb = true;
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+
}
- return;
+ return false;
}
else if (IOTCON_ERROR_NONE != err)
{
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+ return false;
}
if (g_found)
- return;
+ return false;
g_found = true;
g_main_loop_quit(g_pMainLoop);
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
- return;
+ return false;
}
g_nCheckAPICb = iotcon_remote_resource_start_caching(g_hcacheHandle, IotconRepresentationChangedCB, NULL);
if (IOTCON_ERROR_NONE != g_nCheckAPICb)
g_main_loop_quit(g_pMainLoop);
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
- return;
+ return false;
}
Iotcon_update_lite_resource();
RUN_POLLING_LOOP;
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+ return true;
}
/**
* @function IotconRemoteResourceOptionsCB
* @description Callback Function
* @parameter iotcon_remote_resource_h resource, iotcon_error_e result,void *user_data
-* @return NA
+* @return bool
*/
- static void IotconRemoteResourceOptionsCB(iotcon_remote_resource_h resource, iotcon_error_e result,void *user_data)
+ static bool IotconRemoteResourceOptionsCB(iotcon_remote_resource_h resource, iotcon_error_e result,void *user_data)
{
FPRINTF("[Line : %d][%s] IotconRemoteResourceOptionsCB\\n", __LINE__, API_NAMESPACE);
int nRet;
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+
}
- return;
+ return false;
}
else if (IOTCON_ERROR_NONE != result)
{
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+ return false;
}
if (g_found)
- return;
+ return false;
g_found = true;
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+ return false;
}
if ( g_pMainLoop )
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+ return true;
}
/**
* @parameter[IN] iotcon_remote_resource_h resource
* @parameter[IN] iotcon_error_e err
* @parameter[IN] user_data The user data to pass to the function
-* @return void
+* @return bool
*/
-static void IotconRemoteResourceGetPutPostDelCB(iotcon_remote_resource_h resource, iotcon_error_e err, void *user_data)
+static bool IotconRemoteResourceGetPutPostDelCB(iotcon_remote_resource_h resource, iotcon_error_e err, void *user_data)
{
iotcon_query_h query;
g_bCheckCb = true;
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+
}
- return;
+ return false;
}
else if (IOTCON_ERROR_NONE != err)
{
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+ return false;
}
if (g_found)
- return;
+ return false;
g_found = true;
if (IOTCON_ERROR_NONE != g_nCheckAPICb)
{
FPRINTF("[Line : %d][%s] iotcon_remote_resource_clone : %s\\n", __LINE__, API_NAMESPACE,IotConGetError(g_nCheckAPICb));
- return;
+ return false;
}
g_nCheckAPICb = iotcon_query_create(&query);
if (IOTCON_ERROR_NONE != g_nCheckAPICb)
{
FPRINTF("[Line : %d][%s] iotcon_query_create : %s\\n", __LINE__, API_NAMESPACE,IotConGetError(g_nCheckAPICb));
iotcon_remote_resource_destroy(g_hcacheHandle);
- return;
+ return false;
}
g_nCheckAPICb = iotcon_query_add(query, "key", "value");
if (IOTCON_ERROR_NONE != g_nCheckAPICb)
FPRINTF("[Line : %d][%s] iotcon_query_add : %s\\n", __LINE__, API_NAMESPACE,IotConGetError(g_nCheckAPICb));
iotcon_query_destroy(query);
iotcon_remote_resource_destroy(g_hcacheHandle);
- return;
+ return false;
}
//Get
g_nCheckAPICb = iotcon_remote_resource_get(g_hcacheHandle, query, IotconGetChangedCB, NULL);
FPRINTF("[Line : %d][%s] iotcon_remote_resource_get : %s\\n", __LINE__, API_NAMESPACE,IotConGetError(g_nCheckAPICb));
iotcon_remote_resource_destroy(g_hcacheHandle);
iotcon_query_destroy(query);
- return;
+ return false;
}
RUN_POLLING_LOOP;
iotcon_query_destroy(query);
{
FPRINTF("[Line : %d][%s] iotcon_representation_create : %s\\n", __LINE__, API_NAMESPACE,IotConGetError(g_nCheckAPICb));
iotcon_remote_resource_destroy(g_hcacheHandle);
- return;
+ return false;
}
if(hRepr == NULL)
{
FPRINTF("[Line : %d][%s] iotcon_representation_create failed returned resource is NULL \\n", __LINE__, API_NAMESPACE);
iotcon_remote_resource_destroy(g_hcacheHandle);
- return;
+ return false;
}
g_nCheckAPICb = iotcon_remote_resource_put(g_hcacheHandle, hRepr, NULL, IotconPutChangedCB, NULL);
if (IOTCON_ERROR_NONE != g_nCheckAPICb)
FPRINTF("[Line : %d][%s] iotcon_remote_resource_get : %s\\n", __LINE__, API_NAMESPACE,IotConGetError(g_nCheckAPICb));
iotcon_remote_resource_destroy(g_hcacheHandle);
iotcon_representation_destroy(hRepr);
- return;
+ return false;
}
RUN_POLLING_LOOP;
//post
FPRINTF("[Line : %d][%s] iotcon_remote_resource_get : %s\\n", __LINE__, API_NAMESPACE,IotConGetError(g_nCheckAPICb));
iotcon_remote_resource_destroy(g_hcacheHandle);
iotcon_representation_destroy(hRepr);
- return;
+ return false;
}
RUN_POLLING_LOOP;
iotcon_representation_destroy(hRepr);
{
FPRINTF("[Line : %d][%s] iotcon_remote_resource_get : %s\\n", __LINE__, API_NAMESPACE,IotConGetError(g_nCheckAPICb));
iotcon_remote_resource_destroy(g_hcacheHandle);
- return;
+ return false;
}
RUN_POLLING_LOOP;
iotcon_remote_resource_destroy(g_hcacheHandle);
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+ return true;
}
/**
* @parameter[IN] iotcon_remote_resource_h resource
* @parameter[IN] iotcon_error_e err
* @parameter[IN] user_data The user data to pass to the function
-* @return void
+* @return bool
*/
-static void IotconRemoteResourceObserveCB(iotcon_remote_resource_h resource, iotcon_error_e err, void *user_data)
+static bool IotconRemoteResourceObserveCB(iotcon_remote_resource_h resource, iotcon_error_e err, void *user_data)
{
FPRINTF("[Line : %d][%s] IotconRemoteResourceObserveCB\\n", __LINE__, API_NAMESPACE);
int nIotconTimeoutId = 0;
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+
}
- return;
+ return false;
}
else if (IOTCON_ERROR_NONE != err)
{
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+ return false;
}
if (g_found)
- return;
+ return false;
g_found = true;
if (IOTCON_ERROR_NONE != g_nCheckAPICb)
{
FPRINTF("[Line : %d][%s] iotcon_remote_resource_clone : %s\\n", __LINE__, API_NAMESPACE,IotConGetError(g_nCheckAPICb));
- return;
+ return false;
}
g_nCheckAPICb = iotcon_remote_resource_observe_register(g_hcacheHandle, IOTCON_OBSERVE_IGNORE_OUT_OF_ORDER, NULL, IotconObserveChangedCB, NULL);
if (IOTCON_ERROR_NONE != g_nCheckAPICb)
{
FPRINTF("[Line : %d][%s] iotcon_remote_resource_observe_register : %s\\n", __LINE__, API_NAMESPACE,IotConGetError(g_nCheckAPICb));
iotcon_remote_resource_destroy(g_hcacheHandle);
- return;
+ return false;
}
RUN_POLLING_LOOP;
g_main_loop_unref(g_pMainLoop);
g_pMainLoop = NULL;
}
- return;
+ return true;
}
/**
* @function ITs_iotcon_remote_resource_startup
//& purpose: Creates a new query handle.
//& type: auto
/**
-* @testcase ITc_iotcon_remote_resource_get_policies_p
+* @testcase ITc_iotcon_remote_resource_get_properties_p
* @since_tizen 3.0
* @author SRID(asit.s)
* @reviewer SRID(parshant.v)
* @type auto
* @description Creates a new query handle.
-* @scenario call iotcon_remote_resource_get_policies
-* @apicovered iotcon_remote_resource_get_policies
-* @passcase When iotcon_remote_resource_get_policies is successful.
-* @failcase If target API iotcon_remote_resource_get_policies or any precondition API fails.
+* @scenario call iotcon_remote_resource_get_properties
+* @apicovered iotcon_remote_resource_get_properties
+* @passcase When iotcon_remote_resource_get_properties is successful.
+* @failcase If target API iotcon_remote_resource_get_properties or any precondition API fails.
* @precondition NA
* @postcondition NA
*/
* @type auto
* @description Creates a new query handle.
* @scenario call iotcon_query_create
-* @apicovered iotcon_remote_resource_clone,iotcon_remote_resource_start_caching,iotcon_remote_resource_get_cached_representation
-* @passcase When iotcon_remote_resource_clone,iotcon_remote_resource_start_caching,iotcon_remote_resource_get_cached_representation are successful.
+* @apicovered iotcon_remote_resource_clone,iotcon_remote_resource_start_caching, iotcon_state_create,iotcon_state_add_int,iotcon_lite_resource_update_state,iotcon_remote_resource_get_cached_representation
+* @passcase When iotcon_remote_resource_clone,iotcon_remote_resource_start_caching, iotcon_state_create,iotcon_state_add_int,iotcon_lite_resource_update_state,iotcon_remote_resource_get_cached_representation are successful.
* @failcase If target API or any precondition API fails.
* @precondition NA
* @postcondition NA
* @description get remote resource clone
* @parameter iotcon_remote_resource_h : The remote resource handle, iotcon_error_e : iotcon error
* user_data : The user data passed from function
-* @return NA
+* @return bool
*/
-static void FoundResourceCB(iotcon_remote_resource_h resource,
- iotcon_error_e err, void *user_data)
+static bool FoundResourceCB(iotcon_remote_resource_h resource,iotcon_error_e err, void *user_data)
{
FPRINTF("Inside FoundResourceCB callback... \n");
if (IOTCON_ERROR_NONE != nRet) {
FPRINTF("iotcon_find_resource() Fail(%d)", nRet);
QuitGmainLoopIdle(false);
- return;
+
}
- return;
+ return false;
} else if (IOTCON_ERROR_NONE != err) {
QuitGmainLoopIdle(false);
- return;
+ return false;
}
char *host_address, *uri;
if (IOTCON_ERROR_NONE != nRet) {
FPRINTF("iotcon_resource_set_request_handler() Fail(%d)", nRet);
QuitGmainLoopIdle(false);
- return;
+ return false;
}
nRet = iotcon_remote_resource_clone(resource, &g_hRemoteResource);
if (IOTCON_ERROR_NONE != nRet) {
FPRINTF("iotcon_remote_resource_clone() Fail(%d)", nRet);
QuitGmainLoopIdle(false);
- return;
+ return false;
}
nRet = iotcon_remote_resource_observe_register(g_hRemoteResource,
if (IOTCON_ERROR_NONE != nRet) {
FPRINTF("iotcon_remote_resource_observe_register() Fail(%d)", nRet);
QuitGmainLoopIdle(false);
- return;
+ return false;
}
break;
case RESOURCE_CREATE:
if (IOTCON_ERROR_NONE != nRet) {
FPRINTF("iotcon_remote_resource_clone() Fail(%d)", nRet);
QuitGmainLoopIdle(false);
- return;
+ return false;
}
nRet = iotcon_remote_resource_observe_register(g_hRemoteResource,
if (IOTCON_ERROR_NONE != nRet) {
FPRINTF("iotcon_remote_resource_observe_register() Fail(%d)", nRet);
QuitGmainLoopIdle(false);
- return;
+ return false;
}
break;
default:
FPRINTF("Invalid tc_index(%d)", tc_index);
QuitGmainLoopIdle(false);
- return;
+ return false;
}
+
+ return true;
}
/**