[ACR-746] Passive Location 59/80659/9 accepted/tizen/common/20160907.154259 accepted/tizen/ivi/20160908.004808 accepted/tizen/mobile/20160908.004658 accepted/tizen/tv/20160908.004715 accepted/tizen/wearable/20160908.004740 submit/tizen/20160907.014728
authorkj7.sung <kj7.sung@samsung.com>
Tue, 19 Jul 2016 10:18:54 +0000 (19:18 +0900)
committerkj7.sung <kj7.sung@samsung.com>
Tue, 6 Sep 2016 04:28:57 +0000 (13:28 +0900)
Signed-off-by: kj7.sung <kj7.sung@samsung.com>
Change-Id: Ice011d8b67b05fd3a93f04d53a3aef0de74c9041

CMakeLists.txt
include/locations.h
packaging/capi-location-manager.changes
packaging/capi-location-manager.spec
src/locations.c

index edcb331..db1aff2 100755 (executable)
@@ -20,7 +20,6 @@ FOREACH(flag ${dependents_CFLAGS})
 ENDFOREACH(flag)
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fvisibility=hidden -fPIC -Wall -Werror")
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fvisibility=hidden -fPIC -Wall -Werror -Wno-error=deprecated-declarations")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
 IF("${ARCH}" STREQUAL "arm")
