Add the feature check logic 54/253054/1 accepted/tizen/unified/20210208.061806 submit/tizen/20210208.015605
authorDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 4 Feb 2021 05:57:22 +0000 (14:57 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 4 Feb 2021 05:57:22 +0000 (14:57 +0900)
Change-Id: I3a7ba78dd468ebdab71190648e0561a6c355ba74
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
CMakeLists.txt
include/user-awareness-private.h
packaging/capi-network-ua.spec
src/user-awareness-device.c
src/user-awareness-event-handler.c
src/user-awareness-monitors.c
src/user-awareness-service.c
src/user-awareness-users.c
src/user-awareness-util.c

index 80cbb51168e937f01d850c30c1cfc85c9c2f45d7..43db0dfcd057d86ee99c01269757e6483959b1bb 100644 (file)
@@ -12,6 +12,7 @@ SET(PKG_MODULES
        glib-2.0
        gio-2.0
        ua-api
+       capi-system-info
 )
 IF (${SUSPEND_RESUME_TEST})
     pkg_check_modules (PKGS REQUIRED ${PKG_MODULES}
index b4481c8d30fbd979ae242fb2cf722073ede98c7e..8c06bdf4d8a3c4126795ecd87f8232962c28bc4c 100755 (executable)
 #ifndef __TIZEN_CAPI_NETWORK_USER_AWARENESS_PRIVATE_H__
 #define __TIZEN_CAPI_NETWORK_USER_AWARENESS_PRIVATE_H__
 
-#include <user-awareness-log.h>
+
 #include <glib.h>
+#include <user-awareness-log.h>
+#include <user-awareness.h>
+
+#include <system_info.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -139,6 +143,34 @@ extern "C" {
                } \
        } \
 
