changed async reply callback argument
authorKevron Rees <tripzero.kev@gmail.com>
Fri, 17 Aug 2012 01:54:26 +0000 (18:54 -0700)
committerKevron Rees <tripzero.kev@gmail.com>
Fri, 17 Aug 2012 01:54:26 +0000 (18:54 -0700)
lib/abstractroutingengine.h
plugins/exampleplugin.cpp
plugins/examplesink.cpp

index 695b497..627b803 100644 (file)
 
 class AbstractSink;
 class AbstractSource;
+class AsyncPropertyReply;
 
-typedef std::function<void (void)> CompletedSignal;
+
+typedef std::function<void (AsyncPropertyReply*)> CompletedSignal;
 
 class AsyncPropertyRequest
 {
index a79e502..64e7cc4 100644 (file)
@@ -75,12 +75,12 @@ void ExampleSourcePlugin::getPropertyAsync(AsyncPropertyReply *reply)
        if(reply->property == VehicleProperty::VehicleSpeed)
        {
                reply->value = velocity;
-               reply->completed();
+               reply->completed(reply);
        }
        else if(reply->property == VehicleProperty::EngineSpeed)
        {
                reply->value = engineSpeed;
-               reply->completed();
+               reply->completed(reply);
        }
 }
 
index 193be18..e72ba5d 100644 (file)
@@ -33,7 +33,7 @@ ExampleSink::ExampleSink(AbstractRoutingEngine* engine): AbstractSink(engine)
 
        AsyncPropertyRequest velocityRequest;
        velocityRequest.property = VehicleProperty::VehicleSpeed;
-       velocityRequest.completed = [](void) { DebugOut()<<"Velocity Async request completed"<<endl; };
+       velocityRequest.completed = [](AsyncPropertyReply* reply) { DebugOut()<<"Velocity Async request completed: "<<boost::any_cast<uint16_t>(reply->value)<<endl; };
 
        AsyncPropertyReply* reply = routingEngine->getPropertyAsync(velocityRequest);
 }