#include "debug_utils.h"
#include <Types.h>
+#include <iomanip>
+
+/*
+ * Number of digits after decimal point used in geo coordinates.
+ */
+#define GEO_LOCATION_PRECISION 7
std::string ctx::DebugUtils::humanReadableDateTime(time_t timestamp, std::string format, size_t size, bool utc)
{
}
return std::string(buffer);
}
+
+void ctx::DebugUtils::printPlace2Stream(const Place &place, std::ostream &out)
+{
+ out << "PLACE:" << std::endl;
+ out << "__CATEGORY: " << place.name << std::endl;
+ if (place.locationValid) {
+ out << "__LOCATION: lat=" << std::setprecision(GEO_LOCATION_PRECISION + 2) << place.location.latitude;
+ out << ", lon=" << place.location.longitude << std::setprecision(5) << std::endl;
+ }
+ out << "__WIFI:" << place.wifiAps << std::endl;
+ out << "__CREATE_DATE: " << humanReadableDateTime(place.createDate, "%F %T", 80) << std::endl;
+}
#include <string>
#include <ctime>
+#include <iostream>
+#include <user_places_types.h>
namespace ctx {
public:
static std::string humanReadableDateTime(time_t timestamp, std::string format, size_t size, bool utc = false);
+ static void printPlace2Stream(const Place &place, std::ostream &out);
}; /* class DebugUtils */
#include <fstream>
#include <algorithm>
#include "user_places_params.h"
+#include "debug_utils.h"
#define __DELETE_PLACES_QUERY "DELETE FROM " PLACE_TABLE
{ // Print to file TODO: Only for debug -> remove in final solution
std::ofstream out(__USER_PLACES_FILE);
for (size_t i = 0; i < newDetectedPlaces.size(); i++) {
- newDetectedPlaces[i]->print2Stream(out);
+ DebugUtils::printPlace2Stream(*newDetectedPlaces[i], out);
Visits placeVisits = placesVisits[i];
for (Visit visit : placeVisits) {
visit.printShort2Stream(out);
#define PLACES_DETECTOR_RETENTION_SECONDS 24 * 60 * 60 * PLACES_DETECTOR_RETENTION_DAYS
/*
- * Number of digits after decimal point used in geo coordinates.
- */
-#define GEO_LOCATION_PRECISION 7
-
-/*
* Minimal duration of visit (in minutes) taking into account for place detection
*/
#define PLACES_DETECTOR_MIN_VISIT_DURATION_MINUTES 15
_E("Negative interval, start=%d, end=%d", start_, end_);
}
}
-
-void ctx::Place::print2Stream(std::ostream &out) const
-{
- out << "PLACE:" << std::endl;
- out << "__CATEGORY: " << name << std::endl;
- if (locationValid) {
- out << "__LOCATION: lat=" << std::setprecision(GEO_LOCATION_PRECISION + 2) << location.latitude;
- out << ", lon=" << location.longitude << std::setprecision(5) << std::endl;
- }
- out << "__WIFI:" << wifiAps << std::endl;
- out << "__CREATE_DATE: " << DebugUtils::humanReadableDateTime(createDate, "%F %T", 80) << std::endl;
-}
std::string wifiAps; // WiFi APs MAC addresses separated by ","
time_t createDate; // The last update time of this place
- void print2Stream(std::ostream &out) const;
-
}; /* class Place */
} /* namespace ctx */