+typedef enum {
+       UA_FEATURE_BASE = 0,
+       UA_FEATURE_COMMON = UA_FEATURE_BASE,
+       UA_FEATURE_MAX
+} ua_feature_t;
+
+typedef struct {
+       const char *name;
+       gboolean is_check;
+       gboolean value;
+} ua_feature_table_t;
+
+int _ua_check_supported_feature(ua_feature_t feature, bool *supported);
+
+#define UA_CHECK_SUPPORTED_FEATURE(feature) \
+do     { \
+       bool is_supported = false; \
+       if (!_ua_check_supported_feature(feature, &is_supported)) { \
+               if (is_supported == false) { \
+                       UA_ERR("[%s] NOT_SUPPORTED", __FUNCTION__); \
+                       return UA_ERROR_NOT_SUPPORTED; \
+               } \
+       } else { \
+               UA_ERR("[%s] Fail to get the system feature: [%d]", __FUNCTION__, feature); \
+       } \
+} while (0)
+
+
 #define UA_ALL_SENSOR_PRESENCE_DETECTION_WAIT_TIME 65 /**< All sensor presence detection wait time */
 
 /**
index edfb913b92590ed74551daa9fe354d20c43ecdd9..c0f629655135b160436b7276ec91e457bf942c63 100644 (file)
@@ -9,6 +9,7 @@ BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(ua-api)
+BuildRequires:  pkgconfig(capi-system-info)
 
 %if 0%{?ptest:1}
 BuildRequires:  pkgconfig(deviced)
index 219f8c9863ec0c152342544b26e37dc04c2d0d4a..a5605bc9abb6ab26fca842fa80fab5b9da722c6e 100755 (executable)
@@ -444,6 +444,7 @@ int ua_device_create(ua_mac_type_e mac_type,
        FUNC_ENTRY;
        ua_dev_info_s *device = NULL;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_VALIDATE_INPUT_PARAMETER(mac_address);
@@ -490,6 +491,7 @@ int ua_device_destroy(ua_device_h device_handle)
 {
        FUNC_ENTRY;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
 
@@ -533,6 +535,7 @@ int ua_device_get_mac_type(ua_device_h handle, ua_mac_type_e *mac_type)
 {
        FUNC_ENTRY;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
 
@@ -597,6 +600,7 @@ int ua_device_set_os_info(
 {
        FUNC_ENTRY;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
 
@@ -654,6 +658,7 @@ int ua_device_set_wifi_bssid(
 {
        FUNC_ENTRY;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_INPUT_PARAMETER(bssid);
@@ -681,6 +686,7 @@ int ua_device_set_wifi_ipv4_address(
 {
        FUNC_ENTRY;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_INPUT_PARAMETER(ipv4_address);
@@ -726,6 +732,7 @@ int ua_device_get_mac_address(
 {
        FUNC_ENTRY;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_VALIDATE_INPUT_PARAMETER(mac_address);
@@ -759,6 +766,7 @@ int ua_device_get_os_info(
 {
        FUNC_ENTRY;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_VALIDATE_INPUT_PARAMETER(os_info);
@@ -776,6 +784,7 @@ int ua_device_get_device_id(
 {
        FUNC_ENTRY;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_PRINT_DEVICE_HANDLE(device_handle);
@@ -807,6 +816,7 @@ int ua_device_get_wifi_bssid(
 {
        FUNC_ENTRY;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_VALIDATE_INPUT_PARAMETER(bssid);
@@ -838,6 +848,7 @@ int ua_device_get_wifi_ipv4_address(
 {
        FUNC_ENTRY;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_VALIDATE_INPUT_PARAMETER(ipv4_address);
@@ -871,6 +882,7 @@ int ua_device_get_last_presence(
 {
        FUNC_ENTRY;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_VALIDATE_INPUT_PARAMETER(timestamp);
@@ -893,6 +905,7 @@ int ua_device_get_by_mac_address(
        ua_dev_info_s *dev;
        uam_device_info_s uam_dev;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(mac);
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
@@ -937,6 +950,7 @@ int ua_device_get_by_device_id(
        uam_device_info_s uam_dev;
        uam_tech_type_e type;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_VALIDATE_INPUT_PARAMETER(device_id);
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        retv_if(UA_MAC_TYPE_NONE >= mac_type, UA_ERROR_INVALID_PARAMETER);
@@ -977,6 +991,7 @@ int ua_device_update(ua_device_h device_handle)
        gboolean is_registered = false;
        uam_device_info_s uam_device;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
        UA_VALIDATE_HANDLE(device_handle, ua_devices_list);
@@ -1206,6 +1221,7 @@ int ua_device_get_pairing_required(
        gboolean is_registered = FALSE;
        uam_device_info_s uam_device;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_INPUT_PARAMETER(pairing_required);
index 38da6e792f98fbb36be9e09dcb8459deba7a27a9..1a231bf5f3458dded3d32a9f7d25ceabcf1c5ade 100755 (executable)
@@ -306,6 +306,8 @@ int ua_initialize(void)
        FUNC_ENTRY;
        int ret;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
+
        retv_if(TRUE == is_initialized, UA_ERROR_ALREADY_DONE);
 
        ret = _ua_get_error_code(_uam_init(__ua_event_handler, NULL));
@@ -371,6 +373,7 @@ int ua_deinitialize(void)
        FUNC_ENTRY;
        int ret;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
 
        __ua_cleanup();
index 24ada08e9390e02ab5341bcecb78123eb1398161..50728cf5bed7ca83e7416e1fefbfc915ca1b718d 100755 (executable)
@@ -1040,6 +1040,7 @@ int ua_monitor_is_sensor_available(
        int ret;
        unsigned int bitmask;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(available);
 
@@ -1108,6 +1109,7 @@ int ua_monitor_create(ua_monitor_h *handle)
        ua_monitor_s *monitor = NULL;
        unsigned int available_sensors = 0;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
 
@@ -1141,6 +1143,7 @@ int ua_monitor_destroy(ua_monitor_h handle)
 
        ua_monitor_s *monitor = (ua_monitor_s *)handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_HANDLE(handle, ua_monitor_list);
@@ -1253,6 +1256,7 @@ int ua_monitor_set_sensor_status_cb(ua_monitor_h handle,
        FUNC_ENTRY;
        ua_monitor_s *monitor = (ua_monitor_s *)handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(callback);
        UA_VALIDATE_INPUT_PARAMETER(handle);
@@ -1270,6 +1274,7 @@ int ua_monitor_unset_sensor_status_cb(ua_monitor_h handle)
        FUNC_ENTRY;
        ua_monitor_s *monitor = (ua_monitor_s *)handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_HANDLE(handle, ua_monitor_list);
@@ -1290,6 +1295,7 @@ int ua_monitor_add_sensor(
        unsigned int bitmask;
        unsigned int available_sensors = 0;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_HANDLE(handle, ua_monitor_list);
@@ -1317,6 +1323,7 @@ int ua_monitor_remove_sensor(
        ua_monitor_s *monitor = (ua_monitor_s *)handle;
        unsigned int bitmask;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_HANDLE(handle, ua_monitor_list);
@@ -1340,6 +1347,7 @@ int ua_monitor_foreach_sensor(
        unsigned int bitmask;
        int sensor;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_INPUT_PARAMETER(foreach_cb);
@@ -1369,6 +1377,7 @@ int ua_monitor_start_scan(
        int ret;
        ua_monitor_s *monitor = (ua_monitor_s *)handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_HANDLE(handle, ua_monitor_list);
@@ -1404,6 +1413,7 @@ int ua_monitor_stop_scan(ua_monitor_h handle)
        int ret;
        ua_monitor_s *monitor = (ua_monitor_s *)handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_HANDLE(handle, ua_monitor_list);
@@ -1443,6 +1453,7 @@ int ua_monitor_start_presence_detection(
        GSList *ua_services_list = _ua_service_get_services();
        unsigned int available_sensors = 0;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_HANDLE(handle, ua_monitor_list);
@@ -1520,6 +1531,7 @@ int ua_monitor_start_absence_detection(
        GSList *ua_services_list = _ua_service_get_services();
        unsigned int available_sensors = 0;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_HANDLE(handle, ua_monitor_list);
@@ -1603,6 +1615,7 @@ int ua_monitor_stop_presence_detection(ua_monitor_h handle)
        ua_detection_type_e detect = UA_PRESENCE_DETECTION;
        unsigned int available_sensors = 0;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_HANDLE(handle, ua_monitor_list);
@@ -1649,6 +1662,7 @@ int ua_monitor_stop_absence_detection(ua_monitor_h handle)
        ua_detection_type_e detect = UA_ABSENCE_DETECTION;
        unsigned int available_sensors = 0;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(handle);
        UA_VALIDATE_HANDLE(handle, ua_monitor_list);
index a21710dba2b73e1ba2543f6880f79f5f51e3fdb4..ebc9fbcaeca0447a7cbb4f421baa49b62d48b96e 100755 (executable)
@@ -322,6 +322,7 @@ int ua_service_create(const char *name,
        FUNC_ENTRY;
        ua_service_info_s *service = NULL;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
        UA_VALIDATE_INPUT_PARAMETER(name);
@@ -352,6 +353,7 @@ int ua_service_destroy(ua_service_h service_handle)
 {
        FUNC_ENTRY;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
        UA_VALIDATE_HANDLE(service_handle, ua_services_list);
@@ -381,6 +383,7 @@ int ua_service_add(ua_service_h service_handle)
        uam_service_info_s uam_service;
        ua_service_info_s *service = (ua_service_info_s *)service_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
        UA_VALIDATE_HANDLE(service_handle, ua_services_list);
@@ -415,6 +418,7 @@ int ua_service_update(ua_service_h service_handle)
        uam_service_info_s uam_service;
        ua_service_info_s *service = (ua_service_info_s *)service_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
        UA_VALIDATE_HANDLE(service_handle, ua_services_list);
@@ -446,6 +450,7 @@ int ua_service_remove(ua_service_h service_handle)
        uam_service_info_s uam_service;
        ua_service_info_s *service = (ua_service_info_s *)service_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
        UA_VALIDATE_HANDLE(service_handle, ua_services_list);
@@ -500,6 +505,7 @@ int ua_service_set_detection_threshold(ua_service_h service_handle,
 
        ua_service_info_s *service = (ua_service_info_s *)service_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
        UA_VALIDATE_HANDLE(service_handle, ua_services_list);
@@ -517,6 +523,7 @@ int ua_service_get_name(ua_service_h service_handle, char **name)
 
        ua_service_info_s *service = (ua_service_info_s *)service_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(name);
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
@@ -542,6 +549,7 @@ int ua_service_get_detection_threshold(ua_service_h service_handle,
 
        ua_service_info_s *service = (ua_service_info_s *)service_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
        UA_VALIDATE_HANDLE(service_handle, ua_services_list);
@@ -561,6 +569,7 @@ int ua_get_default_service(ua_service_h* service_handle)
        ua_service_info_s *h_service = NULL;
        GSList *l;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
 
@@ -598,6 +607,7 @@ int ua_get_service_by_name(const char *name,
        GSList *l;
        ua_service_info_s *s;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(name);
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
@@ -662,6 +672,7 @@ int ua_service_add_user(ua_service_h service_handle, ua_user_h user_handle)
        ua_service_info_s* service_info = (ua_service_info_s *)service_handle;
        ua_user_info_s* user_info = (ua_user_info_s*)user_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
        UA_VALIDATE_INPUT_PARAMETER(user_handle);
@@ -695,6 +706,7 @@ int ua_service_remove_user(ua_service_h service_handle, ua_user_h user_handle)
        ua_service_info_s* service_info = (ua_service_info_s*)service_handle;
        ua_user_info_s* user_info = (ua_user_info_s*)user_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
        UA_VALIDATE_INPUT_PARAMETER(user_handle);
@@ -805,6 +817,7 @@ int ua_service_set_device_discriminant(ua_service_h service_handle,
        ua_service_info_s* service_info = (ua_service_info_s*)service_handle;
        ua_dev_info_s* dev_info = (ua_dev_info_s*)device_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
@@ -843,6 +856,7 @@ int ua_service_get_device_discriminant(ua_service_h service_handle,
        ua_service_info_s* service_info = (ua_service_info_s*)service_handle;
        ua_dev_info_s* dev_info = (ua_dev_info_s*)device_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
@@ -879,6 +893,7 @@ int ua_foreach_services(ua_service_added_cb foreach_cb,
        GSList *l;
        ua_service_info_s *s;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(foreach_cb);
 
@@ -908,6 +923,7 @@ int ua_service_foreach_users(
        uam_user_info_s *ptr;
        ua_service_info_s *service = (ua_service_info_s *)service_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(foreach_cb);
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
@@ -1079,6 +1095,7 @@ int ua_service_get_user_by_account(ua_service_h service_handle,
 {
        FUNC_ENTRY;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(service_handle);
        UA_VALIDATE_INPUT_PARAMETER(account);
index 7df9c924ce7b03f7777cbc55d7e367ee169ddc11..971a1a034e2c968567c3645d621c2d2f25be257d 100755 (executable)
@@ -447,6 +447,7 @@ int ua_user_create(const char *account,
        FUNC_ENTRY;
        ua_user_info_s *user = NULL;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(user_handle);
        UA_VALIDATE_INPUT_PARAMETER(account);
@@ -533,6 +534,7 @@ int ua_user_add(ua_user_h user_handle)
        uam_user_info_s uam_user;
        ua_user_info_s *user = (ua_user_info_s *)user_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(user_handle);
 
@@ -567,6 +569,7 @@ int ua_user_remove(ua_user_h user_handle)
        char account[UAM_USER_ACCOUNT_MAX_STRING_LEN];
        ua_user_info_s *user = (ua_user_info_s *)user_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(user_handle);
 
@@ -658,6 +661,7 @@ int ua_user_get_account(ua_user_h user_handle, char **account)
 
        ua_user_info_s *user = (ua_user_info_s *)user_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(user_handle);
        UA_VALIDATE_INPUT_PARAMETER(account);
@@ -727,6 +731,7 @@ int ua_user_destroy(ua_user_h user_handle)
 
        ua_user_info_s *user = (ua_user_info_s *)user_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(user_handle);
        UA_VALIDATE_HANDLE(user_handle, ua_users_list);
@@ -790,6 +795,7 @@ int ua_user_add_device(ua_user_h user_handle, ua_device_h device_handle,
        uam_device_info_s uam_device;
        ua_dev_info_s *device = (ua_dev_info_s *) device_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
 
@@ -863,6 +869,7 @@ int ua_user_remove_device(ua_user_h user_handle, ua_device_h device_handle)
        uam_device_info_s uam_device;
        ua_dev_info_s *device = (ua_dev_info_s *) device_handle;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(device_handle);
 
@@ -948,6 +955,7 @@ int ua_user_foreach_devices(
        FUNC_ENTRY;
        int ret;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(foreach_cb);
        UA_VALIDATE_INPUT_PARAMETER(user_handle);
index 536161aa5b712a258f31c6cf9cb61981b7a0b3bd..f417d3f548b8d49ac5a280bf4f42b0c4c0723609 100755 (executable)
 
 static GSList *ua_sensors_list = NULL; /* ua_sensor_info_s */
 
