[my-place] Extend Place Wifi AP's list by network names. 60/72360/1
authorMarcin Masternak <m.masternak@samsung.com>
Tue, 31 May 2016 14:28:13 +0000 (16:28 +0200)
committerMarcin Masternak <m.masternak@samsung.com>
Tue, 31 May 2016 14:28:13 +0000 (16:28 +0200)
Change-Id: I0fd849c7e6533edbd90142d3eff17196cab51716
Signed-off-by: Marcin Masternak <m.masternak@samsung.com>
include/MyPlaceTypes.h
src/shared/MyPlaceTypes.cpp

index 349e5ac..83ba395 100644 (file)
@@ -18,6 +18,7 @@
 #define _CONTEXT_MYPLACE_TYPES_H_
 
 #include <string>
+#include <map>
 #include <ctime>
 
 #define PLACE_DETECTION_SUBJECT      "place/pattern/personal_poi"
@@ -64,7 +65,7 @@ namespace ctx {
                std::string name; // for now: "work"/"home"/"other"
                bool locationValid;
                Location location; // makes sense if locationValid == true;
-               std::string wifiAps; // WiFi APs MAC addresses separated by ","
+               std::map<std::string, std::string> wifiAps; // WiFi APs MAC addresses to corresponding network name map
                time_t createDate; // The last update time of this place
 
        };      /* class Place */
index b58a603..587f2d9 100644 (file)
@@ -19,7 +19,7 @@
 
 SO_EXPORT bool ctx::operator==(const ctx::Place &p1, const ctx::Place &p2)
 {
-       return p1.categId == p2.categId
+       bool ret = p1.categId == p2.categId
                        && p1.categConfidence == p2.categConfidence
                        && p1.name == p2.name
                        && p1.locationValid == p2.locationValid
@@ -28,4 +28,14 @@ SO_EXPORT bool ctx::operator==(const ctx::Place &p1, const ctx::Place &p2)
                        && p1.location.accuracy == p2.location.accuracy
                        && p1.wifiAps == p2.wifiAps
                        && p1.createDate == p2.createDate;
+       if (ret) {
+               for (std::pair<std::string, std::string> ap : p1.wifiAps) {
+                       if (p2.wifiAps.find(ap.first) == p2.wifiAps.end()) {
+                               ret = false;
+                               break;
+                       }
+               }
+       }
+       return ret;
+
 }