may have fixed crasher
authorKevron Rees <kevron_m_rees@linux.intel.com>
Tue, 30 Jul 2013 22:59:29 +0000 (15:59 -0700)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Tue, 30 Jul 2013 23:37:22 +0000 (16:37 -0700)
15 files changed:
ambd/core.cpp
plugins/dbus/abstractdbusinterface.cpp
plugins/dbus/abstractproperty.h
plugins/dbus/custompropertyinterface.cpp
plugins/dbus/dbusinterfacemanager.cpp
plugins/dbus/dbusplugin.h
plugins/dbus/drivingsafety.h
plugins/dbus/environmentproperties.h
plugins/dbus/maintenance.h
plugins/dbus/parking.h
plugins/dbus/runningstatus.h
plugins/dbus/uncategorizedproperty.cpp
plugins/dbus/varianttype.cpp
plugins/dbus/varianttype.h
plugins/dbus/vehicleinfo.h

index 8e96bb5..1d66233 100644 (file)
@@ -175,7 +175,12 @@ void Core::updateProperty(VehicleProperty::Property property, AbstractPropertyTy
                if( (isFiltered != filteredSourceSinkMap.end() && filteredSourceSinkMap[sink][property] == uuid) || isFiltered == filteredSourceSinkMap.end())
                {
                        /// FIXME: Set this here just in case a source neglects to:
-                       value->sourceUuid = uuid;
+
+                       if(value->sourceUuid != uuid)
+                       {
+                               DebugOut(DebugOut::Warning)<<"Source not setting uuid for property "<<value->name<<endl;
+                               value->sourceUuid = uuid;
+                       }
 
                        sink->propertyChanged(property, value, uuid);
                }
index 86d04d7..fb4ef02 100644 (file)
@@ -142,9 +142,10 @@ void AbstractDBusInterface::addProperty(AbstractProperty* property)
        
        properties[property->name()] = property;
 
-       if(!ListPlusPlus<string>(&mimplementedProperties).contains(property->name()))
+       if(!ListPlusPlus<string>(&mimplementedProperties).contains(property->ambPropertyName()))
        {
-               mimplementedProperties.push_back(property->name());
+               std::string pname = property->ambPropertyName();
+               mimplementedProperties.push_back(pname);
        }
 }
 
index 37fce83..f9e952c 100644 (file)
@@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 #include "debugout.h"
 #include "abstractpropertytype.h"
 #include "abstractroutingengine.h"
+#include "vehicleproperty.h"
 
 class AbstractDBusInterface;
 
@@ -62,6 +63,11 @@ public:
                return mPropertyName;
        }
 
+       virtual VehicleProperty::Property ambPropertyName()
+       {
+               return mAmbPropertyName;
+       }
+
        virtual Access access()
        {
                return mAccess;
@@ -130,6 +136,7 @@ protected:
        
        boost::any mAnyValue;
        string mPropertyName;
+       VehicleProperty::Property mAmbPropertyName;
        string mSignature;
        SetterFunc mSetterFunc;
        Access mAccess;
index b019a6a..06894a5 100644 (file)
@@ -19,10 +19,10 @@ CustomPropertyInterface::CustomPropertyInterface(VehicleProperty::Property prop,
 
                std::string signature = g_variant_get_type_string(temp->toVariant());
 
-               propertyDBusMap[prop] = new VariantType(re, signature, prop, VariantType::ReadWrite, this);
+               propertyDBusMap[prop] = new VariantType(re, signature, prop, prop, VariantType::ReadWrite, this);
 
                delete temp;
        }
 
-       supportedChanged(re->supported());
+
 }
index 850742e..d6fbc3b 100644 (file)
@@ -97,18 +97,6 @@ void exportProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
 
                boost::algorithm::erase_all(objectPath, "-");
 
