Change for websocket port to be 7681
[profile/ivi/automotive-message-broker.git] / plugins / examplesink.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 "examplesink.h"
21 #include "abstractroutingengine.h"
22 #include "debugout.h"
23
24 extern "C" AbstractSinkManager * create(AbstractRoutingEngine* routingengine)
25 {
26         return new ExampleSinkManager(routingengine);
27 }
28
29 ExampleSink::ExampleSink(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 ExampleSink::subscriptions()
43 {
44
45 }
46
47 void ExampleSink::supportedChanged(PropertyList supportedProperties)
48 {
49
50 }
51
52 void ExampleSink::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 ExampleSink::uuid()
58 {
59         return "f7e4fab2-eb73-4842-9fb0-e1c550eb2d81";
60 }