RDK Documentation (Open Sourced RDK Components)
Tuner.h
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 
21 /**
22 * @defgroup trm
23 * @{
24 * @defgroup common
25 * @{
26 **/
27 
28 
29 #ifndef _TRM_TUNER_H
30 #define _TRM_TUNER_H
31 
32 #include <string>
33 #include <vector>
34 #include <list>
35 #include <map>
36 
37 #include "trm/TunerReservation.h"
38 #include "trm/Activity.h"
39 #include "trm/TunerState.h"
40 
41 TRM_BEGIN_NAMESPACE
42 
43 class Tuner
44 {
45 public:
46  typedef std::list<std::string> IdList;
47 
48  typedef std::map<std::string, TunerReservation> ReservationCT;
49  Tuner(const std::string & internalId);
50  const std::string &getId(void) const;
51  uint64_t getEndTime(const Activity &activity) const;
52 
53  TunerReservation::TokenList & getReservationTokens(TunerReservation::TokenList & tokens) const;
54  const TunerReservation &getReservation(const std::string &reservationToken) const;
55  TunerReservation &getReservation(const std::string &reservationToken);
56  const TunerReservation &getReservation(const Activity &activity, int reservationState, const std::string &serviceLocator="") const;
57 
58  const TunerState getState(void) const;
59  void setState(const TunerState &state);
60 
61  const std::string getServiceLocator(bool considerFutureToken = true) const;
62 
63  void addReservation(const TunerReservation & reservation);
64  void releaseReservation(const std::string & reservationToken);
65 
66 private:
67  bool assertTunerState(int state, int lowMark, int highMark);
68  std::string internalId;
69  ReservationCT reservations;
70 };
71 
72 TRM_END_NAMESPACE
73 
74 #endif
75 
76 
77 /** @} */
78 /** @} */
Tuner
Definition: Tuner.h:43