-               if(!zones.size())
-               {
-
-                       T* t = new T(re, connection);
-
-                       objectPath += "/" + t->objectName();
-                       t->setObjectPath(objectPath);
-                       t->setSourceFilter(source);
-                       t->unregisterObject();
-                       t->supportedChanged(re->supported());
-               }
-
                for(auto zoneItr = zones.begin(); zoneItr != zones.end(); zoneItr++)
                {
                        Zone::Type zone = (*zoneItr).first;
@@ -149,18 +137,6 @@ void exportProperty(VehicleProperty::Property prop, AbstractRoutingEngine *re, G
 
                boost::algorithm::erase_all(objectPath, "-");
 
-               if(!zones.size())
-               {
-
-                       T* t = new T(prop, re, connection);
-
-                       objectPath += "/" + t->objectName();
-                       t->setObjectPath(objectPath);
-                       t->setSourceFilter(source);
-                       t->unregisterObject();
-                       t->supportedChanged(re->supported());
-               }
-
                for(auto zoneItr = zones.begin(); zoneItr != zones.end(); zoneItr++)
                {
                        Zone::Type zone = (*zoneItr).first;
@@ -244,13 +220,12 @@ on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_d
        /// Create objects for unimplemented properties:
 
        PropertyList capabilitiesList = VehicleProperty::capabilities();
+       PropertyList implemented = AbstractDBusInterface::implementedProperties();
 
        for (auto itr = capabilitiesList.begin(); itr != capabilitiesList.end(); itr++)
        {
                VehicleProperty::Property prop = *itr;
 
-               PropertyList implemented = AbstractDBusInterface::implementedProperties();
-
                if(!ListPlusPlus<VehicleProperty::Property>(&implemented).contains(prop))
                {
                        exportProperty<UncategorizedPropertyInterface>(prop, iface->re, connection);
index 1afa635..2afb74b 100644 (file)
@@ -64,18 +64,18 @@ protected:
        template <typename T>
        void wantProperty(VehicleProperty::Property property, std::string propertyName, std::string signature, AbstractProperty::Access access)
        {
-               propertyDBusMap[property] = new VariantType(routingEngine, signature, property, access, this);
+               propertyDBusMap[property] = new VariantType(routingEngine, signature, property, propertyName, access, this);
        }
 
 
        void wantPropertyString(VehicleProperty::Property property, std::string propertyName, std::string signature, AbstractProperty::Access access)
        {
-               propertyDBusMap[property] = new VariantType(routingEngine, signature, property, access, this);
+               propertyDBusMap[property] = new VariantType(routingEngine, signature, property, propertyName, access, this);
        }
 
        void wantPropertyVariant(VehicleProperty::Property property, std::string propertyName, std::string signature, AbstractProperty::Access access)
        {
-               propertyDBusMap[property] = new VariantType(routingEngine, signature, property, access, this);
+               propertyDBusMap[property] = new VariantType(routingEngine, signature, property, propertyName, access, this);
        }
 
        PropertyDBusMap propertyDBusMap;
index e16c653..e97ee4d 100644 (file)
@@ -21,7 +21,7 @@ public:
                wantPropertyVariant(VehicleProperty::AntilockBrakingSystem, "AntilockBrakingSystem", "b", AbstractProperty::Read);
 
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -41,7 +41,7 @@ public:
                wantPropertyVariant(VehicleProperty::TractionControlSystem, "TractionControlSystem", "b", AbstractProperty::Read);
 
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -62,7 +62,7 @@ public:
                wantPropertyVariant(VehicleProperty::VehicleTopSpeedLimit, "VehicleTopSpeedLimit", "q", AbstractProperty::Read);
 
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -88,7 +88,7 @@ public:
                wantPropertyVariant(VehicleProperty::AirbagStatus, "AirbagStatus", "y", AbstractProperty::Read);
 
 
-               //supportedChanged(re->supported());
+               //
        }
 };
 
@@ -136,7 +136,7 @@ public:
                 **/
                wantPropertyVariant(VehicleProperty::DoorLockStatus, "ChildLockStatus", "b", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -164,7 +164,7 @@ public:
                wantPropertyVariant(VehicleProperty::SeatBeltStatus, "SeatBeltStatus", "a(yb)", AbstractProperty::Read);
 
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -197,7 +197,7 @@ public:
                wantPropertyVariant(VehicleProperty::OccupantStatus, "OccupantStatus", "a(yy)", AbstractProperty::Read);
 
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -225,7 +225,7 @@ public:
                wantPropertyVariant(VehicleProperty::ObstacleDistance, "ObstacleDistance", "a{yd}", AbstractProperty::Read);
 
 
-               supportedChanged(re->supported());
+               
        }
 };
 
index 7f76480..294237b 100644 (file)
@@ -19,7 +19,7 @@ public:
                 * @attributeComment \brief Must return the brightness outside the vehicle in lux.
                 */
                wantPropertyVariant(VehicleProperty::ExteriorBrightness,"ExteriorBrightness", "q", AbstractProperty::Read);
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -46,7 +46,7 @@ public:
                 */
                wantPropertyVariant(VehicleProperty::ExteriorTemperature, "Exterior", "i", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -64,7 +64,7 @@ public:
                 * @attributeComment \brief Must return level of rain intensity 0: No Rain - 10: Heaviest Rain.
                 */
                wantPropertyVariant(VehicleProperty::RainSensor, "RainSensor", "q", AbstractProperty::Read);
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -89,7 +89,7 @@ public:
                 * @attributeComment \brief Must return Level of windshield whiper speed (see WIPERSPEED_)
                 */
                wantPropertyVariant(VehicleProperty::RainSensor, "WindshieldWiper", "y", AbstractProperty::ReadWrite);
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -196,7 +196,7 @@ public:
                 */
                wantPropertyVariant(VehicleProperty::SeatCooler, "SeatCooler", "b", AbstractProperty::ReadWrite);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
index 77d14db..3240af9 100644 (file)
@@ -20,7 +20,7 @@ public:
                 **/
                wantProperty<uint>(VehicleProperty::Odometer, "Odometer", "i", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -74,7 +74,7 @@ public:
                 *  @attributeComment \brief MUST return battery current in Amperes
                 **/
                wantProperty<double>(VehicleProperty::BatteryCurrent, "Current", "d", AbstractProperty::Read);
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -112,7 +112,7 @@ public:
                 *  @attributeComment \brief MUST return right rear tire pressure in kPa.
                 **/
                wantProperty<double>(VehicleProperty::TirePressureRightRear, "RightRear", "d", AbstractProperty::Read);
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -150,7 +150,7 @@ public:
                 *  @attributeComment \brief MUST return right rear tire temperature in Celcius.
                 **/
                wantProperty<double>(VehicleProperty::TireTemperatureRightRear, "RightRear", "d", AbstractProperty::Read);
-               supportedChanged(re->supported());
+               
        }
 };
 
index c3e89e5..f41e1ac 100644 (file)
@@ -21,7 +21,7 @@ public:
                 **/
                wantProperty<Security::Status>(VehicleProperty::SecurityAlertStatus,"SecurityAlert", "i", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -39,7 +39,7 @@ public:
                 **/
                wantProperty<bool>(VehicleProperty::ParkingBrakeStatus,"ParkingBrake", "b", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -57,7 +57,7 @@ public:
                 **/
                wantProperty<bool>(VehicleProperty::ParkingLightStatus,"ParkingLight", "b", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -75,7 +75,7 @@ public:
                 **/
                wantProperty<bool>(VehicleProperty::HazardLightStatus,"HazardLight", "b", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
index b0e0e60..28bc146 100644 (file)
@@ -36,7 +36,7 @@ public:
                 *  @attributeComment \brief  Must return Vehicle Speed in kilometers per hour.
                 **/
                wantPropertyVariant(VehicleProperty::VehicleSpeed,"VehicleSpeed", "i", AbstractProperty::Read);
-               supportedChanged(re->supported());
+
        }
 
 
@@ -55,7 +55,7 @@ public:
                 *  @attributeComment \brief  Must return Engine Speed in rotations per minute.
                 **/
                wantPropertyVariant(VehicleProperty::EngineSpeed,"EngineSpeed", "i", AbstractProperty::Read);
-               supportedChanged(re->supported());
+
        }
 
 
@@ -82,7 +82,7 @@ public:
                 *  @attributeComment \brief  Must return Vehicle Power mode (see VEHICLEPOWERMODE)
                 **/
                wantPropertyVariant(VehicleProperty::VehiclePowerMode, "VehiclePowerMode","b",AbstractProperty::Read);
-               supportedChanged(re->supported());
+
        }
 };
 
@@ -99,7 +99,7 @@ public:
                 **/
                wantPropertyVariant(VehicleProperty::TripMeters, "TripMeters", "aq", AbstractProperty::ReadWrite);
 
-               supportedChanged(re->supported());
+
        }
 };
 
