cairo
elementary
capi-media-image-util
+)
+
+IF(${TIZEN_VER} LESS 300)
+ SET(dependents
+ ${dependents}
+ # Privilege check
+ capi-appfw-app-manager
+ pkgmgr-info
+ capi-security-privilege-manager
)
-SET(pc_dependents "capi-base-common")
+ENDIF(${TIZEN_VER} LESS 300)
+
+SET(pc_dependents "capi-base-common evas")
INCLUDE(FindPkgConfig)
pkg_check_modules(${fw_name} REQUIRED ${dependents})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -g -fdump-rtl-expand")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden -fvisibility-inlines-hidden")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -g -fPIC -fdump-rtl-expand -std=c++0x")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
ADD_DEFINITIONS("-DTARGET")
ENDIF("${ARCH}" STREQUAL "arm")
+IF("${PROFILE}" STREQUAL "wearable")
+ ADD_DEFINITIONS("-DTIZEN_WEARABLE")
+ENDIF("${PROFILE}" STREQUAL "wearable")
+
+ADD_DEFINITIONS("-DTIZEN_VER=${TIZEN_VER}")
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
ADD_DEFINITIONS("-DEXPORT_API=__attribute__((visibility(\"default\")))")
#ADD_DEFINITIONS("-DTIZEN_DEBUG")
VERSION ${FULLVER}
SOVERSION ${MAJORVER}
CLEAN_DIRECT_OUTPUT 1
- )
+)
INSTALL(TARGETS ${fw_name} DESTINATION ${LIBDIR})
INSTALL(
# *_plugin.h" are needed by plugin
# PATTERN "*_plugin.h" EXCLUDE
PATTERN "${INC_DIR}/*.h"
- )
+)
SET(PC_NAME ${fw_name})
SET(PC_DESCRIPTION "Tizen Maps Library")
${fw_name}.pc.in
${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
@ONLY
- )
+)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIBDIR}/pkgconfig)
Name: @PC_NAME@
Description: @PC_DESCRIPTION@
Version: @VERSION@
-Requires: evas
+Requires: @PC_REQUIRED@
Libs: -L${libdir} @PC_LDFLAGS@
-Cflags: -I${includedir}
+Cflags: -I${includedir} @PC_CFLAGS@
BuildRequires: cmake
# Maps API dependencies
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(gmodule-2.0)
-BuildRequires: pkgconfig(capi-base-common)
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(capi-system-info)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(gmodule-2.0)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(capi-system-info)
# Mapping API dependencies
-BuildRequires: pkgconfig(eina)
-BuildRequires: pkgconfig(evas)
-BuildRequires: pkgconfig(ecore)
-BuildRequires: pkgconfig(cairo)
-BuildRequires: pkgconfig(elementary)
-BuildRequires: pkgconfig(capi-media-image-util)
-
-Requires(post): /sbin/ldconfig
-Requires(postun): /sbin/ldconfig
+BuildRequires: pkgconfig(eina)
+BuildRequires: pkgconfig(evas)
+BuildRequires: pkgconfig(ecore)
+BuildRequires: pkgconfig(cairo)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(capi-media-image-util)
+
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
Provides: capi-maps-service-plugin-devel
%ifarch %{arm}
export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DLIBDIR=%{_libdir}
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DMAJORVER=${MAJORVER} -DFULLVER=%{version} \
+ -DLIBDIR=%{_libdir} -DPROFILE=%{?profile} -DTIZEN_VER=300
make %{?jobs:-j%jobs}
%install
%files
%manifest capi-maps-service.manifest
%defattr(-,root,root,-)
-/usr/share/license/capi-maps-service
+%{_datadir}/license/%{name}
%{_libdir}/libcapi-maps-service.so.*
--- /dev/null
+/* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <glib.h>
+#include <unistd.h>
+#if TIZEN_VER < 300
+#include <app_manager.h>
+#include <pkgmgr-info.h>
+#include <privilege_checker.h> /* privilege */
+#endif
+#include <system_info.h> /* system_info_get_platform_bool */
+#include <maps_util.h> /* log */
+#include <maps_error.h>
+
+
+#define MAPSERVICE_PRIVILEGE "http://tizen.org/privilege/mapservice"
+
+#define INTERNET_FEATURE "http://tizen.org/feature/network.internet"
+
+
+#if TIZEN_VER < 300
+static char* __maps_condition_get_package_id(char **package_id)
+{
+ int ret = 0;
+ pid_t pid = 0;
+ char *app_id = NULL;
+ char *pkg_id = NULL;
+ pkgmgrinfo_appinfo_h pkgmgrinfo_appinfo;
+
+ do {
+ pid = getpid();
+ ret = app_manager_get_app_id(pid, &app_id);
+ if (ret) {
+ MAPS_LOGE("Fail to get app_id. Err[%d]", ret);
+ break;
+ }
+
+ ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &pkgmgrinfo_appinfo);
+ if (ret) {
+ MAPS_LOGE("Fail to get appinfo for [%s]. Err[%d]", app_id, ret);
+ break;
+ }
+
+ ret = pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo, &pkg_id);
+ if (ret) {
+ MAPS_LOGE("Fail to get package_id for [%s]. Err[%d]", app_id, ret);
+ break;
+ }
+
+ *package_id = g_strdup(pkg_id);
+ } while (0);
+
+ g_free(app_id);
+ pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo);
+
+ return *package_id;
+}
+#endif
+
+bool maps_condition_check_privilege(void)
+{
+ bool is_permitted = true;
+#if TIZEN_VER < 300
+ /* to check for Tizen 2.x privilege */
+ char *package_id = NULL;
+ if (!__maps_condition_get_package_id(&package_id))
+ return is_permitted;
+
+ int ret = privilege_checker_check_package_privilege(package_id, MAPSERVICE_PRIVILEGE);
+ is_permitted = (ret == PRIV_CHECKER_ERR_NONE);
+ g_free(package_id);
+#else
+ /* to check for Tizen 3.x privilege */
+ extern const char *MAPS_PLUGINS_PATH_PREFIX;
+ is_permitted = (access(MAPS_PLUGINS_PATH_PREFIX, F_OK) != 0) || /* not exist */
+ (access(MAPS_PLUGINS_PATH_PREFIX, R_OK) == 0); /* readable */
+#endif
+ MAPS_LOGD("mapservice privilege is%sconsented", ( is_permitted ? " " : " not "));
+ return is_permitted;
+}
+
+bool maps_condition_check_feature(void)
+{
+ bool is_supported = true;
+#ifdef TIZEN_WEARABLE
+ int ret = system_info_get_platform_bool(INTERNET_FEATURE, &is_supported);
+ if (ret == SYSTEM_INFO_ERROR_NONE)
+ MAPS_LOGD("internet feature is%ssupported", (is_supported ? " " : " not "));
+ else
+ MAPS_LOGD("system info error (%d)", ret);
+#endif
+ return is_supported;
+}
--- /dev/null
+/* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MAPS_SERVICE_CHECK_H__
+#define __MAPS_SERVICE_CHECK_H__
+
+/**
+ * @brief Gets if privilege is consented
+ */
+bool maps_condition_check_privilege(void);
+
+/**
+ * @brief Gets if network.internet feature is supported
+ * @remarks If target is not a wearable gear, it returns true always.
+ */
+bool maps_condition_check_feature(void);
+
+#endif /* __MAPS_SERVICE_CHECK_H__ */
*/
#include <glib.h>
-#include <unistd.h> /* to check for Tizen 3.x privilege */
-#include <system_info.h>
#include "maps_service.h"
#include "maps_error.h"
#include "maps_service.h"
#include "maps_util.h"
+#include "maps_condition.h"
#include "command_queue.h"
#include "commands.h"
return supported;
}
-bool _is_internet_feature_supported(void)
-{
- static bool __is_checked = false;
- static bool __is_supported = true;
-
- if (!__is_checked) {
- char *profile = NULL;
- int ret = system_info_get_platform_string("http://tizen.org/feature/profile", &profile);
- if (ret == SYSTEM_INFO_ERROR_NONE && profile && *profile) {
- MAPS_LOGD("profile : %s", profile);
-
- /* if wearable, check internet feature in addition */
- if (!strcmp("wearable", profile)) {
- ret = system_info_get_platform_bool("http://tizen.org/feature/network.internet", &__is_supported);
- MAPS_LOGD("internet feature supported : %d", __is_supported);
- }
- g_free(profile);
-
- /* set the flag which means feature checked */
- __is_checked = (ret == SYSTEM_INFO_ERROR_NONE);
- }
- }
-
- return __is_supported;
-}
-
-static bool __has_maps_service_privilege()
-{
- /* to check for Tizen 3.x privilege */
- extern const char *MAPS_PLUGINS_PATH_PREFIX;
- return (access(MAPS_PLUGINS_PATH_PREFIX, F_OK) != 0) || /* not exist */
- (access(MAPS_PLUGINS_PATH_PREFIX, R_OK) == 0); /* readable */
-}
/*----------------------------------------------------------------------------*/
/* */
return MAPS_ERROR_INVALID_PARAMETER;
/* Check if privileges enough */
- if (!__has_maps_service_privilege()) {
+ if (!maps_condition_check_privilege()) {
MAPS_LOGD("ERROR: privilege is not included");
return MAPS_ERROR_PERMISSION_DENIED;
}
return MAPS_ERROR_INVALID_PARAMETER;
/* Check if privileges enough */
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
maps_service_s *maps_service = (maps_service_s *) maps;
int *request_id)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
/* Check if the handle of the Maps Service is valid */
return MAPS_ERROR_INVALID_PARAMETER;
/* Check if privileges enough */
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
session::command *cmd = new session::command_geocode(maps, address, preference,
void *user_data, int *request_id)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
/* Check if the handle of the Maps Service is valid */
return MAPS_ERROR_INVALID_PARAMETER;
/* Check if privileges enough */
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
session::command *cmd = new session::command_geocode_inside_bounds(maps,
void *user_data, int *request_id)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
/* Check if the handle of the Maps Service is valid */
return MAPS_ERROR_INVALID_PARAMETER;
/* Check if privileges enough */
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
session::command *cmd = new session::command_geocode_by_structured_address(maps,
int *request_id)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
/* Check if the handle of the Maps Service is valid */
return MAPS_ERROR_INVALID_PARAMETER;
/* Check if privileges enough */
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
session::command *cmd = new session::command_reverse_geocode(maps, latitude,
void *user_data, int *request_id)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
/* Check if the handle of the Maps Service is valid */
return MAPS_ERROR_INVALID_PARAMETER;
/* Check if privileges enough */
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
session::command *cmd = new session::command_search_place(maps, position,
int *request_id)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
/* Check if the handle of the Maps Service is valid */
return MAPS_ERROR_INVALID_PARAMETER;
/* Check if privileges enough */
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
session::command *cmd = new session::command_search_by_area_place(maps,
int *request_id)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
/* Check if the handle of the Maps Service is valid */
return MAPS_ERROR_INVALID_PARAMETER;
/* Check if privileges enough */
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
session::command *cmd = new session::command_search_by_address_place(maps,
void *user_data, int *request_id)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
if (!maps)
if (!boundary || !filter || !callback || !request_id)
return MAPS_ERROR_INVALID_PARAMETER;
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
session::command *cmd = new session::command_search_place_list(maps,
void *user_data, int *request_id)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
if (!maps)
if (!url || !callback || !request_id)
return MAPS_ERROR_INVALID_PARAMETER;
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
session::command *cmd = new session::command_get_place_details(maps,
void *user_data, int *request_id)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
/* Check if the handle of the Maps Service is valid */
return MAPS_ERROR_INVALID_PARAMETER;
/* Check if privileges enough */
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
session::command *cmd = new session::command_search_route(maps, preference,
int *request_id)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
/* Check if the handle of the Maps Service is valid */
return MAPS_ERROR_INVALID_PARAMETER;
/* Check if privileges enough */
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
session::command *cmd = new session::command_search_route_waypoints(maps,
return MAPS_ERROR_INVALID_PARAMETER;
/* Check if privileges enough */
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
session::command *cmd = new session::command_cancel_request(maps, request_id);
maps_service_multi_reverse_geocode_cb callback, void *user_data, int *request_id)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
if (!maps)
if (!coordinates_list || !callback || !request_id)
return MAPS_ERROR_INVALID_PARAMETER;
- if (!__has_maps_service_privilege())
+ if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
session::command *cmd = new session::command_multi_reverse_geocode(maps,
#include "inertial_gesture.h"
#include "gesture_detector_statemachine.h"
#include "maps_view_event_data.h"
+#include "maps_condition.h"
/*
* The structure of callbacks info, Maps View is invoking during events
/* ---------------------------------------------------------------------------*/
extern plugin::plugin_s *__extract_plugin(maps_service_h maps);
-extern bool _is_internet_feature_supported(void);
extern int _maps_view_event_data_set_type(const maps_view_event_data_h event, maps_view_event_type_e event_type);
extern int _maps_view_event_data_set_gesture_type(const maps_view_event_data_h event, maps_view_gesture_e gesture_type);
extern int _maps_view_event_data_set_action_type(const maps_view_event_data_h event, maps_view_action_e action_type);
/* Create the panel and link it to the instance of Maps Service */
EXPORT_API int maps_view_create(maps_service_h maps, Evas_Object *obj, maps_view_h *view)
{
+ /* Check if parameters are valid */
if (!maps || !obj || !view)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
maps_view_s *v = g_slice_new0(maps_view_s);
if (!v) {
MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
/* Destroy the panel and unlink it from the instance of Maps Service */
EXPORT_API int maps_view_destroy(maps_view_h view)
{
+ /* Check if parameters are valid */
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
maps_view_s *v = (maps_view_s *) view;
/* Unregister gesture processing */
EXPORT_API int maps_view_set_center(maps_view_h view, maps_coordinates_h coordinates)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
+ /* Check if parameters are valid */
if (!view || !coordinates)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
return __maps_view_set_center(view, coordinates, FALSE);
}
EXPORT_API int maps_view_set_scalebar_enabled(const maps_view_h view, bool enable)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
+ /* Check if parameters are valid */
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
return __get_plugin_interface(view)->maps_plugin_set_scalebar(view, enable);
}
EXPORT_API int maps_view_set_zoom_level(maps_view_h view, int level)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
+ /* Check if parameters are valid */
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
maps_view_s *v = (maps_view_s *) view;
int new_level = level;
if (new_level < v->min_zoom_level) new_level = v->min_zoom_level;
EXPORT_API int maps_view_set_min_zoom_level(maps_view_h view, int level)
{
+ /* Check if parameters are valid */
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
maps_view_s *v = (maps_view_s *) view;
int min_zoom_level = -1;
__get_plugin_interface(v)->maps_plugin_get_min_zoom_level(view, &min_zoom_level);
EXPORT_API int maps_view_set_max_zoom_level(maps_view_h view, int level)
{
+ /* Check if parameters are valid */
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
maps_view_s *v = (maps_view_s *) view;
int max_zoom_level = -1;
__get_plugin_interface(v)->maps_plugin_get_max_zoom_level(view, &max_zoom_level);
EXPORT_API int maps_view_set_orientation(maps_view_h view, double angle)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
+ /* Check if parameters are valid */
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
/* Add inertia to the rotation process */
maps_view_s *v = (maps_view_s *)view;
if (v->inertial_camera)
EXPORT_API int maps_view_screen_to_geolocation(maps_view_h view,
int x, int y, maps_coordinates_h *coordinates)
{
+ /* Check if parameters are valid */
if (!view || !coordinates)
return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
int posx = 0;
int posy = 0;
maps_view_get_screen_location(view, &posx, &posy, NULL, NULL);
EXPORT_API int maps_view_geolocation_to_screen(const maps_view_h view,
const maps_coordinates_h coordinates, int *x, int *y)
{
+ /* Check if parameters are valid */
if (!view || !coordinates || !x || !y)
return MAPS_ERROR_INVALID_PARAMETER;
+
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
int posx = 0;
int posy = 0;
maps_view_get_screen_location(view, &posx, &posy, NULL, NULL);
EXPORT_API int maps_view_set_type(maps_view_h view, maps_view_type_e type)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
+ /* Check if parameters are valid */
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
if ((type < MAPS_VIEW_TYPE_NORMAL) || (type > MAPS_VIEW_TYPE_HYBRID))
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
maps_view_s *v = (maps_view_s *) view;
v->type = type;
return maps_view_set_center(view, v->center);
EXPORT_API int maps_view_set_buildings_enabled(maps_view_h view, bool enabled)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
+ /* Check if parameters are valid */
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
maps_view_s *v = (maps_view_s *) view;
v->buildings_enabled = enabled;
return maps_view_set_center(view, v->center);
EXPORT_API int maps_view_set_traffic_enabled(maps_view_h view, bool enabled)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
+ /* Check if parameters are valid */
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
maps_view_s *v = (maps_view_s *) view;
v->traffic_enabled = enabled;
return maps_view_set_center(view, v->center);
EXPORT_API int maps_view_set_public_transit_enabled(maps_view_h view, bool enabled)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
+ /* Check if parameters are valid */
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
maps_view_s *v = (maps_view_s *) view;
v->public_transit_enabled = enabled;
return maps_view_set_center(view, v->center);
EXPORT_API int maps_view_set_language(maps_view_h view, const char *language)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
+ /* Check if parameters are valid */
if (!view || !language)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
/* Check if language is supported */
static const char *lngs[] = {
"ara",
EXPORT_API int maps_view_set_screen_location(maps_view_h view, int x, int y, int width, int height)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
+ /* Check if parameters are valid */
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
int error = maps_view_move(view, x, y);
if (error == MAPS_ERROR_NONE)
error = maps_view_resize(view, width, height);
EXPORT_API int maps_view_move(maps_view_h view, int x, int y)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
if (!view)
EXPORT_API int maps_view_resize(maps_view_h view, int width, int height)
{
/* Check if internet feature is supported */
- if (!_is_internet_feature_supported())
+ if (!maps_condition_check_feature())
return MAPS_ERROR_NOT_SUPPORTED;
+ /* Check if parameters are valid */
if (!view || (width <= 0) || (height <= 0))
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
maps_view_s *v = (maps_view_s *) view;
evas_object_resize(v->panel, width, height);
evas_object_resize(v->clipper, width, height);
EXPORT_API int maps_view_add_object(maps_view_h view, maps_view_object_h object)
{
+ /* Check if parameters are valid */
if (!view || !object)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
int error = MAPS_ERROR_NONE;
do {
/* Add Visual Object to the list of View Visual Objects */
EXPORT_API int maps_view_remove_object(maps_view_h view, maps_view_object_h object)
{
+ /* Check if parameters are valid */
if (!view || !object)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
int error = MAPS_ERROR_NONE;
do {
/* Remove Visual Object from the list of View Visual Objects */
EXPORT_API int maps_view_remove_all_objects(maps_view_h view)
{
+ /* Check if parameters are valid */
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
int error = MAPS_ERROR_NONE;
do {
maps_view_s *v = (maps_view_s *)view;
* limitations under the License.
*/
+#include <stdlib.h>
#include <image_util.h>
#include <maps_view_plugin.h>
+#include <maps_condition.h>
#include <module.h>
#include <empty_module.h>
-#include <stdlib.h>
const plugin::interface_s *__get_plugin_interface(maps_view_h view);
int quality,
const char *path)
{
+ /* Check if parameters are valid */
if (!view || type < MAPS_VIEW_SNAPSHOT_BMP || type > MAPS_VIEW_SNAPSHOT_JPEG ||
quality < 0 || quality > 100 || !path || (path && *path == '\0'))
return MAPS_ERROR_INVALID_PARAMETER;
+ /* Check if privileges enough */
+ if (!maps_condition_check_privilege())
+ return MAPS_ERROR_PERMISSION_DENIED;
+
int error = MAPS_ERROR_UNKNOWN;
int w, h;
unsigned char *image_buffer = NULL;