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>
33 #include <maps_view.h>
36 #include "here_types.h"
39 #include <geocoder/GeoCoderQuery.h>
40 #include <finder/DiscoveryQuery.h>
41 #include <routes/GeoRouteQuery.h>
42 #include <routes/Maneuver.h>
43 #include <common/GeoCoordinates.h>
44 #include <common/GeoBoundingBox.h>
45 #include <common/GeoBoundingCircle.h>
46 #include <maps/GeoTiledMap.h>
48 #define HERE_PLUGIN_BEGIN_NAMESPACE namespace Here { namespace PlugIn {
49 #define HERE_PLUGIN_END_NAMESPACE }}
50 #define HERE_PLUGIN_NAMESPACE_PREFIX Here::PlugIn
55 #define LOG_TAG "HERE_PLUGIN"
60 #define MAPS_LOGD(fmt,args...) LOGD(fmt, ##args)
61 #define MAPS_LOGW(fmt,args...) LOGW(fmt, ##args)
62 #define MAPS_LOGI(fmt,args...) LOGI(fmt, ##args)
63 #define MAPS_LOGE(fmt,args...) LOGE(fmt, ##args)
64 #define MAPS_SECLOG(fmt,args...) SECURE_LOGD(fmt, ##args)
66 #define MAPS_CHECK_CONDITION(condition, error, msg) \
70 MAPS_LOGE("%s(0x%08x)", msg, error); \
75 #define MAPS_NULL_ARG_CHECK_RETURN_FALSE(arg)\
79 MAPS_LOGE("MAPS_ERROR_INVALID_PARAMETER"); \
83 #define MAPS_NULL_ARG_CHECK(arg) \
84 MAPS_CHECK_CONDITION(arg != NULL,MAPS_ERROR_INVALID_PARAMETER,"MAPS_ERROR_INVALID_PARAMETER")
86 #define MAPS_PRINT_ERROR_CODE_RETURN(code) \
88 MAPS_LOGE("%s(0x%08x)", #code, code); \
92 #ifndef TIZEN_MIGRATION
93 typedef std::string String;
94 typedef std::string Uri;
95 typedef std::wstring WString;
98 #define maps_item_list_items(item_list) g_list_length((GList*)(*(unsigned long*)item_list) )
102 int ConvertToMapsError(int nRet);
103 int ConvertToHereError(int nRet);
104 const char* ConverHereErrorToString(int nErr);
105 const char* ConvertMapsErrorToChar(int nErr);
108 HERE_PLUGIN_BEGIN_NAMESPACE
110 using namespace HERE_MAPS_NAMESPACE_PREFIX;
116 *This is the default constructor for Geocoder.
122 *This is the default destructor for Geocoder.
127 static GeoRouteQuery::TravelMode Convert(maps_route_transport_mode_e nVal);
128 static maps_route_transport_mode_e Convert(GeoRouteQuery::TravelMode nVal);
129 static GeoRouteQuery::FeatureType Convert(maps_route_feature_e nVal);
130 static GeoRouteQuery::FeatureWeight Convert(maps_route_feature_weight_e nVal);
131 static Maneuver::InstructionDirection Convert(maps_route_turn_type_e nVal);
132 static GeoTiledMap::MapType Convert(maps_view_type_e nMapType, bool bBuildings, bool bTraffic, bool bPublicTransit);
133 static maps_route_turn_type_e Convert(Maneuver::InstructionDirection nVal);
134 static GeoBoundingBox& Convert(maps_area_h hArea, GeoBoundingBox& Box);
135 static maps_area_h& Convert(GeoBoundingBox Box, maps_area_h& hArea);
136 static GeoBoundingCircle& Convert(maps_area_h hArea, GeoBoundingCircle& circle);
137 static void Convert(String strUtf8, WString& strUtf16);
138 static void Convert(WString strUtf16, String& strUtf8);
139 static GeoBoundingBox& Convert(const char *src, GeoBoundingBox &box);
140 static maps_error_e ConvertHttpCodeToMapsError(int nVal);
141 static const double ConvertDistance(const double originValue, maps_distance_unit_e destUnit);
142 static const double ConvertDistance(const double originValue, maps_distance_unit_e originUnit, maps_distance_unit_e destUnit);
144 static bool IsValid(GeoCoordinates geoCoord);
145 static bool IsValid(maps_coordinates_s geoCoord);
146 static bool IsValidCoord(double dLat, double dLng);
147 static bool IsValid(maps_area_s hArea);
150 HERE_PLUGIN_END_NAMESPACE
152 #endif //_LOCATION_HERE_UTILS_H_