@@ -130,7 +130,7 @@ public:
                 *  @attributeComment \brief  Must return acceleration on the "Z" axis as 1/1000 G (gravitational force).
                 **/
                wantPropertyVariant(VehicleProperty::AccelerationZ, "Z", "q", AbstractProperty::Read);
-               supportedChanged(re->supported());
+
        }
 };
 
@@ -192,7 +192,7 @@ public:
                wantPropertyVariant(VehicleProperty::TransmissionMode,
                                                                                                                  "Mode", "y", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+
        }
 };
 
@@ -216,7 +216,7 @@ public:
                 *  @attributeComment \brief  Must return target Cruise Control speed in kilometers per hour (kph).
                 **/
                wantPropertyVariant(VehicleProperty::CruiseControlSpeed, "Speed", "q", AbstractProperty::Read);
-               supportedChanged(re->supported());
+
        }
 };
 
@@ -233,7 +233,7 @@ public:
                 *  @attributeComment \brief  Must return Wheel Brake status: Engaged = true, disengaged = false
                 **/
                wantPropertyVariant(VehicleProperty::WheelBrake, "Engaged", "b", AbstractProperty::Read);
-               supportedChanged(re->supported());
+
        }
 };
 
@@ -299,7 +299,7 @@ public:
                 *  @attributeComment \brief  Must return high beam status: on = true, off = false.
                 **/
                wantPropertyVariant(VehicleProperty::LightHighBeam, "HighBeam", "b", AbstractProperty::Read);
