dbus plugin updates
[profile/ivi/automotive-message-broker.git] / plugins / dbus / dbusplugin.cpp
1 /*
2         Copyright (C) 2012  Intel Corporation
3
4         This library is free software; you can redistribute it and/or
5         modify it under the terms of the GNU Lesser General Public
6         License as published by the Free Software Foundation; either
7         version 2.1 of the License, or (at your option) any later version.
8
9         This library is distributed in the hope that it will be useful,
10         but WITHOUT ANY WARRANTY; without even the implied warranty of
11         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12         Lesser General Public License for more details.
13
14         You should have received a copy of the GNU Lesser General Public
15         License along with this library; if not, write to the Free Software
16         Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18
19
20 #include "dbusplugin.h".h"
21 #include "abstractroutingengine.h"
22 #include "debugout.h"
23
24 extern "C" AbstractSinkManager * create(AbstractRoutingEngine* routingengine)
25 {
26         return new DBusSinkManager(routingengine);
27 }
28
29 DBusSink::DBusSink(AbstractRoutingEngine* engine): AbstractSink(engine)
30 {
31         routingEngine->subscribeToProperty(VehicleProperty::EngineSpeed, this);
32         routingEngine->subscribeToProperty(VehicleProperty::VehicleSpeed, this);
33
34         AsyncPropertyRequest velocityRequest;
35         velocityRequest.property = VehicleProperty::VehicleSpeed;
36         velocityRequest.completed = [](AsyncPropertyReply* reply) { DebugOut()<<"Velocity Async request completed: "<<boost::any_cast<uint16_t>(reply->value)<<endl; };
37
38         AsyncPropertyReply* reply = routingEngine->getPropertyAsync(velocityRequest);
39 }
40
41
42 PropertyList DBusSink::subscriptions()
43 {
44
45 }
46
47 void DBusSink::supportedChanged(PropertyList supportedProperties)
48 {
49
50 }
51
52 void DBusSink::propertyChanged(VehicleProperty::Property property, boost::any value, std::string uuid)
53 {
54         DebugOut()<<VehicleProperty::name(property)<<" value: "<<boost::any_cast<uint16_t>(value)<<endl;
55 }
56
57 std::string DBusSink::uuid()
58 {
59         return "c2e6cafa-eef5-4b8a-99a0-0f2c9be1057d";
60 }