[my-place] DatabaseManager usage refactoring.
[platform/core/context/context-provider.git] / src / my-place / facade / UserPlaces.h
index f645fc1..179fc93 100644 (file)
 #define _CONTEXT_PLACE_RECOGNITION_USER_PLACES_H_
 
 #include <vector>
+#include <map>
+#include <string>
 #include <Json.h>
 #include <TimerManager.h>
+#include <ITimerListener.h>
 #include "../visit-detector/VisitDetector.h"
 #include "../place/PlacesDetector.h"
 #include "UserPlacesTypes.h"
 
 namespace ctx {
 
-       class UserPlaces {
+       class UserPlaces : public ITimerListener {
 
        private:
                VisitDetector *__visitDetector;
-               PlacesDetector *__placesDetector;
-               int __placesDetectorTimerId;
+               int __timerId;
                TimerManager __timerManager;
+               std::vector<Json> __dbGetPlaces();
+               std::map<std::string, std::string> __dbGetWifiAPsMap();
+               std::shared_ptr<ctx::Place> __placeFromJson(Json &row, std::map<std::string,
+                               std::string> &wifiAPsMap);
+               void __placeCategoryFromJson(Json &row, ctx::Place &place);
+               void __placeLocationFromJson(Json &row, ctx::Place &place);
+               void __placeWifiAPsFromJson(Json &row, std::map<std::string,
+                               std::string> &wifiAPsMap, ctx::Place &place);
+               void __placeCreateDateFromJson(Json &row, ctx::Place &place);
+               std::vector<std::shared_ptr<Place>> __placesFromJsons(
+                               std::vector<Json>& records,
+                               std::map<std::string, std::string> &wifiAPsMap);
                std::vector<std::shared_ptr<Place>> __getPlaces();
                static Json __composeJson(std::vector<std::shared_ptr<Place>> places);
 
+               bool onTimerExpired(int timerId);
+
        public:
                UserPlaces(PlaceRecogMode energyMode = PLACE_RECOG_HIGH_ACCURACY_MODE);
                ~UserPlaces();