2 Copyright (C) 2012 Intel Corporation
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.
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.
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
23 #include "abstractsink.h"
24 #include "abstractsource.h"
25 #include "abstractroutingengine.h"
27 #include <unordered_map>
30 class Core: public AbstractRoutingEngine
38 void setSupported(PropertyList supported, AbstractSource* source);
39 void updateSupported(PropertyList added, PropertyList removed, AbstractSource* source);
40 void updateProperty(AbstractPropertyType* value, const std::string &uuid);
44 void registerSink(AbstractSink *self);
45 void unregisterSink(AbstractSink *self);
46 AsyncPropertyReply* getPropertyAsync(AsyncPropertyRequest request);
47 AsyncRangePropertyReply* getRangePropertyAsync(AsyncRangePropertyRequest request);
48 AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
49 bool subscribeToProperty(VehicleProperty::Property, AbstractSink* self);
50 bool subscribeToProperty(VehicleProperty::Property, std::string sourceUuidFilter, AbstractSink *self);
51 bool subscribeToProperty(VehicleProperty::Property, std::string sourceUuidFilter, Zone::Type zoneFilter, AbstractSink *self);
52 bool unsubscribeToProperty(VehicleProperty::Property, AbstractSink* self);
53 PropertyList supported();
55 PropertyInfo getPropertyInfo(VehicleProperty::Property, std::string sourceUuid);
56 std::list<std::string> sourcesForProperty(VehicleProperty::Property property);
59 Performance(): propertiesPerSecond(0), firedPropertiesPerSecond(0) {}
60 int propertiesPerSecond;
61 int firedPropertiesPerSecond;
66 void handleAddSupported(const PropertyList& added, AbstractSource* source);
67 void handleRemoveSupported(const PropertyList& removed, AbstractSource* source);
68 AbstractSource* sourceForProperty(const VehicleProperty::Property& property, const std::string& sourceUuidFilter = "") const;
72 //typedef std::map< Zone::Type, AbstractPropertyType> ZonePropertyType;
74 // to support zone filtering replace VehicleProperty::Property with ZonePropertyType
75 std::multimap<AbstractSource*, VehicleProperty::Property> mMasterPropertyList;
77 // K = AbstractSource::uuid(), T = AbstractSource*
78 std::unordered_map<std::string, AbstractSource*> mSources;
79 std::set<AbstractSink*> mSinks;
81 Performance performance;
83 // std::string here is AbstractSource::uuid()
84 typedef std::map<AbstractSink*, std::string> FilteredSourceSinkMap;
86 // to support zone filtering replace VehicleProperty::Property with ZonePropertyType
87 std::unordered_map<VehicleProperty::Property, FilteredSourceSinkMap > propertySinkMap;