RDK Documentation (Open Sourced RDK Components)
MessageProcessor.hpp
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 hdmicec
23 * @{
24 * @defgroup ccec
25 * @{
26 **/
27 
28 
29 #ifndef HDMI_CCEC_MESSAGE_PROCESSOR_HPP_
30 #define HDMI_CCEC_MESSAGE_PROCESSOR_HPP_
31 
32 #include <iostream>
33 
34 #include "Messages.hpp"
35 #include "Header.hpp"
36 
37 CCEC_BEGIN_NAMESPACE
38 
39 /**
40  * @brief The MessageProcessor class implements a set of overloaded process() methods, with each handling a specific message type.
41  *
42  * When a CEC frame is received, the MessageDecoder converts the raw bytes into a message object and invoke the
43  * corresponding process() function.
44  * @n @n
45  * Application that desires to process certain CEC messages should extend MessageProcessor class and provide customized
46  * implementation of the overloaded process() method. The default processing in the base class is simply discarding the message
47  * (and by doing so, serves as a message filter for the application).
48  * @n @n
49  * Here is an example code that sends an ActiveSource message by a Tuner device,
50  * @code
51  * CECFrame frame = (MessageEncoder().encode(
52  * Header(LogicalAddress(TUNER_1), LogicalAddress(TV)),
53  * ActiveSource(PhysicalAddress(phy0, phy1, phy2, phy3)));
54  * Connection(LogicalAddress(TUNER_1)).send(frame);
55  * @endcode
56  * @ingroup HDMI_CEC_MSG_N_FRAME_CLASSES
57  */
59 {
60 public:
61  MessageProcessor(void) {}
62 
63  virtual void process (const ActiveSource &msg, const Header &header) {header.print();msg.print();}
64  virtual void process (const InActiveSource &msg, const Header &header) {header.print();msg.print();}
65  virtual void process (const ImageViewOn &msg, const Header &header) {header.print();msg.print();}
66  virtual void process (const TextViewOn &msg, const Header &header) {header.print();msg.print();}
67  virtual void process (const RequestActiveSource &msg, const Header &header) {header.print();msg.print();}
68  virtual void process (const Standby &msg, const Header &header) {header.print();msg.print();}
69  virtual void process (const GetCECVersion &msg, const Header &header) {header.print();msg.print();}
70  virtual void process (const CECVersion &msg, const Header &header) {header.print();msg.print();}
71  virtual void process (const SetMenuLanguage &msg, const Header &header) {header.print();msg.print();}
72  virtual void process (const GiveOSDName &msg, const Header &header) {header.print();msg.print();}
73  virtual void process (const GivePhysicalAddress &msg, const Header &header) {header.print();msg.print();}
74  virtual void process (const GiveDeviceVendorID &msg, const Header &header) {header.print();msg.print();}
75  virtual void process (const SetOSDString &msg, const Header &header) {header.print();msg.print();}
76  virtual void process (const SetOSDName &msg, const Header &header) {header.print();msg.print();}
77  virtual void process (const RoutingChange &msg, const Header &header) {header.print();msg.print();}
78  virtual void process (const RoutingInformation &msg, const Header &header) {header.print();msg.print();}
79  virtual void process (const SetStreamPath &msg, const Header &header) {header.print();msg.print();}
80  virtual void process (const GetMenuLanguage &msg, const Header &header) {header.print();msg.print();}
81  virtual void process (const ReportPhysicalAddress &msg, const Header &header) {header.print();msg.print();}
82  virtual void process (const DeviceVendorID &msg, const Header &header) {header.print();msg.print();}
83  //virtual void process (const UserControlReleased &msg, const Header &header) {header.print();msg.print();}
84  //virtual void process (const UserControlPressed &msg, const Header &header) {header.print();msg.print();}
85  virtual void process (const GiveDevicePowerStatus &msg, const Header &header) {header.print();msg.print();}
86  virtual void process (const ReportPowerStatus &msg, const Header &header) {header.print();msg.print();}
87  virtual void process (const FeatureAbort &msg, const Header &header) {header.print();msg.print();}
88  virtual void process (const Abort &msg, const Header &header) {header.print();msg.print();}
89  virtual void process (const Polling &msg, const Header &header) {header.print();msg.print();}
90  virtual void process (const InitiateArc &msg, const Header &header) {header.print();msg.print();}
91  virtual void process (const TerminateArc &msg, const Header &header) {header.print();msg.print();}
92  virtual void process (const RequestShortAudioDescriptor &msg,const Header &header) {header.print();msg.print();}
93  virtual void process (const ReportShortAudioDescriptor &msg, const Header &header) {header.print();msg.print();}
94  virtual void process (const SystemAudioModeRequest &msg , const Header &header) {header.print();msg.print();}
95  virtual void process (const SetSystemAudioMode &msg , const Header &header) {header.print();msg.print();}
96  virtual void process (const ReportAudioStatus &msg, const Header &header) {header.print();msg.print();}
97  virtual ~MessageProcessor(void) {}
98 
99 private:
100 };
101 
102 CCEC_END_NAMESPACE
103 #endif
104 
105 
106 /** @} */
107 /** @} */
FeatureAbort
Definition: Messages.hpp:369
MessageProcessor
The MessageProcessor class implements a set of overloaded process() methods, with each handling a spe...
Definition: MessageProcessor.hpp:58
GetCECVersion
Definition: Messages.hpp:161
SetOSDString
Definition: Messages.hpp:249
GiveOSDName
Definition: Messages.hpp:220
TextViewOn
Definition: Messages.hpp:119
GiveDevicePowerStatus
Definition: Messages.hpp:334
SetOSDName
Definition: Messages.hpp:226
ReportAudioStatus
Definition: Messages.hpp:613
DeviceVendorID
Definition: Messages.hpp:311
GivePhysicalAddress
Definition: Messages.hpp:272
SetSystemAudioMode
Definition: Messages.hpp:591
Header
Definition: Header.hpp:41
Polling
Definition: Messages.hpp:649
ReportShortAudioDescriptor
Definition: Messages.hpp:515
SetMenuLanguage
Definition: Messages.hpp:190
Standby
Definition: Messages.hpp:155
RoutingInformation
Definition: Messages.hpp:419
ActiveSource
The Message API allows the application to send or receive high-level CEC message construct instead of...
Definition: Messages.hpp:88
GetMenuLanguage
Definition: Messages.hpp:214
SetStreamPath
Definition: Messages.hpp:443
TerminateArc
Definition: Messages.hpp:685
GiveDeviceVendorID
Definition: Messages.hpp:305
ReportPhysicalAddress
Definition: Messages.hpp:278
InActiveSource
Definition: Messages.hpp:125
RequestActiveSource
Definition: Messages.hpp:149
RequestShortAudioDescriptor
Definition: Messages.hpp:466
RoutingChange
Definition: Messages.hpp:394
ImageViewOn
Definition: Messages.hpp:112
ReportPowerStatus
Definition: Messages.hpp:340
InitiateArc
Definition: Messages.hpp:680
SystemAudioModeRequest
Definition: Messages.hpp:564
CECVersion
Definition: Messages.hpp:167
Abort
Definition: Messages.hpp:363