tizen 2.4 release
[framework/location/maps-plugin-here.git] / src / here / here_manager.h
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef _LOCATION_HERE_MANAGER_H_
18 #define _LOCATION_HERE_MANAGER_H_
19
20 //common header
21 #include <glib.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <iostream>
25 #include <math.h>
26 #include <vector>
27
28 //platform header
29 #include <net_connection.h>
30 #include <app_manager.h>
31
32 //plug-in header
33 #include "here_base.h"
34 #include "here_api.h"
35 #include "here_types.h"
36 #include "here_utils.h"
37
38 //map engine header
39 #include <common/ApplicationContext.h>
40 #include <common/HereConfig.h>
41
42 HERE_PLUGIN_BEGIN_NAMESPACE
43
44 class HereManager;
45
46 typedef std::vector<HereBase*> HereSvcList;
47
48 class HereManager
49 {
50 public:
51         /**
52          *This is the default constructor for Geocoder.
53          */
54
55         HereManager();
56
57         /**
58          *This is the default destructor for Geocoder.
59          */
60
61         virtual ~HereManager();
62
63         enum HereSvcType {
64                 HERE_SVC_GEOCODE,
65                 HERE_SVC_REV_GEOCODE,
66                 HERE_SVC_PLACE,
67                 HERE_SVC_ROUTE
68         };
69
70         void* CreateInstance(HereSvcType nHereSvc, void* pCbFunc, void* pUserData, int *nReqId);
71         here_error_e CloseInstance(int nReqId);
72         here_error_e CancelInstance(int nReqId);
73         here_error_e SetCredentials(const char* provider_key);
74         here_error_e GetCredentials(char** provider_key);
75         void TerminateAllServices(void);
76
77         here_error_e SetProxyAddress();
78         here_error_e SetPreference(maps_preference_h hPref);
79         here_error_e GetPreference(maps_preference_h *hPref);
80         maps_preference_h GetPreference();
81
82         static bool Create();
83         static HereManager* GetHandler();
84         static void Close();
85
86 private:
87         here_error_e SetCredentials();
88         static bool AppInfoMetadataCb(const char *metadata_key, const char *metadata_value, void *user_data);
89         static void NetworkStateChangedIndCb(connection_type_e type, void *user_data);
90         static here_error_e ConvertNetworkErrorCode(const int nErrorCode);
91         connection_h m_hConnection;
92         static int m_nRefCnt;
93         static HereManager *m_pHereManager;
94
95 protected:
96         HereSvcList m_HereList;
97         gint m_nNextReqId;
98         maps_preference_h m_hPref;
99 };
100
101 HERE_PLUGIN_END_NAMESPACE
102
103 #endif //_LOCATION_HERE_MANAGER_H_