RDK Documentation (Open Sourced RDK Components)
JsonDecoder.h
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 
21 /**
22 * @defgroup trm
23 * @{
24 * @defgroup common
25 * @{
26 **/
27 
28 
29 #ifndef TRM_JSON_DECODER_H_
30 #define TRM_JSON_DECODER_H_
31 
32 #include <stdint.h>
33 #include <vector>
34 
35 #include "TRM.h"
36 #include "MessageProcessor.h"
37 
38 TRM_BEGIN_NAMESPACE
39 
40 void JsonDecode(int handle, ReserveTuner & message);
41 void JsonDecode(int handle, ReserveTunerResponse & message);
42 void JsonDecode(int handle, ReleaseTunerReservation & message);
43 void JsonDecode(int handle, ValidateTunerReservation & message);
44 void JsonDecode(int handle, CancelRecording & message);
45 void JsonDecode(int handle, CancelLive & message);
46 void JsonDecode(int handle, ReleaseTunerReservationResponse & message);
47 void JsonDecode(int handle, ValidateTunerReservationResponse & message);
48 void JsonDecode(int handle, CancelRecordingResponse & message);
49 void JsonDecode(int handle, CancelLiveResponse & message);
50 void JsonDecode(int handle, GetAllTunerIds & message);
51 void JsonDecode(int handle, GetAllTunerIdsResponse & message);
52 void JsonDecode(int handle, GetAllTunerStates & message);
53 void JsonDecode(int handle, GetAllTunerStatesResponse & message);
54 void JsonDecode(int handle, GetAllReservations & message);
55 void JsonDecode(int handle, GetAllReservationsResponse & message);
56 void JsonDecode(int handle, GetAllConnectedDeviceIdsResponse & message);
57 void JsonDecode(int handle, GetVersion & message);
58 void JsonDecode(int handle, GetVersionResponse & message);
59 void JsonDecode(int handle, NotifyTunerReservationUpdate & message);
60 void JsonDecode(int handle, NotifyTunerReservationRelease & message);
61 void JsonDecode(int handle, NotifyTunerReservationConflicts & message);
62 void JsonDecode(int handle, NotifyTunerStatesUpdate & message);
63 void JsonDecode(int handle, NotifyTunerPretune & message);
64 void JsonDecode(int handle, NotifyClientConnectionEvent & message);
65 void JsonDecode(int handle, GetTRMConnectionEvents & message);
66 void JsonDecode(int handle, UpdateTunerActivityStatus & message);
67 
68 
69 
70 extern int JsonDecode(const std::vector<uint8_t> &in, Enum<Klass> &meta);
71 
72 
74 {
75 public:
76  JsonDecoder(MessageProcessor & processor)
77  : processor(processor){};
78  void decode(std::vector<uint8_t> &in);
79 private:
80  MessageProcessor &processor;
81 };
82 
83 
84 template<class MsgT>
85 void JsonDecode(int handle, MessageProcessor &processor)
86 {
87  MsgT msg;
88  JsonDecode(handle, msg);
89  processor(msg);
90 }
91 
92 TRM_END_NAMESPACE
93 #endif
94 
95 
96 /** @} */
97 /** @} */
TRM::MessageProcessor
Definition: MessageProcessor.h:39
TRM::JsonDecoder
Definition: JsonDecoder.h:73