From 6491f8e11aff4df6eb4d0c7d29d324ae6653c39e Mon Sep 17 00:00:00 2001 From: Kevron Rees Date: Tue, 16 Jul 2013 14:38:19 -0700 Subject: [PATCH] merge from 0.10 --- ambd/core.cpp | 19 +++++++++++++++++++ lib/abstractroutingengine.h | 8 +++++++- lib/debugout.h | 6 +++--- plugins/examplesink.cpp | 16 ++++++++-------- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/ambd/core.cpp b/ambd/core.cpp index 8e96bb5..59ad1af 100644 --- a/ambd/core.cpp +++ b/ambd/core.cpp @@ -201,12 +201,31 @@ std::list Core::sourcesForProperty(VehicleProperty::Property proper return l; } +struct UserData{ + AbstractSink* sink; + PropertyList list; +}; + void Core::registerSink(AbstractSink *self) { if(!ListPlusPlus(&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) diff --git a/lib/abstractroutingengine.h b/lib/abstractroutingengine.h index e3439ed..8dd5133 100644 --- a/lib/abstractroutingengine.h +++ b/lib/abstractroutingengine.h @@ -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; diff --git a/lib/debugout.h b/lib/debugout.h index 1506c63..88bf9c6 100644 --- a/lib/debugout.h +++ b/lib/debugout.h @@ -61,7 +61,7 @@ public: out.precision(15); - if(mDebugLevel <= debugThreshhold) + if(mDebugLevel <= debugThreshhold || mDebugLevel == Error || mDebugLevel == Warning) out< 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 ("<error<<")"<value->toString()<success) - DebugOut(0)<<"VIN Async request failed"; + DebugOut(DebugOut::Error)<<"VIN Async request failed ("<error<<")"<value->toString()<success) - DebugOut(0)<<"WMI Async request failed"; + DebugOut(DebugOut::Error)<<"WMI Async request failed ("<error<<")"<value->toString()<success) - DebugOut(0)<<"BatteryVoltage Async request failed"; + DebugOut(DebugOut::Error)<<"BatteryVoltage Async request failed ("<error<<")"<value->toString()<success) - DebugOut(0)<<"Doors per row Async request failed"; + DebugOut(DebugOut::Error)<<"Doors per row Async request failed ("<error<<")"<value->toString()<success) - DebugOut(0)<<"Airbag Async request failed"; + DebugOut(DebugOut::Error)<<"Airbag Async request failed ("<error<<")"<value->toString()<success) - DebugOut(0)<<"Exterior Brightness Async request failed"; + DebugOut(DebugOut::Error)<<"Exterior Brightness Async request failed ("<error<<")"<value->toString()<