index 81c8c9a..952e27f 100755 (executable)
@@ -60,6 +60,7 @@ typedef enum {
        LOCATIONS_METHOD_HYBRID,        /**< This method selects the best method available at the moment */
        LOCATIONS_METHOD_GPS,           /**< This method uses Global Positioning System */
        LOCATIONS_METHOD_WPS,           /**< This method uses WiFi Positioning System */
+       LOCATIONS_METHOD_PASSIVE,       /**< This method can be used to passively receive location updates without power consumption (Since 3.0)*/
 } location_method_e;
 
 /**
@@ -345,6 +346,7 @@ int location_manager_destroy(location_manager_h manager);
  * @param[in] user_data                The user data to be passed to the callback function
  * @retval #LOCATIONS_ERROR_NONE                                               Successful
  * @retval #LOCATIONS_ERROR_INVALID_PARAMETER                  Invalid parameter
+ * @retval #LOCATIONS_ERROR_INCORRECT_METHOD                   Incorrect method
  * @retval #LOCATIONS_ERROR_SERVICE_NOT_AVAILABLE              Service not available
  * @retval #LOCATIONS_ERROR_NETWORK_FAILED                             Network failed
  * @retval #LOCATIONS_ERROR_GPS_SETTING_OFF                            GPS is not enabled
index 04e87c9..f1ed36c 100644 (file)
@@ -1,3 +1,9 @@
+[Version]      capi-location-manager_0.7.4
+[Date]         6 Sep 2016
+[Title]                Passive location
+[Developer]    Kyoungjun Sung <kj7.sung@samsung.com>
+
+================================================================================
 [Version]      capi-location-manager_0.7.3
 [Date]         18 Aug 2016
 [Title]                Change mock location behavior
index 7753586..7369f84 100644 (file)
@@ -1,6 +1,6 @@
 Name: capi-location-manager
 Summary: A Location Manager library in Tizen Native API
-Version: 0.7.3
+Version: 0.7.4
 Release: 1
 Group: Location/API
 License: Apache-2.0
index 4a46c58..b148c9a 100755 (executable)
@@ -21,7 +21,7 @@
 #include "locations.h"
 #include "location_internal.h"
 
-static location_setting_changed_s g_location_setting[LOCATIONS_METHOD_WPS + 1];
+static location_setting_changed_s g_location_setting[LOCATIONS_METHOD_PASSIVE + 1];
 
 static location_method_e __convert_location_method_e(LocationMethod method)
 {
@@ -56,6 +56,9 @@ static LocationMethod __convert_LocationMethod(location_method_e method)
        case LOCATIONS_METHOD_WPS:
                _method = LOCATION_METHOD_WPS;
                break;
+       case LOCATIONS_METHOD_PASSIVE:
+               _method = LOCATION_METHOD_PASSIVE;
+               break;
        case LOCATIONS_METHOD_NONE:
        default:
                _method = LOCATION_METHOD_NONE;
@@ -490,6 +493,11 @@ EXPORT_API int location_manager_create(location_method_e method, location_manage
                        LOCATIONS_LOGE("LOCATIONS_ERROR_NOT_SUPPORTED(0x%08x) : fail to location feature", LOCATIONS_ERROR_NOT_SUPPORTED);
                        return LOCATIONS_ERROR_NOT_SUPPORTED;
                }
+       } else if (method == LOCATIONS_METHOD_PASSIVE) {
+               if (__is_location_supported() == LOCATIONS_ERROR_NOT_SUPPORTED) {
+                       LOCATIONS_LOGE("LOCATIONS_ERROR_NOT_SUPPORTED(0x%08x) : fail to location feature", LOCATIONS_ERROR_NOT_SUPPORTED);
+                       return LOCATIONS_ERROR_NOT_SUPPORTED;
+               }
        }
 
        LocationMethod _method = __convert_LocationMethod(method);
@@ -591,7 +599,7 @@ EXPORT_API int location_manager_start(location_manager_h manager)
        if (!handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED])
                handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED] = g_signal_connect(handle->object, "service-updated", G_CALLBACK(__cb_service_updated), handle);
 
-       if (handle->method >= LOCATIONS_METHOD_HYBRID && handle->method <= LOCATIONS_METHOD_WPS) {
+       if (handle->method >= LOCATIONS_METHOD_HYBRID && handle->method <= LOCATIONS_METHOD_PASSIVE) {
                if (!handle->sig_id[_LOCATION_SIGNAL_ZONE_IN])
                        handle->sig_id[_LOCATION_SIGNAL_ZONE_IN] = g_signal_connect(handle->object, "zone-in", G_CALLBACK(__cb_zone_in), handle);
 
@@ -635,8 +643,13 @@ EXPORT_API int location_manager_request_single_location(location_manager_h manag
                return ret;
 
        ret = location_request_single_location(handle->object, timeout);
-       if (ret != LOCATION_ERROR_NONE)
+       if (ret != LOCATION_ERROR_NONE) {
+               if (ret == LOCATION_ERROR_NOT_SUPPORTED) {
+                       LOCATIONS_LOGE("LOCATIONS_ERROR_INCORRECT_METHOD : method - %d", handle->method);
+                       return LOCATIONS_ERROR_INCORRECT_METHOD;
+               }
                return __convert_error_code(ret);
+       }
 
        return LOCATIONS_ERROR_NONE;
 }
@@ -654,7 +667,7 @@ EXPORT_API int location_manager_stop(location_manager_h manager)
                handle->sig_id[_LOCATION_SIGNAL_SERVICE_UPDATED] = 0;
        }
 
-       if (handle->method >= LOCATIONS_METHOD_HYBRID && handle->method <= LOCATIONS_METHOD_WPS) {
+       if (handle->method >= LOCATIONS_METHOD_HYBRID && handle->method <= LOCATIONS_METHOD_PASSIVE) {
                if (handle->sig_id[_LOCATION_SIGNAL_ZONE_IN]) {
                        g_signal_handler_disconnect(handle->object, handle->sig_id[_LOCATION_SIGNAL_ZONE_IN]);
                        handle->sig_id[_LOCATION_SIGNAL_ZONE_IN] = 0;
@@ -750,6 +763,9 @@ EXPORT_API int location_manager_get_method(location_manager_h manager, location_
        case LOCATION_METHOD_WPS:
                *method = LOCATIONS_METHOD_WPS;
                break;
+       case LOCATION_METHOD_PASSIVE:
+               *method = LOCATIONS_METHOD_PASSIVE;
+               break;
        default: {
                LOCATIONS_LOGE("[LOCATIONS_ERROR_INVALID_PARAMETER] method : %d ", method);
                        return LOCATIONS_ERROR_INVALID_PARAMETER;