RDK Documentation (Open Sourced RDK Components)
ResponseStatus.h
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 
21 
22 /**
23 * @defgroup trm
24 * @{
25 * @defgroup common
26 * @{
27 **/
28 
29 
30 #ifndef TRM_RESPONSE_STATUS_H_
31 #define TRM_RESPONSE_STATUS_H_
32 
33 #include <stdio.h>
34 #include <string>
35 
36 #include "TRM.h"
37 #include "Enum.h"
38 #include "Klass.h"
39 
40 TRM_BEGIN_NAMESPACE
41 
42 
43 /**
44  * @brief This class is responsible for handling response message for tuner reservation.
45  * All response messages from TRM will provide information regarding the status of the response.
46  * Responses to recognized requests may contain additional information, as described in later sections
47  * of this document. Responses to unrecognized requests will contain only this status data, consisting
48  * of a status code and message signifying the request was unrecognized.
49  * The Tuner response status could be the following types.
50  * - @b Ok : Request was successful
51  * - @b GeneralError : Request was unsuccessful
52  * - @b MalFormedRequest : Unexpected/Invalid request data
53  * - @b UnRecognizedRequest : Unrecognized request
54  * - @b InsufficientResource : there is no tuner available
55  * - @b UserCancellation: Token is released as result of user cancellation.
56  * - @b InvalidToken: Token included in the message is invalid.
57  * - @b InvalidState: Token is in invalid state.
58  * - @b statusMessage: is a string containing additional information about the status.
59  *
60  * @ingroup TRM_RESERVATION_CLASSES
61  */
63 {
64 public:
65  static const char *klassName(void) { return Klass::kResponseStatus; }
66 
67  typedef int EnumType;
68 
69  static const Enum<ResponseStatus> kOk;
70  static const Enum<ResponseStatus> kGeneralError;
71  static const Enum<ResponseStatus> kMalFormedRequest;
72  static const Enum<ResponseStatus> kUnRecognizedRequest;
73  static const Enum<ResponseStatus> kInvalidToken;
74  static const Enum<ResponseStatus> kInvalidState;
75  static const Enum<ResponseStatus> kUserCancellation;
76  static const Enum<ResponseStatus> kInsufficientResource;
77 
78  static const std::vector<const Enum<ResponseStatus> * > & getEnums(void);
79 
80  ResponseStatus(const Enum<ResponseStatus> &statusCode, const std::string &details="");
81  ResponseStatus(const char *name, const std::string &details="");
82  ~ResponseStatus(void);
83 
84  const Enum<ResponseStatus> & getStatusCode(void) const;
85 
86  bool operator==(const ResponseStatus &that) const;
87  ResponseStatus & operator += (const char *message);
88  ResponseStatus & operator = (const Enum<ResponseStatus> &status);
89 
90  const std::string & getDetails(void) const;
91  std::string &getDetails(void);
92  void print(void) const;
93 
94 private:
95  Enum<ResponseStatus> statusCode;
96  std::string details;
97 };
98 
99 
100 TRM_END_NAMESPACE
101 
102 #endif
103 
104 
105 /** @} */
106 /** @} */
TRM::ResponseStatus
This class is responsible for handling response message for tuner reservation. All response messages ...
Definition: ResponseStatus.h:62
TRM::Enum
Definition: Enum.h:42