From 8b4b6e9fd0c9e5fd0762e5d3aade734bd42278e2 Mon Sep 17 00:00:00 2001 From: Marcin Masternak Date: Tue, 31 May 2016 10:11:35 +0200 Subject: [PATCH] [my-place] Move shared definitions to context-common. Change-Id: Idd0c2ac5652bf57988ee5bc5396ce7feaa95b560 Signed-off-by: Marcin Masternak --- include/ProviderTypes.h | 3 ++- src/my-place/place_recognition.h | 6 ++++-- src/my-place/place_recognition_types.h | 12 ------------ src/my-place/user_places/user_places.cpp | 6 +++--- src/my-place/user_places/user_places_types.h | 3 +-- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/include/ProviderTypes.h b/include/ProviderTypes.h index 79817b3..323f505 100644 --- a/include/ProviderTypes.h +++ b/include/ProviderTypes.h @@ -17,6 +17,7 @@ #ifndef _CONTEXT_PROVIDER_TYPES_H_ #define _CONTEXT_PROVIDER_TYPES_H_ +#include "MyPlaceTypes.h" /* Privileges */ #define PRIV_ALARM "alarm.set" @@ -86,7 +87,7 @@ #define SUBJ_SOCIAL_FREQUENCY SUBJ_SOCIAL_STATS "frequency" #define SUBJ_PLACE_GEOFENCE "place/geofence" -#define SUBJ_PLACE_DETECTION "place/pattern/personal_poi" +#define SUBJ_PLACE_DETECTION PLACE_DETECTION_SUBJECT /* Data & Option Keys */ #define KEY_QUERY_RESULT "QueryResult" diff --git a/src/my-place/place_recognition.h b/src/my-place/place_recognition.h index fe90094..729a8bc 100644 --- a/src/my-place/place_recognition.h +++ b/src/my-place/place_recognition.h @@ -18,15 +18,16 @@ #define _CONTEXT_PLACE_RECOGNITION_H_ #include -#include "place_recognition_types.h" +#include "MyPlaceTypes.h" #include "user_places/user_places.h" namespace ctx { class PlaceRecognitionProvider : public ContextProvider { + public: PlaceRecognitionProvider() : - ContextProvider(PLACE_SUBJ_RECOGNITION), + ContextProvider(SUBJ_PLACE_DETECTION), __engine(PLACE_RECOG_HIGH_ACCURACY_MODE) {} ~PlaceRecognitionProvider() {} @@ -41,6 +42,7 @@ namespace ctx { private: UserPlaces __engine; + }; /* class PlaceRecognitionProvider */ } /* namespace ctx */ diff --git a/src/my-place/place_recognition_types.h b/src/my-place/place_recognition_types.h index 4036693..ef046be 100644 --- a/src/my-place/place_recognition_types.h +++ b/src/my-place/place_recognition_types.h @@ -20,8 +20,6 @@ #include // Context Items -#define PLACE_SUBJ_RECOGNITION SUBJ_PLACE_DETECTION - #define PLACE_PRIV_RECOGNITION "location" // Database @@ -66,16 +64,6 @@ #define LOCATION_COLUMN_METHOD "method" #endif /* TIZEN_ENGINEER_MODE */ -// Data Key -#define DATA_READ "PlacesList" -#define PLACE_CATEG_ID "TypeId" // Name inconsistency: "cated_id" vs "type_id" TODO make it consistent -#define PLACE_CATEG_CONFIDENCE "TypeConfidence" -#define PLACE_NAME "Name" -#define PLACE_GEO_LATITUDE "GeoLatitude" -#define PLACE_GEO_LONGITUDE "GeoLongitude" -#define PLACE_WIFI_APS "WifiAPs" -#define PLACE_CREATE_DATE "CreateDate" - enum PlaceRecogMode { PLACE_RECOG_HIGH_ACCURACY_MODE = 0, PLACE_RECOG_LOW_POWER_MODE = 1 diff --git a/src/my-place/user_places/user_places.cpp b/src/my-place/user_places/user_places.cpp index ccbce92..ccc1e8a 100755 --- a/src/my-place/user_places/user_places.cpp +++ b/src/my-place/user_places/user_places.cpp @@ -19,7 +19,7 @@ #include #include "user_places.h" #include "places_detector.h" -#include "../place_recognition_types.h" +#include ctx::UserPlaces::UserPlaces(PlaceRecogMode energyMode): __visitDetector(nullptr), @@ -125,8 +125,8 @@ ctx::Json ctx::UserPlaces::__composeJson(std::vector> pla placeJson.set(NULL, PLACE_CATEG_CONFIDENCE, static_cast(place->categConfidence)); placeJson.set(NULL, PLACE_NAME, place->name); if (place->locationValid) { - placeJson.set(NULL, PLACE_GEO_LATITUDE, static_cast(place->location.latitude)); - placeJson.set(NULL, PLACE_GEO_LONGITUDE, static_cast(place->location.longitude)); + placeJson.set(NULL, PLACE_LOCATION_LATITUDE, static_cast(place->location.latitude)); + placeJson.set(NULL, PLACE_LOCATION_LONGITUDE, static_cast(place->location.longitude)); } placeJson.set(NULL, PLACE_WIFI_APS, place->wifiAps); placeJson.set(NULL, PLACE_CREATE_DATE, static_cast(place->createDate)); diff --git a/src/my-place/user_places/user_places_types.h b/src/my-place/user_places/user_places_types.h index e2cc437..db80bf1 100644 --- a/src/my-place/user_places/user_places_types.h +++ b/src/my-place/user_places/user_places_types.h @@ -130,8 +130,7 @@ namespace ctx { Mac mac; std::string networkName; - MacEvent(time_t timestamp_, Mac mac_) : timestamp(timestamp_), mac(mac_) {} - MacEvent(time_t timestamp_, Mac mac_, std::string networkName_) + MacEvent(time_t timestamp_, Mac mac_, std::string networkName_ = "") : timestamp(timestamp_) , mac(mac_) , networkName(networkName_) {} -- 2.34.1