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>
28 #include <unordered_set>
31 class Core: public AbstractRoutingEngine
39 void registerSource(AbstractSource *src);
40 void updateSupported(PropertyList added, PropertyList removed, AbstractSource* source);
41 void updateProperty(AbstractPropertyType* value, const std::string &uuid);
45 void registerSink(AbstractSink *self);
46 void unregisterSink(AbstractSink *self);
47 AsyncPropertyReply* getPropertyAsync(AsyncPropertyRequest request);
48 AsyncRangePropertyReply* getRangePropertyAsync(AsyncRangePropertyRequest request);
49 AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
50 uint subscribeToProperty(VehicleProperty::Property, AbstractRoutingEngine::PropertyChangedType, std::string pid="");
51 bool subscribeToProperty(VehicleProperty::Property, AbstractSink* self);
52 bool subscribeToProperty(VehicleProperty::Property, std::string sourceUuidFilter, AbstractSink *self);
53 bool subscribeToProperty(VehicleProperty::Property, std::string sourceUuidFilter, Zone::Type zoneFilter, AbstractSink *self);
54 bool unsubscribeToProperty(VehicleProperty::Property, AbstractSink* self);
55 void unsubscribeToProperty(uint handle);
56 PropertyList supported();
58 PropertyInfo getPropertyInfo(VehicleProperty::Property, std::string sourceUuid);
59 std::list<std::string> sourcesForProperty(VehicleProperty::Property property);
62 Performance(): propertiesPerSecond(0), firedPropertiesPerSecond(0) {}
63 int propertiesPerSecond;
64 int firedPropertiesPerSecond;
67 void inspectSupported();
71 void handleAddSupported(const PropertyList& added, AbstractSource* source);
72 void handleRemoveSupported(const PropertyList& removed, AbstractSource* source);
73 AbstractSource* sourceForProperty(const VehicleProperty::Property& property, const std::string& sourceUuidFilter = "") const;
77 //typedef std::map< Zone::Type, AbstractPropertyType> ZonePropertyType;
79 // to support zone filtering replace VehicleProperty::Property with ZonePropertyType
80 std::multimap<AbstractSource*, VehicleProperty::Property> mMasterPropertyList;
82 // K = AbstractSource::uuid(), T = AbstractSource*
83 std::unordered_set<AbstractSource*> mSources;
84 std::unordered_set<AbstractSink*> mSinks;
86 Performance performance;
88 // std::string here is AbstractSource::uuid()
89 typedef std::map<AbstractSink*, std::string> FilteredSourceSinkMap;
91 ///uint cbHandle, std::string uuid
92 typedef std::unordered_map<uint, std::string> FilteredSourceCbMap;
94 // to support zone filtering replace VehicleProperty::Property with ZonePropertyType
95 std::unordered_map<VehicleProperty::Property, FilteredSourceSinkMap > propertySinkMap;
96 std::unordered_map<VehicleProperty::Property, FilteredSourceCbMap> propertyCbMap;
97 std::unordered_map<uint, AbstractRoutingEngine::PropertyChangedType> handleCbMap;