29 #include "trm/Klass.h"
30 #include "trm/JsonDecoder.h"
36 void JsonDecoder::decode(std::vector<uint8_t> &in)
38 Log() <<
"Decoding " << in.size() <<
" bytes" << std::endl;
39 Enum<Klass> klass(Klass::kUnknown);
42 int handle = JsonDecode(in, klass);
44 if (handle == 0)
return;
46 if (klass == Klass::kReserveTuner) {
47 JsonDecode<ReserveTuner>(handle, processor);
50 if (klass == Klass::kReserveTunerResponse) {
51 JsonDecode<ReserveTunerResponse>(handle, processor);
54 if (klass == Klass::kReleaseTunerReservation) {
55 JsonDecode<ReleaseTunerReservation>(handle, processor);
58 if (klass == Klass::kReleaseTunerReservationResponse) {
59 JsonDecode<ReleaseTunerReservationResponse>(handle, processor);
62 if (klass == Klass::kValidateTunerReservation) {
63 JsonDecode<ValidateTunerReservation>(handle, processor);
66 if (klass == Klass::kValidateTunerReservationResponse) {
67 JsonDecode<ValidateTunerReservationResponse>(handle, processor);
70 if (klass == Klass::kCancelRecording) {
71 JsonDecode<CancelRecording>(handle, processor);
74 if (klass == Klass::kCancelRecordingResponse) {
75 JsonDecode<CancelRecordingResponse>(handle, processor);
78 if (klass == Klass::kCancelLive) {
79 JsonDecode<CancelLive>(handle, processor);
82 if (klass == Klass::kCancelLiveResponse) {
83 JsonDecode<CancelLiveResponse>(handle, processor);
86 if (klass == Klass::kGetAllTunerIds) {
87 JsonDecode<GetAllTunerIds>(handle, processor);
90 if (klass == Klass::kGetAllTunerIdsResponse) {
91 JsonDecode<GetAllTunerIdsResponse>(handle, processor);
94 if (klass == Klass::kGetAllTunerStates) {
95 JsonDecode<GetAllTunerStates>(handle, processor);
98 if (klass == Klass::kGetAllTunerStatesResponse) {
99 JsonDecode<GetAllTunerStatesResponse>(handle, processor);
102 if (klass == Klass::kGetAllReservations) {
103 JsonDecode<GetAllReservations>(handle, processor);
106 if (klass == Klass::kGetAllReservationsResponse) {
107 JsonDecode<GetAllReservationsResponse>(handle, processor);
110 if (klass == Klass::kGetAllConnectedDeviceIdsResponse) {
111 JsonDecode<GetAllConnectedDeviceIdsResponse>(handle, processor);
114 if (klass == Klass::kGetVersion) {
115 JsonDecode<GetVersion>(handle, processor);
118 if (klass == Klass::kGetVersionResponse) {
119 JsonDecode<GetVersionResponse>(handle, processor);
122 if (klass == Klass::kNotifyTunerReservationUpdate) {
123 JsonDecode<NotifyTunerReservationUpdate>(handle, processor);
126 if (klass == Klass::kNotifyTunerReservationRelease) {
127 JsonDecode<NotifyTunerReservationRelease>(handle, processor);
130 if (klass == Klass::kNotifyTunerReservationConflicts) {
131 JsonDecode<NotifyTunerReservationConflicts>(handle, processor);
134 if (klass == Klass::kNotifyTunerStatesUpdate) {
135 JsonDecode<NotifyTunerStatesUpdate>(handle, processor);
138 if (klass == Klass::kNotifyTunerPretune) {
139 JsonDecode<NotifyTunerPretune>(handle, processor);
142 if (klass == Klass::kNotifyClientConnectionEvent) {
143 JsonDecode<NotifyClientConnectionEvent>(handle, processor);
145 else if (klass == Klass::kGetTRMConnectionEvents) {
146 JsonDecode<GetTRMConnectionEvents>(handle, processor);
148 else if (klass == Klass::kUpdateTunerActivityStatus) {
149 JsonDecode<UpdateTunerActivityStatus>(handle, processor);