Change for updateProperty shouldn't be called if there is a pending reply 27/2527/1
authorMichael Carpenter <malcom2073@gmail.com>
Tue, 27 Nov 2012 01:16:46 +0000 (20:16 -0500)
committerKevron Rees <tripzero.kev@gmail.com>
Tue, 27 Nov 2012 02:05:51 +0000 (18:05 -0800)
plugins/obd2plugin/obd2source.cpp

index ddd439c..5e75e99 100644 (file)
@@ -417,21 +417,8 @@ static int updateProperties(/*gpointer retval,*/ gpointer data)
                ObdPid *reply = (ObdPid*)retval;
 
                
-               if (src->propertyReplyMap.find(reply->property) != src->propertyReplyMap.end())
-               {
-                       AsyncPropertyReply *newreply = src->propertyReplyMap[reply->property];
-                       AbstractPropertyType* value = VehicleProperty::getPropertyTypeForPropertyNameValue(reply->property, reply->value);
-                       newreply->value = value;
-                       newreply->success = true;
-                       newreply->completed(newreply);
-                       src->propertyReplyMap.erase(src->propertyReplyMap.find(reply->property));
-               }
-               else
-               {
-                       AbstractPropertyType* value = VehicleProperty::getPropertyTypeForPropertyNameValue(reply->property, reply->value);
-                       src->updateProperty(reply->property, value);
-               }
-
+               AbstractPropertyType* value = VehicleProperty::getPropertyTypeForPropertyNameValue(reply->property, reply->value);
+               src->updateProperty(reply->property, value);
 
                /*if (reply->req == "05")
                {
@@ -488,13 +475,17 @@ static int updateProperties(/*gpointer retval,*/ gpointer data)
 void OBD2Source::updateProperty(VehicleProperty::Property property,AbstractPropertyType* value)
 {
        //m_re->updateProperty(property,&value);
-       m_re->updateProperty(property,value,uuid(),amb::currentTime(),0);
+       
        if (propertyReplyMap.find(property) != propertyReplyMap.end())
        {
                propertyReplyMap[property]->value = value;
                propertyReplyMap[property]->completed(propertyReplyMap[property]);
                propertyReplyMap.erase(property);
        }
+       else
+       {
+               m_re->updateProperty(property,value,uuid(),amb::currentTime(),0);
+       }
 }
 void OBD2Source::mafValue(double maf)
 {