RDK Documentation (Open Sourced RDK Components)
Activity.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  * @defgroup TRM_ACTIVITY Tuner Activity
22  * @ingroup TRM_MAIN
23  * This represents the request or granted usage of a tuner.
24  * @n @b Activity object represents the request or granted usage of a tuner.
25  * @n
26  * @code
27  * Activity := {
28  * "name" : [String] name,
29  * "details"(optional): <Details>,
30  * }
31  * @endcode
32  * @n
33  * The activity field represents the intended use of the tuner. Supported tuner activity names are:
34  * - @b Live: the tuner is used for Live (Live Streaming or Local Live).
35  * - @b Record: the tuner is used for Recording.
36  * - @b Hybrid: the tuner is reserved for Live and Record activity.
37  * - @b EAS: the tuner is used for EAS.
38  * @n
39  * When tuner sharing is allowed among these activities, a tuner may be reserved for multiple activities at a time.
40  * This is indicated by the state of the tuner. However, a single Tuner Reservation Request message can contain at most one activity.
41  * The details of activity is optional.
42  *
43  * @par Tuner Details
44  * Each activity may be associated with a set of details describing the activity.
45  * @n
46  * @code
47  * Details :=
48  * {
49  * "recordingId" : [String]
50  * "hot" : [String]
51  * }
52  * @endcode
53  *
54  * @defgroup TRM_ACTIVITY_CLASSES Tuner Activity Interface Classes
55  * @ingroup TRM_ACTIVITY
56  */
57 
58 /**
59 * @defgroup trm
60 * @{
61 * @defgroup common
62 * @{
63 **/
64 
65 
66 #ifndef TRM_ACTIVITY_H_
67 #define TRM_ACTIVITY_H_
68 
69 #include <string>
70 #include <iostream>
71 #include <map>
72 
73 #include "TRM.h"
74 #include "Enum.h"
75 
76 TRM_BEGIN_NAMESPACE
77 
78 /**
79  * @brief The Activity class represents the request or granted usage of a tuner.
80  * The activity field in the class represents the intended use of the tuner.
81  * Supported tuner activity names are:
82  * - @b Live: the tuner is used for Live (Live Streaming or Local Live)
83  * - @b Record: The tuner is used for Recording.
84  * - @b Hybrid: the tuner is reserved for Live and Record activity.
85  * - @b EAS: The tuner is used for EAS
86  * When tuner sharing is allowed among these activities, a tuner may be reserved for multiple
87  * activities at a time. This is indicated by the state of the tuner. However, a single Tuner
88  * Reservation message can contain at most one activity. The details filed which contains in the
89  * class is optional.
90  * @ingroup TRM_ACTIVITY_CLASSES
91  */
92 class Activity
93 {
94 public:
95  static const char *klassName(void) { return "Activity"; }
96 
97  typedef const std::string KeyT;
98  typedef const std::string ValT;
99  typedef int EnumType;
100 
101  static const Enum<Activity> kNone;
102  static const Enum<Activity> kLive;
103  static const Enum<Activity> kRecord;
104  static const Enum<Activity> kEAS;
105 
106  static const std::vector<const Enum<Activity> * > & getEnums(void);
107 
108  Activity(const Enum<Activity> &activity = kNone);
109  Activity(const char *);
110  ~Activity(void);
111 
112  const Enum<Activity> & getActivity(void) const;
113  bool hasDetails(void) const;
114  const std::string & getDetail(const std::string &key) const;
115  const std::map<KeyT,ValT> & getDetails(void) const;
116  void addDetail(const std::string &key, const std::string &value);
117  bool operator == (const Activity &that) const ;
118  void print(void) const;
119 
120 private:
121  Enum<Activity> activity;
122  std::map<KeyT,ValT> details;
123 };
124 
125 TRM_END_NAMESPACE
126 
127 #endif
128 
129 
130 /** @} */
131 /** @} */
TRM::Enum
Definition: Enum.h:42
TRM::Activity
The Activity class represents the request or granted usage of a tuner. The activity field in the clas...
Definition: Activity.h:92