Update test app for location sensors 47/260547/1 accepted/tizen/unified/20210630.144051 submit/tizen/20210629.001718
authorAbhay Agarwal <ay.agarwal@samsung.com>
Tue, 29 Jun 2021 03:07:54 +0000 (08:37 +0530)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Tue, 29 Jun 2021 03:07:54 +0000 (08:37 +0530)
Change-Id: I797a94f45835c35c93dc0d7cd443243d47afe002
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
src/user-awareness-device.c
src/user-awareness-users.c
tests/test/uat-common.c
tests/test/uat-common.h
tests/test/uat-detections.c
tests/test/uat-init.c

index 9239327632d70be59238b637fd3d63db59d27023..a2519632dc5c042cde9ab4934a84f0a4f351eb75 100755 (executable)
@@ -412,7 +412,7 @@ int ua_device_create(ua_mac_type_e mac_type,
        UA_VALIDATE_INPUT_PARAMETER(device_id);
 
        retv_if(UA_MAC_TYPE_NONE >= mac_type, UA_ERROR_INVALID_PARAMETER);
-       retv_if(UA_MAC_TYPE_INVALID <= mac_type, UA_ERROR_INVALID_PARAMETER);
+       /*retv_if(UA_MAC_TYPE_INVALID <= mac_type, UA_ERROR_INVALID_PARAMETER);*/
        retv_if((strlen(mac_address) != (UA_MAC_ADDRESS_STRING_LEN -1)),
                                                UA_ERROR_INVALID_PARAMETER);
 
index 680f5a0fd212dbedbb0fe7ba2e663559b251c25a..c2c9d674590b32d867fd5956c03c3ae81263a909 100755 (executable)
@@ -801,7 +801,7 @@ int ua_user_add_device(ua_user_h user_handle, ua_device_h device_handle,
 
        retv_if((((device->device_id == NULL) && (device->mac == NULL))), UA_ERROR_INVALID_PARAMETER);
        retv_if((UA_MAC_TYPE_NONE >= device->type), UA_ERROR_INVALID_PARAMETER);
-       retv_if((UA_MAC_TYPE_INVALID <= device->type), UA_ERROR_INVALID_PARAMETER);
+       /*retv_if((UA_MAC_TYPE_INVALID <= device->type), UA_ERROR_INVALID_PARAMETER);*/
 
        user_callback = _ua_get_user_callback(UA_USER_EVENT_DEVICE_ADDED, device->type);
        if (user_callback && user_callback != callback) {
index ccb0152aab87d502f937d12d397f26b425699aa7..9d0d8f9880ea8db05347f8642ac7e2d686a3f0a5 100755 (executable)
@@ -118,7 +118,7 @@ const char* uat_get_str_from_uat_mac_type(int mac_type)
        }
 }
 
-const char* uat_get_sensor_bitmask_str(ua_sensor_type_e sensor)
+const char* uat_get_sensor_bitmask_str(int sensor)
 {
        switch (sensor) {
        /* CHECK: List all enum values here */
@@ -141,7 +141,6 @@ const char* uat_get_sensor_bitmask_str(ua_sensor_type_e sensor)
        default:
                return "Unknown";
        }
-
 }
 
 char* uat_get_time()
index 0cafa1ce1a1815018d163c8f19461b3dfb4fe0a9..6b7c3d9847609b32e5c1866fa8945ecbc1ca38b6 100755 (executable)
@@ -53,9 +53,9 @@ const char* uat_get_error_str(int err);
 const char* uat_get_sensor_str(int sensors);
 const char* uat_get_mac_type_str(int sensor);
 const char* uat_get_str_from_uat_mac_type(int mac_type);
-const char* uat_get_sensor_bitmask_str(ua_sensor_type_e sensor);
+const char* uat_get_sensor_bitmask_str(int sensor);
 char* uat_get_time(void);
-const char * uat_convert_device_mac_type_to_txt(ua_mac_type_e mac_type);
+const char * uat_convert_device_mac_type_to_txt(int mac_type);
 void uat_print_device_uid(const char *device_uid);
 void uat_clear_device_list(void);
 ua_mac_type_e uat_convert_idx_to_device_type(int idx);
@@ -94,6 +94,11 @@ bool _foreach_added_service_cb(
 bool _foreach_added_device_cb(
        ua_device_h device_handle, void *user_data);
 
+#define UA_SENSOR_WIFI_LOCATION 0x00000040
+#define UA_MAC_TYPE_WIFI_LOCATION 0x10
+#define UA_SENSOR_UWB 0x00000080
+#define UA_MAC_TYPE_UWB 0x20
+
 #ifdef __cplusplus
 }
 #endif
index ba895dfcd1dd381e881c92140728a25fc3171689..9227f115a1668c390663d5fe89e24a0a7e0a9a86 100755 (executable)
@@ -60,7 +60,7 @@ static void __sensor_presence_detected_device(ua_device_h device_handle)
                msg(" - ua_device_get_mac_type() ret: [0x%X] [%s]",
                        ret, uat_get_error_str(ret));
        }
