Fix typo
[platform/core/api/location-manager.git] / src / location_internal.c
index 9cc78fe..ede0a44 100644 (file)
@@ -146,13 +146,45 @@ int __is_batch_supported(void)
        return LOCATIONS_ERROR_NONE;    //LCOV_EXCL_LINE
 }
 
+int __is_fused_supported(void)
+{
+       bool is_supported = false;
+       bool is_accelerometer = false;
+       bool is_gyroscope = false;
+       int retval = 0;
+
+       retval = system_info_get_platform_bool("http://tizen.org/feature/location.fused", &is_supported);
+       if (retval != SYSTEM_INFO_ERROR_NONE)
+               LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval);
+       if (is_supported == false)
+               return LOCATIONS_ERROR_NOT_SUPPORTED;
+
+       retval = system_info_get_platform_bool("http://tizen.org/feature/sensor.accelerometer", &is_accelerometer);
+       if (retval != SYSTEM_INFO_ERROR_NONE)
+               LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval);
+       if (is_accelerometer == false)
+               return LOCATIONS_ERROR_NOT_SUPPORTED;
+
+       retval = system_info_get_platform_bool("http://tizen.org/feature/sensor.gyroscope", &is_gyroscope);
+       if (retval != SYSTEM_INFO_ERROR_NONE)
+               LOCATIONS_LOGW("system_info_get_platform_bool failed: retval = %d", retval);
+       if (is_gyroscope == false)
+               return LOCATIONS_ERROR_NOT_SUPPORTED;
+
+       return LOCATIONS_ERROR_NONE;    //LCOV_EXCL_LINE
+}
+
 int __set_callback(_location_event_e type, location_manager_h manager, void *callback, void *user_data)
 {
        LOCATIONS_NULL_ARG_CHECK(manager);
        LOCATIONS_NULL_ARG_CHECK(callback);
        location_manager_s *handle = (location_manager_s *) manager;
-       handle->user_cb[type] = callback;
-       handle->user_data[type] = user_data;
+       if (handle != NULL){
+               handle->user_cb[type] = callback;
+               handle->user_data[type] = user_data;
+       }
+       else
+               LOCATIONS_LOGE("Null Handle");
        LOCATIONS_LOGD("event type : %d", type);
        return LOCATIONS_ERROR_NONE;
 }
@@ -161,8 +193,12 @@ int __unset_callback(_location_event_e type, location_manager_h manager)
 {
        LOCATIONS_NULL_ARG_CHECK(manager);
        location_manager_s *handle = (location_manager_s *) manager;
-       handle->user_cb[type] = NULL;
-       handle->user_data[type] = NULL;
+       if (handle != NULL){
+               handle->user_cb[type] = NULL;
+               handle->user_data[type] = NULL;
+       }
+       else
+               LOCATIONS_LOGE("Null Handle");
        LOCATIONS_LOGD("event type : %d", type);
        return LOCATIONS_ERROR_NONE;
 }