RDK Documentation (Open Sourced RDK Components)
Messages.h
Go to the documentation of this file.
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  * @file Messages.h
22  */
23 
24 /**
25  * @defgroup TRM_MESSAGE TRM Messages
26  * @ingroup TRM_MAIN
27  * Certain information will be shared among messages, as described below.
28  *
29  * @par Custom Attributes
30  * @n
31  * Tuner State object represents state of the tuner.
32  * @n
33  * @code
34  * CustomAttributes :=
35  * {
36  * // JSON Entities defined by application
37  * }
38  * @endcode
39  * @n
40  * The CustomAttribute contains JSON Entities defined by the application. It is sent by the application when it requests for a
41  * tuner reservation. After the reservation is granted, and as long as the content of the reservation is not modified, the customAttributes
42  * will be present in any messages, including the asynchronous notifications, that contains the corresponding TunerRevervation.
43  * If a renewed TunerReservation also contains CustomAttribute, the new attributes object will take the place.
44  * See more on this in @b NotifyTunerReservationUpdate message.
45  * @n
46  * The lifetime of the object is then same as the lifetime of the @b TunerReversation itself.
47  *
48  * @defgroup TRM_GENERAL_MESSAGE TRM General Messages
49  * The messages will follow the request-response message exchange pattern.
50  * The general format of the request payload is:
51  * @code
52  * {
53  * RequestName : {
54  * "requestId" : [String] requestId,
55  * "device" : [String] device,
56  * }
57  * }
58  * @endcode
59  * The fields are defined as follows:
60  * - @b RequestName: the name of the request, it will vary for the operations.
61  * This generally should be the device where the request message originates.
62  * - @b requestId: a GUID used to match requests with responses.
63  * For every request, the client supplies a requestId that it can use to match the corresponding response.
64  * For every notification, the sender supplies a requestId.
65  * - @b device: the remote device making the request.
66  *
67  * The general format of the response payload is
68  *
69  * @code
70  * {
71  * response: {
72  * "requestId" : [String] requestId,
73  * <ResponseStatus>
74  * }
75  * }
76  * @endcode
77  *
78  * The fields are defined as follows:
79  *
80  * - @b requestId: matches the response to a request.
81  *
82  * @ingroup TRM_MESSAGE
83  *
84  * @defgroup TRM_NOTIFY_MSG TRM Notification Messages
85  * Notifications are asynchronous messages sent by TRM to token owners with regard to status update of an existing reservation.
86  * @ingroup TRM_MESSAGE
87  *
88  * @defgroup TRM_UTILITY_MSG TRM Utility Messages
89  * Utility Messages provide useful information about the status of the TRM.
90  * @ingroup TRM_MESSAGE
91  */
92 
93 /**
94  * @defgroup getVersion Get Version Number
95  * @ingroup TRM_UTILITY_MSG
96  *
97  * @par Get Version Number Message
98  * @n
99  * To get the TRM Server Version Number.
100  * @n
101  * TRM clients query for the server Version Number.
102  * The TRM server and client shall maintain backward compatibility.
103  * @n
104  * The message format:
105  * @n
106  * @code
107  * {
108  * "getVersion" : {
109  * "requestId" : [String] requestId,
110  * }
111  * }
112  * @endcode
113  * @n
114  * The details about the fields,
115  * @n
116  * - @b requestId : a GUID used to match requests with responses.
117  * For every request, the client supplies a requestId corresponding to the response.
118  *
119  * @par Get Version Number Response Message
120  * @n
121  * The Message Format,
122  * @n
123  * @code
124  * {
125  * getVersionResponse: {
126  * "requestId" : [String] requestId,
127  * <ResponseStatus>
128  * "version" : [String] version number
129  * }
130  * }
131  * @endcode
132  * @n
133  * - @b requestId : a GUID used to match requests with responses.
134  * For every request, the client supplies a requestId corresponding to the response.
135  * - @b version : Version number for which protocol is defined.
136  *
137  * @defgroup getAllTunerIds Get All Tuner Id's
138  * @ingroup TRM_UTILITY_MSG
139  *
140  * @par Get All Tuner Id's Message
141  * Requests for the unique ID that system has assigned to each tuner.
142  * The ID for each tuner is guaranteed to be unique within a same target host.
143  * @n
144  * The Message format,
145  * @n
146  * @code
147  * {
148  * "getAllTunerIds" : {
149  * "requestId" : [String] requestId,
150  * }
151  * }
152  * @endcode
153  * @n
154  * - @b requestId : a GUID used to match requests with responses.
155  * For every request, the client supplies a requestId corresponding to the response.
156  *
157  * @par Get All Tuner Id's Response Message
158  * @n
159  * Response for the unique ID that system has assigned to each tuner.
160  * The ID for each tuner is guaranteed to be unique within a same target host.
161  * @n
162  * The message format,
163  * @n
164  * @code
165  * {
166  * "getAllTunerIdsResponse" : {
167  * "requestId" : [String] requestId,
168  * <ResponseStatus>
169  * "tunerIds. : [String,...]
170  * }
171  * }
172  * @endcode
173  * @n
174  * - @b requestId : a GUID used to match requests with responses.
175  * For every request, the client supplies a requestId corresponding to the response.
176  * - @b tunerIds: An array of String. Each element is an ID of a tuner.
177  *
178  * @defgroup getAllTunerStates Get All Tuner States
179  * @ingroup TRM_UTILITY_MSG
180  *
181  * @par Get All Tuner States Message
182  * @n
183  * Requests for the State of all tuners on the system.
184  * Each tuner can be in any of the following state specified in 0.
185  * @n
186  * The message format,
187  * @n
188  * @code
189  * {
190  * "getAllTunerStates" : {
191  * "requestId" : [String] requestId,
192  * }
193  * }
194  * @endcode
195  * @n
196  * - @b requestId : a GUID used to match requests with responses.
197  * For every request, the client supplies a requestId corresponding to the response.
198  *
199  * @par Get All Tuner States Response Message
200  * @n
201  * Requests for all tuner reservations that are valid at the time of the request.
202  * @n
203  * The message format,
204  * @n
205  * @code
206  * {
207  * "getAllTunerStatesResponse" : {
208  * "requestId" : [String] requestId,
209  * <ResponseStatus>
210  * "allStates" : <AllTunerStates>
211  * "detailedStates" : <AllTunerDetailedStates>
212  * }
213  * }
214  * @endcode
215  * @n
216  * - @b tunerId: A string returned from getAllTunerIdsResponse.
217  * - @b AllTunerStates: An enumeration of tuner states at time of request.
218  * This is deprecated and replaced by "AllTunerDetailedStates" since 1.0.5.
219  * For backward compatibility, the 1.0.5 or newer TRM client should ignore this field if it is present in the response message.
220  *- @b AllTunerDetailedStates: An enumeration of detailed tuner states at time of request.
221  *
222  * @defgroup getAllReservations Get All Reservation
223  * @ingroup TRM_UTILITY_MSG
224  *
225  * @par Get All Reservation Message
226  * @n
227  * Requests for all tuner reservations that are valid at the time of the request.
228  * @n
229  * @code
230  * Filter :=
231  * {
232  * "device" (optional) : [String] device,
233  * "activity" (optional) : <Activity>,
234  * "tunerState" (optional) : <State>,
235  * }
236  * @endcode
237  * @n
238  * @code
239  * {
240  * "getAllReservations" : {
241  * "requestId" : [String] requestId,
242  * "filters" : [<Filter>,...]
243  * }
244  * }
245  * @endcode
246  * @n
247  * The fields are defined as follows:
248  * @n
249  * - @b filters: An array of filtering values, each filter can contain any number of conditions.
250  * Valid condition include device, Activity, State. If a filter has multiple conditions,
251  * these conditioned are AND.d to generate the final result. If there are multiple filters,
252  * these filters are OR.d to generate the final result.
253  *
254  * @par Get All Reservation Response Message
255  * @n
256  * @b getAllReservationsResponse requests for all tuner reservations that are valid at the time of the request.
257  * @n
258  * @code
259  * AllTunerReservations := {
260  * <tunerId> : [<TunerReservation>, ...]
261  * }
262  * @endcode
263  * @n
264  * @code
265  * {
266  * "getAllReservationsResponse" : {
267  * "requestId" : [String] requestId,
268  * "allTunerReservations" : <AllTunerReservations> ...
269  * }
270  * }
271  * @endcode
272  * @n
273  * The fields are defined as follows,
274  * @n
275  * - @b tunerId: A string returned from getAllTunerIdsResponse.
276  * Each tunerId maps to an array of tunerReservation currently active on the tuner.
277  */
278 
279 /**
280  * @defgroup notifyTunerReservationConflict Notify Tuner Reservation Conflict
281  * @ingroup TRM_NOTIFY_MSG
282  *
283  * @b notifyTunerReservationConflict is an asynchronous notification from TRM to the owner of a token
284  * that a tuner reservation is about to be terminated, unless the owner initiates to resolve the conflict.
285  * If no conflict resolution is provided, the current reservation will be terminated automatically at the
286  * startTime of the new reservation. The owner of current reservation will receive
287  * notifyTunerReservationRelease notification when its reservation is released by TRM.
288  * If any value of the tunerReservation does not match those held by the owner, the notifyTunerConflict
289  * should be discarded. This can happen if user has changed tuner activity after the notifyTunerConflict is sent.
290  *
291  * The message format,
292  *
293  * @code
294  * {
295  * "notifyTunerReservationConflict" : {
296  * "requestId" : [String] requestId,
297  * "tunerReservation" :
298  * <TunerReservation>
299  * "conflicts" : [<TunerReservation>]
300  * }
301  * }
302  * @endcode
303  *
304  * The fields are defined as follows:
305  *
306  * - @b requestId : a GUID used to match requests with responses.
307  * For every request, the client supplies a requestId corresponding to the response.
308  * - @b tunerReservation: details of the current reservation that has to be cancelled as a result of the conflict.
309  * This reservation is in conflict with those listed in conflicts. Upon notification, the owner must initialize
310  * conflict resolution if it wishes to retain its reservation.
311  * - @b conflicts: one or more reservations that are going to override current reservation.
312  * The reservations listed in most conflicts will be cancelled if the owner wishes to retain the reservation in tunerReservation.
313  *
314  * @defgroup NotifyTunerReservationRelease Notify Tuner Reservation Release
315  * @ingroup TRM_NOTIFY_MSG
316  * @b NotifyTunerReservationRelease is an Asynchronous Notification from TRM to the owner of a token that its
317  * tuner reservation has been terminated. The token is no longer valid after receiving this message.
318  *
319  * The message format,
320  *
321  * @code
322  * {
323  * "notifyTunerReservationRelease" : {
324  * "requestId" : [String] requestId,
325  * "reservationToken" : [String] reservationToken
326  * "reason" : [String] reason
327  * }
328  * }
329  * @endcode
330  *
331  * The fields are defined as follows:
332  *
333  * - @b requestId : a GUID used to match requests with responses.
334  * For every request, the client supplies a requestId corresponding to the response.
335  * - @b reservationToken: the tuner reservation that is terminated.
336  * - @b reason: a message explaining why the reservation is terminated.
337  *
338  * @defgroup NotifyTunerStatesUpdate Notify Tuner State Update
339  * @ingroup TRM_NOTIFY_MSG
340  * @b NotifyTunerStatesUpdate is an Asynchronous Notification from TRM whenever a tuner has changed it state.
341  * The TRM client can listen for this notification and keep a local cache of the tuner states.
342  * Note the payload represents the states when the message is generated.
343  * Tuner states could change after the message is sent.
344  *
345  * The message format
346  *
347  * @code
348  * {
349  * "notifyTunerStatesUpdate" : {
350  * "requestId" : [String] requestId,
351  * "detailedState" : <AllTunerDetailedStates>
352  * }
353  * }
354  * @endcode
355  *
356  * The fields are defined as follows:
357  *
358  * - @b requestId : a GUID used to match requests with responses.
359  * For every request, the client supplies a requestId corresponding to the response.
360  * - @b detailedStates: state Information about each tuner.
361  *
362  * @defgroup NotifyTuneReservationUpdate Notify Tuner Reservation Update
363  * @ingroup TRM_NOTIFY_MSG
364  *
365  * @b NotifyTuneReservationUpdate is an Asynchronous Notification from TRM whenever a reservation has changed
366  * its usage by its owner. The Server can listen for this notification and synchronize its cached value with the
367  * new reservation. In the update message, these fields are guaranteed to be the original value associated with the reservation.
368  * - tunerReservation::reservationToken
369  * - tunerReservation::device
370  * - tunerReservation::activity
371  * - tunerReservation::customAttributes
372  *
373  * The message format,
374  *
375  * @code
376  * {
377  * "notifyTunerReservationUpdate" : {
378  * "requestId" : [String] requestId,
379  * "tunerReservation" : <TunerReservation>
380  * }
381  * }
382  * @endcode
383  *
384  * The fields are defined as follows,
385  *
386  * - @b requestId : a GUID used to match requests with responses.
387  * For every request, the client supplies a requestId corresponding to the response.
388  * - @b tunerReservation: the reservation that has changed.
389  */
390 
391 /**
392  * @defgroup reserveTuner Reserve Tuner
393  * @ingroup TRM_GENERAL_MESSAGE
394  *
395  * @par Reserve Tuner Message
396  * @n
397  * The client uses this message to request, update or renew a reservation.
398  * When renewing a reservation, the tunerReservation contains an existing reservationToken
399  * and matching values of {device, activity}.
400  * @n
401  * Message format for @b reserveTuner
402  * @code
403  * {
404  * "reserveTuner" : {
405  * "requestId" : [String] requestId,
406  * "device" : [String] device,
407  * "tunerReservation" : <TunerReservation>
408  * }
409  * }
410  * @endcode
411  * @n
412  * Fields are defined as follows: @n
413  * - @b requestId : a GUID used to match requests with responses.
414  * For every request, the client supplies a requestId corresponding to the response.
415  * - @b device : the remote device making the request.
416  * - @b reservationToken : If present and valid in <tunerReservation>, the existing reservation will be updated.
417  * - @b tunerReservation : details of the requested, renewed or updated reservation. If the tunerReservation
418  * contains reservationToken entity, the request is to renew or update an existing
419  * reservation identified by the token. Only certain values of tokenReservation can be updated.
420  * The field should not be present in the initial ReserveTuner message. The value can only be created by TRM.
421  * - @b resurrect : If resurrect flag is on, then the TRM will accept.
422  *
423  * @par Reserve Tuner Response Message
424  * @n
425  * The tuner reservations included in the response are granted reservations. The requesting component
426  * (e.g Guide-App or Recorder) must comply with the granted reservations, or update the granted
427  * reservations with the actual tuner usage.
428  * @n
429  * Message format:
430  * @n
431  * @code
432  * "reserveTunerResponse" =:
433  * {
434  * "requestId" : [String] requestId,
435  * "status" : [String] status,
436  * "statusMessage" (optional) : [String] statusMessage
437  * "tunerReservation" : <TunerReservation>
438  * "conflicts" : [ [<TunerReservation>, ...], ...]
439  * }
440  * @endcode
441  * @n
442  * Attribute details:
443  * @n
444  * - @b requestId : a GUID (Globally Unique Identifier) used to match requests with responses. For every request,
445  * the client supplies a requestId that it can use to match the corresponding response.
446  * For every notification, the sender supplies a requestId.
447  * - @b status : is an enumeration of strings indicating the status of the request
448  * - @b statusMessage : is a string containing additional information about the status.
449  * - @b tunerReservation : the returned/granted reservation. This may or may not exist in the response message
450  * depending on the conflict resolution rules used by TRM. If present, its values may be different
451  * (in serviceLocator, or in startTime and such) from what are requested.
452  * When this field is present and there is no conflicts in the response, the owner of the token must
453  * comply with the activity in the response message. When this field is present and there is conflicts in the
454  * response, the granted tunerReservation is compatible to those listed in conflicts. The owner of the granted
455  * token must either accept the granted resolution as is or resolve the conflict without acting on the granted
456  * reservation. After conflict is resolved, and the resolution results in different from the granted reservation,
457  * the owner must update the granted token with the new values. When this field is not present, the owner of the
458  * token must initiate resolution and then try reservation again.
459  * - @b conflicts : an array of existing tuner reservations that is in conflict with the requested reservation.
460  *
461  * @defgroup releaseTunerReservation Release Tuner Reservation
462  * @ingroup TRM_GENERAL_MESSAGE
463  *
464  * @par Release Tuner Reservation Message
465  * @n
466  * The client can release an existing tuner reservation. Normally,
467  * a token need not be released if its owner device and activity have not changed.
468  * In this case a next TunerReservation request will update the same token with new values of
469  * { servicelocator, startTime, duration}.
470  * @n
471  * The format of releasing a reservation is,
472  * @n
473  * @code
474  * {
475  * "releaseTunerReservation" : {
476  * "requestId" : [String] requestId,
477  * "device" : [String] device,
478  * "reservationToken" : [String] reservationToken
479  * }
480  * }
481  * @endcode
482  * @n
483  * The fields are defined as follows:
484  * @n
485  * - @b requestId : a GUID (Globally Unique Identifier) used to match requests with responses. For every request,
486  * the client supplies a requestId that it can use to match the corresponding response.
487  * For every notification, the sender supplies a requestId.
488  * - @b device : the remote device making the request.
489  * - @b reservationToken: the reservation to be released.
490  * After successful release, the token is no longer valid and cannot be used in future messages.
491  * It is clients responsibility to stop the associated activity first before releasing the tuner reservation with TRM.
492  *
493  * @par Release Tuner Reservation Response Message
494  * @n
495  * The general format of the response payload is:
496  * @n
497  * @code
498  * {
499  * releaseTunerReservationResponse: {
500  * "requestId" : [String] requestId,
501  * <ResponseStatus>
502  * "reservationToken" : [String] reservationToken
503  * "released" : [String] released
504  * }
505  * }
506  * @endcode
507  * @n
508  * The fields are defined as follows:
509  * @n
510  * - @b reservationToken : the reservation released. After successful release, the token is no longer valid
511  * and cannot be used in future messages.
512  * - @b Released : a string of "true" or "false", indicating if an valid token is successfully released.
513  * If the token is not valid, the ResponseStatus will carry "MALFORMED_REQUEST"
514  *
515  * @defgroup validateTunerReservation Validate Tuner Reservation
516  * @ingroup TRM_GENERAL_MESSAGE
517  *
518  * @par Validate Tuner Reservation Message
519  * @n
520  * The client can validate an existing tuner reservation. A reservation is valid after it is created,
521  * and invalid after it is released either per client's request or upon receiving asynchronous notification from TRM.
522  * @n
523  * The format of validating a reservation is:
524  * @n
525  * @code
526  * {
527  * "validateTunerReservation" : {
528  * "requestId" [required] : [String] requestId,
529  * "device" [required] : [String] device,
530  * "reservationToken" [required] : [String] reservationToken
531  * }
532  * }
533  * @endcode
534  * @n
535  * The fields are defined as follows:
536  * @n
537  * - @b requestId : a GUID to be used for every request.
538  * - @b device : the remote device making the request.
539  * - @b reservationToken: The reservation to be validated.
540  *
541  * @par Validate Tuner Reservation Response Message
542  * @n
543  * The general format of the response payload is:
544  * @n
545  * @code
546  * {
547  * validateTunerReservationResponse: {
548  * "requestId" : [String] requestId,
549  * <ResponseStatus>
550  * "reservationToken" : [String] reservationToken
551  * "valid" : [String] valid
552  * }
553  * }
554  * @endcode
555  * @n
556  * The fields are defined below,
557  * @n
558  * - @b reservationToken: the reservation validated.
559  * - @b valid: a string of "true" or "false" indicates if the token is valid or not.
560  * The token is valid only if the reservationToken and device both match the record maintained by TRM.
561  *
562  * @defgroup cancelRecording Cancel Recording
563  * @ingroup TRM_GENERAL_MESSAGE
564  *
565  * @par Cancel Recording Message
566  * @n
567  * The client uses this message to request TRM to cancel the recording associated with the supplied
568  * reservationToken. After successful cancellation of the recording, the associated token is no longer valid.
569  * @n
570  * The message format,
571  * @n
572  * @code
573  * {
574  * "cancelRecording" : {
575  * "requestId" : [String] requestId,
576  * "reservationToken" : [String] reservationToken,
577  * }
578  * }
579  * @endcode
580  * @n
581  * The fields are defined as follows:
582  * @n
583  * - @b requestId : a GUID to be used for every request.
584  * - @b reservationToken: the token whose recording is to be cancelled. The activity of the token must be Record.
585  *
586  * @par Cancel Recording Response Message
587  * @n
588  * The response message to a CancelRecording request.
589  * @n
590  * @code
591  * {
592  * "cancelRecordingResponse" : {
593  * "requestId" : [String] requestId,
594  * <ResponseStatus>
595  * "reservationToken " : [String] reservationToken
596  * "cancelled" : cancelled
597  * }
598  * }
599  * @endcode
600  * @n
601  * The fields are defined as follows:
602  * @n
603  * - @b reservationToken: The reservation that is cancelled.
604  * - @b state: state of the tuner after reservation is cancelled.
605  * - @b cancelled: if the recording is cancelled. "false" is also returned if the recording does not exist.
606  *
607  * @defgroup TRM_MESSAGE_IFACE TRM Interface Classes
608  * Described the details about the classes used in Messages.
609  * @ingroup TRM_MESSAGE
610  */
611 
612 /**
613 * @defgroup trm
614 * @{
615 * @defgroup common
616 * @{
617 **/
618 
619 
620 #ifndef TRM_MESSAGES_H_
621 #define TRM_MESSAGES_H_
622 
623 #include <list>
624 #include <stdint.h>
625 
626 #include "TRM.h"
627 #include "Activity.h"
628 #include "TunerReservation.h"
629 #include "ResponseStatus.h"
630 #include "Klass.h"
631 
632 TRM_BEGIN_NAMESPACE
633 
634 enum MessageType {
635  Request = 0x1234,
636  Response = 0x1800,
637  Notification = 0x1400,
638  Unknown,
639 };
640 
642 {
643 public:
644  static const char *klassName(void) { return Klass::kMessageBase; }
645 
646  const std::string & getClassName(void) const
647  {
648  return className;
649  }
650 
651  const MessageType & getType(void) const
652  {
653  return type;
654  }
655 
656  const std::string & getUUID(void) const
657  {
658  return uuid;
659  }
660 
661  virtual void print(void) const
662  {
663  std::cout << "[OBJ][" << klassName() << "] className = " << className << std::endl;
664  }
665 protected:
666 
667  MessageBase(const std::string &className, MessageType type, const std::string &uuid)
668  : className(className), type(type), uuid(uuid) {}
669  virtual ~MessageBase(void) {};
670 
671 private:
672  std::string className;
673  MessageType type;
674  std::string uuid;
675 
676 };
677 
678 class NoResponse : public MessageBase
679 {
680 public:
681  static const char *klassName(void) { return Klass::kNoResponse; }
682 
683  NoResponse(const std::string &uuid/*uuid*/)
684  : MessageBase(klassName(), Response, uuid)
685  {
686  }
687 };
688 
689 
690 class RequestBase : public MessageBase
691 {
692 public:
693  static const char *klassName(void) { return Klass::kRequestBase; }
694 
695  RequestBase(const std::string &className, const std::string &uuid, const std::string &device)
696  : MessageBase(className, Request, uuid), device(device)
697  {
698  };
699 
700  RequestBase(const std::string &className, const std::string &uuid)
701  : MessageBase(className, Request, uuid), device("")
702  {
703  };
704 
705  virtual void print(void) const
706  {
707  MessageBase::print();
708  std::cout << "[OBJ][" << klassName() << "] uuid = " << getUUID() << std::endl;
709  if (!device.empty())
710  std::cout << "[OBJ][" << klassName() << "] device = " << getDevice() << std::endl;
711 
712  };
713 
714  const std::string &getDevice(void) const {
715  return device;
716  }
717 protected:
718  std::string device;
719 
720 };
721 
722 
723 class ResponseBase : public MessageBase
724 {
725 public:
726 
727  typedef NoResponse ResponseType;
728 
729  static const char *klassName(void) { return Klass::kResponseBase; }
730 
731  ResponseBase(const std::string & className,
732  const std::string & uuid,
733  const ResponseStatus & status)
734  : MessageBase(className, Response, uuid),
735  status(status)
736  {
737  };
738 
739  const ResponseStatus & getStatus(void) const {
740  return status;
741  }
742 
743  ResponseStatus & getStatus(void) {
744  return status;
745  }
746 
747  virtual void print(void) const
748  {
749  MessageBase::print();
750  status.print();
751  };
752 
753 protected:
754  ResponseStatus status;
755 };
756 
758 {
759 public:
760  typedef NoResponse ResponseType;
761 
762  static const char *klassName(void) { return Klass::kNotificationBase; }
763 
764  NotificationBase(const std::string &className, const std::string &uuid)
765  : MessageBase(className, Notification, uuid)
766  {
767  };
768 
769  virtual void print(void) const
770  {
771  MessageBase::print();
772  std::cout << "[OBJ][" << klassName() << "] uuid = " << getUUID() << std::endl;
773  };
774 };
775 
776 typedef MessageBase Message;
777 
779 {
780 public:
781  static const char *klassName(void) { return Klass::kSimpleTRMRequest; }
782 
783  virtual void print(void) const
784  {
785  RequestBase::print();
786  if (!reservationToken.empty())
787  std::cout << "[OBJ][" << klassName() << "]reservationToken = " << reservationToken<< std::endl;
788  }
789 
790  const std::string & getReservationToken(void) const
791  {
792  return reservationToken;
793  }
794 
795 public:
796  SimpleTRMRequest(const std::string &className, const std::string &uuid, const std::string &device, const std::string & reservationToken)
797  : RequestBase( className, uuid, device),
798  reservationToken(reservationToken)
799  {
800  }
801 
802  SimpleTRMRequest(const std::string &className, const std::string &uuid, const std::string & reservationToken)
803  : RequestBase( className, uuid, ""),
804  reservationToken(reservationToken)
805  {
806  }
807 
808  virtual ~SimpleTRMRequest(void)
809  {
810  }
811 
812 
813 private:
814  std::string reservationToken;
815 };
816 
818 {
819 public:
820  static const char *klassName(void) { return Klass::kSimpleTRMResponse; }
821 
822  virtual void print(void) const
823  {
824  ResponseBase::print();
825  if (!reservationToken.empty())
826  std::cout << "reservationToken = " << reservationToken<< std::endl;
827  }
828 
829  const std::string & getReservationToken(void) const
830  {
831  return reservationToken;
832  }
833 
834 public:
835  SimpleTRMResponse(const std::string &className, const std::string &uuid,
836  const ResponseStatus &status, const std::string & reservationToken)
837  : ResponseBase( className, uuid, status),
838  reservationToken(reservationToken)
839  {
840  }
841 
842  virtual ~SimpleTRMResponse(void)
843  {
844  }
845 
846 private:
847  std::string reservationToken;
848 };
849 
850 /**
851  * @brief Class implementing the response message to a ReserveTuner request.
852  *
853  * The tuner reservations included in the response are granted reservations.
854  * The requesting component (e.g. Guide or Recorder) must comply with the granted reservations,
855  * or update the granted reservations with the actual tuner usage
856  * @ingroup TRM_MESSAGE_IFACE
857  */
859 {
860 public:
861  typedef std::list<TunerReservation> ReservationCT;
862  typedef std::list<TunerReservation> ConflictCT;
863 
864 
865  static const char *klassName(void) { return Klass::kReserveTunerResponse; }
866 
867  ReserveTunerResponse(const std::string &uuid = "")
868  : ResponseBase(klassName(), uuid, ResponseStatus::kOk) {}
869 
870  ReserveTunerResponse(const std::string &uuid,
871  const ResponseStatus &status,
872  const TunerReservation &tunerReservation)
873  : ResponseBase(klassName(), uuid, status),
874  tunerReservation(tunerReservation)
875  {
876  }
877 
878  ReserveTunerResponse(const std::string &uuid,
879  const ResponseStatus &status,
880  const ConflictCT &conflicts = ConflictCT ())
881  : ResponseBase(klassName(), uuid, status),
882  conflicts(conflicts)
883  {
884  }
885 
886 /**
887  * @brief This function is used to return the unique token generated when a reservation
888  * is created.
889  * This token will be used with the response message payload.
890  *
891  * @return Returns the already granted reservation token.
892  */
893  const TunerReservation & getTunerReservation(void) const {
894  return tunerReservation;
895  }
896 
897 /**
898  * @brief This function is used to set the input token which will
899  * be used to uniquely identify the response message.
900  *
901  * @param[in] tunerReservation A unique token that the requesting device can use to make the remote tuning request.
902  * @return None.
903  */
904  void setTunerReservation(const TunerReservation &tunerReservation) {
905  this->tunerReservation = tunerReservation;
906  }
907 
908 /**
909  * @brief This function returns an array of existing tuner reservations that is in
910  * conflict with the requested reservation
911  *
912  * @return Array of conflict reservations.
913  */
914  const ConflictCT & getConflicts(void) const {
915  return conflicts;
916  }
917 
918 /**
919  * @brief This function returns an array of existing tuner reservations that is in
920  * conflict with the requested reservation
921  *
922  * @return Array of conflict reservations.
923  */
924  ConflictCT & getConflicts(void) {
925  return conflicts;
926  }
927 
928 /**
929  * @brief This function adds a tuner reservation request to the array of existing tuner reservations that is in
930  * conflict with the requested reservation
931  *
932  * @param[in] reservation A unique token that the requesting device can use to make the remote tuning request.
933  * @return None.
934  */
935  void addConflict(const TunerReservation &reservation) {
936  conflicts.push_back(reservation);
937  }
938 
939 /**
940  * @brief This function prints the list of tuner reservations with all the conflicts if exist.
941  * It is used for debugging purpose.
942  *
943  * @return None.
944  */
945  virtual void print(void) const
946  {
947  ResponseBase::print();
948  if (conflicts.size() == 0) {
949  tunerReservation.print();
950  }
951  else {
952  ConflictCT::const_iterator itm;
953  for (itm = conflicts.begin(); itm != conflicts.end(); itm++) {
954  const TunerReservation & reservation = *itm;
955  reservation.print();
956  }
957  }
958  }
959 private:
960  TunerReservation tunerReservation;
961  ConflictCT conflicts;
962 };
963 
964 /**
965  * @brief Class implementing a Tuner reservation request, the client uses this message
966  * to request, update or renew a reservation.
967  *
968  * When renewing a reservation, the tunerReservation contains an existing reservationToken
969  * and matching values of {device, activity}
970  * @ingroup TRM_MESSAGE_IFACE
971  */
972 class ReserveTuner : public RequestBase
973 {
974 public:
976 
977  static const char *klassName(void) { return Klass::kReserveTuner; }
978 
979  ReserveTuner(void)
980  : RequestBase(klassName(), "", "") {}
981 
982  ReserveTuner(const std::string &uuid, const std::string &device, const TunerReservation &tunerReservation, const std::string &resurrect ="false")
983  : RequestBase(klassName(), uuid, device), tunerReservation(tunerReservation),resurrect(resurrect)
984  {
985  }
986 
987  virtual ~ReserveTuner(void)
988  {
989  }
990 
991  virtual void print(void) const
992  {
993  RequestBase::print();
994  tunerReservation.print();
995  }
996 
997 /**
998  * @brief This function is used to return the unique token generated when a reservation
999  * is created. This token will be used when creating a reservation request message payload.
1000  *
1001  * If present and valid in <tunerReservation>, the existing reservation will be updated.
1002  * The field should not be present in the initial ReserveTuner message.
1003  *
1004  * @return Returns the existing reservation token.
1005  */
1007  {
1008  return tunerReservation;
1009  }
1010 
1011 /**
1012  * @brief This function is used to return the unique token generated when a reservation
1013  * is created. This token will be used when creating a reservation request message payload.
1014  *
1015  * If present and valid in <tunerReservation>, the existing reservation will be updated.
1016  * The field should not be present in the initial ReserveTuner message.
1017  *
1018  * @return Returns the existing reservation token.
1019  */
1021  {
1022  return tunerReservation;
1023  }
1024 
1025 /**
1026  * @brief This function is used to return the list of resurrect (dead) reservation tokens.
1027  *
1028  * A resurrect token is the one which the TRM server has lost due to re-set.
1029  *
1030  * @return Returns the array of resurrect reservation token.
1031  */
1032  const std::string & getResurrect(void) const
1033  {
1034  return resurrect;
1035  }
1036 
1037 private:
1038  TunerReservation tunerReservation;
1039  std::string resurrect;
1040 };
1041 
1042 /**
1043  * @brief Class implementing the response message payload for releasing Tuner reservation.
1044  * @ingroup TRM_MESSAGE_IFACE
1045  */
1047 {
1048 public:
1049  static const char *klassName(void) { return Klass::kReleaseTunerReservationResponse; }
1050 
1051  ReleaseTunerReservationResponse(const std::string &uuid = "", const std::string &reservationToken = "")
1052  : SimpleTRMResponse(klassName(), uuid, ResponseStatus(ResponseStatus::kOk), reservationToken), released(false) {} //CID:18199-Initialize released
1053 
1054  ReleaseTunerReservationResponse(const std::string &uuid,
1055  const ResponseStatus &status,
1056  const std::string &reservationToken,
1057  const bool &released)
1058  : SimpleTRMResponse(klassName(), uuid, status, reservationToken),
1059  released(released)
1060  {
1061  }
1062 
1063 /**
1064  * @brief This function is used to a return the value of released flag which may be
1065  * “true” or “false”, indicating if a valid token is successfully released or not.
1066  *
1067  * If the token is not valid, the ResponseStatus will carry “MALFORMED_REQUEST”
1068  *
1069  * @return Returns the value of released flag.
1070  * @retval true if token is released, false otherwise.
1071  */
1072  bool isReleased(void) const {return released;}
1073 
1074 /**
1075  * @brief This function is used to set the value of released flag with input value.
1076  *
1077  * A true value will be supplied in response message when a valid token is released successfully.
1078  *
1079  * @param [in] result Boolean value used for setting the released flag.
1080  */
1081  void setReleased(bool result) {released = result;}
1082 
1084 private:
1085  bool released;
1086 };
1087 
1088 /**
1089  * @brief Implements the message payload for releasing tuner reservation.
1090  *
1091  * Generally a release request is needed if the device owner or activity has changed.
1092  * @ingroup TRM_MESSAGE_IFACE
1093  */
1095 {
1096 public:
1097 
1099 
1100  static const char *klassName(void) { return Klass::kReleaseTunerReservation; }
1101 
1103  : SimpleTRMRequest(klassName(), "", ""){}
1104 
1105  ReleaseTunerReservation(const std::string &uuid, const std::string &device, const std::string & reservationToken)
1106  : SimpleTRMRequest(klassName(), uuid, device, reservationToken)
1107  {
1108  }
1109 
1110  ~ReleaseTunerReservation(void){}
1111 private:
1112 };
1113 
1114 /**
1115  * @brief Implements the response message payload for Tuner reservation validation requests.
1116  * @ingroup TRM_MESSAGE_IFACE
1117  */
1119 {
1120 public:
1121  static const char *klassName(void) { return Klass::kValidateTunerReservationResponse; }
1122 
1123  ValidateTunerReservationResponse(const std::string &uuid = "", const std::string &reservationToken = "")
1124  : SimpleTRMResponse(klassName(), uuid, ResponseStatus(ResponseStatus::kOk), reservationToken) , valid(true) {} //CID:18362-Initialize valid
1125 
1126  ValidateTunerReservationResponse(const std::string &uuid,
1127  const ResponseStatus &status,
1128  const std::string &reservationToken,
1129  const bool &valid)
1130  : SimpleTRMResponse(klassName(), uuid, status, reservationToken),
1131  valid(valid)
1132  {
1133  }
1134 
1135 /**
1136  * @brief This function returns whether the token requested is valid or not.
1137  *
1138  * A string of “true” or “false” indicates if the token is valid or not.
1139  * The token is valid only if the reservationToken and device both match the record maintained by TRM
1140  *
1141  * @return Returns a boolean value indicating the token is valid or not.
1142  */
1143  bool isValid(void) const {return valid;}
1144 
1145 /**
1146  * @brief This function sets the value of 'valid' flag for a validate tuner reservation response.
1147  *
1148  * A true value will be present in the "valid" field of response message if the token and device
1149  * both match in the record maintained by TRM.
1150  *
1151  * @param [in] result Boolean value used for setting the valid flag.
1152  */
1153  void setValid(bool result) {valid = result;}
1154 
1156 
1157 private:
1158  bool valid;
1159 };
1160 
1161 /**
1162  * @brief Implements the message format for client to validate an existing tuner reservation.
1163  *
1164  * A reservation is valid after it is created, and invalid after it is released either
1165  * per client’s request or upon receiving asynchronous notification from TRM.
1166  * @ingroup TRM_MESSAGE_IFACE
1167  */
1169 {
1170 public:
1171 
1173 
1174  static const char *klassName(void) { return Klass::kValidateTunerReservation; }
1175 
1177  : SimpleTRMRequest(klassName(), "", ""){}
1178 
1179  ValidateTunerReservation(const std::string &uuid,
1180  const std::string &device,
1181  const std::string &reservationToken)
1182  : SimpleTRMRequest(klassName(), uuid, device, reservationToken)
1183  {
1184  }
1185 
1186  ~ValidateTunerReservation(void){}
1187 private:
1188 };
1189 
1190 /**
1191  * @brief Implements payload for a response message against cancel recording request.
1192  * @ingroup TRM_MESSAGE_IFACE
1193  */
1195 {
1196 public:
1197  static const char *klassName(void) { return Klass::kCancelRecordingResponse; }
1198 
1199  CancelRecordingResponse(const std::string &uuid = "", const std::string &reservationToken = "")
1200  : SimpleTRMResponse(klassName(), uuid, ResponseStatus(ResponseStatus::kOk), reservationToken), canceled(false)
1201  {} //CID:18282-Initialize canceled
1202 
1203  CancelRecordingResponse(const std::string &uuid,
1204  const ResponseStatus &status,
1205  const std::string &reservationToken,
1206  const bool &canceled)
1207  : SimpleTRMResponse(klassName(), uuid, status, reservationToken),
1208  canceled(canceled)
1209  {
1210  }
1211 
1212 /**
1213  * @brief This function returns whether a recording is cancelled, this is used when preparing
1214  * the response message against a cancel recording request.
1215  *
1216  * @return Returns "true" if the recording is cancelled. “false” if the recording does not exist.
1217  */
1218  bool isCanceled(void) const {return canceled;}
1219 
1220 /**
1221  * @brief This function sets the value of "cancelled" field for the response message
1222  * of a cancel recording request.
1223  *
1224  * @param [in] result Boolean value used for setting the 'cancelled' flag.
1225  */
1226  void setCanceled(bool result) {canceled = result;}
1227 
1228  ~CancelRecordingResponse(void){}
1229 private:
1230  bool canceled;
1231 };
1232 
1233 /**
1234  * @brief Implements a message to cancel the recording.
1235  *
1236  * The client uses this message to request TRM to cancel the recording associated with
1237  * the supplied reservationToken. After successful cancellation of the recording,
1238  * the associated token is no longer valid.
1239  * @ingroup TRM_MESSAGE_IFACE
1240  */
1242 {
1243 public:
1244 
1246 
1247  static const char *klassName(void) { return Klass::kCancelRecording; }
1248 
1249  CancelRecording(void)
1250  : SimpleTRMRequest(klassName(), "", ""){}
1251 
1252  CancelRecording(const std::string &uuid, const std::string & reservationToken)
1253  : SimpleTRMRequest(klassName(), uuid, reservationToken)
1254  {
1255  }
1256 
1257  ~CancelRecording(void){}
1258 private:
1259 };
1260 
1261 /**
1262  * @brief Implements payload for a response message against cancel live streaming request.
1263  * @ingroup TRM_MESSAGE_IFACE
1264  */
1266 {
1267 public:
1268  static const char *klassName(void) { return Klass::kCancelLiveResponse; }
1269 
1270  CancelLiveResponse(const std::string &uuid = "", const std::string &reservationToken = "")
1271  : SimpleTRMResponse(klassName(), uuid, ResponseStatus(ResponseStatus::kOk), reservationToken),
1272  canceled(false), serviceLocator()
1273  {}
1274 
1275  CancelLiveResponse(const std::string &uuid,
1276  const ResponseStatus &status,
1277  const std::string &reservationToken,
1278  const std::string &serviceLocator,
1279  const bool &canceled)
1280  : SimpleTRMResponse(klassName(), uuid, status, reservationToken),
1281  canceled(canceled), serviceLocator(serviceLocator)
1282  {
1283  }
1284 
1285 /**
1286  * @brief This will return whether the Live session has been cancelled, this information
1287  * will be used in the response message of a cancel live streaming request.
1288  *
1289  * @return Returns true if the live streaming is cancelled, false otherwise.
1290  */
1291  bool isCanceled(void) const {return canceled;}
1292 
1293 /**
1294  * @brief This will update value of the "cancelled" flag which will be used in the response message
1295  * of a cancel live streaming request.
1296  *
1297  * @param [in] result Boolean value used for setting the 'cancelled' flag.
1298  */
1299  void setCanceled(bool result) {canceled = result;}
1300 
1301 /**
1302  * @brief This function returns a string containing the service Locator which will be used
1303  * while preparing response for a cancel live streaming request.
1304  *
1305  * @return Returns the service locator string.
1306  */
1307  const std::string &getServiceLocator() const{
1308  return serviceLocator;
1309  }
1310 
1311 /**
1312  * @brief This function sets value of the service Locator field which will be used in the
1313  * response message of a cancel live streaming request.
1314  *
1315  * @param [in] serviceLocator A string value representing the service locator (source locator).
1316  */
1317  void setServiceLocator(const std::string &serviceLocator) {
1318  this->serviceLocator = serviceLocator;
1319  }
1320  ~CancelLiveResponse(void){}
1321 private:
1322  bool canceled;
1323  std::string serviceLocator;
1324 };
1325 
1326 /**
1327  * @brief Implements a message to cancel the live streaming.
1328  *
1329  * The client uses this message to request TRM to cancel the live streaming session associated with
1330  * the supplied reservationToken. After successful cancellation of the session,
1331  * the associated token is no longer valid.
1332  * @ingroup TRM_MESSAGE_IFACE
1333  */
1335 {
1336 public:
1337 
1339 
1340  static const char *klassName(void) { return Klass::kCancelLive; }
1341 
1342  CancelLive(void)
1343  : SimpleTRMRequest(klassName(), "", ""){}
1344 
1345  CancelLive(const std::string &uuid, const std::string & serviceLocator, const std::string & reservationToken = "")
1346  : SimpleTRMRequest(klassName(), uuid, reservationToken), serviceLocator(serviceLocator)
1347  {
1348  }
1349 
1350 /**
1351  * @brief This function returns a string containing the service Locator which will be used
1352  * while preparing the cancel live streaming request.
1353  *
1354  * @return Returns the service locator string.
1355  */
1356  const std::string & getServiceLocator(void) const {
1357  return serviceLocator;
1358  }
1359 
1360 /**
1361  * @brief This function sets value of the service Locator field which will be used while
1362  * preparing the cancel live streaming request.
1363  *
1364  * @param[in] serviceLocator A string value representing the service locator (source locator).
1365  */
1366  void setServiceLocator(const std::string &serviceLocator) {
1367  this->serviceLocator = serviceLocator;
1368  }
1369  ~CancelLive(void){}
1370 private:
1371  std::string serviceLocator;
1372 };
1373 
1374 /**
1375  * @brief Implements the response message payload against a Tuner Id request.
1376  * @ingroup TRM_MESSAGE_IFACE
1377  */
1379 {
1380 public:
1381  static const char *klassName(void) { return Klass::kGetAllTunerIdsResponse; }
1382 
1383  GetAllTunerIdsResponse(const std::string &uuid = "")
1384  : SimpleTRMResponse(klassName(), uuid, ResponseStatus(ResponseStatus::kOk), "") {}
1385 
1386  GetAllTunerIdsResponse(const std::string &uuid,
1387  const ResponseStatus &status,
1388  const std::list<std::string> & tunerIds = std::list<std::string>())
1389  : SimpleTRMResponse(klassName(), uuid, status, ""),
1390  tunerIds(tunerIds)
1391  {
1392  }
1393 
1394 /**
1395  * @brief This function will return an array of tuner id.
1396  *
1397  * @return Returns an array of tuner Identifiers.
1398  */
1399  const std::list<std::string> & getTunerIds(void) const {
1400  return tunerIds;
1401  }
1402 
1403 /**
1404  * @brief This function will add a new tuner identifier to the list of tuner ID.
1405  *
1406  * @param [in] tid An unique tuner identifier.
1407  */
1408  void addTunerId(const std::string &tid) {
1409  tunerIds.push_back(tid);
1410  }
1411 
1412 /**
1413  * @brief This function will add a list of new tuner identifiers to existing array of tuner ID.
1414  *
1415  * @param [in] tid List of unique tuner identifiers.
1416  */
1417  void addTunerId(const std::list<std::string> &tid) {
1418  tunerIds.insert(tunerIds.end(), tid.begin(), tid.end());
1419  }
1420 
1421  void print(void) const {
1422  SimpleTRMResponse::print();
1423  std::list<std::string>::const_iterator it;
1424  for (it = tunerIds.begin(); it != tunerIds.end(); it++) {
1425  std::cout << "[OBJ][" << klassName() << "]tunerId = " << *it << std::endl;
1426  }
1427  }
1428  ~GetAllTunerIdsResponse(void){}
1429 
1430 private:
1431  std::list<std::string> tunerIds;
1432 };
1433 
1434 /**
1435  * @brief Implements the message payload format for requesting the system allocated Unique Id of tuner.
1436  * The ID for each tuner is guaranteed to be unique within the same target host.
1437  * @ingroup TRM_MESSAGE_IFACE
1438  */
1440 {
1441 public:
1442 
1444 
1445  static const char *klassName(void) { return Klass::kGetAllTunerIds; }
1446 
1447  GetAllTunerIds(void)
1448  : SimpleTRMRequest(klassName(), "", ""){}
1449 
1450  GetAllTunerIds(const std::string &uuid, const std::string &device="")
1451  : SimpleTRMRequest(klassName(), uuid, device, "")
1452  {
1453  }
1454 
1455  ~GetAllTunerIds(void){}
1456 private:
1457 };
1458 
1459 /**
1460  * @brief Class for implementing the detail state information of a single tuner.
1461  * @ingroup TRM_MESSAGE_IFACE
1462  */
1464 public:
1465  DetailedTunerState(const std::string &state="Free", const std::string &serviceLocator="")
1466  : state(state), serviceLocator(serviceLocator), reservedDeviceId("") {
1467 
1468  }
1469 
1470 /**
1471  * @brief This function will return the detailed state for the tuner.
1472  * @return Returns a string value containing the detailed tuner state.
1473  */
1474  const std::string getState() const {
1475  return state;
1476  }
1477 
1478 /**
1479  * @brief This function will Service Locator that has to be used in the Detailed State message.
1480  * @return Returns the Service Locator string.
1481  */
1482  const std::string getServiceLocator() const {
1483  return serviceLocator;
1484  }
1485 
1486 /**
1487  * @brief This function will return the Owners list in the form of activity and device
1488  * @return Returns the Owners list string.
1489  */
1490  const std::map<std::string, std::string> & getOwners(void) const {
1491  return owners;
1492  }
1493 
1494 /**
1495  * @brief This function will return the ReservedDeviceId for the tuner.
1496  *
1497  * If this value is present in the detailedStates, the corresponding tuner is can only be used in the following cases.
1498  * - LIVE streaming for the device represented by the reservedDeviceId.
1499  * - RECORD for any recording request, regardless of the recording’s originating device
1500  *
1501  * @return Returns the remote Device name making the request.
1502  */
1503  const std::string getReservedDeviceId() const {
1504  return reservedDeviceId;
1505  }
1506 /**
1507  * @brief This function will set the reserved Device Id field while getting Detalied Tuner State message.
1508  *
1509  * @param [in] reservedDeviceId String representing Reserved Device Id.
1510  */
1511  void setReservedDeviceId(const std::string &reservedDeviceId) {
1512  this->reservedDeviceId = reservedDeviceId;
1513  }
1514 
1515 /**
1516  * @brief This function sets the state attribute of the DetailedTunerState message
1517  * with the input parameters such as tuner state and service Locator.
1518  *
1519  * @param [in] state Detailed tuner state.
1520  * @param [in] serviceLocator Service Locator (Source Locator) string.
1521  */
1522  void setState(const std::string &state, const std::string &serviceLocator="") {
1523  this->state = state;
1524  this->serviceLocator = serviceLocator;
1525  }
1526 
1527 /**
1528  * @brief This function will add a new device Id to the activity attribute of owners list.
1529  *
1530  * @param [in] activity Tuner Activity such as "Live" or "Record"
1531  * @param [in] device The unique device identifier.
1532  */
1533  void addTunerOwner(const std::string &activity, const std::string &device) {
1534  owners[activity] = device;
1535  }
1536 
1537  void print(const std::string &prefix="") const {
1538  std::cout << prefix << "[detailedStates][state] = " << state << std::endl;
1539  std::cout << prefix << "[detailedStates][serviceLocator] = " << serviceLocator << std::endl;
1540  std::map<std::string, std::string>::const_iterator owners_it = owners.begin();
1541  for (owners_it = owners.begin(); owners_it != owners.end(); owners_it++) {
1542  std::cout << prefix << "[detailedState][activity] = " << owners_it->first << std::endl;
1543  std::cout << prefix << "[detailedState][detice] = " << owners_it->second << std::endl;
1544  }
1545  }
1546 
1547  friend class GetAllTunerStatesResponse;
1548  friend class NotifyTunerStatesUpdate;
1549  friend std::ostream & operator << (std::ostream &, DetailedTunerState const &);
1550  private:
1551  std::string state;
1552  std::string serviceLocator;
1553  std::map<std::string, std::string> owners;
1554  std::string reservedDeviceId;
1555 };
1556 
1557 /**
1558  * @brief Implements the response payload against a Get tuner state request.
1559  *
1560  * This message will ask for all tuner reservations that are valid at the time of request.
1561  * @ingroup TRM_MESSAGE_IFACE
1562  */
1564 {
1565 public:
1566  static const char *klassName(void) { return Klass::kGetAllTunerStatesResponse; }
1567 
1568  GetAllTunerStatesResponse(const std::string &uuid = "")
1569  : SimpleTRMResponse(klassName(), uuid, ResponseStatus(ResponseStatus::kOk), "") {}
1570 
1571  GetAllTunerStatesResponse(const std::string &uuid,
1572  const ResponseStatus &status,
1573  const std::map<std::string, std::string> & tunerStates = std::map<std::string, std::string>())
1574  : SimpleTRMResponse(klassName(), uuid, status, ""),
1575  tunerStates(tunerStates), tunerDetailedStates()
1576  {
1577  }
1578 
1579 /**
1580  * @brief This function will return the tuner states which is an enumeration
1581  * of detailed tuner states at time of request.
1582  *
1583  * @return Returns the list of detailed tuner states.
1584  */
1585  const std::map<std::string, std::string> & getTunerStates(void) const {
1586  return tunerStates;
1587  }
1588 
1589 /**
1590  * @brief This function will add the new state value against the specified tuner id.
1591  *
1592  * @param [in] tid The unique tuner identifier.
1593  * @param [in] state The new state represented as a string value.
1594  */
1595  void addTunerState(const std::string &tid, const std::string &state) {
1596  tunerStates[tid] = state;
1597  }
1598 
1599 /**
1600  * @brief This function is used to print the debug information for each tuner state.
1601  */
1602  void print(void) const {
1603  SimpleTRMResponse::print();
1604  {
1605  std::map<std::string, std::string>::const_iterator it;
1606  for (it = tunerStates.begin(); it != tunerStates.end(); it++) {
1607  std::cout << "[OBJ][" << klassName() << "]" << it->first << " = " << it->second << std::endl;
1608  }
1609  }
1610  {
1611  std::map<std::string, DetailedTunerState>::const_iterator it;
1612  for (it = tunerDetailedStates.begin(); it != tunerDetailedStates.end(); it++) {
1613  std::string prefix = std::string("[OBJ][") + klassName() + "][detailedStates][" + it->first + "] = ";
1614  it->second.print(prefix);
1615  }
1616  }
1617 
1618  }
1619 
1620  ~GetAllTunerStatesResponse(void){}
1621 
1622  const std::map<std::string, DetailedTunerState> & getTunerDetailedStates(void) const {
1623  return tunerDetailedStates;
1624  }
1625 
1626 /**
1627  * @brief This function will add the detailed tuner state value against the specified tuner id.
1628  *
1629  * @param [in] tid The unique tuner identifier.
1630  * @param [in] state The new state represented as a string value.
1631  * @param [in] serviceLocator The Source Locator string.
1632  * @param [in] reservedDeciceId The remote Device making the request.
1633  */
1634  void addTunerState(const std::string &tid, const std::string &state, const std::string &serviceLocator, const std::string &reservedDeviceId) {
1635  tunerStates[tid] = state;
1636  tunerDetailedStates[tid].state = state;
1637  tunerDetailedStates[tid].serviceLocator = serviceLocator;
1638  tunerDetailedStates[tid].reservedDeviceId = reservedDeviceId;
1639  }
1640 
1641 /**
1642  * @brief This function will add the supplied device to the corresponding owners activity list.
1643  *
1644  * @param [in] tid The unique tuner identifier.
1645  * @param [in] activity Tuner activity string which may "Live", "Record", "Hybrid" etc.
1646  * @param [in] device The Remote device name.
1647  */
1648  void addTunerOwner(const std::string &tid, const std::string &activity, const std::string &device) {
1649  tunerDetailedStates[tid].owners[activity] = device;
1650  }
1651 
1652 private:
1653  std::map<std::string, std::string> tunerStates;
1654  std::map<std::string, DetailedTunerState> tunerDetailedStates;
1655 };
1656 
1657 /**
1658  * @brief Implements a request message for getting the state of all tuners in the system.
1659  *
1660  * The state field indicates the activity state of a tuner, which can be one of following:
1661  * - Live: the tuner is reserved for Live activity (Streaming or Playback).
1662  * - Record: the tuner is reserved for Record activity.
1663  * - Hybrid: the tuner is reserved for Live and Record activity.
1664  * - EAS: the tuner is reserved for EAS.
1665  * - Free: the Tuner is not reserved.
1666  * @ingroup TRM_MESSAGE_IFACE
1667  */
1669 {
1670 public:
1671 
1673 
1674  static const char *klassName(void) { return Klass::kGetAllTunerStates; }
1675 
1676  GetAllTunerStates(void)
1677  : SimpleTRMRequest(klassName(), "", ""){}
1678 
1679  GetAllTunerStates(const std::string &uuid, const std::string &device="")
1680  : SimpleTRMRequest(klassName(), uuid, device, "")
1681  {
1682  }
1683 
1684  ~GetAllTunerStates(void){}
1685 private:
1686 };
1687 
1688 /**
1689  * @brief Implements the response message for the request to get All tuner reservation details.
1690  * @ingroup TRM_MESSAGE_IFACE
1691  */
1693 {
1694 public:
1695  static const char *klassName(void) { return Klass::kGetAllReservationsResponse; }
1696 
1697  GetAllReservationsResponse(const std::string &uuid = "")
1698  : SimpleTRMResponse(klassName(), uuid, ResponseStatus(ResponseStatus::kOk), "") {}
1699 
1700  GetAllReservationsResponse(const std::string &uuid,
1701  const ResponseStatus &status,
1702  const std::map<std::string, std::list<TunerReservation> > & reservations = std::map<std::string, std::list<TunerReservation> > ())
1703  : SimpleTRMResponse(klassName(), uuid, status, ""),
1704  reservations(reservations)
1705  {
1706  }
1707 
1708  const std::map<std::string, std::list<TunerReservation> > & getAllReservations(void) const {
1709  return reservations;
1710  }
1711 
1712  void addTunerReservation(const std::string &tid, const TunerReservation &reservation) {
1713  reservations[tid].push_back(reservation);
1714  }
1715 
1717 
1718 private:
1719  std::map<std::string, std::list<TunerReservation> > reservations;
1720 };
1721 
1722 /**
1723  * @brief Implements a request message to get reservation detail of all the tuners
1724  * that are valid at that time.
1725  * @ingroup TRM_MESSAGE_IFACE
1726  */
1728 {
1729 public:
1730 
1732 
1733  static const char *klassName(void) { return Klass::kGetAllReservations; }
1734 
1735  GetAllReservations(void)
1736  : SimpleTRMRequest(klassName(), "", ""){}
1737 
1738  GetAllReservations(const std::string &uuid, const std::string &filterDevice)
1739  : SimpleTRMRequest(klassName(), uuid, "", ""),
1740  filterDevice(filterDevice)
1741  {
1742  filters["device"] = filterDevice;
1743  }
1744 
1745  GetAllReservations(const std::string &uuid, const std::map<std::string, std::string> &filters)
1746  : SimpleTRMRequest(klassName(), uuid, "", ""),
1747  filterDevice(filterDevice), filters(filters)
1748  {
1749  }
1750 
1751  const std::string getFilterDevice(void) const {
1752  return filterDevice;
1753  }
1754 
1755  void setFilterDevice(const std::string &filterDevice) {
1756  this->filterDevice = filterDevice;
1757  filters["device"] = filterDevice;
1758  }
1759 
1760  const std::string getFilter(const std::string filterId) const {
1761  std::map<std::string, std::string>::const_iterator it = filters.find(filterId);
1762  return it == filters.end() ? "" : it->second;
1763  }
1764 
1765  void addFilter(const std::string &filterId, const std::string &filterValue) {
1766  filters[filterId] = filterValue;
1767  }
1768 
1769  const std::map<std::string, std::string> getFilters(void) const {
1770  return filters;
1771  }
1772 
1773  ~GetAllReservations(void){}
1774 private:
1775  std::string filterDevice;
1776  std::map<std::string, std::string> filters;
1777 };
1778 
1779 /**
1780  * @brief Implements the response message for the queries that request TRM server version.
1781  * @ingroup TRM_MESSAGE_IFACE
1782  */
1784 {
1785 public:
1786  static const char *klassName(void) { return Klass::kGetVersionResponse; }
1787 
1788  GetVersionResponse(const std::string &uuid = "")
1789  : SimpleTRMResponse(klassName(), uuid, ResponseStatus(ResponseStatus::kOk), "") {}
1790 
1791  GetVersionResponse(const std::string &uuid,
1792  const ResponseStatus &status,
1793  const std::string &version)
1794  : SimpleTRMResponse(klassName(), uuid, status, ""),
1795  version(version)
1796  {
1797  }
1798 
1799  const std::string getVersion(void) const {
1800  return version;
1801  }
1802 
1803  void setVersion(const std::string &version) {
1804  this->version = version;
1805  }
1806 
1807  void print(void) const {
1808  SimpleTRMResponse::print();
1809  //std::cout << "[OBJ][" << klassName() << "]Version = " << version << std::endl;
1810  }
1811  ~GetVersionResponse(void){}
1812 
1813 private:
1814  std::string version;
1815 };
1816 
1817 /**
1818  * @brief Implements a message to request for getting TRM server version.
1819  */
1821 {
1822 public:
1823 
1825 
1826  static const char *klassName(void) { return Klass::kGetVersion; }
1827 
1828  GetVersion(void)
1829  : SimpleTRMRequest(klassName(), "", ""){}
1830 
1831  GetVersion(const std::string &uuid, const std::string &device="")
1832  : SimpleTRMRequest(klassName(), uuid, device, "")
1833  {
1834  }
1835 
1836  ~GetVersion(void){}
1837 private:
1838 };
1839 
1840 /**
1841  * @brief Class to implement asynchronous Notification from TRM to the owner of a token that
1842  * its tuner reservation has been terminated. The token is no longer valid after receiving this message.
1843  * @ingroup TRM_MESSAGE_IFACE
1844  */
1846 {
1847 public:
1848  static const char *klassName(void) { return Klass::kNotifyTunerReservationRelease; }
1849 
1850  NotifyTunerReservationRelease(const std::string &uuid = "")
1851  : NotificationBase(klassName(), uuid){}
1852 
1853  NotifyTunerReservationRelease(const std::string &uuid, const std::string &reservationToken, const std::string &reason)
1854  : NotificationBase(klassName(), uuid),
1855  reservationToken(reservationToken), reason(reason)
1856  {}
1857 
1858 /**
1859  * @brief This function will return the reservation token that has been terminated.
1860  *
1861  * @return Returns the string value containing termination reservation token.
1862  */
1863  const std::string & getReservationToken(void) const
1864  {
1865  return reservationToken;
1866  }
1867 
1868 /**
1869  * @brief This function will return the reason for the tuner reservation release.
1870  * Reason is a message explaining why the reservation is terminated
1871  *
1872  * @return Returns the string value containing termination reason.
1873  */
1874  const std::string & getReason(void) const
1875  {
1876  return reason;
1877  }
1878 
1880 private:
1881  std::string reservationToken;
1882  std::string reason;
1883 };
1884 
1885 /**
1886  * @brief Implements the asynchronous Notification from TRM whenever a reservation has changed its usage by its owner.
1887  *
1888  * The Server can listen for this notification and synchronize its cached value with the new reservation.
1889  * In the update message, these fields are guaranteed to be the original value associated with the reservation
1890  * @ingroup TRM_MESSAGE_IFACE
1891  */
1893 {
1894 public:
1895  static const char *klassName(void) { return Klass::kNotifyTunerReservationUpdate; }
1896 
1897  NotifyTunerReservationUpdate(const std::string &uuid = "")
1898  : NotificationBase(klassName(), uuid){}
1899 
1900  NotifyTunerReservationUpdate(const std::string &uuid, const TunerReservation &updatedReservation)
1901  : NotificationBase(klassName(), uuid),
1902  updatedReservation(updatedReservation)
1903  {}
1904 
1905 /**
1906  * @brief This function will return the details of the reservation token
1907  * that has been updated.
1908  *
1909  * @return Returns the changed reservation token.
1910  */
1912  return updatedReservation;
1913  }
1914 
1915 /**
1916  * @brief This function will return the details of the reservation token
1917  * that has been updated.
1918  *
1919  * @return Returns the changed reservation token.
1920  */
1922  return updatedReservation;
1923  }
1924 
1925 /**
1926  * @brief This function will set the value for the updated reservation token to current
1927  * message instance for notification.
1928  *
1929  * @param [in] tunerReservation The tuner reservation token that has changed.
1930  */
1931  void setTunerReservation(const TunerReservation &tunerReservation) {
1932  this->updatedReservation = tunerReservation;
1933  }
1934 
1936 private:
1937  TunerReservation updatedReservation;
1938 };
1939 
1940 /**
1941  * @brief Class for implementing asynchronous notification from TRM to the owner of a token
1942  * that a tuner reservation is about to be terminated, unless the owner initiates to resolve the conflict.
1943  * @ingroup TRM_MESSAGE_IFACE
1944  */
1946 {
1947 public:
1948  typedef std::list<TunerReservation> ConflictCT;
1949 
1950  static const char *klassName(void) { return Klass::kNotifyTunerReservationConflicts; }
1951 
1952  NotifyTunerReservationConflicts(const std::string &uuid = "")
1953  : NotificationBase(klassName(), uuid){}
1954 
1955  NotifyTunerReservationConflicts(const std::string &uuid, const TunerReservation &requestedReservation, const ConflictCT &conflicts = ConflictCT())
1956  : NotificationBase(klassName(), uuid),
1957  requestedReservation(requestedReservation), conflicts(conflicts)
1958  {}
1959 
1960  NotifyTunerReservationConflicts(const std::string &uuid, const TunerReservation &existingLiveReservation, const TunerReservation &conflictingRecordReservation)
1961  : NotificationBase(klassName(), uuid),
1962  requestedReservation(existingLiveReservation) {
1963  addConflict(conflictingRecordReservation);
1964  }
1965 
1966 /**
1967  * @brief This function will return the details of the current reservation
1968  * that has to be cancelled as a result of the conflict.
1969  *
1970  * @return Returns the requested reservation token.
1971  */
1973  return requestedReservation;
1974  }
1975 
1976 /**
1977  * @brief This function will return the details of the current reservation
1978  * that has to be cancelled as a result of the conflict.
1979  *
1980  * @return Returns the requested reservation token.
1981  */
1983  return requestedReservation;
1984  }
1985 
1986 /**
1987  * @brief This function will set the input reservation token to this instance which
1988  * has to be used for the notification.
1989  *
1990  * @param [in] tunerReservation The tuner reservation token.
1991  */
1992  void setTunerReservation(const TunerReservation &tunerReservation) {
1993  this->requestedReservation = tunerReservation;
1994  }
1995 
1996 /**
1997  * @brief This function will return the array of tuner reservation conflicts.
1998  *
1999  * @return Returns the array of conflicts.
2000  */
2001  const ConflictCT & getConflicts(void) const {
2002  return conflicts;
2003  }
2004 
2005 /**
2006  * @brief This function will return the array of tuner reservation conflicts.
2007  *
2008  * @return Returns the array of conflicts.
2009  */
2010  ConflictCT & getConflicts(void) {
2011  return conflicts;
2012  }
2013 
2014 /**
2015  * @brief This function will add a tuner reservation request to the existing list of conflicts.
2016  *
2017  * @param [in] tunerReservation The tuner reservation token.
2018  */
2019  void addConflict(const TunerReservation &reservation) {
2020  conflicts.push_back(reservation);
2021  }
2022 
2024 private:
2025  //@TODO: Conflicts
2026  TunerReservation requestedReservation;
2027  ConflictCT conflicts;
2028 };
2029 
2030 /**
2031  * @brief Class for implementing an asynchronous Notification from TRM whenever a tuner has changed it state.
2032  *
2033  * The TRM client can listen for this notification and keep a local cache of the tuner states.
2034  * @note The payload represents the states when the message is generated. Tuner states could change after the message is sent.
2035  * @ingroup TRM_MESSAGE_IFACE
2036  */
2038 {
2039 public:
2040  static const char *klassName(void) { return Klass::kNotifyTunerStatesUpdate; }
2041 
2042  NotifyTunerStatesUpdate(const std::string &uuid = "")
2043  : NotificationBase(klassName(), uuid), tunerDetailedStates(){}
2044 
2045  ~NotifyTunerStatesUpdate(void){}
2046 
2047 /**
2048  * @brief This function adds the detail state of the tuner specified by it's unique id when a notification
2049  * has to be issued after tuner has changed it's state.
2050  *
2051  * @param [in] tid Unique identification number of tuner.
2052  * @param [out] detailedState Detailed state of the tuner.
2053  */
2054  void addTunerDetailedState(const std::string & tid, const DetailedTunerState &detailedState) {
2055  tunerDetailedStates[tid] = detailedState;
2056  }
2057 
2058 /**
2059  * @brief This function returns the detailed tuner state and is used when a notification has to be
2060  * sent after tuner has changed state.
2061  *
2062  * @return Returns the Detailed tuner state.
2063  */
2064  const std::map<std::string, DetailedTunerState> & getTunerDetailedStates(void) const {
2065  return tunerDetailedStates;
2066  }
2067 
2068 private:
2069  std::map<std::string, DetailedTunerState> tunerDetailedStates;
2070 };
2071 
2072 /**
2073  * @brief Implements a Notification message when a pre tune has performed.
2074  * @ingroup TRM_MESSAGE_IFACE
2075  */
2077 {
2078 public:
2079  static const char *klassName(void) { return Klass::kNotifyTunerPretune; }
2080 
2081  NotifyTunerPretune(const std::string &uuid = "")
2082  : NotificationBase(klassName(), uuid), serviceLocator(""){}
2083 
2084  NotifyTunerPretune(const std::string &uuid, const std::string &serviceLocator)
2085  : NotificationBase(klassName(), uuid),
2086  serviceLocator(serviceLocator)
2087  {}
2088 
2089  const std::string & getServiceLocator(void) const
2090  {
2091  return serviceLocator;
2092  }
2093 
2094  ~NotifyTunerPretune(void){}
2095 private:
2096  std::string serviceLocator;
2097 };
2098 
2100 {
2101 
2102 public:
2104  static const char *klassName(void) { return Klass::kNotifyClientConnectionEvent; }
2105 
2106  NotifyClientConnectionEvent(const std::string &uuid = "")
2107  : NotificationBase(klassName(), uuid),timeStamp(0){} //CID:18484-Initialize timeStamp
2108 
2109  NotifyClientConnectionEvent(const std::string &uuid,const std::string &eventName, const std::string &clientIP, uint64_t timeStamp)
2110  : NotificationBase(klassName(), uuid),
2111  eventName(eventName),clientIP(clientIP),timeStamp(timeStamp)
2112  {}
2113 
2114  const std::string & getEventName(void) const
2115  {
2116  return eventName;
2117  }
2118 
2119  const std::string & getClientIP(void) const
2120  {
2121  return clientIP;
2122  }
2123 
2124  const uint64_t getEventTimeStamp(void) const
2125  {
2126  return timeStamp;
2127  }
2128 
2130 
2131 private:
2132  std::string eventName;
2133  std::string clientIP;
2134  uint64_t timeStamp;
2135 
2136 };
2137 
2138 
2140 {
2141 
2142 public:
2143  typedef std::list<NotifyClientConnectionEvent> ConnectionEventList;
2144 
2145  static const char *klassName(void) { return Klass::kGetTRMConnectionEvents; }
2146 
2147  GetTRMConnectionEvents(const std::string &uuid = "")
2148  : SimpleTRMResponse(klassName(), uuid, ResponseStatus(ResponseStatus::kOk), "") {}
2149 
2150  GetTRMConnectionEvents(const std::string &uuid,
2151  const ResponseStatus &status,
2152  const ConnectionEventList &conEventList = ConnectionEventList())
2153  : SimpleTRMResponse(klassName(), uuid, status, ""),
2154  conEventList(conEventList)
2155  {
2156  }
2157 
2158  const ConnectionEventList & getConEvents(void) const {
2159  return conEventList;
2160  }
2161 
2162  ConnectionEventList & getConEvents(void) {
2163  return conEventList;
2164  }
2165 
2166  void addConEvents(const NotifyClientConnectionEvent &event) {
2167  conEventList.push_back(event);
2168  }
2169 
2170  ~GetTRMConnectionEvents(void){}
2171 
2172 private:
2173  ConnectionEventList conEventList;
2174 };
2175 
2176 
2177 
2179 {
2180 
2181 public:
2182  static const char *klassName(void) { return Klass::kGetAllConnectedDeviceIdsResponse; }
2183 
2184  GetAllConnectedDeviceIdsResponse(const std::string &uuid = "")
2185  : SimpleTRMResponse(klassName(), uuid, ResponseStatus(ResponseStatus::kOk), "") {}
2186 
2187  GetAllConnectedDeviceIdsResponse(const std::string &uuid,
2188  const ResponseStatus &status,
2189  const std::list<std::string> & conDeviceIDs = std::list<std::string>())
2190  : SimpleTRMResponse(klassName(), uuid, status, ""),
2191  conDeviceIDs(conDeviceIDs)
2192  {
2193  }
2194 
2195  const std::list<std::string> & getDeviceIds(void) const {
2196  return conDeviceIDs;
2197  }
2198 
2199  void addDeviceId(const std::string &deviceId) {
2200  conDeviceIDs.push_back(deviceId);
2201  }
2202 
2203  void addDeviceId(const std::list<std::string> &deviceId) {
2204  conDeviceIDs.insert(conDeviceIDs.end(), deviceId.begin(), deviceId.end());
2205  }
2206 
2207  void print(void) const {
2208  SimpleTRMResponse::print();
2209  std::list<std::string>::const_iterator it;
2210  for (it = conDeviceIDs.begin(); it != conDeviceIDs.end(); it++) {
2211  std::cout << "[OBJ][" << klassName() << "]conDeviceIDs = " << *it << std::endl;
2212  }
2213  }
2215 
2216 private:
2217  std::list<std::string> conDeviceIDs;
2218 };
2219 
2220 
2221 
2223 public:
2224  std::string deviceId;
2225  std::string authToken;
2226 };
2227 
2229 public:
2230  std::string deviceId;
2231  std::string partnerId;
2232 };
2233 
2235 public:
2236  static const char *klassName(void) { return Klass::kUpdateTunerActivityStatusResponse; }
2237  UpdateTunerActivityStatusResponse(const std::string &uuid = "")
2238  : ResponseBase(klassName(), uuid, ResponseStatus(ResponseStatus::kOk)) {}
2239 
2240  void print(void) const {
2241  std::cout<<"UpdateTunerActivityStatusResponse "<< std::endl;
2242  }
2243 
2244 };
2245 
2247 public:
2249  static const char *klassName(void) { return Klass::kUpdateTunerActivityStatus; }
2250  UpdateTunerActivityStatus(void): RequestBase(klassName(), "", ""){}
2251  UpdateTunerActivityStatus(const std::string &UUID, const std::string &device,const std::string & activityStatus,const std::string & lastActivityTimeStamp, const std::string & lastActivityAction): RequestBase( klassName(), UUID, device),activityStatus(activityStatus),lastActivityTimeStamp(lastActivityTimeStamp),lastActivityAction(lastActivityAction){}
2252 
2253  const std::string &getTunerActivityStatus(void) const {
2254  return activityStatus;
2255  }
2256  const std::string &getLastActivityTimeStamp(void) const {
2257  return lastActivityTimeStamp;
2258  }
2259  const std::string &getLastActivityAction(void) const {
2260  return lastActivityAction;
2261  }
2262  void print(void) const {
2263  std::cout<<"TRM Message UpdateTunerActivityStatus"<< std::endl;
2264  std::cout<< "[OBJ] tunerActivityStatus: "<<getTunerActivityStatus() <<std::endl;
2265  std::cout<< "[OBJ] lastActivityTimeStamp: "<<getLastActivityTimeStamp() <<std::endl;
2266  std::cout<< "[OBJ] lastActivityAction: "<<getLastActivityAction() <<std::endl;
2267  }
2268 
2269  ~UpdateTunerActivityStatus(void){}
2270 
2271 private:
2272  std::string activityStatus;
2273  std::string lastActivityTimeStamp;
2274  std::string lastActivityAction;
2275 };
2276 
2277 TRM_END_NAMESPACE
2278 
2279 #endif
2280 
2281 
2282 /** @} */
2283 /** @} */
TRM::GetAllTunerIdsResponse::addTunerId
void addTunerId(const std::list< std::string > &tid)
This function will add a list of new tuner identifiers to existing array of tuner ID.
Definition: Messages.h:1417
TRM::ValidateTunerReservation
Implements the message format for client to validate an existing tuner reservation.
Definition: Messages.h:1168
TRM::ValidateTunerReservationResponse
Implements the response message payload for Tuner reservation validation requests.
Definition: Messages.h:1118
TRM::CancelRecordingResponse::isCanceled
bool isCanceled(void) const
This function returns whether a recording is cancelled, this is used when preparing the response mess...
Definition: Messages.h:1218
TRM::SimpleTRMResponse
Definition: Messages.h:817
TRM::DetailedTunerState::getReservedDeviceId
const std::string getReservedDeviceId() const
This function will return the ReservedDeviceId for the tuner.
Definition: Messages.h:1503
TRM::DetailedTunerState::setReservedDeviceId
void setReservedDeviceId(const std::string &reservedDeviceId)
This function will set the reserved Device Id field while getting Detalied Tuner State message.
Definition: Messages.h:1511
TRM::GetAllTunerIdsResponse::addTunerId
void addTunerId(const std::string &tid)
This function will add a new tuner identifier to the list of tuner ID.
Definition: Messages.h:1408
TRM::ResponseBase
Definition: Messages.h:723
TRM::ResponseStatus
This class is responsible for handling response message for tuner reservation. All response messages ...
Definition: ResponseStatus.h:62
TRM::CancelRecording
Implements a message to cancel the recording.
Definition: Messages.h:1241
TRM::NotifyTunerReservationUpdate::getTunerReservation
const TunerReservation & getTunerReservation(void) const
This function will return the details of the reservation token that has been updated.
Definition: Messages.h:1911
TRM::DetailedTunerState::setState
void setState(const std::string &state, const std::string &serviceLocator="")
This function sets the state attribute of the DetailedTunerState message with the input parameters su...
Definition: Messages.h:1522
TRM::ReserveTunerResponse::getConflicts
const ConflictCT & getConflicts(void) const
This function returns an array of existing tuner reservations that is in conflict with the requested ...
Definition: Messages.h:914
TRM::NotifyTunerReservationConflicts::getTunerReservation
TunerReservation & getTunerReservation(void)
This function will return the details of the current reservation that has to be cancelled as a result...
Definition: Messages.h:1982
TRM::NotifyTunerReservationConflicts::getConflicts
const ConflictCT & getConflicts(void) const
This function will return the array of tuner reservation conflicts.
Definition: Messages.h:2001
TRM::NotifyTunerReservationConflicts::getConflicts
ConflictCT & getConflicts(void)
This function will return the array of tuner reservation conflicts.
Definition: Messages.h:2010
TRM::TunerReservationBase::print
virtual void print(void) const
This function is used to print the following attributes of tunerReservation token.
Definition: TunerReservation.cpp:270
TRM::NotifyTunerReservationRelease::getReason
const std::string & getReason(void) const
This function will return the reason for the tuner reservation release. Reason is a message explainin...
Definition: Messages.h:1874
TRM::GetAllTunerStatesResponse::addTunerState
void addTunerState(const std::string &tid, const std::string &state, const std::string &serviceLocator, const std::string &reservedDeviceId)
This function will add the detailed tuner state value against the specified tuner id.
Definition: Messages.h:1634
TRM::ReserveTuner::getTunerReservation
TunerReservation & getTunerReservation(void)
This function is used to return the unique token generated when a reservation is created....
Definition: Messages.h:1006
TRM::ReserveTunerResponse::setTunerReservation
void setTunerReservation(const TunerReservation &tunerReservation)
This function is used to set the input token which will be used to uniquely identify the response mes...
Definition: Messages.h:904
TRM::ReleaseTunerReservation
Implements the message payload for releasing tuner reservation.
Definition: Messages.h:1094
TRM::ReserveTuner
Class implementing a Tuner reservation request, the client uses this message to request,...
Definition: Messages.h:972
TRM::GenerateAuthTokenResponseFromAuthService
Definition: Messages.h:2228
TRM::CancelLive::getServiceLocator
const std::string & getServiceLocator(void) const
This function returns a string containing the service Locator which will be used while preparing the ...
Definition: Messages.h:1356
TRM::CancelLiveResponse::isCanceled
bool isCanceled(void) const
This will return whether the Live session has been cancelled, this information will be used in the re...
Definition: Messages.h:1291
TRM::MessageBase
Definition: Messages.h:641
TRM::NotifyTunerStatesUpdate::getTunerDetailedStates
const std::map< std::string, DetailedTunerState > & getTunerDetailedStates(void) const
This function returns the detailed tuner state and is used when a notification has to be sent after t...
Definition: Messages.h:2064
TRM::UpdateTunerActivityStatus
Definition: Messages.h:2246
TRM::DetailedTunerState::addTunerOwner
void addTunerOwner(const std::string &activity, const std::string &device)
This function will add a new device Id to the activity attribute of owners list.
Definition: Messages.h:1533
TRM::GetAllConnectedDeviceIdsResponse
Definition: Messages.h:2178
TRM::ReserveTunerResponse::getConflicts
ConflictCT & getConflicts(void)
This function returns an array of existing tuner reservations that is in conflict with the requested ...
Definition: Messages.h:924
TRM::NotifyTunerReservationUpdate::setTunerReservation
void setTunerReservation(const TunerReservation &tunerReservation)
This function will set the value for the updated reservation token to current message instance for no...
Definition: Messages.h:1931
TRM::NotifyClientConnectionEvent
Definition: Messages.h:2099
TRM::CancelLive::setServiceLocator
void setServiceLocator(const std::string &serviceLocator)
This function sets value of the service Locator field which will be used while preparing the cancel l...
Definition: Messages.h:1366
TRM::CancelRecordingResponse
Implements payload for a response message against cancel recording request.
Definition: Messages.h:1194
TRM::DetailedTunerState::getOwners
const std::map< std::string, std::string > & getOwners(void) const
This function will return the Owners list in the form of activity and device.
Definition: Messages.h:1490
TRM::ValidateTunerReservationResponse::isValid
bool isValid(void) const
This function returns whether the token requested is valid or not.
Definition: Messages.h:1143
TRM::NotifyTunerPretune
Implements a Notification message when a pre tune has performed.
Definition: Messages.h:2076
TRM::RequestBase
Definition: Messages.h:690
TRM::SimpleTRMRequest
Definition: Messages.h:778
TRM::NotifyTunerStatesUpdate::addTunerDetailedState
void addTunerDetailedState(const std::string &tid, const DetailedTunerState &detailedState)
This function adds the detail state of the tuner specified by it's unique id when a notification has ...
Definition: Messages.h:2054
TRM::GetAllTunerStatesResponse::getTunerStates
const std::map< std::string, std::string > & getTunerStates(void) const
This function will return the tuner states which is an enumeration of detailed tuner states at time o...
Definition: Messages.h:1585
TRM::UpdateTunerActivityStatusResponse
Definition: Messages.h:2234
TRM::ReleaseTunerReservationResponse
Class implementing the response message payload for releasing Tuner reservation.
Definition: Messages.h:1046
TRM::NotifyTunerReservationRelease::getReservationToken
const std::string & getReservationToken(void) const
This function will return the reservation token that has been terminated.
Definition: Messages.h:1863
TRM::GetAllTunerStates
Implements a request message for getting the state of all tuners in the system.
Definition: Messages.h:1668
TRM::GetAllTunerStatesResponse::print
void print(void) const
This function is used to print the debug information for each tuner state.
Definition: Messages.h:1602
TRM::CancelLive
Implements a message to cancel the live streaming.
Definition: Messages.h:1334
TRM::NotifyTunerReservationConflicts
Class for implementing asynchronous notification from TRM to the owner of a token that a tuner reserv...
Definition: Messages.h:1945
TRM::ReleaseTunerReservationResponse::isReleased
bool isReleased(void) const
This function is used to a return the value of released flag which may be “true” or “false”,...
Definition: Messages.h:1072
TRM::NoResponse
Definition: Messages.h:678
TRM::GenerateAuthTokenResponse
Definition: Messages.h:2222
TRM::GetAllTunerStatesResponse::addTunerState
void addTunerState(const std::string &tid, const std::string &state)
This function will add the new state value against the specified tuner id.
Definition: Messages.h:1595
TRM::NotifyTunerReservationConflicts::addConflict
void addConflict(const TunerReservation &reservation)
This function will add a tuner reservation request to the existing list of conflicts.
Definition: Messages.h:2019
TRM::ReserveTunerResponse
Class implementing the response message to a ReserveTuner request.
Definition: Messages.h:858
TRM::NotifyTunerReservationConflicts::setTunerReservation
void setTunerReservation(const TunerReservation &tunerReservation)
This function will set the input reservation token to this instance which has to be used for the noti...
Definition: Messages.h:1992
TRM::GetAllTunerIdsResponse::getTunerIds
const std::list< std::string > & getTunerIds(void) const
This function will return an array of tuner id.
Definition: Messages.h:1399
TRM::DetailedTunerState::getState
const std::string getState() const
This function will return the detailed state for the tuner.
Definition: Messages.h:1474
TRM::ReserveTunerResponse::print
virtual void print(void) const
This function prints the list of tuner reservations with all the conflicts if exist....
Definition: Messages.h:945
TRM::CancelLiveResponse::setServiceLocator
void setServiceLocator(const std::string &serviceLocator)
This function sets value of the service Locator field which will be used in the response message of a...
Definition: Messages.h:1317
TRM::GetTRMConnectionEvents
Definition: Messages.h:2139
TRM::GetAllTunerIdsResponse
Implements the response message payload against a Tuner Id request.
Definition: Messages.h:1378
TRM::DetailedTunerState
Class for implementing the detail state information of a single tuner.
Definition: Messages.h:1463
TRM::GetAllTunerStatesResponse
Implements the response payload against a Get tuner state request.
Definition: Messages.h:1563
TRM::ReserveTunerResponse::getTunerReservation
const TunerReservation & getTunerReservation(void) const
This function is used to return the unique token generated when a reservation is created....
Definition: Messages.h:893
TRM::GetAllReservationsResponse
Implements the response message for the request to get All tuner reservation details.
Definition: Messages.h:1692
TRM::NotifyTunerReservationUpdate::getTunerReservation
TunerReservation & getTunerReservation(void)
This function will return the details of the reservation token that has been updated.
Definition: Messages.h:1921
TRM::NotifyTunerStatesUpdate
Class for implementing an asynchronous Notification from TRM whenever a tuner has changed it state.
Definition: Messages.h:2037
TRM::GetAllTunerIds
Implements the message payload format for requesting the system allocated Unique Id of tuner....
Definition: Messages.h:1439
TRM::GetAllReservations
Implements a request message to get reservation detail of all the tuners that are valid at that time.
Definition: Messages.h:1727
TRM::CancelLiveResponse
Implements payload for a response message against cancel live streaming request.
Definition: Messages.h:1265
TRM::ReserveTunerResponse::addConflict
void addConflict(const TunerReservation &reservation)
This function adds a tuner reservation request to the array of existing tuner reservations that is in...
Definition: Messages.h:935
TRM::DetailedTunerState::getServiceLocator
const std::string getServiceLocator() const
This function will Service Locator that has to be used in the Detailed State message.
Definition: Messages.h:1482
TRM::ReserveTuner::getTunerReservation
const TunerReservation & getTunerReservation(void) const
This function is used to return the unique token generated when a reservation is created....
Definition: Messages.h:1020
TRM::ValidateTunerReservationResponse::setValid
void setValid(bool result)
This function sets the value of 'valid' flag for a validate tuner reservation response.
Definition: Messages.h:1153
TRM::TunerReservationBase
The TunerReservation class is used to set the requested or granted tuner reservation from client....
Definition: TunerReservation.h:139
TRM::CancelLiveResponse::getServiceLocator
const std::string & getServiceLocator() const
This function returns a string containing the service Locator which will be used while preparing resp...
Definition: Messages.h:1307
TRM::NotifyTunerReservationUpdate
Implements the asynchronous Notification from TRM whenever a reservation has changed its usage by its...
Definition: Messages.h:1892
TRM::CancelLiveResponse::setCanceled
void setCanceled(bool result)
This will update value of the "cancelled" flag which will be used in the response message of a cancel...
Definition: Messages.h:1299
TRM::ReserveTuner::getResurrect
const std::string & getResurrect(void) const
This function is used to return the list of resurrect (dead) reservation tokens.
Definition: Messages.h:1032
TRM::GetAllTunerStatesResponse::addTunerOwner
void addTunerOwner(const std::string &tid, const std::string &activity, const std::string &device)
This function will add the supplied device to the corresponding owners activity list.
Definition: Messages.h:1648
TRM::ReleaseTunerReservationResponse::setReleased
void setReleased(bool result)
This function is used to set the value of released flag with input value.
Definition: Messages.h:1081
TRM::NotifyTunerReservationRelease
Class to implement asynchronous Notification from TRM to the owner of a token that its tuner reservat...
Definition: Messages.h:1845
TRM::NotifyTunerReservationConflicts::getTunerReservation
const TunerReservation & getTunerReservation(void) const
This function will return the details of the current reservation that has to be cancelled as a result...
Definition: Messages.h:1972
TRM::CancelRecordingResponse::setCanceled
void setCanceled(bool result)
This function sets the value of "cancelled" field for the response message of a cancel recording requ...
Definition: Messages.h:1226
TRM::NotificationBase
Definition: Messages.h:757
TRM::GetVersion
Implements a message to request for getting TRM server version.
Definition: Messages.h:1820
TRM::GetVersionResponse
Implements the response message for the queries that request TRM server version.
Definition: Messages.h:1783