const char *name,
ua_service_h *service_handle);
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @brief Sets detection threshold for service handle.
+ * @since_tizen 5.5
+ *
+ * @param[in] service_handle The service handle
+ * @param[in] presence_threshold The service presence threshold information
+ * @param[in] absence_threshold The service absence threshold information
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #UA_ERROR_NONE Successful
+ * @retval #UA_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ */
+int ua_service_set_detection_threshold(
+ ua_service_h service_handle,
+ unsigned int presence_threshold,
+ unsigned int absence_threshold);
+
/**
* @ingroup CAPI_NETWORK_UA_MODULE
* @brief Sets name info for service handle.
memset(&uam_service, 0, sizeof(uam_service_info_s));
g_strlcpy(uam_service.name, service->name, UAM_SERVICE_MAX_STRING_LEN);
+ uam_service.presence_threshold = service->presence_threshold;
+ uam_service.absence_threshold = service->absence_threshold;
ret = _ua_get_error_code(_uam_register_service(&uam_service));
if (UA_ERROR_NONE != ret) {
return UA_ERROR_NONE;
}
-
int ua_service_remove(ua_service_h service_handle)
{
FUNC_ENTRY;
return UA_ERROR_NONE;
}
+int ua_service_set_detection_threshold(ua_service_h service_handle,
+ unsigned int presence_threshold, unsigned int absence_threshold)
+{
+ FUNC_ENTRY;
+ ua_service_info_s *service = (ua_service_info_s *)service_handle;
+
+ UA_VALIDATE_INPUT_PARAMETER(service_handle);
+ UA_VALIDATE_HANDLE(service_handle, ua_services_list);
+
+ retv_if(service->isadded, UA_ERROR_NOT_PERMITTED);
+// retv_if(presence_threshold > UAM_SERVICE_MAX_THRESHOLD), UA_ERROR_INVALID_PARAMETER);
+// retv_if(absence_threshold < UAM_SERVICE_MIN_THRESHOLD), UA_ERROR_INVALID_PARAMETER);
+
+ service->presence_threshold = presence_threshold;
+ service->absence_threshold = absence_threshold;
+
+ FUNC_EXIT;
+ return UA_ERROR_NONE;
+}
+
int ua_service_get_name(ua_service_h service_handle, char **name)
{
FUNC_ENTRY;
ua_service_h g_service_h = NULL; /**< Service handle */
char g_service_str[MENU_DATA_SIZE + 1] = { "ua.service.default" }; /**< Seletected service name */
+static char g_presence_threshold_str[MENU_DATA_SIZE + 1] = {0,}; /**< Seletected service presence threshold */
+static char g_absence_threshold_str[MENU_DATA_SIZE + 1] = {0,}; /**< Seletected service absence threshold */
static char g_selected_service_id[MENU_DATA_SIZE + 1] = {0,}; /**< Selected service id in the list */
static GSList *g_service_list = NULL; /**< Service List */
return RET_SUCCESS;
}
+static int run_ua_service_set_detection_threshold(MManager *mm, struct menu_data *menu)
+{
+ int ret = UA_ERROR_NONE;
+ unsigned int presence_threshold = 0;
+ unsigned int absence_threshold = 0;
+
+ msg("ua_service_set_threshold");
+
+ check_if(NULL == g_service_h);
+
+ if (strlen(g_presence_threshold_str))
+ presence_threshold = (unsigned int)strtol(g_presence_threshold_str, NULL, 10);
+ if (strlen(g_absence_threshold_str))
+ absence_threshold = (unsigned int)strtol(g_absence_threshold_str, NULL, 10);
+
+ ret = ua_service_set_detection_threshold(g_service_h, presence_threshold,
+ absence_threshold);
+
+ msg(" - ua_service_set_name() ret: [0x%X] [%s]",
+ ret, uat_get_error_str(ret));
+
+ return RET_SUCCESS;
+}
+
static int run_ua_service_add(
MManager *mm, struct menu_data *menu)
{
{ NULL, NULL, },
};
+static struct menu_data menu_ua_service_set_detection_threshold[] = {
+ { "1", "light presence detection threshold",
+ NULL, NULL, g_presence_threshold_str},
+ { "2", "light absence detection threshold",
+ NULL, NULL, g_absence_threshold_str},
+ { "3", "run",
+ NULL, run_ua_service_set_detection_threshold, NULL },
+ { NULL, NULL, },
+};
+
struct menu_data menu_ua_services[] = {
{ "1", "ua_service_get_default_service",
NULL, run_ua_service_get_default_service, NULL },
NULL, run_ua_service_create, NULL },
{ "3", "ua_service_set_name",
menu_ua_service_set_name, NULL, g_service_str },
- { "4", "ua_service_add",
+ { "4", "ua_service_set_detection_threshold",
+ menu_ua_service_set_detection_threshold, NULL, NULL },
+ { "5", "ua_service_add",
NULL, run_ua_service_add, NULL },
- { "5", "ua_service_remove",
+ { "6", "ua_service_remove",
NULL, run_ua_service_remove, NULL},
- { "6", "ua_service_destroy",
+ { "7", "ua_service_destroy",
NULL, run_ua_service_destroy, NULL},
- { "7", "ua_service_get_by_name",
+ { "8", "ua_service_get_by_name",
menu_ua_service_get_by_name, NULL, NULL },
- { "8", "ua_service_foreach_added_services",
+ { "9", "ua_service_foreach_added_services",
NULL, run_ua_service_foreach_added_services, NULL },
{ NULL, NULL, },
};