-       msgb("[%s] Presence detected on [%s]",
+       msgb("[%s] Device detected on [%s]",
              uat_convert_device_mac_type_to_txt(mac_type), mac);
 
        g_free(mac);
@@ -220,8 +220,8 @@ void _sensor_location_detected_cb(int result, ua_monitor_h monitor,
        }
 
        /* For device information */
-       //if (device_handle)
-       //      __sensor_presence_detected_device(device_handle);
+       if (device_handle)
+               __sensor_presence_detected_device(device_handle);
 
        ret = ua_location_get_distance(location_handle, &distance);
        if (UA_ERROR_NONE != ret) {
index 62a44b8147c010b38fb642ed7930eb1a964c8dfc..5a91bb56f6d3191ebedacb436172644b5b1dc28f 100755 (executable)
@@ -33,7 +33,7 @@ extern char g_service_str[MENU_DATA_SIZE + 1]; /**< Service name */
 extern char g_sensor_list_str[MENU_DATA_SIZE + 1]; /**< Sendosr list string */
 extern unsigned int g_sensor_list; /**< Added sensor list */
 
-const char * uat_convert_device_mac_type_to_txt(ua_mac_type_e mac_type)
+const char * uat_convert_device_mac_type_to_txt(int mac_type)
 {
        switch (mac_type) {
        case UA_MAC_TYPE_BT:
@@ -113,6 +113,34 @@ int _uat_monitor_create()
                }
                is_available = false;
        }
+
+       /* Add Wifi location Sensor */
+       unsigned int i;
+       i = UA_SENSOR_WIFI_LOCATION;
+       ret = ua_monitor_is_sensor_available(i, &is_available);
+       if (UA_ERROR_NONE == ret && is_available) {
+               ua_monitor_add_sensor(g_ua_mon_h, i);
+               g_sensor_list |= i;
+               buf = uat_get_sensor_bitmask_str(i);
+               strncat(g_sensor_list_str, buf,
+                               sizeof(g_sensor_list_str) - strlen(g_sensor_list_str) - 1);
+               strncat(g_sensor_list_str, " ",
+                               sizeof(g_sensor_list_str) - strlen(g_sensor_list_str) - 1);
+       }
+
+       /* Add UWB Sensor */
+       i = UA_SENSOR_UWB;
+       ret = ua_monitor_is_sensor_available(i, &is_available);
+       if (UA_ERROR_NONE == ret && is_available) {
+               ua_monitor_add_sensor(g_ua_mon_h, i);
+               g_sensor_list |= i;
+               buf = uat_get_sensor_bitmask_str(i);
+               strncat(g_sensor_list_str, buf,
+                               sizeof(g_sensor_list_str) - strlen(g_sensor_list_str) - 1);
+               strncat(g_sensor_list_str, " ",
+                               sizeof(g_sensor_list_str) - strlen(g_sensor_list_str) - 1);
+       }
+
        return ret;
 }