+static ua_feature_table_t feature_table[] = {
+       {"tizen.org/feature/network.user_awareness", FALSE, FALSE}, /* UA_FEATURE_COMMON */
+};
+
+int _ua_check_supported_feature(ua_feature_t feature, bool *supported)
+{
+       int ret;
+
+       if (feature < UA_FEATURE_BASE || feature >= UA_FEATURE_MAX) {
+               UA_ERR("Invalid parameter. feature [%d]", feature);
+               return UA_ERROR_INVALID_PARAMETER;
+       }
+
+       if (TRUE == feature_table[feature].is_check) {
+               *supported = feature_table[feature].value;
+               return UA_ERROR_NONE;
+       }
+
+       ret = system_info_get_platform_bool(feature_table[feature].name, supported);
+       if (SYSTEM_INFO_ERROR_NONE != ret) {
+               UA_ERR("fail to get %s", feature_table[feature].name);
+               return UA_ERROR_OPERATION_FAILED;
+       }
+
+       feature_table[feature].is_check = TRUE;
+       feature_table[feature].value = *supported;
+
+       return UA_ERROR_NONE;
+}
+
 ua_mac_type_e _to_ua_mac_type(uam_tech_type_e tech_type)
 {
        switch (tech_type) {
@@ -384,6 +414,7 @@ int ua_sensor_get_status(
        FUNC_ENTRY;
        ua_sensor_info_s *sensor;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(sensor_handle);
        UA_INFO("Sensor Handle [%p]", sensor_handle);
@@ -402,6 +433,7 @@ int ua_sensor_get_timestamp(
        FUNC_ENTRY;
        ua_sensor_info_s *sensor;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(sensor_handle);
        UA_INFO("Sensor Handle [%p]", sensor_handle);
@@ -420,6 +452,7 @@ int ua_sensor_get_type(
        FUNC_ENTRY;
        ua_sensor_info_s *sensor;
 
+       UA_CHECK_SUPPORTED_FEATURE(UA_FEATURE_COMMON);
        UA_CHECK_INIT_STATUS();
        UA_VALIDATE_INPUT_PARAMETER(sensor_handle);
        UA_INFO("Sensor Handle [%p]", sensor_handle);