use ZoneList for zones
[profile/ivi/ico-vic-amb-plugin.git] / src / ambinterface.cc
index e9275a5..5106639 100644 (file)
@@ -76,7 +76,6 @@ create(AbstractRoutingEngine* routingengine, map<string, string> config)
     }
     return ambif;
 }
-
 AMBIF::AMBIF(AbstractRoutingEngine *engine,
              std::map<std::string, std::string> config) :
         AbstractSource(engine, config)
@@ -213,7 +212,7 @@ AMBIF::initialize(VICCommunicator *comm, AMBConfig *conf)
                        << "\n";
         }
     }
-    routingEngine->setSupported(supported(), this);
+    routingEngine->updateSupported(supported(), PropertyList(), this);
     DebugOut(1) << "INFO CHG_VIC_INF The number of AMB vehicle info is " << vehicleinfoArray.size() << ".\n";
     return true;
 }
@@ -278,13 +277,17 @@ AMBIF::updateProperty(AMBVehicleInfo *vehicleinfo)
 {
     if (vehicleinfo->name == VehicleProperty::VehicleSpeed) {
         static uint16_t prevspd = -1;
-        static uint16_t spdmax = -1;
+        static const uint16_t unusablespd = -1;
         uint16_t spd = vehicleinfo->value->value<uint16_t>();
-        if ((prevspd == spdmax && spd > 0) || (prevspd == 0 && spd > 0)) {
-            DebugOut(3) << "PERF CHG_VIC_INF VIC-Plugin notify Code of update " << vehicleinfo->name << ". VehicleSpeed is 1km/h or more.\n";
+        if ((prevspd == unusablespd && spd > 0) || (prevspd == 0 && spd > 0)) {
+            DebugOut(3) << "PERF CHG_VIC_INF VIC-Plugin notify Code of update " 
+                        << vehicleinfo->name 
+                        << ". VehicleSpeed is 1km/h or more.\n";
         }
-        else if ((prevspd == spdmax && spd == 0) || (prevspd > 0 && spd == 0)) {
-            DebugOut(3) << "PERF CHG_VIC_INF VIC-Plugin notify Code of update " << vehicleinfo->name << ". VehicleSpeed is 0km/h.\n";
+        else if ((prevspd == unusablespd && spd == 0) || 
+                 (prevspd > 0 && spd == 0)) {
+            DebugOut(3) << "PERF CHG_VIC_INF VIC-Plugin notify Code of update " 
+                        << vehicleinfo->name << ". VehicleSpeed is 0km/h.\n";
         }
         prevspd = spd;
     }
@@ -321,6 +324,7 @@ AMBIF::requestUpdate(AMBVehicleInfo *vehicleinfo)
                << vehicleinfo->name << "\n";
     if (find(vehicleinfo->name) != NULL) {
         vehicleinfo->value->zone = vehicleinfo->zone;
+        vehicleinfo->value->priority = AbstractPropertyType::Instant;
         DebugOut(50) << "AMBIF requestUpdate request property name is "
                    << vehicleinfo->name << ", zone is " << vehicleinfo->zone << "\n";
         updateProperty(vehicleinfo);
@@ -421,11 +425,11 @@ AMBIF::find(std::string propertyName)
 }
 
 #if LATER1024
-PropertyInfo AMBIF::getPropertyInfo(VehicleProperty::Property property) {
+PropertyInfo AMBIF::getPropertyInfo(const VehicleProperty::Property & property) {
     if (propertyInfoMap.find(property) != propertyInfoMap.end()) {
         return propertyInfoMap[property];
     }
-    std::list<Zone::Type> zones;
+    Zone::ZoneList zones;
     AMBVehicleInfo vi;
     vi.name = property;
     std::vector<AMBVehicleInfo>::iterator itr, itr_idx, itr_end;