-               supportedChanged(re->supported());
+
        }
 };
 
@@ -330,7 +330,7 @@ public:
                 *  @attributeComment \brief  Must return center interior light status: on = true, off = false
                 **/
                wantPropertyVariant(VehicleProperty::InteriorLightCenter, "Center", "b", AbstractProperty::Read);
-               supportedChanged(re->supported());
+
        }
 };
 
@@ -347,7 +347,7 @@ public:
                 *  @attributeComment \brief  Must return horn status: on = true, off = false
                 **/
                wantPropertyVariant(VehicleProperty::Horn,"On","b",AbstractProperty::Read);
-               supportedChanged(re->supported());
+
        }
 };
 
@@ -391,7 +391,7 @@ public:
                 *  @attributeComment \brief  Must return average fuel 'economy' in kilometers per liter of fuel since last reset.  Setting this to any value should reset the counter to '0'
                 **/
                wantPropertyVariant(VehicleProperty::FuelAverageEconomy,"AverageEconomy", "q", AbstractProperty::ReadWrite);
-               supportedChanged(re->supported());
+
        }
 };
 
@@ -422,7 +422,7 @@ public:
                 *  @attributeComment \brief  Must return Engine Oil Pressure in kPa.
                 **/
                wantPropertyVariant(VehicleProperty::EngineOilPressure, "Pressure", "q", AbstractProperty::Read);
-               supportedChanged(re->supported());
+
        }
 };
 
@@ -460,7 +460,7 @@ public:
                 *  @attributeComment \brief  Must return direction in Degrees  (0-360)
                 **/
                wantPropertyVariant(VehicleProperty::Direction, "Direction", "q", AbstractProperty::Read);
-               supportedChanged(re->supported());
+
        }
 };
 
index 87ff7a8..83ea0f1 100644 (file)
@@ -15,9 +15,9 @@ UncategorizedPropertyInterface::UncategorizedPropertyInterface(VehicleProperty::
 
        std::string signature = g_variant_get_type_string(temp->toVariant());
 
-       propertyDBusMap[prop] = new VariantType(re, signature, prop, VariantType::ReadWrite, this);
+       propertyDBusMap[prop] = new VariantType(re, signature, prop, prop, VariantType::ReadWrite, this);
 
        delete temp;
 
-       supportedChanged(re->supported());
+
 }
