2 * Copyright (C) 2012, BMW AG
4 * This file is part of GENIVI Project AudioManager.
6 * Contributions are licensed to the GENIVI Alliance under one or more
7 * Contribution License Agreements.
10 * This Source Code Form is subject to the terms of the
11 * Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
12 * this file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 * \author Christian Mueller, christian.ei.mueller@bmw.de BMW 2011,2012
18 * For further information see http://www.genivi.org/.
25 #include "audiomanagertypes.h"
30 class CAmDatabaseHandlerInterface;
31 class CAmControlSender;
34 * Implements an autorouting algorithm for connecting sinks and sources via different audio domains.
39 CAmRouter(CAmDatabaseHandlerInterface* iDatabaseHandler, CAmControlSender* iSender);
41 am_Error_e getRoute(const bool onlyfree, const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_Route_s>& returnList);
44 am_Error_e findBestWay(am_sinkID_t sinkID, am_sourceID_t sourceID, std::vector<am_RoutingElement_s>& listRoute, std::vector<am_RoutingElement_s>::iterator routeIterator, std::vector<am_gatewayID_t>::iterator gatewayIterator);
45 void listPossibleConnectionFormats(const am_sourceID_t sourceID, const am_sinkID_t sinkID, std::vector<am_ConnectionFormat_e>& listFormats) const;
46 void listRestrictedOutputFormatsGateways(const am_gatewayID_t gatewayID, const am_ConnectionFormat_e sinkConnectionFormat, std::vector<am_ConnectionFormat_e>& listFormats) const;
47 CAmDatabaseHandlerInterface* mpDatabaseHandler; //!< pointer to database handler
48 CAmControlSender* mpControlSender; //!< pointer the controlsender - is used to retrieve information for the optimal route
52 * an item in the routing tree
54 class CAmRoutingTreeItem
57 CAmRoutingTreeItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID = 0, CAmRoutingTreeItem *parent = 0);
58 ~CAmRoutingTreeItem();
59 void appendChild(CAmRoutingTreeItem *newChild); //!< appends a new child
60 void returnChildItems(std::vector<CAmRoutingTreeItem*> listChildItems); //!< returns the list of childs
61 am_domainID_t returnDomainID() const; //!< returns the domainID of the tree
62 am_gatewayID_t returnGatewayID() const; //!< returns the gatewayID of the tree
63 CAmRoutingTreeItem* returnParent() const; //!< returns the parent item of the tree
65 std::vector<CAmRoutingTreeItem*> mListChildItems; //!< List of all child items
66 am_domainID_t mDomainID; //!< the domain ID of the item
67 am_gatewayID_t mGatewayID; //!< the gateway Id
68 CAmRoutingTreeItem *mpParentItem; //!< pointer to the parent item
77 CAmRoutingTree(const am_domainID_t rootDomainID);
79 CAmRoutingTreeItem* insertItem(const am_domainID_t domainID, const am_gatewayID_t gatewayID, CAmRoutingTreeItem *parent);
80 void getRoute(CAmRoutingTreeItem* targetItem, std::vector<am_gatewayID_t>& listGateways);
81 am_domainID_t returnRootDomainID() const;
82 CAmRoutingTreeItem* returnRootItem();
84 CAmRoutingTreeItem mRootItem; //!< pointer to root item
85 std::vector<CAmRoutingTreeItem*> mListChild; //!< list of all childs
89 #endif /* ROUTER_H_ */