2 * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef _LOCATION_HERE_UTILS_H_
18 #define _LOCATION_HERE_UTILS_H_
29 #include <maps_area.h>
30 #include <maps_preference.h>
31 #include <maps_route_maneuver.h>
32 #include <maps_service.h>
35 #include "here_types.h"
38 #include <geocoder/GeoCoderQuery.h>
39 #include <finder/DiscoveryQuery.h>
40 #include <routes/GeoRouteQuery.h>
41 #include <routes/Maneuver.h>
42 #include <common/GeoCoordinates.h>
44 #define HERE_PLUGIN_BEGIN_NAMESPACE namespace Here { namespace PlugIn {
45 #define HERE_PLUGIN_END_NAMESPACE }}
46 #define HERE_PLUGIN_NAMESPACE_PREFIX Here::PlugIn
51 #define LOG_TAG "HERE_PLUGIN"
56 #define MAPS_LOGD(fmt,args...) LOGD(fmt, ##args)
57 #define MAPS_LOGW(fmt,args...) LOGW(fmt, ##args)
58 #define MAPS_LOGI(fmt,args...) LOGI(fmt, ##args)
59 #define MAPS_LOGE(fmt,args...) LOGE(fmt, ##args)
60 #define MAPS_SECLOG(fmt,args...) SECURE_LOGD(fmt, ##args)
62 #define MAPS_CHECK_CONDITION(condition, error, msg) \
66 MAPS_LOGE("%s(0x%08x)", msg, error); \
71 #define MAPS_NULL_ARG_CHECK_RETURN_FALSE(arg)\
75 MAPS_LOGE("MAPS_ERROR_INVALID_PARAMETER"); \
79 #define MAPS_NULL_ARG_CHECK(arg) \
80 MAPS_CHECK_CONDITION(arg != NULL,MAPS_ERROR_INVALID_PARAMETER,"MAPS_ERROR_INVALID_PARAMETER")
82 #define MAPS_PRINT_ERROR_CODE_RETURN(code) \
84 MAPS_LOGE("%s(0x%08x)", #code, code); \
88 #ifndef TIZEN_MIGRATION
89 typedef std::string String;
90 typedef std::string Uri;
91 typedef std::wstring WString;
94 #define maps_item_list_items(item_list) g_list_length((GList*)(*(unsigned long*)item_list) )
98 int ConvertToMapsError(int nRet);
99 int ConvertToHereError(int nRet);
102 HERE_PLUGIN_BEGIN_NAMESPACE
104 using namespace HERE_MAPS_NAMESPACE_PREFIX;
110 *This is the default constructor for Geocoder.
116 *This is the default destructor for Geocoder.
121 static GeoRouteQuery::TravelMode Convert(maps_route_transport_mode_e nVal);
122 static maps_route_transport_mode_e Convert(GeoRouteQuery::TravelMode nVal);
123 static GeoRouteQuery::FeatureType Convert(maps_route_feature_e nVal);
124 static GeoRouteQuery::FeatureWeight Convert(maps_route_feature_weight_e nVal);
125 static Maneuver::InstructionDirection Convert(maps_route_turn_type_e nVal);
126 static maps_route_turn_type_e Convert(Maneuver::InstructionDirection nVal);
127 static GeoBoundingBox& Convert(maps_area_h hArea, GeoBoundingBox& Box);
128 static maps_area_h& Convert(GeoBoundingBox Box, maps_area_h& hArea);
129 static void Convert(String strUtf8, WString& strUtf16);
130 static void Convert(WString strUtf16, String& strUtf8);
131 static GeoBoundingBox& Convert(const char *src, GeoBoundingBox &box);
133 static bool IsValid(GeoCoordinates geoCoord);
134 static bool IsValid(maps_coordinates_s geoCoord);
135 static bool IsValidCoord(double dLat, double dLng);
136 static bool IsValid(maps_area_s hArea);
141 HERE_PLUGIN_END_NAMESPACE
143 #endif //_LOCATION_HERE_UTILS_H_