From: Marcin Masternak Date: Wed, 26 Oct 2016 17:13:53 +0000 (+0200) Subject: [my-place] Submodules dynamic loading bug fix (utils static library). X-Git-Tag: submit/tizen/20161031.062309^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0096c66ccacc042ddc1c1425387be6e13770f9bd;p=platform%2Fcore%2Fcontext%2Fcontext-provider.git [my-place] Submodules dynamic loading bug fix (utils static library). Change-Id: I872e137d3f44c4093ee0a0cecb0448e636601f79 Signed-off-by: Marcin Masternak --- diff --git a/src/my-place/CMakeLists.txt b/src/my-place/CMakeLists.txt index 7ea03ee..cc19619 100644 --- a/src/my-place/CMakeLists.txt +++ b/src/my-place/CMakeLists.txt @@ -1,4 +1,7 @@ SET(target "${target_prefix}-my-place") +SET(target_myplace_utils_static "${target}-utils_static") + +INCLUDE_DIRECTORIES(utils) SET(DEPS ${DEPS} gmodule-2.0 @@ -6,7 +9,7 @@ SET(DEPS ${DEPS} capi-network-wifi ) -FILE(GLOB SRCS *.cpp facade/*.cpp utils/*.cpp visit-detector/*.cpp) +FILE(GLOB SRCS *.cpp facade/*.cpp visit-detector/*.cpp) INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(PKG_MYPLACE REQUIRED ${DEPS}) @@ -16,9 +19,10 @@ FOREACH(flag ${PKG_MYPLACE_CFLAGS}) ENDFOREACH(flag) ADD_LIBRARY(${target} SHARED ${SRCS}) -TARGET_LINK_LIBRARIES(${target} ${PKG_MYPLACE_LDFLAGS} ${target_shared}) +TARGET_LINK_LIBRARIES(${target} ${PKG_MYPLACE_LDFLAGS} ${target_shared} ${target_myplace_utils_static}) INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/${target_dir}) +ADD_SUBDIRECTORY(utils) ADD_SUBDIRECTORY(place) ADD_SUBDIRECTORY(visit-categer) \ No newline at end of file diff --git a/src/my-place/facade/UserPlaces.h b/src/my-place/facade/UserPlaces.h index 31bac72..bc552cc 100644 --- a/src/my-place/facade/UserPlaces.h +++ b/src/my-place/facade/UserPlaces.h @@ -24,8 +24,7 @@ #include #include #include "../visit-detector/VisitDetector.h" -#include "../place/PlacesDetector.h" -#include "UserPlacesTypes.h" +#include namespace ctx { diff --git a/src/my-place/facade/UserPlacesParams.h b/src/my-place/facade/UserPlacesParams.h deleted file mode 100644 index ccb136b..0000000 --- a/src/my-place/facade/UserPlacesParams.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _CONTEXT_PLACE_RECOGNITION_USER_PLACES_PARAMS_H_ -#define _CONTEXT_PLACE_RECOGNITION_USER_PLACES_PARAMS_H_ - -/* - * WiFi scanning frequency (in minutes) in PLACE_RECOG_HIGH_ACCURACY_MODE. - */ -#define WIFI_LOGGER_INTERVAL_MINUTES_HIGH_ACCURACY 3 - -/* - * WiFi scanning frequency (in minutes) in PLACE_RECOG_LOW_POWER_MODE. - */ -#define WIFI_LOGGER_INTERVAL_MINUTES_LOW_POWER 60 - -/* - * Time window taken into consideration (in seconds) in PLACE_RECOG_HIGH_ACCURACY_MODE. - */ -#define VISIT_DETECTOR_PERIOD_SECONDS_HIGH_ACCURACY 360 - -/* - * Time window taken into consideration (in seconds) in PLACE_RECOG_LOW_POWER_MODE. - */ -#define VISIT_DETECTOR_PERIOD_SECONDS_LOW_POWER 3600 - -/* - * Overlap threshold between two sets of mac addresses (overlap - * coefficient for two sets should be higher than this threshold - * in order to detect stable radio environment); =< 1.0 - * New parameter in algorithm compared to original version of PlaceSense! - */ -#define VISIT_DETECTOR_OVERLAP 0.8f - -/* - * Specifies how many stable intervals must be seen to - * indicate an entrance to a place; >= 1 - */ -#define VISIT_DETECTOR_STABLE_DEPTH 1 - -/* - * Representatives threshold (representatnive beacon - * response rate should be higher than this threshold); =< 1.0 - */ -#define VISIT_DETECTOR_REP_THRESHOLD 0.9f - -/* - * Specifies how long scans must be unstable to indicate a leave form a place; >= 1 - */ -#define VISIT_DETECTOR_TOLERANCE_DEPTH 3 - -#define PLACES_DETECTOR_TASK_START_HOUR 3 -#define PLACES_DETECTOR_TASK_START_MINUTE 11 -#define PLACES_DETECTOR_RETENTION_DAYS 30 -#define PLACES_DETECTOR_RETENTION_SECONDS 24 * 60 * 60 * PLACES_DETECTOR_RETENTION_DAYS - -/* - * Minimal duration of visit (in minutes) taking into account for place detection - */ -#define PLACES_DETECTOR_MIN_VISIT_DURATION_MINUTES 15 - -/* - * Maximum duration of visit (in minutes) taking into account for place detection - */ -#define PLACES_DETECTOR_MAX_VISIT_DURATION_MINUTES 5 * 24 * 60 - -/* - * Minimum visits number per place - */ -#define PLACES_DETECTOR_MIN_VISITS_PER_PLACE 1 - -/* - * Minimum visits number per big place - */ -#define PLACES_DETECTOR_MIN_VISITS_PER_BIG_PLACE 4 - -/* - * Minimal visit category score for taking this visit into consideration during - * place categorization - */ -#define PLACES_CATEGER_MIN_VISITS_SCORE 0.1 - -/* - * Minimum visits number per home - */ -#define PLACES_CATEGER_MIN_VISITS_PER_HOME 3 - -/* - * Minimum visits number per work - */ -#define PLACES_CATEGER_MIN_VISITS_PER_WORK 2 - -/* - * Default user consent value for place detection - */ -#define MYPLACE_SETTING_USER_CONSENT_DEFAULT false - -#endif /* End of _CONTEXT_PLACE_RECOGNITION_USER_PLACES_PARAMS_H_ */ diff --git a/src/my-place/facade/UserPlacesTypes.cpp b/src/my-place/facade/UserPlacesTypes.cpp deleted file mode 100644 index bf00798..0000000 --- a/src/my-place/facade/UserPlacesTypes.cpp +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include -#include -#include "UserPlacesTypes.h" -#include "UserPlacesParams.h" -#include "../utils/DebugUtils.h" - -#define __MAC_STRING_COMPONENTS_SEPARATOR ':' -#define __MAC_SET_STRING_DELIMITER ',' - -ctx::Mac::Mac(const std::string& str) -{ - std::stringstream ss(str); - try { - ss >> *this; - } catch (std::runtime_error &e) { - _E("%s", e.what()); - } -} - -ctx::Mac::Mac(const char *str) -{ - std::stringstream ss(str); - try { - ss >> *this; - } catch (std::runtime_error &e) { - _E("%s", e.what()); - } -} - -std::istream& ctx::operator>>(std::istream &input, ctx::Mac &mac) -{ - int h; - char colon; - for (size_t i = 0; i < ctx::Mac::MAC_SIZE; i++) { - input >> std::hex; - input >> h; - mac.c[i] = h; - if (i + 1 >= ctx::Mac::MAC_SIZE) - break; - input >> colon; - if (colon != __MAC_STRING_COMPONENTS_SEPARATOR) - throw std::runtime_error("Invalid MAC format"); - } - input >> std::dec; - return input; -} - -std::ostream& ctx::operator<<(std::ostream &output, const ctx::Mac &mac) -{ - size_t i = 0; - while (true) { - output << std::hex << std::setfill('0') << std::setw(2); - output << static_cast(mac.c[i]); - i++; - if (i >= Mac::MAC_SIZE) - break; - output << __MAC_STRING_COMPONENTS_SEPARATOR; - } - output << std::dec; - return output; -} - -ctx::Mac::operator std::string() const -{ - std::stringstream ss; - ss << *this; - return ss.str(); -} - -bool ctx::operator==(const Mac &m1, const Mac &m2) -{ - for (size_t i = 0; i < Mac::MAC_SIZE; i++) { - if (m1.c[i] != m2.c[i]) - return false; - } - return true; -} - -bool ctx::operator!=(const Mac &m1, const Mac &m2) -{ - return !(m1 == m2); -} - -bool ctx::operator<(const Mac &m1, const Mac &m2) -{ - unsigned char c1, c2; - for (size_t i = 0; i < Mac::MAC_SIZE; i++) { - c1 = m1.c[i]; - c2 = m2.c[i]; - if (c1 < c2) - return true; - if (c1 > c2) - return false; - } - return false; // they are equal -} - -std::istream& ctx::operator>>(std::istream &input, ctx::MacSet &macSet) -{ - Mac mac; - char delimeter; - while (!input.eof()) { - try { - input >> mac; - } catch (std::runtime_error &e) { - _E("Cannot read macSet. Exception: %s", e.what()); - break; - } - macSet.insert(mac); - if (input.eof()) - break; - delimeter = input.get(); - if (delimeter != __MAC_SET_STRING_DELIMITER) { - input.unget(); - break; - } - } - return input; -} - -std::ostream& ctx::operator<<(std::ostream &output, const ctx::MacSet &macSet) -{ - std::vector macVec(macSet.size()); - std::copy(macSet.begin(), macSet.end(), macVec.begin()); - std::sort(macVec.begin(), macVec.end()); - - bool first = true; - for (auto &mac: macVec) { - if (first) { - first = false; - } else { - output << __MAC_SET_STRING_DELIMITER; - } - output << mac; - } - return output; -} - -void ctx::LocationEvent::log() -{ - std::string time_str = DebugUtils::humanReadableDateTime(timestamp, "%T", 9); -#ifdef TIZEN_ENGINEER_MODE - _D("location lat=%.8f, lon=%.8f, acc=%.2f[m], time=%s, method=%d", - coordinates.latitude, - coordinates.longitude, - coordinates.accuracy, - time_str.c_str(), - method); -#else /* TIZEN_ENGINEER_MODE */ - _D("location lat=%.8f, lon=%.8f, acc=%.2f[m], time=%s", - coordinates.latitude, - coordinates.longitude, - coordinates.accuracy, - time_str.c_str()); -#endif /* TIZEN_ENGINEER_MODE */ -} - -void ctx::Visit::setLocation(Location location_) -{ - locationValid = true; - location = location_; -} - -void ctx::Visit::printShort2Stream(std::ostream &out) const -{ - // print only valid visits - if (interval.end != 0) { - float duration = ((float) (interval.end - interval.start)) / 3600; // [h] - out << "__VISIT " << duration << "h: "; - out << DebugUtils::humanReadableDateTime(interval.start, "%m/%d %H:%M", 15) << " ÷ "; - out << DebugUtils::humanReadableDateTime(interval.end, "%m/%d %H:%M", 15) << std::endl; - } -} - -bool ctx::operator==(const ctx::Visit &v1, const ctx::Visit &v2) -{ - return v1.interval.start == v2.interval.start - && v1.interval.end == v2.interval.end - && v1.categs == v2.categs - && v1.location.latitude == v2.location.latitude - && v1.location.longitude == v2.location.longitude - && v1.location.accuracy == v2.location.accuracy - && v1.locationValid == v2.locationValid - && v1.macSet == v2.macSet; -} - -ctx::MacSet ctx::macSetFromString(const std::string &str) -{ - MacSet macSet; - std::stringstream ss; - ss << str; - ss >> macSet; - return macSet; -} - -bool ctx::operator>(const Mac &m1, const Mac &m2) -{ - return m2 < m1; -} - -std::shared_ptr ctx::macSetFromMacs2Counts(const Macs2Counts &macs2Counts) -{ - std::shared_ptr macSet(std::make_shared()); - for (auto &macCount: macs2Counts) { - macSet->insert(macCount.first); - } - return macSet; -} - -std::shared_ptr ctx::macSetsUnion(const std::vector> &macSets) -{ - std::shared_ptr unionSet = std::make_shared(); - for (std::shared_ptr macSet : macSets) { - unionSet->insert(macSet->begin(), macSet->end()); - } - return unionSet; -} - -ctx::Interval::Interval(time_t start_, time_t end_) : start(start_), end(end_) { - if (end_ < start_) - _E("Negative interval, start=%d, end=%d", start_, end_); -} diff --git a/src/my-place/facade/UserPlacesTypes.h b/src/my-place/facade/UserPlacesTypes.h deleted file mode 100644 index 9365beb..0000000 --- a/src/my-place/facade/UserPlacesTypes.h +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _CONTEXT_PLACE_RECOGNITION_USER_PLACES_TYPES_H_ -#define _CONTEXT_PLACE_RECOGNITION_USER_PLACES_TYPES_H_ - -#include -#include -#include -#include -#include -#include -#include -#include - -// Database -#define VISIT_TABLE "Log_Myplace_Visit" -#define VISIT_COLUMN_START_TIME "start_time" -#define VISIT_COLUMN_END_TIME "end_time" -#define VISIT_COLUMN_WIFI_APS "wifi_aps" -#define VISIT_COLUMN_CATEGORY "category" -#ifdef TIZEN_ENGINEER_MODE -#define VISIT_COLUMN_START_TIME_HUMAN "start_time_human" // only for debug: human readable time data: -#define VISIT_COLUMN_END_TIME_HUMAN "end_time_human" // only for debug: human readable time data: -#endif /* TIZEN_ENGINEER_MODE */ -#define VISIT_COLUMN_LOCATION_VALID "location_valid" -#define VISIT_COLUMN_LOCATION_LATITUDE "location_latitude" -#define VISIT_COLUMN_LOCATION_LONGITUDE "location_longitude" -#define VISIT_COLUMN_LOCATION_ACCURACY "location_accuracy" -#define VISIT_COLUMN_CATEG_HOME "categ_home" -#define VISIT_COLUMN_CATEG_WORK "categ_work" -#define VISIT_COLUMN_CATEG_OTHER "categ_other" - -#define WIFI_APS_MAP_TABLE "Log_Myplace_WifiAPsMap" -#define WIFI_APS_MAP_COLUMN_MAC "mac" -#define WIFI_APS_MAP_COLUMN_NETWORK_NAME "network_name" -#define WIFI_APS_MAP_COLUMN_INSERT_TIME "insert_time" - -#define PLACE_TABLE "Log_Myplace_Place" -#define PLACE_COLUMN_CATEG_ID "categ_id" -#define PLACE_COLUMN_CATEG_CONFIDENCE "categ_confidence" -#define PLACE_COLUMN_NAME "name" -#define PLACE_COLUMN_LOCATION_VALID "location_valid" -#define PLACE_COLUMN_LOCATION_LATITUDE "location_latitude" -#define PLACE_COLUMN_LOCATION_LONGITUDE "location_longitude" -#define PLACE_COLUMN_LOCATION_ACCURACY "location_accuracy" -#define PLACE_COLUMN_WIFI_APS "wifi_aps" -#define PLACE_COLUMN_CREATE_DATE "create_date" - -#define WIFI_TABLE "Log_Myplace_Wifi" -#define WIFI_COLUMN_TIMESTAMP "timestamp" -#define WIFI_COLUMN_BSSID "bssid" -#define WIFI_COLUMN_ESSID "essid" - -#define LOCATION_TABLE "Log_Myplace_Location" -#define LOCATION_COLUMN_LATITUDE "latitude" -#define LOCATION_COLUMN_LONGITUDE "longitude" -#define LOCATION_COLUMN_ACCURACY "accuracy" -#define LOCATION_COLUMN_TIMESTAMP "timestamp" -#ifdef TIZEN_ENGINEER_MODE -#define LOCATION_COLUMN_TIMESTAMP_HUMAN "time_human" // only for debug: human readable time data: -#define LOCATION_COLUMN_METHOD "method" -#endif /* TIZEN_ENGINEER_MODE */ - -#define MYPLACE_SETTINGS_TABLE "Myplace_Settings" -#define MYPLACE_SETTINGS_COLUMN_KEY "key" -#define MYPLACE_SETTINGS_COLUMN_VALUE "value" -#define MYPLACE_SETTING_KEY_USER_CONSENT PLACE_DETECTION_REQUEST_CONSENT - -enum PlaceRecogMode { - PLACE_RECOG_HIGH_ACCURACY_MODE = 0, - PLACE_RECOG_LOW_POWER_MODE = 1 -}; - -namespace ctx { - - /* - * type for numerical computations - */ - typedef double num_t; - - /* - * mac address - */ - class Mac { - - public: - const static size_t MAC_SIZE = 6; // number of bytes for mac address. - unsigned char c[MAC_SIZE]; - - Mac() {}; - Mac(const std::string &str); - Mac(const char *str); - operator std::string() const; - - }; /* class Mac */ - - std::istream &operator>>(std::istream &input, ctx::Mac &mac); - std::ostream &operator<<(std::ostream &output, const ctx::Mac &mac); - bool operator==(const ctx::Mac &m1, const ctx::Mac &m2); - bool operator!=(const ctx::Mac &m1, const ctx::Mac &m2); - bool operator<(const ctx::Mac &m1, const ctx::Mac &m2); - bool operator>(const ctx::Mac &m1, const ctx::Mac &m2); - -} /* namespace ctx */ - -namespace std { - - template <> struct hash { - size_t operator()(const ctx::Mac & m) const { - size_t h = 1; - for (size_t i = 0; i < ctx::Mac::MAC_SIZE; i++) { - h = h * 37 + m.c[i]; - } - return h; - } - }; - -} /* namespace std */ - -namespace ctx { - - typedef float share_t; - typedef int count_t; - - typedef std::unordered_map Macs2Counts; - typedef std::unordered_map Macs2Shares; - - typedef std::unordered_set MacSet; - - std::istream &operator>>(std::istream &input, ctx::MacSet &macSet); - std::ostream &operator<<(std::ostream &output, const ctx::MacSet &macSet); - ctx::MacSet macSetFromString(const std::string &str); - - std::shared_ptr macSetsUnion(const std::vector> &macSets); - - struct Interval { - time_t start; - time_t end; - - Interval(time_t start, time_t end); - }; - -} /* namespace ctx */ - -namespace std { - - template <> struct hash { - size_t operator()(const ctx::Interval & interval) const { - return interval.end * interval.start; - } - }; - -} /* namespace std */ - -namespace ctx { - - /* - * fully describes interval data after the interval is finished - */ - struct Frame { - Interval interval; - count_t numberOfTimestamps; - Macs2Counts macs2Counts; - - Frame(Interval interval_) : interval(interval_), numberOfTimestamps(0) {}; - }; - - /* - * mac address + its timestamp - */ - struct MacEvent { - time_t timestamp; - Mac mac; - std::string networkName; - - MacEvent(time_t timestamp_, Mac mac_, std::string networkName_ = "") - : timestamp(timestamp_) - , mac(mac_) - , networkName(networkName_) {} - }; - - typedef std::map Categs; // scores of categories - -#ifdef TIZEN_ENGINEER_MODE - enum LocationSource { - LOCATION_METHOD_REQUEST = 0, - LOCATION_METHOD_GET_LOCATION = 1, - LOCATION_METHOD_GET_LAST_LOCATION = 2 - }; -#endif /* TIZEN_ENGINEER_MODE */ - - /* - * location + timestamp + method - */ - struct LocationEvent { - Location coordinates; - time_t timestamp; - -#ifdef TIZEN_ENGINEER_MODE - LocationSource method; - - LocationEvent(double latitude_, double longitude_, double accuracy_, time_t timestamp_, LocationSource method_) : - coordinates(latitude_, longitude_, accuracy_), - timestamp(timestamp_), method(method_) {} -#else /* TIZEN_ENGINEER_MODE */ - LocationEvent(double latitude_, double longitude_, double accuracy_, time_t timestamp_) : - coordinates(latitude_, longitude_, accuracy_), - timestamp(timestamp_) {} -#endif /* TIZEN_ENGINEER_MODE */ - - void log(); - - }; /* struct LocationEvent */ - - struct Visit { - Interval interval; - std::shared_ptr macSet; - Categs categs; - bool locationValid; - Location location; // makes sense if locationValid == true; - - Visit(Interval interval_, std::shared_ptr macSet_ = std::make_shared(), Categs categs_ = Categs()) : - interval(interval_), - macSet(macSet_), - categs(categs_), - locationValid(false) {} - void setLocation(Location location); - void printShort2Stream(std::ostream &out) const; - - }; /* struct Visit */ - - bool operator==(const Visit &v1, const Visit &v2); - typedef std::vector Visits; - typedef std::vector MacEvents; // used to store current interval logs - - std::shared_ptr macSetFromMacs2Counts(const Macs2Counts &macs2Counts); - -} /* namespace ctx */ - -#endif /* End of _CONTEXT_PLACE_RECOGNITION_USER_PLACES_TYPES_H_ */ diff --git a/src/my-place/place/CMakeLists.txt b/src/my-place/place/CMakeLists.txt index fc2c120..7ac705f 100644 --- a/src/my-place/place/CMakeLists.txt +++ b/src/my-place/place/CMakeLists.txt @@ -1,7 +1,10 @@ SET(target "${target_prefix}-my-place-places-detector") +INCLUDE_DIRECTORIES(../utils) + FILE(GLOB SRCS *.cpp) ADD_LIBRARY(${target} SHARED ${SRCS}) +TARGET_LINK_LIBRARIES(${target} ${target_myplace_utils_static}) INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/${target_dir}) \ No newline at end of file diff --git a/src/my-place/place/PlaceCateger.cpp b/src/my-place/place/PlaceCateger.cpp index 1b956a8..603e857 100644 --- a/src/my-place/place/PlaceCateger.cpp +++ b/src/my-place/place/PlaceCateger.cpp @@ -15,9 +15,9 @@ */ #include "PlaceCateger.h" -#include "../utils/Median.h" -#include "../facade/UserPlacesParams.h" -#include "../facade/UserPlacesTypes.h" +#include +#include +#include #include #include diff --git a/src/my-place/place/PlaceCateger.h b/src/my-place/place/PlaceCateger.h index 44927b3..dd6943f 100644 --- a/src/my-place/place/PlaceCateger.h +++ b/src/my-place/place/PlaceCateger.h @@ -17,7 +17,7 @@ #ifndef _CONTEXT_PLACE_RECOGNITION_PLACE_CATEGER_ #define _CONTEXT_PLACE_RECOGNITION_PLACE_CATEGER_ -#include "../facade/UserPlacesTypes.h" +#include #include #include #include diff --git a/src/my-place/place/PlacesDetector.cpp b/src/my-place/place/PlacesDetector.cpp index e66c5ee..115a44b 100644 --- a/src/my-place/place/PlacesDetector.cpp +++ b/src/my-place/place/PlacesDetector.cpp @@ -17,18 +17,18 @@ #include #include #include -#include "../utils/Similarity.h" +#include #include "PlacesDetector.h" #include "PlaceCateger.h" -#include "../utils/Median.h" +#include #ifdef TIZEN_ENGINEER_MODE -#include "../utils/Gmap.h" +#include #endif /* TIZEN_ENGINEER_MODE */ -#include "../facade/UserPlacesTypes.h" +#include #include #include -#include "../facade/UserPlacesParams.h" -#include "../utils/DebugUtils.h" +#include +#include #include #define __DELETE_PLACES_QUERY "DELETE FROM " PLACE_TABLE @@ -89,7 +89,7 @@ double ctx::PlacesDetector::__doubleValueFromJson(Json &row, const char* key) { double value; row.get(NULL, key, &value); - _D("__doubleValueFromJson, key:%s, value: %lf", key, value); + _D("key: %s, value: %lf", key, value); return value; } diff --git a/src/my-place/place/PlacesDetector.h b/src/my-place/place/PlacesDetector.h index d9c47cb..81c6a44 100644 --- a/src/my-place/place/PlacesDetector.h +++ b/src/my-place/place/PlacesDetector.h @@ -20,7 +20,7 @@ #include #include #include -#include "../facade/UserPlacesTypes.h" +#include #include #include "Graph.h" diff --git a/src/my-place/utils/CMakeLists.txt b/src/my-place/utils/CMakeLists.txt new file mode 100644 index 0000000..2ecc5e4 --- /dev/null +++ b/src/my-place/utils/CMakeLists.txt @@ -0,0 +1,5 @@ +SET(target ${target_myplace_utils_static}) + +FILE(GLOB SRCS *.cpp) + +ADD_LIBRARY(${target} STATIC ${SRCS}) \ No newline at end of file diff --git a/src/my-place/utils/Gmap.h b/src/my-place/utils/Gmap.h index 891b851..c6a5482 100644 --- a/src/my-place/utils/Gmap.h +++ b/src/my-place/utils/Gmap.h @@ -17,7 +17,7 @@ #ifndef _CONTEXT_PLACE_RECOGNITION_GMAP_H_ #define _CONTEXT_PLACE_RECOGNITION_GMAP_H_ -#include "../facade/UserPlacesTypes.h" +#include "UserPlacesTypes.h" #define GMAP_FILE "/tmp/user_places_map.html" diff --git a/src/my-place/utils/Median.h b/src/my-place/utils/Median.h index b33e7b2..275fa13 100644 --- a/src/my-place/utils/Median.h +++ b/src/my-place/utils/Median.h @@ -17,7 +17,7 @@ #ifndef _CONTEXT_PLACE_RECOGNITION_MEDIAN_ #define _CONTEXT_PLACE_RECOGNITION_MEDIAN_ -#include "../facade/UserPlacesTypes.h" +#include "UserPlacesTypes.h" #include namespace ctx { diff --git a/src/my-place/utils/Similarity.h b/src/my-place/utils/Similarity.h index e006164..f78b675 100644 --- a/src/my-place/utils/Similarity.h +++ b/src/my-place/utils/Similarity.h @@ -17,7 +17,7 @@ #ifndef _CONTEXT_PLACE_RECOGNITION_SIMILAR_H_ #define _CONTEXT_PLACE_RECOGNITION_SIMILAR_H_ -#include "../facade/UserPlacesTypes.h" +#include "UserPlacesTypes.h" namespace ctx { diff --git a/src/my-place/utils/UserPlacesParams.h b/src/my-place/utils/UserPlacesParams.h new file mode 100644 index 0000000..ccb136b --- /dev/null +++ b/src/my-place/utils/UserPlacesParams.h @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _CONTEXT_PLACE_RECOGNITION_USER_PLACES_PARAMS_H_ +#define _CONTEXT_PLACE_RECOGNITION_USER_PLACES_PARAMS_H_ + +/* + * WiFi scanning frequency (in minutes) in PLACE_RECOG_HIGH_ACCURACY_MODE. + */ +#define WIFI_LOGGER_INTERVAL_MINUTES_HIGH_ACCURACY 3 + +/* + * WiFi scanning frequency (in minutes) in PLACE_RECOG_LOW_POWER_MODE. + */ +#define WIFI_LOGGER_INTERVAL_MINUTES_LOW_POWER 60 + +/* + * Time window taken into consideration (in seconds) in PLACE_RECOG_HIGH_ACCURACY_MODE. + */ +#define VISIT_DETECTOR_PERIOD_SECONDS_HIGH_ACCURACY 360 + +/* + * Time window taken into consideration (in seconds) in PLACE_RECOG_LOW_POWER_MODE. + */ +#define VISIT_DETECTOR_PERIOD_SECONDS_LOW_POWER 3600 + +/* + * Overlap threshold between two sets of mac addresses (overlap + * coefficient for two sets should be higher than this threshold + * in order to detect stable radio environment); =< 1.0 + * New parameter in algorithm compared to original version of PlaceSense! + */ +#define VISIT_DETECTOR_OVERLAP 0.8f + +/* + * Specifies how many stable intervals must be seen to + * indicate an entrance to a place; >= 1 + */ +#define VISIT_DETECTOR_STABLE_DEPTH 1 + +/* + * Representatives threshold (representatnive beacon + * response rate should be higher than this threshold); =< 1.0 + */ +#define VISIT_DETECTOR_REP_THRESHOLD 0.9f + +/* + * Specifies how long scans must be unstable to indicate a leave form a place; >= 1 + */ +#define VISIT_DETECTOR_TOLERANCE_DEPTH 3 + +#define PLACES_DETECTOR_TASK_START_HOUR 3 +#define PLACES_DETECTOR_TASK_START_MINUTE 11 +#define PLACES_DETECTOR_RETENTION_DAYS 30 +#define PLACES_DETECTOR_RETENTION_SECONDS 24 * 60 * 60 * PLACES_DETECTOR_RETENTION_DAYS + +/* + * Minimal duration of visit (in minutes) taking into account for place detection + */ +#define PLACES_DETECTOR_MIN_VISIT_DURATION_MINUTES 15 + +/* + * Maximum duration of visit (in minutes) taking into account for place detection + */ +#define PLACES_DETECTOR_MAX_VISIT_DURATION_MINUTES 5 * 24 * 60 + +/* + * Minimum visits number per place + */ +#define PLACES_DETECTOR_MIN_VISITS_PER_PLACE 1 + +/* + * Minimum visits number per big place + */ +#define PLACES_DETECTOR_MIN_VISITS_PER_BIG_PLACE 4 + +/* + * Minimal visit category score for taking this visit into consideration during + * place categorization + */ +#define PLACES_CATEGER_MIN_VISITS_SCORE 0.1 + +/* + * Minimum visits number per home + */ +#define PLACES_CATEGER_MIN_VISITS_PER_HOME 3 + +/* + * Minimum visits number per work + */ +#define PLACES_CATEGER_MIN_VISITS_PER_WORK 2 + +/* + * Default user consent value for place detection + */ +#define MYPLACE_SETTING_USER_CONSENT_DEFAULT false + +#endif /* End of _CONTEXT_PLACE_RECOGNITION_USER_PLACES_PARAMS_H_ */ diff --git a/src/my-place/utils/UserPlacesTypes.cpp b/src/my-place/utils/UserPlacesTypes.cpp new file mode 100644 index 0000000..c5ed30c --- /dev/null +++ b/src/my-place/utils/UserPlacesTypes.cpp @@ -0,0 +1,242 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include "UserPlacesTypes.h" +#include "UserPlacesParams.h" +#include "DebugUtils.h" + +#define __MAC_STRING_COMPONENTS_SEPARATOR ':' +#define __MAC_SET_STRING_DELIMITER ',' + +ctx::Mac::Mac(const std::string& str) +{ + std::stringstream ss(str); + try { + ss >> *this; + } catch (std::runtime_error &e) { + _E("%s", e.what()); + } +} + +ctx::Mac::Mac(const char *str) +{ + std::stringstream ss(str); + try { + ss >> *this; + } catch (std::runtime_error &e) { + _E("%s", e.what()); + } +} + +std::istream& ctx::operator>>(std::istream &input, ctx::Mac &mac) +{ + int h; + char colon; + for (size_t i = 0; i < ctx::Mac::MAC_SIZE; i++) { + input >> std::hex; + input >> h; + mac.c[i] = h; + if (i + 1 >= ctx::Mac::MAC_SIZE) + break; + input >> colon; + if (colon != __MAC_STRING_COMPONENTS_SEPARATOR) + throw std::runtime_error("Invalid MAC format"); + } + input >> std::dec; + return input; +} + +std::ostream& ctx::operator<<(std::ostream &output, const ctx::Mac &mac) +{ + size_t i = 0; + while (true) { + output << std::hex << std::setfill('0') << std::setw(2); + output << static_cast(mac.c[i]); + i++; + if (i >= Mac::MAC_SIZE) + break; + output << __MAC_STRING_COMPONENTS_SEPARATOR; + } + output << std::dec; + return output; +} + +ctx::Mac::operator std::string() const +{ + std::stringstream ss; + ss << *this; + return ss.str(); +} + +bool ctx::operator==(const Mac &m1, const Mac &m2) +{ + for (size_t i = 0; i < Mac::MAC_SIZE; i++) { + if (m1.c[i] != m2.c[i]) + return false; + } + return true; +} + +bool ctx::operator!=(const Mac &m1, const Mac &m2) +{ + return !(m1 == m2); +} + +bool ctx::operator<(const Mac &m1, const Mac &m2) +{ + unsigned char c1, c2; + for (size_t i = 0; i < Mac::MAC_SIZE; i++) { + c1 = m1.c[i]; + c2 = m2.c[i]; + if (c1 < c2) + return true; + if (c1 > c2) + return false; + } + return false; // they are equal +} + +std::istream& ctx::operator>>(std::istream &input, ctx::MacSet &macSet) +{ + Mac mac; + char delimeter; + while (!input.eof()) { + try { + input >> mac; + } catch (std::runtime_error &e) { + _E("Cannot read macSet. Exception: %s", e.what()); + break; + } + macSet.insert(mac); + if (input.eof()) + break; + delimeter = input.get(); + if (delimeter != __MAC_SET_STRING_DELIMITER) { + input.unget(); + break; + } + } + return input; +} + +std::ostream& ctx::operator<<(std::ostream &output, const ctx::MacSet &macSet) +{ + std::vector macVec(macSet.size()); + std::copy(macSet.begin(), macSet.end(), macVec.begin()); + std::sort(macVec.begin(), macVec.end()); + + bool first = true; + for (auto &mac: macVec) { + if (first) { + first = false; + } else { + output << __MAC_SET_STRING_DELIMITER; + } + output << mac; + } + return output; +} + +void ctx::LocationEvent::log() +{ + std::string time_str = DebugUtils::humanReadableDateTime(timestamp, "%T", 9); +#ifdef TIZEN_ENGINEER_MODE + _D("location lat=%.8f, lon=%.8f, acc=%.2f[m], time=%s, method=%d", + coordinates.latitude, + coordinates.longitude, + coordinates.accuracy, + time_str.c_str(), + method); +#else /* TIZEN_ENGINEER_MODE */ + _D("location lat=%.8f, lon=%.8f, acc=%.2f[m], time=%s", + coordinates.latitude, + coordinates.longitude, + coordinates.accuracy, + time_str.c_str()); +#endif /* TIZEN_ENGINEER_MODE */ +} + +void ctx::Visit::setLocation(Location location_) +{ + locationValid = true; + location = location_; +} + +void ctx::Visit::printShort2Stream(std::ostream &out) const +{ + // print only valid visits + if (interval.end != 0) { + float duration = ((float) (interval.end - interval.start)) / 3600; // [h] + out << "__VISIT " << duration << "h: "; + out << DebugUtils::humanReadableDateTime(interval.start, "%m/%d %H:%M", 15) << " ÷ "; + out << DebugUtils::humanReadableDateTime(interval.end, "%m/%d %H:%M", 15) << std::endl; + } +} + +bool ctx::operator==(const ctx::Visit &v1, const ctx::Visit &v2) +{ + return v1.interval.start == v2.interval.start + && v1.interval.end == v2.interval.end + && v1.categs == v2.categs + && v1.location.latitude == v2.location.latitude + && v1.location.longitude == v2.location.longitude + && v1.location.accuracy == v2.location.accuracy + && v1.locationValid == v2.locationValid + && v1.macSet == v2.macSet; +} + +ctx::MacSet ctx::macSetFromString(const std::string &str) +{ + MacSet macSet; + std::stringstream ss; + ss << str; + ss >> macSet; + return macSet; +} + +bool ctx::operator>(const Mac &m1, const Mac &m2) +{ + return m2 < m1; +} + +std::shared_ptr ctx::macSetFromMacs2Counts(const Macs2Counts &macs2Counts) +{ + std::shared_ptr macSet(std::make_shared()); + for (auto &macCount: macs2Counts) { + macSet->insert(macCount.first); + } + return macSet; +} + +std::shared_ptr ctx::macSetsUnion(const std::vector> &macSets) +{ + std::shared_ptr unionSet = std::make_shared(); + for (std::shared_ptr macSet : macSets) { + unionSet->insert(macSet->begin(), macSet->end()); + } + return unionSet; +} + +ctx::Interval::Interval(time_t start_, time_t end_) : start(start_), end(end_) { + if (end_ < start_) + _E("Negative interval, start=%d, end=%d", start_, end_); +} diff --git a/src/my-place/utils/UserPlacesTypes.h b/src/my-place/utils/UserPlacesTypes.h new file mode 100644 index 0000000..9365beb --- /dev/null +++ b/src/my-place/utils/UserPlacesTypes.h @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _CONTEXT_PLACE_RECOGNITION_USER_PLACES_TYPES_H_ +#define _CONTEXT_PLACE_RECOGNITION_USER_PLACES_TYPES_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +// Database +#define VISIT_TABLE "Log_Myplace_Visit" +#define VISIT_COLUMN_START_TIME "start_time" +#define VISIT_COLUMN_END_TIME "end_time" +#define VISIT_COLUMN_WIFI_APS "wifi_aps" +#define VISIT_COLUMN_CATEGORY "category" +#ifdef TIZEN_ENGINEER_MODE +#define VISIT_COLUMN_START_TIME_HUMAN "start_time_human" // only for debug: human readable time data: +#define VISIT_COLUMN_END_TIME_HUMAN "end_time_human" // only for debug: human readable time data: +#endif /* TIZEN_ENGINEER_MODE */ +#define VISIT_COLUMN_LOCATION_VALID "location_valid" +#define VISIT_COLUMN_LOCATION_LATITUDE "location_latitude" +#define VISIT_COLUMN_LOCATION_LONGITUDE "location_longitude" +#define VISIT_COLUMN_LOCATION_ACCURACY "location_accuracy" +#define VISIT_COLUMN_CATEG_HOME "categ_home" +#define VISIT_COLUMN_CATEG_WORK "categ_work" +#define VISIT_COLUMN_CATEG_OTHER "categ_other" + +#define WIFI_APS_MAP_TABLE "Log_Myplace_WifiAPsMap" +#define WIFI_APS_MAP_COLUMN_MAC "mac" +#define WIFI_APS_MAP_COLUMN_NETWORK_NAME "network_name" +#define WIFI_APS_MAP_COLUMN_INSERT_TIME "insert_time" + +#define PLACE_TABLE "Log_Myplace_Place" +#define PLACE_COLUMN_CATEG_ID "categ_id" +#define PLACE_COLUMN_CATEG_CONFIDENCE "categ_confidence" +#define PLACE_COLUMN_NAME "name" +#define PLACE_COLUMN_LOCATION_VALID "location_valid" +#define PLACE_COLUMN_LOCATION_LATITUDE "location_latitude" +#define PLACE_COLUMN_LOCATION_LONGITUDE "location_longitude" +#define PLACE_COLUMN_LOCATION_ACCURACY "location_accuracy" +#define PLACE_COLUMN_WIFI_APS "wifi_aps" +#define PLACE_COLUMN_CREATE_DATE "create_date" + +#define WIFI_TABLE "Log_Myplace_Wifi" +#define WIFI_COLUMN_TIMESTAMP "timestamp" +#define WIFI_COLUMN_BSSID "bssid" +#define WIFI_COLUMN_ESSID "essid" + +#define LOCATION_TABLE "Log_Myplace_Location" +#define LOCATION_COLUMN_LATITUDE "latitude" +#define LOCATION_COLUMN_LONGITUDE "longitude" +#define LOCATION_COLUMN_ACCURACY "accuracy" +#define LOCATION_COLUMN_TIMESTAMP "timestamp" +#ifdef TIZEN_ENGINEER_MODE +#define LOCATION_COLUMN_TIMESTAMP_HUMAN "time_human" // only for debug: human readable time data: +#define LOCATION_COLUMN_METHOD "method" +#endif /* TIZEN_ENGINEER_MODE */ + +#define MYPLACE_SETTINGS_TABLE "Myplace_Settings" +#define MYPLACE_SETTINGS_COLUMN_KEY "key" +#define MYPLACE_SETTINGS_COLUMN_VALUE "value" +#define MYPLACE_SETTING_KEY_USER_CONSENT PLACE_DETECTION_REQUEST_CONSENT + +enum PlaceRecogMode { + PLACE_RECOG_HIGH_ACCURACY_MODE = 0, + PLACE_RECOG_LOW_POWER_MODE = 1 +}; + +namespace ctx { + + /* + * type for numerical computations + */ + typedef double num_t; + + /* + * mac address + */ + class Mac { + + public: + const static size_t MAC_SIZE = 6; // number of bytes for mac address. + unsigned char c[MAC_SIZE]; + + Mac() {}; + Mac(const std::string &str); + Mac(const char *str); + operator std::string() const; + + }; /* class Mac */ + + std::istream &operator>>(std::istream &input, ctx::Mac &mac); + std::ostream &operator<<(std::ostream &output, const ctx::Mac &mac); + bool operator==(const ctx::Mac &m1, const ctx::Mac &m2); + bool operator!=(const ctx::Mac &m1, const ctx::Mac &m2); + bool operator<(const ctx::Mac &m1, const ctx::Mac &m2); + bool operator>(const ctx::Mac &m1, const ctx::Mac &m2); + +} /* namespace ctx */ + +namespace std { + + template <> struct hash { + size_t operator()(const ctx::Mac & m) const { + size_t h = 1; + for (size_t i = 0; i < ctx::Mac::MAC_SIZE; i++) { + h = h * 37 + m.c[i]; + } + return h; + } + }; + +} /* namespace std */ + +namespace ctx { + + typedef float share_t; + typedef int count_t; + + typedef std::unordered_map Macs2Counts; + typedef std::unordered_map Macs2Shares; + + typedef std::unordered_set MacSet; + + std::istream &operator>>(std::istream &input, ctx::MacSet &macSet); + std::ostream &operator<<(std::ostream &output, const ctx::MacSet &macSet); + ctx::MacSet macSetFromString(const std::string &str); + + std::shared_ptr macSetsUnion(const std::vector> &macSets); + + struct Interval { + time_t start; + time_t end; + + Interval(time_t start, time_t end); + }; + +} /* namespace ctx */ + +namespace std { + + template <> struct hash { + size_t operator()(const ctx::Interval & interval) const { + return interval.end * interval.start; + } + }; + +} /* namespace std */ + +namespace ctx { + + /* + * fully describes interval data after the interval is finished + */ + struct Frame { + Interval interval; + count_t numberOfTimestamps; + Macs2Counts macs2Counts; + + Frame(Interval interval_) : interval(interval_), numberOfTimestamps(0) {}; + }; + + /* + * mac address + its timestamp + */ + struct MacEvent { + time_t timestamp; + Mac mac; + std::string networkName; + + MacEvent(time_t timestamp_, Mac mac_, std::string networkName_ = "") + : timestamp(timestamp_) + , mac(mac_) + , networkName(networkName_) {} + }; + + typedef std::map Categs; // scores of categories + +#ifdef TIZEN_ENGINEER_MODE + enum LocationSource { + LOCATION_METHOD_REQUEST = 0, + LOCATION_METHOD_GET_LOCATION = 1, + LOCATION_METHOD_GET_LAST_LOCATION = 2 + }; +#endif /* TIZEN_ENGINEER_MODE */ + + /* + * location + timestamp + method + */ + struct LocationEvent { + Location coordinates; + time_t timestamp; + +#ifdef TIZEN_ENGINEER_MODE + LocationSource method; + + LocationEvent(double latitude_, double longitude_, double accuracy_, time_t timestamp_, LocationSource method_) : + coordinates(latitude_, longitude_, accuracy_), + timestamp(timestamp_), method(method_) {} +#else /* TIZEN_ENGINEER_MODE */ + LocationEvent(double latitude_, double longitude_, double accuracy_, time_t timestamp_) : + coordinates(latitude_, longitude_, accuracy_), + timestamp(timestamp_) {} +#endif /* TIZEN_ENGINEER_MODE */ + + void log(); + + }; /* struct LocationEvent */ + + struct Visit { + Interval interval; + std::shared_ptr macSet; + Categs categs; + bool locationValid; + Location location; // makes sense if locationValid == true; + + Visit(Interval interval_, std::shared_ptr macSet_ = std::make_shared(), Categs categs_ = Categs()) : + interval(interval_), + macSet(macSet_), + categs(categs_), + locationValid(false) {} + void setLocation(Location location); + void printShort2Stream(std::ostream &out) const; + + }; /* struct Visit */ + + bool operator==(const Visit &v1, const Visit &v2); + typedef std::vector Visits; + typedef std::vector MacEvents; // used to store current interval logs + + std::shared_ptr macSetFromMacs2Counts(const Macs2Counts &macs2Counts); + +} /* namespace ctx */ + +#endif /* End of _CONTEXT_PLACE_RECOGNITION_USER_PLACES_TYPES_H_ */ diff --git a/src/my-place/visit-categer/CMakeLists.txt b/src/my-place/visit-categer/CMakeLists.txt index 93fb055..f127d61 100644 --- a/src/my-place/visit-categer/CMakeLists.txt +++ b/src/my-place/visit-categer/CMakeLists.txt @@ -1,7 +1,10 @@ SET(target "${target_prefix}-my-place-visit-categer") +INCLUDE_DIRECTORIES(../utils) + FILE(GLOB SRCS *.cpp) ADD_LIBRARY(${target} SHARED ${SRCS}) +TARGET_LINK_LIBRARIES(${target} ${target_myplace_utils_static}) INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/${target_dir}) \ No newline at end of file diff --git a/src/my-place/visit-categer/Mahal.h b/src/my-place/visit-categer/Mahal.h index 54ec7f3..26e6235 100644 --- a/src/my-place/visit-categer/Mahal.h +++ b/src/my-place/visit-categer/Mahal.h @@ -18,7 +18,7 @@ #define _CONTEXT_PLACE_RECOGNITION_MAHAL_H_ #include -#include "../facade/UserPlacesTypes.h" +#include namespace ctx { diff --git a/src/my-place/visit-categer/PiecewiseLin.h b/src/my-place/visit-categer/PiecewiseLin.h index a0e92d7..4ff497b 100644 --- a/src/my-place/visit-categer/PiecewiseLin.h +++ b/src/my-place/visit-categer/PiecewiseLin.h @@ -17,7 +17,7 @@ #ifndef _CONTEXT_PLACE_RECOGNITION_PIECEWISE_LIN_ #define _CONTEXT_PLACE_RECOGNITION_PIECEWISE_LIN_ -#include "../facade/UserPlacesTypes.h" +#include namespace ctx { diff --git a/src/my-place/visit-categer/VisitCateger.h b/src/my-place/visit-categer/VisitCateger.h index f1c5456..3edfb93 100644 --- a/src/my-place/visit-categer/VisitCateger.h +++ b/src/my-place/visit-categer/VisitCateger.h @@ -17,7 +17,7 @@ #ifndef _CONTEXT_PLACE_RECOGNITION_VISIT_CATEGER_H_ #define _CONTEXT_PLACE_RECOGNITION_VISIT_CATEGER_H_ -#include "../facade/UserPlacesTypes.h" +#include #include "Mahal.h" #include "PiecewiseLin.h" #include diff --git a/src/my-place/visit-detector/LocationListenerIface.h b/src/my-place/visit-detector/LocationListenerIface.h index 46f2b3f..7d2aef2 100644 --- a/src/my-place/visit-detector/LocationListenerIface.h +++ b/src/my-place/visit-detector/LocationListenerIface.h @@ -17,7 +17,7 @@ #ifndef _CONTEXT_PLACE_RECOGNITION_LOCATION_LISTENER_IFACE_H_ #define _CONTEXT_PLACE_RECOGNITION_LOCATION_LISTENER_IFACE_H_ -#include "../facade/UserPlacesTypes.h" +#include namespace ctx { diff --git a/src/my-place/visit-detector/LocationLogger.cpp b/src/my-place/visit-detector/LocationLogger.cpp index 4b95eed..372ee74 100644 --- a/src/my-place/visit-detector/LocationLogger.cpp +++ b/src/my-place/visit-detector/LocationLogger.cpp @@ -18,9 +18,9 @@ #include #include #include -#include "../facade/UserPlacesTypes.h" -#include "../facade/UserPlacesParams.h" -#include "../utils/DebugUtils.h" +#include +#include +#include #include "LocationLogger.h" #ifdef TIZEN_ENGINEER_MODE diff --git a/src/my-place/visit-detector/VisitDetector.cpp b/src/my-place/visit-detector/VisitDetector.cpp index 0aa53c5..98460c2 100644 --- a/src/my-place/visit-detector/VisitDetector.cpp +++ b/src/my-place/visit-detector/VisitDetector.cpp @@ -20,12 +20,12 @@ #include #include #include -#include "../facade/UserPlacesTypes.h" +#include #include "VisitDetector.h" -#include "../facade/UserPlacesParams.h" -#include "../utils/Similarity.h" -#include "../utils/Median.h" -#include "../utils/DebugUtils.h" +#include +#include +#include +#include #include #include diff --git a/src/my-place/visit-detector/VisitDetector.h b/src/my-place/visit-detector/VisitDetector.h index 98bbda3..b476942 100644 --- a/src/my-place/visit-detector/VisitDetector.h +++ b/src/my-place/visit-detector/VisitDetector.h @@ -22,7 +22,7 @@ #include #include #include -#include "../facade/UserPlacesTypes.h" +#include #include #include "VisitListenerIface.h" #include "LocationLogger.h" diff --git a/src/my-place/visit-detector/WifiListenerIface.h b/src/my-place/visit-detector/WifiListenerIface.h index 56307d0..84ef489 100644 --- a/src/my-place/visit-detector/WifiListenerIface.h +++ b/src/my-place/visit-detector/WifiListenerIface.h @@ -17,7 +17,7 @@ #ifndef _CONTEXT_PLACE_RECOGNITION_WIFI_LISTENER_IFACE_H_ #define _CONTEXT_PLACE_RECOGNITION_WIFI_LISTENER_IFACE_H_ -#include "../facade/UserPlacesTypes.h" +#include namespace ctx { diff --git a/src/my-place/visit-detector/WifiLogger.cpp b/src/my-place/visit-detector/WifiLogger.cpp index 2baa24c..874f494 100644 --- a/src/my-place/visit-detector/WifiLogger.cpp +++ b/src/my-place/visit-detector/WifiLogger.cpp @@ -17,8 +17,8 @@ #include #include #include -#include "../facade/UserPlacesTypes.h" -#include "../utils/DebugUtils.h" +#include +#include #include "WifiLogger.h" #define __WIFI_CREATE_TABLE_COLUMNS \ diff --git a/src/my-place/visit-detector/WifiLogger.h b/src/my-place/visit-detector/WifiLogger.h index 0134c2d..7c627a1 100644 --- a/src/my-place/visit-detector/WifiLogger.h +++ b/src/my-place/visit-detector/WifiLogger.h @@ -24,7 +24,7 @@ #include #include "WifiListenerIface.h" #include "VisitListenerIface.h" -#include "../facade/UserPlacesParams.h" +#include /* Database usage flag */ #define WIFI_LOGGER_DATABASE false