merge from 0.10
authorKevron Rees <kevron_m_rees@linux.intel.com>
Tue, 16 Jul 2013 21:38:19 +0000 (14:38 -0700)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Tue, 16 Jul 2013 21:39:07 +0000 (14:39 -0700)
ambd/core.cpp
lib/abstractroutingengine.h
lib/debugout.h
plugins/examplesink.cpp

index 8e96bb5..59ad1af 100644 (file)
@@ -201,12 +201,31 @@ std::list<std::string> Core::sourcesForProperty(VehicleProperty::Property proper
        return l;
 }
 
+struct UserData{
+       AbstractSink* sink;
+       PropertyList list;
+};
+
 void Core::registerSink(AbstractSink *self)
 {
        if(!ListPlusPlus<AbstractSink*>(&mSinks).contains(self))
        {
                mSinks.push_back(self);
        }
+
+       auto cb = [](gpointer userdata) {
+               UserData* foo = (UserData*)userdata;
+               foo->sink->supportedChanged(foo->list);
+
+               delete foo;
+               return (int)0;
+       };
+
+       UserData* foo = new UserData;
+       foo->sink = self;
+       foo->list = mMasterPropertyList;
+
+       g_timeout_add(0, (GSourceFunc) cb, foo);
 }
 
 void Core::unregisterSink(AbstractSink *self)
index e3439ed..8dd5133 100644 (file)
@@ -69,6 +69,8 @@ public:
                return *this;
        }
 
+       virtual ~AsyncPropertyRequest() { }
+
        VehicleProperty::Property property;
        std::string sourceUuidFilter;
        Zone::Type zoneFilter;
@@ -100,7 +102,7 @@ public:
                }
        }
 
-       ~AsyncPropertyReply()
+       virtual ~AsyncPropertyReply()
        {
                if(timeoutSource)
                {
@@ -143,6 +145,8 @@ public:
 
        }
 
+       virtual ~AsyncSetPropertyRequest() { }
+
        AbstractPropertyType* value;
 };
 
@@ -167,6 +171,8 @@ public:
                this->sourceUuid = request.sourceUuid;
        }
 
+       virtual ~AsyncRangePropertyRequest() {}
+
        VehicleProperty::Property property;
        std::string sourceUuid;
        GetRangedPropertyCompletedSignal completed;
index 1506c63..88bf9c6 100644 (file)
@@ -61,7 +61,7 @@ public:
 
                out.precision(15);
 
-               if(mDebugLevel <= debugThreshhold)
+               if(mDebugLevel <= debugThreshhold || mDebugLevel == Error || mDebugLevel == Warning)
                         out<<message<<" ";
                return *this;
        }
@@ -72,7 +72,7 @@ public:
 
                out.precision(15);
 
-               if(mDebugLevel <= debugThreshhold)
+               if(mDebugLevel <= debugThreshhold || mDebugLevel == Error || mDebugLevel == Warning)
                         out<<endl;
                return *this;
        }
@@ -83,7 +83,7 @@ public:
 
                out.precision(15);
 
-               if(mDebugLevel <= debugThreshhold)
+               if(mDebugLevel <= debugThreshhold || mDebugLevel == Error || mDebugLevel == Warning)
                         out<<val<<" ";
                return *this;
        }
index 51e3535..8fdcfdc 100644 (file)
@@ -34,7 +34,7 @@ ExampleSink::ExampleSink(AbstractRoutingEngine* engine, map<string, string> conf
        routingEngine->subscribeToProperty(VehicleProperty::EngineSpeed, this);
        routingEngine->subscribeToProperty(VehicleProperty::VehicleSpeed, this);
 
-       supportedChanged(routingEngine->supported());
+//     supportedChanged(routingEngine->supported());
 
 }
 
@@ -57,7 +57,7 @@ void ExampleSink::supportedChanged(PropertyList supportedProperties)
        velocityRequest.completed = [](AsyncPropertyReply* reply)
        {
                if(!reply->success)
-                       DebugOut(0)<<"Velocity Async request failed";
+                       DebugOut(DebugOut::Error)<<"Velocity Async request failed ("<<reply->error<<")"<<endl;
                else
                        DebugOut(0)<<"Velocity Async request completed: "<<reply->value->toString()<<endl;
                delete reply;
@@ -70,7 +70,7 @@ void ExampleSink::supportedChanged(PropertyList supportedProperties)
        vinRequest.completed = [](AsyncPropertyReply* reply)
        {
                if(!reply->success)
-                       DebugOut(0)<<"VIN Async request failed";
+                       DebugOut(DebugOut::Error)<<"VIN Async request failed ("<<reply->error<<")"<<endl;
                else
                        DebugOut(0)<<"VIN Async request completed: "<<reply->value->toString()<<endl;
                delete reply;
@@ -83,7 +83,7 @@ void ExampleSink::supportedChanged(PropertyList supportedProperties)
        wmiRequest.completed = [](AsyncPropertyReply* reply)
        {
                if(!reply->success)
-                       DebugOut(0)<<"WMI Async request failed";
+                       DebugOut(DebugOut::Error)<<"WMI Async request failed ("<<reply->error<<")"<<endl;
                else
                DebugOut(1)<<"WMI Async request completed: "<<reply->value->toString()<<endl;
                delete reply;
@@ -96,7 +96,7 @@ void ExampleSink::supportedChanged(PropertyList supportedProperties)
        batteryVoltageRequest.completed = [](AsyncPropertyReply* reply)
        {
                if(!reply->success)
-                       DebugOut(0)<<"BatteryVoltage Async request failed";
+                       DebugOut(DebugOut::Error)<<"BatteryVoltage Async request failed ("<<reply->error<<")"<<endl;
                else
                        DebugOut(1)<<"BatteryVoltage Async request completed: "<<reply->value->toString()<<endl;
                delete reply;
@@ -109,7 +109,7 @@ void ExampleSink::supportedChanged(PropertyList supportedProperties)
        doorsPerRowRequest.completed = [](AsyncPropertyReply* reply)
        {
                if(!reply->success)
-                       DebugOut(0)<<"Doors per row Async request failed";
+                       DebugOut(DebugOut::Error)<<"Doors per row Async request failed ("<<reply->error<<")"<<endl;
                else
                        DebugOut(1)<<"Doors per row: "<<reply->value->toString()<<endl;
                delete reply;
@@ -122,7 +122,7 @@ void ExampleSink::supportedChanged(PropertyList supportedProperties)
        airbagStatus.completed = [](AsyncPropertyReply* reply)
        {
                if(!reply->success)
-                       DebugOut(0)<<"Airbag Async request failed";
+                       DebugOut(DebugOut::Error)<<"Airbag Async request failed ("<<reply->error<<")"<<endl;
                else
                        DebugOut(1)<<"Airbag Status: "<<reply->value->toString()<<endl;
                delete reply;
@@ -135,7 +135,7 @@ void ExampleSink::supportedChanged(PropertyList supportedProperties)
        exteriorBrightness.completed = [](AsyncPropertyReply* reply)
        {
                if(!reply->success)
-                       DebugOut(0)<<"Exterior Brightness Async request failed";
+                       DebugOut(DebugOut::Error)<<"Exterior Brightness Async request failed ("<<reply->error<<")"<<endl;
                else
                        DebugOut(1)<<"Exterior Brightness: "<<reply->value->toString()<<endl;
                delete reply;