#include <system_info.h> /* system_info_get_platform_bool */
#include <maps_util.h> /* log */
#include <maps_error.h>
+#include <maps_condition.h>
#if (TIZEN_VER < VERSION(3, 0, 0))
#include <privacy_checker_client.h>
#include <sys/smack.h>
#define INTERNET_FEATURE "http://tizen.org/feature/network.internet"
+void *_maps_view_get_maps_service_ptr(maps_view_h view);
+
+
#if (TIZEN_VER < VERSION(3, 0, 0))
static int __maps_condition_check_privilege(const char *privilege_name, const char *permission)
{
#endif
return is_supported;
}
+
+bool maps_condition_check_service_supported(maps_service_h maps, maps_service_e service)
+{
+ if (!maps)
+ return false;
+ bool supported = false;
+ if (maps_service_provider_is_service_supported(maps, service, &supported) != MAPS_ERROR_NONE)
+ return false;
+ return supported;
+}
+
+bool maps_condition_check_data_supported(maps_service_h maps, maps_service_data_e data)
+{
+ if (!maps)
+ return false;
+ bool supported = false;
+ if (maps_service_provider_is_data_supported(maps, data, &supported) != MAPS_ERROR_NONE)
+ return false;
+ return supported;
+}
+
+bool maps_condition_check_view_service_supported(maps_view_h view, maps_service_e service)
+{
+ if (!view)
+ return false;
+ maps_service_h maps = _maps_view_get_maps_service_ptr(view);
+ bool supported = false;
+ if (maps_service_provider_is_service_supported(maps, service, &supported) != MAPS_ERROR_NONE)
+ return false;
+ return supported;
+}
+
+bool maps_condition_check_view_data_supported(maps_view_h view, maps_service_data_e data)
+{
+ if (!view)
+ return false;
+ maps_service_h maps = _maps_view_get_maps_service_ptr(view);
+ bool supported = false;
+ if (maps_service_provider_is_data_supported(maps, data, &supported) != MAPS_ERROR_NONE)
+ return false;
+ return supported;
+}
\ No newline at end of file
* limitations under the License.
*/
-#ifndef __MAPS_SERVICE_CHECK_H__
-#define __MAPS_SERVICE_CHECK_H__
+#ifndef __MAPS_CONDITION_H__
+#define __MAPS_CONDITION_H__
+
+#include <maps_service.h>
+#include <maps_types.h>
/**
* @brief Gets if privilege is consented
/**
* @brief Gets if maps feature is supported
- * @remarks If target is not a wearable gear, it returns true always.
*/
bool maps_condition_check_maps_feature(void);
*/
bool maps_condition_check_internet_feature(void);
-#endif /* __MAPS_SERVICE_CHECK_H__ */
+/**
+ * @brief Gets if maps service is supported
+ */
+bool maps_condition_check_service_supported(maps_service_h maps, maps_service_e service);
+
+/**
+ * @brief Gets if maps service data is supported
+ */
+bool maps_condition_check_data_supported(maps_service_h maps, maps_service_data_e data);
+
+/**
+ * @brief Gets if maps service is supported
+ */
+bool maps_condition_check_view_service_supported(maps_view_h maps, maps_service_e service);
+
+/**
+ * @brief Gets if maps service data is supported
+ */
+bool maps_condition_check_view_data_supported(maps_view_h view, maps_service_data_e data);
+
+#endif /* __MAPS_CONDITION_H__ */
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!place || !address)
+ if (!place)
return MAPS_ERROR_INVALID_PARAMETER;
if (!__is_supported(place, MAPS_PLACE_ADDRESS))
return MAPS_ERROR_NOT_SUPPORTED;
+ if (!address)
+ return MAPS_ERROR_INVALID_PARAMETER;
if (!((maps_place_s *) place)->address)
return MAPS_ERROR_NOT_FOUND;
return maps_address_clone(((maps_place_s *) place)->address, address);
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!place || !rating)
+ if (!place)
return MAPS_ERROR_INVALID_PARAMETER;
if (!__is_supported(place, MAPS_PLACE_RATING))
return MAPS_ERROR_NOT_SUPPORTED;
+ if (!rating)
+ return MAPS_ERROR_INVALID_PARAMETER;
if (!((maps_place_s *) place)->rating)
return MAPS_ERROR_NOT_FOUND;
return maps_place_rating_clone(((maps_place_s *) place)->rating, rating);
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!place || !callback)
+ if (!place)
return MAPS_ERROR_INVALID_PARAMETER;
if (!__is_supported(place, MAPS_PLACE_CATEGORIES))
return MAPS_ERROR_NOT_SUPPORTED;
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
if (!((maps_place_s *) place)->categories)
return MAPS_ERROR_NOT_FOUND;
return maps_item_list_foreach(((maps_place_s *) place)->categories,
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!place || !callback)
+ if (!place)
return MAPS_ERROR_INVALID_PARAMETER;
if (!__is_supported(place, MAPS_PLACE_ATTRIBUTES))
return MAPS_ERROR_NOT_SUPPORTED;
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
if (!((maps_place_s *) place)->attribute)
return MAPS_ERROR_NOT_FOUND;
return maps_item_list_foreach(((maps_place_s *) place)->attribute,
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!place || !callback)
+ if (!place)
return MAPS_ERROR_INVALID_PARAMETER;
if (!__is_supported(place, MAPS_PLACE_CONTACTS))
return MAPS_ERROR_NOT_SUPPORTED;
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
if (!((maps_place_s *) place)->contacts)
return MAPS_ERROR_NOT_FOUND;
return maps_item_list_foreach(((maps_place_s *) place)->contacts,
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!place || !callback)
+ if (!place)
return MAPS_ERROR_INVALID_PARAMETER;
if (!__is_supported(place, MAPS_PLACE_EDITORIALS))
return MAPS_ERROR_NOT_SUPPORTED;
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
if (!((maps_place_s *) place)->editorials)
return MAPS_ERROR_NOT_FOUND;
return maps_item_list_foreach(((maps_place_s *) place)->editorials,
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!place || !callback)
+ if (!place)
return MAPS_ERROR_INVALID_PARAMETER;
if (!__is_supported(place, MAPS_PLACE_IMAGE))
return MAPS_ERROR_NOT_SUPPORTED;
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
if (!((maps_place_s *) place)->images)
return MAPS_ERROR_NOT_FOUND;
return maps_item_list_foreach(((maps_place_s *) place)->images,
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!place || !callback)
+ if (!place)
return MAPS_ERROR_INVALID_PARAMETER;
if (!__is_supported(place, MAPS_PLACE_REVIEWS))
return MAPS_ERROR_NOT_SUPPORTED;
+ if (!callback)
+ return MAPS_ERROR_INVALID_PARAMETER;
if (!((maps_place_s *) place)->reviews)
return MAPS_ERROR_NOT_FOUND;
return maps_item_list_foreach(((maps_place_s *) place)->reviews,
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!place || !supplier)
+ if (!place)
return MAPS_ERROR_INVALID_PARAMETER;
if (!__is_supported(place, MAPS_PLACE_SUPPLIER))
return MAPS_ERROR_NOT_SUPPORTED;
+ if (!supplier)
+ return MAPS_ERROR_INVALID_PARAMETER;
if (!((maps_place_s *) place)->supplier)
return MAPS_ERROR_NOT_FOUND;
return maps_place_link_object_clone(((maps_place_s *) place)->supplier, supplier);
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!place || !related)
+ if (!place)
return MAPS_ERROR_INVALID_PARAMETER;
if (!__is_supported(place, MAPS_PLACE_RELATED))
return MAPS_ERROR_NOT_SUPPORTED;
+ if (!related)
+ return MAPS_ERROR_INVALID_PARAMETER;
if (!((maps_place_s *) place)->related)
return MAPS_ERROR_NOT_FOUND;
return maps_place_link_object_clone(((maps_place_s *) place)->related, related);
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!maps || !obj || !view)
+ if (!maps)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if (!maps_condition_check_service_supported(maps, MAPS_SERVICE_VIEW))
+ return MAPS_ERROR_NOT_SUPPORTED;
+ if (!obj || !view)
return MAPS_ERROR_INVALID_PARAMETER;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
return MAPS_ERROR_NOT_SUPPORTED;
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+ if (!maps_condition_check_view_data_supported(view, MAPS_VIEW_SCALEBAR))
+ return MAPS_ERROR_NOT_SUPPORTED;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!view || !enabled)
+ if (!view)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if (!maps_condition_check_view_data_supported(view, MAPS_VIEW_SCALEBAR))
+ return MAPS_ERROR_NOT_SUPPORTED;
+ if (!enabled)
return MAPS_ERROR_INVALID_PARAMETER;
return __get_plugin_interface(view)->maps_plugin_get_scalebar(view, enabled);
return MAPS_ERROR_NOT_SUPPORTED;
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+ if (!maps_condition_check_view_data_supported(view, MAPS_VIEW_BUILDING))
+ return MAPS_ERROR_NOT_SUPPORTED;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!view || !enabled)
+ if (!view)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if (!maps_condition_check_view_data_supported(view, MAPS_VIEW_BUILDING))
+ return MAPS_ERROR_NOT_SUPPORTED;
+ if (!enabled)
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_s *v = (maps_view_s *) view;
*enabled = v->buildings_enabled;
return MAPS_ERROR_NOT_SUPPORTED;
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+ if (!maps_condition_check_view_data_supported(view, MAPS_VIEW_TRAFFIC))
+ return MAPS_ERROR_NOT_SUPPORTED;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!view || !enabled)
+ if (!view)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if (!maps_condition_check_view_data_supported(view, MAPS_VIEW_TRAFFIC))
+ return MAPS_ERROR_NOT_SUPPORTED;
+ if (!enabled)
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_s *v = (maps_view_s *) view;
*enabled = v->traffic_enabled;
return MAPS_ERROR_NOT_SUPPORTED;
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
+ if (!maps_condition_check_view_data_supported(view, MAPS_VIEW_PUBLIC_TRANSIT))
+ return MAPS_ERROR_NOT_SUPPORTED;
if (!maps_condition_check_privilege())
return MAPS_ERROR_PERMISSION_DENIED;
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!view || !enabled)
+ if (!view)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if (!maps_condition_check_view_data_supported(view, MAPS_VIEW_PUBLIC_TRANSIT))
+ return MAPS_ERROR_NOT_SUPPORTED;
+ if (!enabled)
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_s *v = (maps_view_s *) view;
*enabled = v->public_transit_enabled;
{
if (!maps_condition_check_maps_feature())
return MAPS_ERROR_NOT_SUPPORTED;
- if (!view || type < MAPS_VIEW_SNAPSHOT_BMP || type > MAPS_VIEW_SNAPSHOT_JPEG ||
+ if (!view)
+ return MAPS_ERROR_INVALID_PARAMETER;
+ if (!maps_condition_check_view_service_supported(view, MAPS_SERVICE_VIEW_SNAPSHOT))
+ return MAPS_ERROR_NOT_SUPPORTED;
+ if (type < MAPS_VIEW_SNAPSHOT_BMP || type > MAPS_VIEW_SNAPSHOT_JPEG ||
quality < 0 || quality > 100 || !path || (path && *path == '\0'))
return MAPS_ERROR_INVALID_PARAMETER;
if (!maps_condition_check_privilege())