Fix to get device for sensor presence detected callback 89/260389/1
authorAbhay Agarwal <ay.agarwal@samsung.com>
Thu, 4 Feb 2021 05:38:00 +0000 (11:08 +0530)
committerAbhay Agarwal <ay.agarwal@samsung.com>
Thu, 24 Jun 2021 05:55:15 +0000 (11:25 +0530)
Change-Id: I3af0c3489f045f1a21f3a3dba80094078dd1dadc
Signed-off-by: Abhay Agarwal <ay.agarwal@samsung.com>
include/user-awareness-util.h
src/user-awareness-monitors.c
src/user-awareness-util.c

index d5f4a86e3d9270938adf315b74e37cf0e801d962..baff68fefee98cdd3a8ca4acba7020bc6ea1b484 100755 (executable)
@@ -170,6 +170,25 @@ uam_tech_type_e _ua_to_uam_tech_type(ua_mac_type_e type);
  */
 ua_sensor_type_e _ua_dev_type_to_sensor(ua_mac_type_e type);
 
+/**
+ * @ingroup CAPI_NETWORK_UA_MODULE
+ * @internal
+ * @brief Converts sensor bitmask enum to device tech type enum.
+ * @since_tizen 6.5
+ *
+ * @remarks The returned value can be used until return call function is valid.
+ *
+ * @param[in] type sensor code to be converted.
+ *
+ * @return Mac type
+ *
+ * @exception
+ * @pre
+ * @post
+ *
+ */
+ ua_mac_type_e _ua_sensor_to_dev_type(ua_sensor_type_e type);
+
 /**
  * @ingroup CAPI_NETWORK_UA_MODULE
  * @internal
index 0d48832a299e442e70117f03a0ff8b0d27dedb31..98a9abb848d36faf40e6ed6f9a644586dcc08349 100755 (executable)
@@ -565,7 +565,8 @@ static void __ua_sensor_presence_detected(ua_monitor_s *monitor,
 
                user_state->sensor_bitmask |= bitmask;
 
-               ret = ua_device_get_by_device_id(device_id, bitmask, &device_handle);
+               ret = ua_device_get_by_device_id(device_id,
+                       _ua_sensor_to_dev_type(bitmask), &device_handle);
                UA_INFO("ua_device_get_by_device_id returned %s",
                                _ua_get_error_string(ret));
                if (device_handle)
index 2c79fc3ecc556277fa830de48d0b1356b9fa2dc3..e9d2d9fac0e98a16f57a5f6faa225b9bf99807a7 100755 (executable)
@@ -223,6 +223,24 @@ ua_sensor_type_e _ua_dev_type_to_sensor(ua_mac_type_e type)
        FUNC_EXIT;
 }
 
+ua_mac_type_e _ua_sensor_to_dev_type(ua_sensor_type_e type)
+{
+       FUNC_ENTRY;
+
+       switch (type) {
+       case UA_SENSOR_BT:
+               return UA_MAC_TYPE_BT;
+       case UA_SENSOR_BLE:
+               return UA_MAC_TYPE_BLE;
+       case UA_SENSOR_WIFI:
+               return UA_MAC_TYPE_WIFI;
+       default:
+               UA_WARN("Uncompatible to convert. sensor [%u]", type);
+               return UA_MAC_TYPE_INVALID;
+       }
+       FUNC_EXIT;
+}
+
 ua_sensor_type_e _uam_to_ua_sensor(uam_sensor_bitmask_e bitmask)
 {
        FUNC_ENTRY;