index 57b5f14..51685a0 100644 (file)
@@ -2,12 +2,13 @@
 #include "abstractroutingengine.h"
 #include "debugout.h"
 
-VariantType::VariantType(AbstractRoutingEngine* re, std::string signature, std::string propertyName,  Access access, AbstractDBusInterface *interface)
+VariantType::VariantType(AbstractRoutingEngine* re, std::string signature, VehicleProperty::Property ambPropertyName, std::string propertyName,  Access access, AbstractDBusInterface *interface)
        :AbstractProperty(propertyName, signature, access, interface), mInitialized(false)
 {
+       mAmbPropertyName = ambPropertyName;
        routingEngine = re;
        //set default value:
-       setValue(VehicleProperty::getPropertyTypeForPropertyNameValue(propertyName));
+       setValue(VehicleProperty::getPropertyTypeForPropertyNameValue(mAmbPropertyName));
 }
 
 void VariantType::initialize()
@@ -15,7 +16,7 @@ void VariantType::initialize()
        if(mInitialized) return;
 
        AsyncPropertyRequest request;
-       request.property = mPropertyName;
+       request.property = mAmbPropertyName;
        request.sourceUuidFilter = mSourceFilter;
        request.zoneFilter = mZoneFilter;
 
@@ -39,7 +40,7 @@ GVariant *VariantType::toGVariant()
 {
        if(!value())
        {
-               AbstractPropertyType* v = VehicleProperty::getPropertyTypeForPropertyNameValue(mPropertyName);
+               AbstractPropertyType* v = VehicleProperty::getPropertyTypeForPropertyNameValue(mAmbPropertyName);
 
                setValue(v);
 
@@ -53,11 +54,11 @@ GVariant *VariantType::toGVariant()
 
 void VariantType::fromGVariant(GVariant *val)
 {
-       AbstractPropertyType* v = VehicleProperty::getPropertyTypeForPropertyNameValue(mPropertyName);
+       AbstractPropertyType* v = VehicleProperty::getPropertyTypeForPropertyNameValue(mAmbPropertyName);
        v->fromVariant( val );
 
        AsyncSetPropertyRequest request;
-       request.property = mPropertyName;
+       request.property = mAmbPropertyName;
        request.value = v;
        request.completed = [](AsyncPropertyReply* reply)
        {
index cf498e8..a6d3b89 100644 (file)
@@ -8,7 +8,7 @@ class VariantType: public AbstractProperty
 {
 public:
 
-       VariantType(AbstractRoutingEngine* re, string signature, string propertyName, Access access, AbstractDBusInterface* interface);
+       VariantType(AbstractRoutingEngine* re, string signature, VehicleProperty::Property ambPropertyName, string propertyName, Access access, AbstractDBusInterface* interface);
 
        void initialize();
 
index bdfcc26..c4fd4d6 100644 (file)
@@ -28,7 +28,7 @@ public:
                 **/
                wantPropertyVariant(VehicleProperty::VIN, "VIN", "s", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -60,7 +60,7 @@ public:
                 **/
                wantPropertyVariant(VehicleProperty::VehicleLength, "Length", "u", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -100,7 +100,7 @@ public:
                 **/
                wantPropertyVariant(VehicleProperty::FuelPositionSide, "RefuelPosition", "y", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -127,7 +127,7 @@ public:
                 **/
                wantPropertyVariant(VehicleProperty::VehicleType, "Type", "y", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -148,7 +148,7 @@ public:
                 **/
                wantPropertyVariant(VehicleProperty::DoorsPerRow, "DoorsPerRow", "ay", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -172,7 +172,7 @@ public:
                 **/
                wantPropertyVariant(VehicleProperty::TransmissionGearType, "TransmissionGearType", "y", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };
 
@@ -212,7 +212,7 @@ public:
                 **/
                wantPropertyVariant(VehicleProperty::AntilockBrakingSystem, "AntilockBrakingSystem", "b", AbstractProperty::Read);
 
-               supportedChanged(re->supported());
+               
        }
 };