RDK Documentation (Open Sourced RDK Components)
Klass.cpp
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 #include <map>
30 
31 #include <iostream>
32 #include "trm/TRM.h"
33 #include "trm/Klass.h"
34 
35 LOCAL_BEGIN_NAMESPACE
36 
37 enum {
38  unknown = 0,
39  details,
40  activity,
41  tunerReservation,
42  tunerState,
43  responseStatus,
44 
45  messageBase,
46  noResponse,
47  requestBase,
48  responseBase,
49  notificationBase,
50  simpleTRMRequest,
51  simpleTRMResponse,
52 
53  reserveTuner,
54  reserveTunerResponse,
55 
56  releaseTunerReservation,
57  releaseTunerReservationResponse,
58 
59  validateTunerReservation,
60  validateTunerReservationResponse,
61 
62  cancelRecording,
63  cancelRecordingResponse,
64 
65  cancelLive,
66  cancelLiveResponse,
67 
68  getAllTunerIds,
69  getAllTunerIdsResponse,
70  getAllTunerStates,
71  getAllTunerStatesResponse,
72  getAllReservations,
73  getAllReservationsResponse,
74  getVersion,
75  getVersionResponse,
76  getAllConnectedDeviceIdsResponse,
77 
78  notifyTunerReservationUpdate,
79  notifyTunerReservationRelease,
80  notifyTunerReservationConflict,
81  notifyTunerStatesUpdate,
82  notifyTunerPretune,
83  notifyClientConnectionEvent,
84 
85  getTRMConnectionEvents,
86  updateTunerActivityStatus,
87  updateTunerActivityStatusResponse,
88 
89  MAX_ENUM_NUMBER
90 };
91 
92 LOCAL_END_NAMESPACE
93 
94 TRM_BEGIN_NAMESPACE
95 
96 const Enum<Klass> Klass::kUnknown (MAKE_PAIR(unknown));
97 const Enum<Klass> Klass::kDetails (MAKE_PAIR(details));
98 const Enum<Klass> Klass::kActivity (MAKE_PAIR(activity));
99 const Enum<Klass> Klass::kTunerReservation (MAKE_PAIR(tunerReservation));
100 const Enum<Klass> Klass::kTunerState (MAKE_PAIR(tunerState));
101 const Enum<Klass> Klass::kResponseStatus (MAKE_PAIR(responseStatus));
102 
103 const Enum<Klass> Klass::kMessageBase (MAKE_PAIR(messageBase));
104 const Enum<Klass> Klass::kNoResponse (MAKE_PAIR(noResponse));
105 const Enum<Klass> Klass::kRequestBase (MAKE_PAIR(requestBase));
106 const Enum<Klass> Klass::kResponseBase (MAKE_PAIR(responseBase));
107 const Enum<Klass> Klass::kNotificationBase (MAKE_PAIR(notificationBase));
108 const Enum<Klass> Klass::kSimpleTRMRequest (MAKE_PAIR(simpleTRMRequest));
109 const Enum<Klass> Klass::kSimpleTRMResponse (MAKE_PAIR(simpleTRMResponse));
110 
111 const Enum<Klass> Klass::kReserveTuner (MAKE_PAIR(reserveTuner));
112 const Enum<Klass> Klass::kReserveTunerResponse (MAKE_PAIR(reserveTunerResponse));
113 
114 const Enum<Klass> Klass::kReleaseTunerReservation (MAKE_PAIR(releaseTunerReservation));
115 const Enum<Klass> Klass::kReleaseTunerReservationResponse (MAKE_PAIR(releaseTunerReservationResponse));
116 
117 const Enum<Klass> Klass::kValidateTunerReservation (MAKE_PAIR(validateTunerReservation));
118 const Enum<Klass> Klass::kValidateTunerReservationResponse (MAKE_PAIR(validateTunerReservationResponse));
119 
120 const Enum<Klass> Klass::kCancelRecording (MAKE_PAIR(cancelRecording));
121 const Enum<Klass> Klass::kCancelRecordingResponse (MAKE_PAIR(cancelRecordingResponse));
122 
123 const Enum<Klass> Klass::kCancelLive (MAKE_PAIR(cancelLive));
124 const Enum<Klass> Klass::kCancelLiveResponse (MAKE_PAIR(cancelLiveResponse));
125 
126 const Enum<Klass> Klass::kGetAllTunerIds (MAKE_PAIR(getAllTunerIds));
127 const Enum<Klass> Klass::kGetAllTunerIdsResponse (MAKE_PAIR(getAllTunerIdsResponse));
128 const Enum<Klass> Klass::kGetAllTunerStates (MAKE_PAIR(getAllTunerStates));
129 const Enum<Klass> Klass::kGetAllTunerStatesResponse (MAKE_PAIR(getAllTunerStatesResponse));
130 const Enum<Klass> Klass::kGetAllReservations (MAKE_PAIR(getAllReservations));
131 const Enum<Klass> Klass::kGetAllReservationsResponse (MAKE_PAIR(getAllReservationsResponse));
132 const Enum<Klass> Klass::kGetVersion (MAKE_PAIR(getVersion));
133 const Enum<Klass> Klass::kGetVersionResponse (MAKE_PAIR(getVersionResponse));
134 
135 const Enum<Klass> Klass::kGetAllConnectedDeviceIdsResponse (MAKE_PAIR(getAllConnectedDeviceIdsResponse));
136 
137 
138 const Enum<Klass> Klass::kNotifyTunerReservationUpdate (MAKE_PAIR(notifyTunerReservationUpdate));
139 const Enum<Klass> Klass::kNotifyTunerReservationRelease (MAKE_PAIR(notifyTunerReservationRelease));
140 const Enum<Klass> Klass::kNotifyTunerReservationConflicts (MAKE_PAIR(notifyTunerReservationConflict));
141 const Enum<Klass> Klass::kNotifyTunerStatesUpdate (MAKE_PAIR(notifyTunerStatesUpdate));
142 const Enum<Klass> Klass::kNotifyTunerPretune (MAKE_PAIR(notifyTunerPretune));
143 const Enum<Klass> Klass::kNotifyClientConnectionEvent (MAKE_PAIR(notifyClientConnectionEvent));
144 
145 const Enum<Klass> Klass::kGetTRMConnectionEvents (MAKE_PAIR(getTRMConnectionEvents));
146 const Enum<Klass> Klass::kUpdateTunerActivityStatus (MAKE_PAIR(updateTunerActivityStatus));
147 const Enum<Klass> Klass::kUpdateTunerActivityStatusResponse (MAKE_PAIR(updateTunerActivityStatusResponse));
148 
149 
150 const std::vector<const Enum<Klass> * > & Klass::getEnums(void)
151 {
152  static std::vector<const Enum<Klass> * > enums_;
153  if (enums_.size() == 0) {
154  enums_.push_back(&Klass::kUnknown);
155  enums_.push_back(&Klass::kDetails);
156  enums_.push_back(&Klass::kActivity);
157  enums_.push_back(&Klass::kTunerReservation);
158  enums_.push_back(&Klass::kTunerState);
159  enums_.push_back(&Klass::kResponseStatus);
160 
161  enums_.push_back(&Klass::kMessageBase);
162  enums_.push_back(&Klass::kNoResponse);
163  enums_.push_back(&Klass::kRequestBase);
164  enums_.push_back(&Klass::kResponseBase);
165  enums_.push_back(&Klass::kNotificationBase);
166  enums_.push_back(&Klass::kSimpleTRMRequest);
167  enums_.push_back(&Klass::kSimpleTRMResponse);
168 
169  enums_.push_back(&Klass::kReserveTuner);
170  enums_.push_back(&Klass::kReserveTunerResponse);
171 
172  enums_.push_back(&Klass::kReleaseTunerReservation);
173  enums_.push_back(&Klass::kReleaseTunerReservationResponse);
174 
175  enums_.push_back(&Klass::kValidateTunerReservation);
176  enums_.push_back(&Klass::kValidateTunerReservationResponse);
177 
178  enums_.push_back(&Klass::kCancelRecording);
179  enums_.push_back(&Klass::kCancelRecordingResponse);
180 
181  enums_.push_back(&Klass::kCancelLive);
182  enums_.push_back(&Klass::kCancelLiveResponse);
183 
184  enums_.push_back(&Klass::kGetAllTunerIds);
185  enums_.push_back(&Klass::kGetAllTunerIdsResponse);
186 
187  enums_.push_back(&Klass::kGetAllTunerStates);
188  enums_.push_back(&Klass::kGetAllTunerStatesResponse);
189 
190  enums_.push_back(&Klass::kGetAllReservations);
191  enums_.push_back(&Klass::kGetAllReservationsResponse);
192 
193  enums_.push_back(&Klass::kGetAllConnectedDeviceIdsResponse);
194 
195 
196  enums_.push_back(&Klass::kGetVersion);
197  enums_.push_back(&Klass::kGetVersionResponse);
198 
199  enums_.push_back(&Klass::kNotifyTunerReservationUpdate);
200  enums_.push_back(&Klass::kNotifyTunerReservationRelease);
201  enums_.push_back(&Klass::kNotifyTunerReservationConflicts);
202  enums_.push_back(&Klass::kNotifyTunerStatesUpdate);
203  enums_.push_back(&Klass::kNotifyTunerPretune);
204  enums_.push_back(&Klass::kNotifyClientConnectionEvent);
205 
206  enums_.push_back(&Klass::kGetTRMConnectionEvents);
207 
208  enums_.push_back(&Klass::kUpdateTunerActivityStatus);
209  enums_.push_back(&Klass::kUpdateTunerActivityStatusResponse);
210 
211  Assert(enums_.size() == MAX_ENUM_NUMBER);
212  };
213 
214  return enums_;
215 }
216 
217 Klass::Klass(const Enum<Klass> &klass)
218 : klass(klass)
219 {
220 }
221 
222 Klass::Klass(const char *name)
223 : klass(Enum<Klass>::at(name))
224 {
225 }
226 
227 Klass::~Klass(void)
228 {
229 }
230 
231 TRM_END_NAMESPACE
232 
233 
234 
235 /** @} */
236 /** @} */