31 #include "ccec/Connection.hpp"
32 #include "ccec/CECFrame.hpp"
34 #include "ccec/Messages.hpp"
35 #include "ccec/MessageDecoder.hpp"
36 #include "ccec/MessageProcessor.hpp"
39 static int libcecInitStatus;
44 void notify(
const CECFrame &in)
const {
45 const uint8_t *buf = NULL;
48 printf(
"\n==================================================\n");
49 printf(
"Received CEC Frame: \n");
50 in.getBuffer(&buf, &len);
52 for (
int i = 0; i < len; i++) {
53 printf(
"%02X ", (
int) *(buf + i));
57 printf(
"==================================================\n");
71 printf(
"Command: ActiveSource\n");
72 printf(
"%s : %s : %s \n",GetOpName(msg.opCode()),msg.physicalAddress.name().c_str(),msg.physicalAddress.toString().c_str());
77 printf(
"Command: InActiveSource\n");
78 printf(
"%s : %s : %s \n",GetOpName(msg.opCode()),msg.physicalAddress.name().c_str(),msg.physicalAddress.toString().c_str());
83 printf(
"Command: ImageViewOn \n");
88 printf(
"Command: TextViewOn\n");
93 printf(
"Command: RequestActiveSource\n");
98 printf(
"Command: Standby\n");
103 printf(
"Command: GetCECVersion\n");
108 printf(
"Command: CECVersion\n");
109 printf(
"Version : %s \n",msg.version.toString().c_str());
114 printf(
"Command: SetMenuLanguage\n");
115 printf(
"Language : %s \n",msg.language.toString().c_str());
120 printf(
"Command: GiveOSDName\n");
125 printf(
"Command: GivePhysicalAddress\n");
130 printf(
"Command: GiveDeviceVendorID\n");
135 printf(
"Command: SetOSDString\n");
136 printf(
"OSDString : %s\n",msg.osdString.toString().c_str());
141 printf(
"Command: SetOSDName\n");
142 printf(
"OSDName : %s\n",msg.osdName.toString().c_str());
147 printf(
"Command: RoutingChange\n");
148 printf(
"Routing Change From : %s\n",msg.from.toString().c_str());
149 printf(
"Routing Change to : %s\n",msg.to.toString().c_str());
154 printf(
"Command: RoutingInformation\n");
155 printf(
"Routing Information to Sink : %s\n",msg.toSink.toString().c_str());
160 printf(
"Command: SetStreamPath\n");
161 printf(
"Set Stream Path to Sink : %s\n",msg.toSink.toString().c_str());
166 printf(
"Command: GetMenuLanguage\n");
171 printf(
"Command: ReportPhysicalAddress\n");
176 printf(
"Command: DeviceVendorID\n");
177 printf(
"VendorID : %s\n",msg.vendorId.toString().c_str());
185 printf(
"Command: GiveDevicePowerStatus\n");
190 printf(
"Command: ReportPowerStatus\n");
191 printf(
"Power Status: %s\n",msg.status.toString().c_str());
196 printf(
"Command: FeatureAbort\n");
198 void process (
const Abort &msg,
const Header &header)
201 printf(
"Command: Abort\n");
205 printf(
"Command: Polling\n");
209 void printHeader(
const Header &header)
211 printf(
"Header : From : %s \n", header.from.toString().c_str());
212 printf(
"Header : to : %s \n", header.to.toString().c_str());
221 char test_status =
'r';
224 if(0 == libcecInitStatus)
231 catch (
const std::exception e)
233 printf(
"Caught LibCCEC exception");
236 Connection testConnection(LogicalAddress::UNREGISTERED,
false,
"CEC Monitor connection");
237 testConnection.open();
240 testConnection.addFrameListener(&frameListener);
242 while(test_status !=
'q')
244 printf(
"CECMonitor Test App Started.Please enter 'q' to quit the test app \n");
245 test_status = getchar();
249 testConnection.close();
251 if(1 == libcecInitStatus)